@cnwenf/occ 2.1.277 → 2.1.279
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/README.md +4 -4
- package/README.zh-CN.md +2 -2
- package/dist/cli.js +1466 -696
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
globalThis.MACRO={"VERSION":"2.1.
|
|
2
|
+
globalThis.MACRO={"VERSION":"2.1.279","BUILD_TIME":"2026-07-24T07:02:14.850Z","FEEDBACK_CHANNEL":"","ISSUES_EXPLAINER":"","NATIVE_PACKAGE_URL":"","PACKAGE_URL":"@cnwenf/occ","VERSION_CHANGELOG":""};
|
|
3
3
|
// @bun
|
|
4
4
|
var __create = Object.create;
|
|
5
5
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -152670,6 +152670,7 @@ function createDefaultGlobalConfig() {
|
|
|
152670
152670
|
},
|
|
152671
152671
|
env: {},
|
|
152672
152672
|
tipsHistory: {},
|
|
152673
|
+
tipsShownCount: {},
|
|
152673
152674
|
memoryUsageCount: 0,
|
|
152674
152675
|
promptQueueUseCount: 0,
|
|
152675
152676
|
btwUseCount: 0,
|
|
@@ -153388,6 +153389,7 @@ var init_config4 = __esm(() => {
|
|
|
153388
153389
|
"diffTool",
|
|
153389
153390
|
"env",
|
|
153390
153391
|
"tipsHistory",
|
|
153392
|
+
"tipsShownCount",
|
|
153391
153393
|
"todoFeatureEnabled",
|
|
153392
153394
|
"showExpandedTodos",
|
|
153393
153395
|
"messageIdleNotifThresholdMs",
|
|
@@ -175674,15 +175676,23 @@ var init_wrap_text = __esm(() => {
|
|
|
175674
175676
|
function collectRemovedRects(parent, removed, underAbsolute = false) {
|
|
175675
175677
|
if (removed.nodeName === "#text")
|
|
175676
175678
|
return;
|
|
175677
|
-
const
|
|
175678
|
-
|
|
175679
|
-
|
|
175680
|
-
|
|
175681
|
-
|
|
175682
|
-
|
|
175683
|
-
|
|
175684
|
-
|
|
175685
|
-
|
|
175679
|
+
const work = [
|
|
175680
|
+
{ node: removed, underAbsolute }
|
|
175681
|
+
];
|
|
175682
|
+
while (work.length > 0) {
|
|
175683
|
+
const { node: cur, underAbsolute: curAbsolute } = work.pop();
|
|
175684
|
+
if (cur.nodeName === "#text")
|
|
175685
|
+
continue;
|
|
175686
|
+
const elem = cur;
|
|
175687
|
+
const isAbsolute5 = curAbsolute || elem.style.position === "absolute";
|
|
175688
|
+
const cached2 = nodeCache.get(elem);
|
|
175689
|
+
if (cached2) {
|
|
175690
|
+
addPendingClear(parent, cached2, isAbsolute5);
|
|
175691
|
+
nodeCache.delete(elem);
|
|
175692
|
+
}
|
|
175693
|
+
for (const child of elem.childNodes) {
|
|
175694
|
+
work.push({ node: child, underAbsolute: isAbsolute5 });
|
|
175695
|
+
}
|
|
175686
175696
|
}
|
|
175687
175697
|
}
|
|
175688
175698
|
function stylesEqual(a5, b5) {
|
|
@@ -175708,23 +175718,26 @@ function isDOMElement(node) {
|
|
|
175708
175718
|
}
|
|
175709
175719
|
function findOwnerChainAtRow(root2, y4) {
|
|
175710
175720
|
let best = [];
|
|
175711
|
-
|
|
175712
|
-
|
|
175713
|
-
|
|
175721
|
+
const work = [
|
|
175722
|
+
{ node: root2, offsetY: 0 }
|
|
175723
|
+
];
|
|
175724
|
+
while (work.length > 0) {
|
|
175725
|
+
const { node, offsetY } = work.pop();
|
|
175714
175726
|
const yoga = node.yogaNode;
|
|
175715
175727
|
if (!yoga || yoga.getDisplay() === LayoutDisplay.None)
|
|
175716
|
-
|
|
175728
|
+
continue;
|
|
175717
175729
|
const top = offsetY + yoga.getComputedTop();
|
|
175718
175730
|
const height = yoga.getComputedHeight();
|
|
175719
175731
|
if (y4 < top || y4 >= top + height)
|
|
175720
|
-
|
|
175732
|
+
continue;
|
|
175721
175733
|
if (node.debugOwnerChain)
|
|
175722
175734
|
best = node.debugOwnerChain;
|
|
175723
175735
|
for (const child of node.childNodes) {
|
|
175724
175736
|
if (isDOMElement(child))
|
|
175725
|
-
|
|
175737
|
+
work.push({ node: child, offsetY: top });
|
|
175726
175738
|
}
|
|
175727
175739
|
}
|
|
175740
|
+
return best;
|
|
175728
175741
|
}
|
|
175729
175742
|
var createNode = (nodeName) => {
|
|
175730
175743
|
const needsYogaNode = nodeName !== "ink-virtual-text" && nodeName !== "ink-link" && nodeName !== "ink-progress";
|
|
@@ -175874,12 +175887,16 @@ var createNode = (nodeName) => {
|
|
|
175874
175887
|
node.nodeValue = text;
|
|
175875
175888
|
markDirty(node);
|
|
175876
175889
|
}, clearYogaNodeReferences = (node) => {
|
|
175877
|
-
|
|
175878
|
-
|
|
175879
|
-
|
|
175890
|
+
const work = [node];
|
|
175891
|
+
while (work.length > 0) {
|
|
175892
|
+
const cur = work.pop();
|
|
175893
|
+
if ("childNodes" in cur) {
|
|
175894
|
+
for (const child of cur.childNodes) {
|
|
175895
|
+
work.push(child);
|
|
175896
|
+
}
|
|
175880
175897
|
}
|
|
175898
|
+
cur.yogaNode = undefined;
|
|
175881
175899
|
}
|
|
175882
|
-
node.yogaNode = undefined;
|
|
175883
175900
|
};
|
|
175884
175901
|
var init_dom = __esm(() => {
|
|
175885
175902
|
init_engine();
|
|
@@ -182369,6 +182386,26 @@ function renderNodeToOutput(node, output, {
|
|
|
182369
182386
|
skipSelfBlit = false,
|
|
182370
182387
|
inheritedBackgroundColor
|
|
182371
182388
|
}) {
|
|
182389
|
+
const stack = [];
|
|
182390
|
+
stack.push(() => renderNodeSelf(node, output, {
|
|
182391
|
+
offsetX,
|
|
182392
|
+
offsetY,
|
|
182393
|
+
prevScreen,
|
|
182394
|
+
skipSelfBlit,
|
|
182395
|
+
inheritedBackgroundColor
|
|
182396
|
+
}, stack));
|
|
182397
|
+
while (stack.length > 0) {
|
|
182398
|
+
const frame = stack.pop();
|
|
182399
|
+
frame();
|
|
182400
|
+
}
|
|
182401
|
+
}
|
|
182402
|
+
function renderNodeSelf(node, output, {
|
|
182403
|
+
offsetX = 0,
|
|
182404
|
+
offsetY = 0,
|
|
182405
|
+
prevScreen,
|
|
182406
|
+
skipSelfBlit = false,
|
|
182407
|
+
inheritedBackgroundColor
|
|
182408
|
+
}, stack) {
|
|
182372
182409
|
const { yogaNode } = node;
|
|
182373
182410
|
if (yogaNode) {
|
|
182374
182411
|
if (yogaNode.getDisplay() === LayoutDisplay.None) {
|
|
@@ -182728,14 +182765,36 @@ function renderNodeToOutput(node, output, {
|
|
|
182728
182765
|
output.write(x4 + borderLeft, y4 + borderTop, fill);
|
|
182729
182766
|
}
|
|
182730
182767
|
}
|
|
182731
|
-
|
|
182768
|
+
stack.push(() => {
|
|
182769
|
+
if (needsClip) {
|
|
182770
|
+
output.unclip();
|
|
182771
|
+
}
|
|
182772
|
+
render_border_default(x4, y4, node, output);
|
|
182773
|
+
const postRect = { x: x4, y: y4, width, height, top: yogaTop };
|
|
182774
|
+
nodeCache.set(node, postRect);
|
|
182775
|
+
if (node.style.position === "absolute") {
|
|
182776
|
+
absoluteRectsCur.push(postRect);
|
|
182777
|
+
}
|
|
182778
|
+
node.dirty = false;
|
|
182779
|
+
});
|
|
182780
|
+
renderChildren(node, output, x4, y4, hasRemovedChild, ownBackgroundColor || node.style.opaque ? undefined : prevScreen, boxBackgroundColor, stack);
|
|
182781
|
+
return;
|
|
182732
182782
|
}
|
|
182733
182783
|
if (needsClip) {
|
|
182734
182784
|
output.unclip();
|
|
182735
182785
|
}
|
|
182736
182786
|
render_border_default(x4, y4, node, output);
|
|
182737
182787
|
} else if (node.nodeName === "ink-root") {
|
|
182738
|
-
|
|
182788
|
+
stack.push(() => {
|
|
182789
|
+
const postRect = { x: x4, y: y4, width, height, top: yogaTop };
|
|
182790
|
+
nodeCache.set(node, postRect);
|
|
182791
|
+
if (node.style.position === "absolute") {
|
|
182792
|
+
absoluteRectsCur.push(postRect);
|
|
182793
|
+
}
|
|
182794
|
+
node.dirty = false;
|
|
182795
|
+
});
|
|
182796
|
+
renderChildren(node, output, x4, y4, hasRemovedChild, prevScreen, inheritedBackgroundColor, stack);
|
|
182797
|
+
return;
|
|
182739
182798
|
}
|
|
182740
182799
|
const rect = { x: x4, y: y4, width, height, top: yogaTop };
|
|
182741
182800
|
nodeCache.set(node, rect);
|
|
@@ -182745,20 +182804,23 @@ function renderNodeToOutput(node, output, {
|
|
|
182745
182804
|
node.dirty = false;
|
|
182746
182805
|
}
|
|
182747
182806
|
}
|
|
182748
|
-
function renderChildren(node, output, offsetX, offsetY, hasRemovedChild, prevScreen, inheritedBackgroundColor) {
|
|
182807
|
+
function renderChildren(node, output, offsetX, offsetY, hasRemovedChild, prevScreen, inheritedBackgroundColor, stack) {
|
|
182749
182808
|
let seenDirtyChild = false;
|
|
182750
182809
|
let seenDirtyClipped = false;
|
|
182810
|
+
const frames = [];
|
|
182751
182811
|
for (const childNode of node.childNodes) {
|
|
182752
182812
|
const childElem = childNode;
|
|
182753
182813
|
const wasDirty = childElem.dirty;
|
|
182754
182814
|
const isAbsolute5 = childElem.style.position === "absolute";
|
|
182755
|
-
|
|
182815
|
+
const childPrevScreen = hasRemovedChild || seenDirtyChild ? undefined : prevScreen;
|
|
182816
|
+
const childSkipSelfBlit = seenDirtyClipped && isAbsolute5 && !childElem.style.opaque && childElem.style.backgroundColor === undefined;
|
|
182817
|
+
frames.push(() => renderNodeSelf(childElem, output, {
|
|
182756
182818
|
offsetX,
|
|
182757
182819
|
offsetY,
|
|
182758
|
-
prevScreen:
|
|
182759
|
-
skipSelfBlit:
|
|
182820
|
+
prevScreen: childPrevScreen,
|
|
182821
|
+
skipSelfBlit: childSkipSelfBlit,
|
|
182760
182822
|
inheritedBackgroundColor
|
|
182761
|
-
});
|
|
182823
|
+
}, stack));
|
|
182762
182824
|
if (wasDirty && !seenDirtyChild) {
|
|
182763
182825
|
if (!clipsBothAxes(childElem) || isAbsolute5) {
|
|
182764
182826
|
seenDirtyChild = true;
|
|
@@ -182767,6 +182829,9 @@ function renderChildren(node, output, offsetX, offsetY, hasRemovedChild, prevScr
|
|
|
182767
182829
|
}
|
|
182768
182830
|
}
|
|
182769
182831
|
}
|
|
182832
|
+
for (let i5 = frames.length - 1;i5 >= 0; i5--) {
|
|
182833
|
+
stack.push(frames[i5]);
|
|
182834
|
+
}
|
|
182770
182835
|
}
|
|
182771
182836
|
function clipsBothAxes(node) {
|
|
182772
182837
|
const ox = node.style.overflowX ?? node.style.overflow;
|
|
@@ -182797,24 +182862,28 @@ function siblingSharesY(node, yogaNode) {
|
|
|
182797
182862
|
function blitEscapingAbsoluteDescendants(node, output, prevScreen, px, py, pw, ph) {
|
|
182798
182863
|
const pr = px + pw;
|
|
182799
182864
|
const pb = py + ph;
|
|
182800
|
-
|
|
182801
|
-
|
|
182802
|
-
|
|
182803
|
-
const
|
|
182804
|
-
|
|
182805
|
-
|
|
182806
|
-
|
|
182807
|
-
|
|
182808
|
-
const
|
|
182809
|
-
|
|
182810
|
-
|
|
182811
|
-
|
|
182812
|
-
|
|
182813
|
-
|
|
182865
|
+
const work = [node];
|
|
182866
|
+
while (work.length > 0) {
|
|
182867
|
+
const current = work.pop();
|
|
182868
|
+
for (const child of current.childNodes) {
|
|
182869
|
+
if (child.nodeName === "#text")
|
|
182870
|
+
continue;
|
|
182871
|
+
const elem = child;
|
|
182872
|
+
if (elem.style.position === "absolute") {
|
|
182873
|
+
const cached2 = nodeCache.get(elem);
|
|
182874
|
+
if (cached2) {
|
|
182875
|
+
absoluteRectsCur.push(cached2);
|
|
182876
|
+
const cx = Math.floor(cached2.x);
|
|
182877
|
+
const cy = Math.floor(cached2.y);
|
|
182878
|
+
const cw = Math.floor(cached2.width);
|
|
182879
|
+
const ch = Math.floor(cached2.height);
|
|
182880
|
+
if (cx < px || cy < py || cx + cw > pr || cy + ch > pb) {
|
|
182881
|
+
output.blit(prevScreen, cx, cy, cw, ch);
|
|
182882
|
+
}
|
|
182814
182883
|
}
|
|
182815
182884
|
}
|
|
182885
|
+
work.push(elem);
|
|
182816
182886
|
}
|
|
182817
|
-
blitEscapingAbsoluteDescendants(elem, output, prevScreen, px, py, pw, ph);
|
|
182818
182887
|
}
|
|
182819
182888
|
}
|
|
182820
182889
|
function renderScrolledChildren(node, output, offsetX, offsetY, hasRemovedChild, prevScreen, scrollTopY, scrollBottomY, inheritedBackgroundColor, preserveCulledCache = false) {
|
|
@@ -182859,10 +182928,14 @@ function renderScrolledChildren(node, output, offsetX, offsetY, hasRemovedChild,
|
|
|
182859
182928
|
}
|
|
182860
182929
|
}
|
|
182861
182930
|
function dropSubtreeCache(node) {
|
|
182862
|
-
|
|
182863
|
-
|
|
182864
|
-
|
|
182865
|
-
|
|
182931
|
+
const work = [node];
|
|
182932
|
+
while (work.length > 0) {
|
|
182933
|
+
const current = work.pop();
|
|
182934
|
+
nodeCache.delete(current);
|
|
182935
|
+
for (const child of current.childNodes) {
|
|
182936
|
+
if (child.nodeName !== "#text") {
|
|
182937
|
+
work.push(child);
|
|
182938
|
+
}
|
|
182866
182939
|
}
|
|
182867
182940
|
}
|
|
182868
182941
|
}
|
|
@@ -183074,6 +183147,18 @@ var init_searchHighlight = __esm(() => {
|
|
|
183074
183147
|
init_screen();
|
|
183075
183148
|
});
|
|
183076
183149
|
|
|
183150
|
+
// src/ink/termio/guiEditorHandoff.ts
|
|
183151
|
+
function guiEditorModeDisableSeq(mouseTrackingOn) {
|
|
183152
|
+
return DISABLE_KITTY_KEYBOARD + DISABLE_MODIFY_OTHER_KEYS + (mouseTrackingOn ? DISABLE_MOUSE_TRACKING : "") + DFE;
|
|
183153
|
+
}
|
|
183154
|
+
function guiEditorModeRestoreSeq(mouseTrackingOn) {
|
|
183155
|
+
return (mouseTrackingOn ? ENABLE_MOUSE_TRACKING : "") + EFE + DISABLE_KITTY_KEYBOARD + ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS;
|
|
183156
|
+
}
|
|
183157
|
+
var init_guiEditorHandoff = __esm(() => {
|
|
183158
|
+
init_csi();
|
|
183159
|
+
init_dec();
|
|
183160
|
+
});
|
|
183161
|
+
|
|
183077
183162
|
// src/ink/useTerminalNotification.ts
|
|
183078
183163
|
function useTerminalNotification() {
|
|
183079
183164
|
const writeRaw = import_react11.useContext(TerminalWriteContext);
|
|
@@ -183627,6 +183712,20 @@ class Ink {
|
|
|
183627
183712
|
this.resume();
|
|
183628
183713
|
this.options.stdout.write("\x1B[?1004h" + (supportsExtendedKeys() ? DISABLE_KITTY_KEYBOARD + ENABLE_KITTY_KEYBOARD + ENABLE_MODIFY_OTHER_KEYS : ""));
|
|
183629
183714
|
}
|
|
183715
|
+
enterGuiEditorHandoff() {
|
|
183716
|
+
this.pause();
|
|
183717
|
+
this.suspendStdin();
|
|
183718
|
+
if (this.options.stdout.isTTY) {
|
|
183719
|
+
this.options.stdout.write(guiEditorModeDisableSeq(this.altScreenMouseTracking));
|
|
183720
|
+
}
|
|
183721
|
+
}
|
|
183722
|
+
exitGuiEditorHandoff() {
|
|
183723
|
+
this.resumeStdin();
|
|
183724
|
+
if (this.options.stdout.isTTY) {
|
|
183725
|
+
this.options.stdout.write(guiEditorModeRestoreSeq(this.altScreenMouseTracking));
|
|
183726
|
+
}
|
|
183727
|
+
this.resume();
|
|
183728
|
+
}
|
|
183630
183729
|
resetScreenReaderDiffState() {
|
|
183631
183730
|
this.screenReaderState.reset();
|
|
183632
183731
|
}
|
|
@@ -184435,6 +184534,7 @@ var init_ink = __esm(() => {
|
|
|
184435
184534
|
init_terminal();
|
|
184436
184535
|
init_csi();
|
|
184437
184536
|
init_dec();
|
|
184537
|
+
init_guiEditorHandoff();
|
|
184438
184538
|
init_osc();
|
|
184439
184539
|
init_useTerminalNotification();
|
|
184440
184540
|
init_ScreenReaderContext();
|
|
@@ -265388,6 +265488,10 @@ async function* withRetry(getClient2, operation, options) {
|
|
|
265388
265488
|
throw error52;
|
|
265389
265489
|
}
|
|
265390
265490
|
const minRequired = (retryContext.thinkingConfig.type === "enabled" ? retryContext.thinkingConfig.budgetTokens : 0) + 1;
|
|
265491
|
+
if (minRequired > availableContext) {
|
|
265492
|
+
logError2(new Error(`thinking budget (${minRequired - 1}) exceeds available context (${availableContext}); cannot retry context-overflow`));
|
|
265493
|
+
throw error52;
|
|
265494
|
+
}
|
|
265391
265495
|
const adjustedMaxTokens = Math.max(FLOOR_OUTPUT_TOKENS, availableContext, minRequired);
|
|
265392
265496
|
retryContext.maxTokensOverride = adjustedMaxTokens;
|
|
265393
265497
|
logEvent2("tengu_max_tokens_context_overflow_adjustment", {
|
|
@@ -355667,11 +355771,13 @@ function logRejectionEvent(tool, messageId, source, waitMs) {
|
|
|
355667
355771
|
}
|
|
355668
355772
|
function logPermissionDecision(ctx, args, permissionPromptStartTimeMs) {
|
|
355669
355773
|
const { tool, input, toolUseContext, messageId, toolUseID } = ctx;
|
|
355670
|
-
const {
|
|
355774
|
+
const { source } = args;
|
|
355671
355775
|
const waiting_for_user_permission_ms = permissionPromptStartTimeMs !== undefined ? Date.now() - permissionPromptStartTimeMs : undefined;
|
|
355776
|
+
const isAbort = args.decision === "reject" && source !== "config" && source.type === "user_abort";
|
|
355777
|
+
const decision = isAbort ? "abort" : args.decision;
|
|
355672
355778
|
if (args.decision === "accept") {
|
|
355673
355779
|
logApprovalEvent(tool, messageId, args.source, waiting_for_user_permission_ms);
|
|
355674
|
-
} else {
|
|
355780
|
+
} else if (!isAbort) {
|
|
355675
355781
|
logRejectionEvent(tool, messageId, args.source, waiting_for_user_permission_ms);
|
|
355676
355782
|
}
|
|
355677
355783
|
const sourceString = source === "config" ? "config" : sourceToString(source);
|
|
@@ -355704,6 +355810,74 @@ var init_permissionLogging = __esm(() => {
|
|
|
355704
355810
|
CODE_EDITING_TOOLS = ["Edit", "Write", "NotebookEdit"];
|
|
355705
355811
|
});
|
|
355706
355812
|
|
|
355813
|
+
// src/hooks/toolPermission/sdkPermissionTelemetry.ts
|
|
355814
|
+
function ruleSourceToOTelSource(ruleSource, behavior) {
|
|
355815
|
+
switch (ruleSource) {
|
|
355816
|
+
case "session":
|
|
355817
|
+
return behavior === "allow" ? "user_temporary" : "user_reject";
|
|
355818
|
+
case "localSettings":
|
|
355819
|
+
case "userSettings":
|
|
355820
|
+
return behavior === "allow" ? "user_permanent" : "user_reject";
|
|
355821
|
+
default:
|
|
355822
|
+
return "config";
|
|
355823
|
+
}
|
|
355824
|
+
}
|
|
355825
|
+
function isSdkPermissionAbort(reason) {
|
|
355826
|
+
if (reason?.type !== "permissionPromptTool")
|
|
355827
|
+
return false;
|
|
355828
|
+
const result = reason.toolResult;
|
|
355829
|
+
if (result === undefined)
|
|
355830
|
+
return true;
|
|
355831
|
+
if (result.interrupt === true)
|
|
355832
|
+
return true;
|
|
355833
|
+
return false;
|
|
355834
|
+
}
|
|
355835
|
+
function decisionReasonToOTelSource(reason, behavior) {
|
|
355836
|
+
if (!reason) {
|
|
355837
|
+
return "config";
|
|
355838
|
+
}
|
|
355839
|
+
switch (reason.type) {
|
|
355840
|
+
case "permissionPromptTool": {
|
|
355841
|
+
const toolResult = reason.toolResult;
|
|
355842
|
+
const classified = toolResult?.decisionClassification;
|
|
355843
|
+
if (classified === "user_temporary" || classified === "user_permanent" || classified === "user_reject") {
|
|
355844
|
+
return classified;
|
|
355845
|
+
}
|
|
355846
|
+
if (isSdkPermissionAbort(reason)) {
|
|
355847
|
+
return "user_abort";
|
|
355848
|
+
}
|
|
355849
|
+
return behavior === "allow" ? "user_temporary" : "user_reject";
|
|
355850
|
+
}
|
|
355851
|
+
case "rule":
|
|
355852
|
+
return ruleSourceToOTelSource(reason.rule.source, behavior);
|
|
355853
|
+
case "hook":
|
|
355854
|
+
return "hook";
|
|
355855
|
+
case "mode":
|
|
355856
|
+
case "classifier":
|
|
355857
|
+
case "subcommandResults":
|
|
355858
|
+
case "asyncAgent":
|
|
355859
|
+
case "sandboxOverride":
|
|
355860
|
+
case "workingDir":
|
|
355861
|
+
case "safetyCheck":
|
|
355862
|
+
case "other":
|
|
355863
|
+
return "config";
|
|
355864
|
+
default: {
|
|
355865
|
+
const _exhaustive = reason;
|
|
355866
|
+
return "config";
|
|
355867
|
+
}
|
|
355868
|
+
}
|
|
355869
|
+
}
|
|
355870
|
+
function sdkPermissionDecisionLabel(behavior, reason) {
|
|
355871
|
+
if (behavior === "allow")
|
|
355872
|
+
return "accept";
|
|
355873
|
+
if (behavior === "deny") {
|
|
355874
|
+
if (isSdkPermissionAbort(reason))
|
|
355875
|
+
return "abort";
|
|
355876
|
+
return "reject";
|
|
355877
|
+
}
|
|
355878
|
+
return "abort";
|
|
355879
|
+
}
|
|
355880
|
+
|
|
355707
355881
|
// src/utils/bash/bashParser.ts
|
|
355708
355882
|
function ensureParserInitialized() {
|
|
355709
355883
|
return READY;
|
|
@@ -361399,6 +361573,47 @@ var init_ids = __esm(() => {
|
|
|
361399
361573
|
AGENT_ID_PATTERN = /^a(?:.+-)?[0-9a-f]{16}$/;
|
|
361400
361574
|
});
|
|
361401
361575
|
|
|
361576
|
+
// src/utils/sessionLimits.ts
|
|
361577
|
+
function parsePositiveIntEnv(raw) {
|
|
361578
|
+
if (raw === undefined) {
|
|
361579
|
+
return null;
|
|
361580
|
+
}
|
|
361581
|
+
const n5 = Number(raw);
|
|
361582
|
+
if (!Number.isFinite(n5) || !Number.isInteger(n5) || n5 <= 0) {
|
|
361583
|
+
return null;
|
|
361584
|
+
}
|
|
361585
|
+
return n5;
|
|
361586
|
+
}
|
|
361587
|
+
function getMaxWebSearchesPerSession() {
|
|
361588
|
+
return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION) ?? DEFAULT_MAX_WEB_SEARCHES_PER_SESSION;
|
|
361589
|
+
}
|
|
361590
|
+
function getMaxSubagentsPerSession() {
|
|
361591
|
+
return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION) ?? DEFAULT_MAX_SUBAGENTS_PER_SESSION;
|
|
361592
|
+
}
|
|
361593
|
+
function getMaxConcurrentSubagents() {
|
|
361594
|
+
return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS) ?? DEFAULT_MAX_CONCURRENT_SUBAGENTS;
|
|
361595
|
+
}
|
|
361596
|
+
function getMaxSubagentSpawnDepth() {
|
|
361597
|
+
return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH) ?? DEFAULT_MAX_SUBAGENT_SPAWN_DEPTH;
|
|
361598
|
+
}
|
|
361599
|
+
function assertSubagentCapAndIncrement(context4) {
|
|
361600
|
+
const max2 = getMaxSubagentsPerSession();
|
|
361601
|
+
const count3 = context4.taskRegistry?.getTotalAgentSpawns() ?? 0;
|
|
361602
|
+
if (count3 >= max2) {
|
|
361603
|
+
throw new Error(`Subagent spawn limit reached (${count3} of ${max2} agents spawned). Complete the remaining work directly with your tools instead of spawning more agents. If more agents are genuinely needed, ask the user to raise CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION.`);
|
|
361604
|
+
}
|
|
361605
|
+
context4.taskRegistry?.incrementTotalAgentSpawns();
|
|
361606
|
+
}
|
|
361607
|
+
function claimConcurrentSubagentSlot(context4) {
|
|
361608
|
+
const max2 = getMaxConcurrentSubagents();
|
|
361609
|
+
const running = context4.taskRegistry?.getConcurrentSubagents() ?? 0;
|
|
361610
|
+
if (running >= max2) {
|
|
361611
|
+
throw new Error(`Concurrent subagent limit reached. You can run ${max2} subagents at once. Do not retry. If the user wants more concurrent subagents, ask them to increase CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS.`);
|
|
361612
|
+
}
|
|
361613
|
+
return context4.taskRegistry?.takeConcurrencySlot() ?? (() => {});
|
|
361614
|
+
}
|
|
361615
|
+
var DEFAULT_MAX_WEB_SEARCHES_PER_SESSION = 200, DEFAULT_MAX_SUBAGENTS_PER_SESSION = 200, DEFAULT_MAX_CONCURRENT_SUBAGENTS = 20, DEFAULT_MAX_SUBAGENT_SPAWN_DEPTH = 1;
|
|
361616
|
+
|
|
361402
361617
|
// src/utils/sdkEventQueue.ts
|
|
361403
361618
|
import { randomUUID as randomUUID12 } from "crypto";
|
|
361404
361619
|
function enqueueSdkEvent(event) {
|
|
@@ -361561,7 +361776,10 @@ function startBackgroundSession({
|
|
|
361561
361776
|
isBuiltIn: true
|
|
361562
361777
|
};
|
|
361563
361778
|
runWithAgentContext(agentContext, async () => {
|
|
361779
|
+
let releaseConcurrentSubagentSlot = null;
|
|
361564
361780
|
try {
|
|
361781
|
+
assertSubagentCapAndIncrement(queryParams.toolUseContext);
|
|
361782
|
+
releaseConcurrentSubagentSlot = claimConcurrentSubagentSlot(queryParams.toolUseContext);
|
|
361565
361783
|
const bgMessages = [...messages];
|
|
361566
361784
|
const recentActivities = [];
|
|
361567
361785
|
let toolCount = 0;
|
|
@@ -361638,6 +361856,8 @@ function startBackgroundSession({
|
|
|
361638
361856
|
} catch (error52) {
|
|
361639
361857
|
logError2(error52);
|
|
361640
361858
|
completeMainSessionTask(taskId, false, setAppState);
|
|
361859
|
+
} finally {
|
|
361860
|
+
releaseConcurrentSubagentSlot?.();
|
|
361641
361861
|
}
|
|
361642
361862
|
});
|
|
361643
361863
|
return taskId;
|
|
@@ -385878,7 +386098,7 @@ function mcpServerPendingApprovalMessage(name3) {
|
|
|
385878
386098
|
function mcpServerHealthStatusLabel(result) {
|
|
385879
386099
|
switch (result.type) {
|
|
385880
386100
|
case "connected":
|
|
385881
|
-
return "\
|
|
386101
|
+
return "\u2714 Connected";
|
|
385882
386102
|
case "needs-auth":
|
|
385883
386103
|
return "! Needs authentication";
|
|
385884
386104
|
case "needs-approval":
|
|
@@ -387361,47 +387581,6 @@ var init_registerFrontmatterHooks = __esm(() => {
|
|
|
387361
387581
|
init_sessionHooks();
|
|
387362
387582
|
});
|
|
387363
387583
|
|
|
387364
|
-
// src/utils/sessionLimits.ts
|
|
387365
|
-
function parsePositiveIntEnv(raw) {
|
|
387366
|
-
if (raw === undefined) {
|
|
387367
|
-
return null;
|
|
387368
|
-
}
|
|
387369
|
-
const n5 = Number(raw);
|
|
387370
|
-
if (!Number.isFinite(n5) || !Number.isInteger(n5) || n5 <= 0) {
|
|
387371
|
-
return null;
|
|
387372
|
-
}
|
|
387373
|
-
return n5;
|
|
387374
|
-
}
|
|
387375
|
-
function getMaxWebSearchesPerSession() {
|
|
387376
|
-
return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_WEB_SEARCHES_PER_SESSION) ?? DEFAULT_MAX_WEB_SEARCHES_PER_SESSION;
|
|
387377
|
-
}
|
|
387378
|
-
function getMaxSubagentsPerSession() {
|
|
387379
|
-
return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION) ?? DEFAULT_MAX_SUBAGENTS_PER_SESSION;
|
|
387380
|
-
}
|
|
387381
|
-
function getMaxConcurrentSubagents() {
|
|
387382
|
-
return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS) ?? DEFAULT_MAX_CONCURRENT_SUBAGENTS;
|
|
387383
|
-
}
|
|
387384
|
-
function getMaxSubagentSpawnDepth() {
|
|
387385
|
-
return parsePositiveIntEnv(process.env.CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH) ?? DEFAULT_MAX_SUBAGENT_SPAWN_DEPTH;
|
|
387386
|
-
}
|
|
387387
|
-
function assertSubagentCapAndIncrement(context4) {
|
|
387388
|
-
const max2 = getMaxSubagentsPerSession();
|
|
387389
|
-
const count3 = context4.taskRegistry?.getTotalAgentSpawns() ?? 0;
|
|
387390
|
-
if (count3 >= max2) {
|
|
387391
|
-
throw new Error(`Subagent spawn limit reached (${count3} of ${max2} agents spawned). Complete the remaining work directly with your tools instead of spawning more agents. If more agents are genuinely needed, ask the user to raise CLAUDE_CODE_MAX_SUBAGENTS_PER_SESSION.`);
|
|
387392
|
-
}
|
|
387393
|
-
context4.taskRegistry?.incrementTotalAgentSpawns();
|
|
387394
|
-
}
|
|
387395
|
-
function claimConcurrentSubagentSlot(context4) {
|
|
387396
|
-
const max2 = getMaxConcurrentSubagents();
|
|
387397
|
-
const running = context4.taskRegistry?.getConcurrentSubagents() ?? 0;
|
|
387398
|
-
if (running >= max2) {
|
|
387399
|
-
throw new Error(`Concurrent subagent limit reached. You can run ${max2} subagents at once. Do not retry. If the user wants more concurrent subagents, ask them to increase CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS.`);
|
|
387400
|
-
}
|
|
387401
|
-
return context4.taskRegistry?.takeConcurrencySlot() ?? (() => {});
|
|
387402
|
-
}
|
|
387403
|
-
var DEFAULT_MAX_WEB_SEARCHES_PER_SESSION = 200, DEFAULT_MAX_SUBAGENTS_PER_SESSION = 200, DEFAULT_MAX_CONCURRENT_SUBAGENTS = 20, DEFAULT_MAX_SUBAGENT_SPAWN_DEPTH = 1;
|
|
387404
|
-
|
|
387405
387584
|
// src/utils/model/agent.ts
|
|
387406
387585
|
function getDefaultSubagentModel() {
|
|
387407
387586
|
return "inherit";
|
|
@@ -389277,6 +389456,10 @@ async function classifyYoloActionXml(prefixMessages, systemPrompt, userPrompt, u
|
|
|
389277
389456
|
promptLengths
|
|
389278
389457
|
};
|
|
389279
389458
|
}
|
|
389459
|
+
if (isClassifierAuthError(error52)) {
|
|
389460
|
+
logAutoModeOutcome("error", model, { classifierType });
|
|
389461
|
+
throw error52;
|
|
389462
|
+
}
|
|
389280
389463
|
const tooLong = detectPromptTooLong(error52);
|
|
389281
389464
|
logForDebugging(`Auto mode classifier (XML) error: ${errorMessage(error52)}`, {
|
|
389282
389465
|
level: "warn"
|
|
@@ -389489,6 +389672,10 @@ async function classifyYoloAction(messages, action2, tools, context4, signal) {
|
|
|
389489
389672
|
unavailable: true
|
|
389490
389673
|
};
|
|
389491
389674
|
}
|
|
389675
|
+
if (isClassifierAuthError(error52)) {
|
|
389676
|
+
logAutoModeOutcome("error", model);
|
|
389677
|
+
throw error52;
|
|
389678
|
+
}
|
|
389492
389679
|
const tooLong = detectPromptTooLong(error52);
|
|
389493
389680
|
logForDebugging(`Auto mode classifier error: ${errorMessage(error52)}`, {
|
|
389494
389681
|
level: "warn"
|
|
@@ -389607,6 +389794,9 @@ function detectPromptTooLong(error52) {
|
|
|
389607
389794
|
}
|
|
389608
389795
|
return parsePromptTooLongTokenCounts(error52.message);
|
|
389609
389796
|
}
|
|
389797
|
+
function isClassifierAuthError(error52) {
|
|
389798
|
+
return error52 instanceof Error && typeof error52.status === "number" && (error52.status === 401 || error52.status === 403);
|
|
389799
|
+
}
|
|
389610
389800
|
function getTwoStageMode() {
|
|
389611
389801
|
const v6 = resolveTwoStageClassifier();
|
|
389612
389802
|
return v6 === "fast" || v6 === "thinking" ? v6 : "both";
|
|
@@ -397709,6 +397899,46 @@ var init_esm20 = __esm(() => {
|
|
|
397709
397899
|
init_ConsoleSpanExporter();
|
|
397710
397900
|
});
|
|
397711
397901
|
|
|
397902
|
+
// src/utils/telemetry/managedOtelEndpoint.ts
|
|
397903
|
+
function governManagedOtelEndpoint(env6, policyEnv) {
|
|
397904
|
+
const managedGenericEndpoint = policyEnv?.[GENERIC_ENDPOINT_VAR];
|
|
397905
|
+
if (!managedGenericEndpoint) {
|
|
397906
|
+
return { ...env6 };
|
|
397907
|
+
}
|
|
397908
|
+
const governed = {};
|
|
397909
|
+
for (const [key2, value] of Object.entries(env6)) {
|
|
397910
|
+
if (SIGNAL_ENDPOINT_VARS.includes(key2) && policyEnv?.[key2] === undefined) {
|
|
397911
|
+
continue;
|
|
397912
|
+
}
|
|
397913
|
+
governed[key2] = value;
|
|
397914
|
+
}
|
|
397915
|
+
return governed;
|
|
397916
|
+
}
|
|
397917
|
+
function applyManagedOtelEndpointGovernance() {
|
|
397918
|
+
const policyEnv = getPolicyEnv();
|
|
397919
|
+
const governed = governManagedOtelEndpoint(process.env, policyEnv);
|
|
397920
|
+
for (const key2 of SIGNAL_ENDPOINT_VARS) {
|
|
397921
|
+
if (governed[key2] === undefined && process.env[key2] !== undefined) {
|
|
397922
|
+
delete process.env[key2];
|
|
397923
|
+
} else if (governed[key2] !== undefined) {
|
|
397924
|
+
process.env[key2] = governed[key2];
|
|
397925
|
+
}
|
|
397926
|
+
}
|
|
397927
|
+
}
|
|
397928
|
+
function getPolicyEnv() {
|
|
397929
|
+
const settings = getSettingsForSource("policySettings");
|
|
397930
|
+
return settings?.env ?? {};
|
|
397931
|
+
}
|
|
397932
|
+
var SIGNAL_ENDPOINT_VARS, GENERIC_ENDPOINT_VAR = "OTEL_EXPORTER_OTLP_ENDPOINT";
|
|
397933
|
+
var init_managedOtelEndpoint = __esm(() => {
|
|
397934
|
+
init_settings2();
|
|
397935
|
+
SIGNAL_ENDPOINT_VARS = [
|
|
397936
|
+
"OTEL_EXPORTER_OTLP_TRACES_ENDPOINT",
|
|
397937
|
+
"OTEL_EXPORTER_OTLP_METRICS_ENDPOINT",
|
|
397938
|
+
"OTEL_EXPORTER_OTLP_LOGS_ENDPOINT"
|
|
397939
|
+
];
|
|
397940
|
+
});
|
|
397941
|
+
|
|
397712
397942
|
// src/utils/telemetry/betaSessionTracing.ts
|
|
397713
397943
|
import { createHash as createHash18 } from "crypto";
|
|
397714
397944
|
function clearBetaTracingState() {
|
|
@@ -398219,6 +398449,383 @@ var init_bigqueryExporter = __esm(() => {
|
|
|
398219
398449
|
import_sdk_metrics = __toESM(require_src15(), 1);
|
|
398220
398450
|
});
|
|
398221
398451
|
|
|
398452
|
+
// node_modules/.bun/@opentelemetry+exporter-prometheus@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusSerializer.js
|
|
398453
|
+
var require_PrometheusSerializer = __commonJS((exports) => {
|
|
398454
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
398455
|
+
exports.PrometheusSerializer = undefined;
|
|
398456
|
+
var api_1 = require_src11();
|
|
398457
|
+
var sdk_metrics_1 = require_src15();
|
|
398458
|
+
var core_1 = require_src13();
|
|
398459
|
+
var semantic_conventions_1 = require_src12();
|
|
398460
|
+
var ATTR_OTEL_SCOPE_SCHEMA_URL = "otel.scope.schema_url";
|
|
398461
|
+
function escapeString(str2) {
|
|
398462
|
+
return str2.replace(/\\/g, "\\\\").replace(/\n/g, "\\n");
|
|
398463
|
+
}
|
|
398464
|
+
function escapeAttributeValue(str2 = "") {
|
|
398465
|
+
if (typeof str2 !== "string") {
|
|
398466
|
+
str2 = JSON.stringify(str2);
|
|
398467
|
+
}
|
|
398468
|
+
return escapeString(str2).replace(/"/g, "\\\"");
|
|
398469
|
+
}
|
|
398470
|
+
var invalidCharacterRegex = /[^a-z0-9_]/gi;
|
|
398471
|
+
var multipleUnderscoreRegex = /_{2,}/g;
|
|
398472
|
+
function sanitizePrometheusMetricName(name3) {
|
|
398473
|
+
return name3.replace(invalidCharacterRegex, "_").replace(multipleUnderscoreRegex, "_");
|
|
398474
|
+
}
|
|
398475
|
+
function enforcePrometheusNamingConvention(name3, data) {
|
|
398476
|
+
if (!name3.endsWith("_total") && data.dataPointType === sdk_metrics_1.DataPointType.SUM && data.isMonotonic) {
|
|
398477
|
+
name3 = name3 + "_total";
|
|
398478
|
+
}
|
|
398479
|
+
return name3;
|
|
398480
|
+
}
|
|
398481
|
+
function valueString(value) {
|
|
398482
|
+
if (value === Infinity) {
|
|
398483
|
+
return "+Inf";
|
|
398484
|
+
} else if (value === -Infinity) {
|
|
398485
|
+
return "-Inf";
|
|
398486
|
+
} else {
|
|
398487
|
+
return `${value}`;
|
|
398488
|
+
}
|
|
398489
|
+
}
|
|
398490
|
+
function toPrometheusType(metricData) {
|
|
398491
|
+
switch (metricData.dataPointType) {
|
|
398492
|
+
case sdk_metrics_1.DataPointType.SUM:
|
|
398493
|
+
if (metricData.isMonotonic) {
|
|
398494
|
+
return "counter";
|
|
398495
|
+
}
|
|
398496
|
+
return "gauge";
|
|
398497
|
+
case sdk_metrics_1.DataPointType.GAUGE:
|
|
398498
|
+
return "gauge";
|
|
398499
|
+
case sdk_metrics_1.DataPointType.HISTOGRAM:
|
|
398500
|
+
return "histogram";
|
|
398501
|
+
default:
|
|
398502
|
+
return "untyped";
|
|
398503
|
+
}
|
|
398504
|
+
}
|
|
398505
|
+
function stringify(metricName, attributes, value, timestamp, additionalAttributes) {
|
|
398506
|
+
let hasAttribute = false;
|
|
398507
|
+
let attributesStr = "";
|
|
398508
|
+
for (const [key2, val] of Object.entries(attributes)) {
|
|
398509
|
+
const sanitizedAttributeName = sanitizePrometheusMetricName(key2);
|
|
398510
|
+
hasAttribute = true;
|
|
398511
|
+
attributesStr += `${attributesStr.length > 0 ? "," : ""}${sanitizedAttributeName}="${escapeAttributeValue(val)}"`;
|
|
398512
|
+
}
|
|
398513
|
+
if (additionalAttributes) {
|
|
398514
|
+
for (const [key2, val] of Object.entries(additionalAttributes)) {
|
|
398515
|
+
const sanitizedAttributeName = sanitizePrometheusMetricName(key2);
|
|
398516
|
+
hasAttribute = true;
|
|
398517
|
+
attributesStr += `${attributesStr.length > 0 ? "," : ""}${sanitizedAttributeName}="${escapeAttributeValue(val)}"`;
|
|
398518
|
+
}
|
|
398519
|
+
}
|
|
398520
|
+
if (hasAttribute) {
|
|
398521
|
+
metricName += `{${attributesStr}}`;
|
|
398522
|
+
}
|
|
398523
|
+
return `${metricName} ${valueString(value)}${timestamp !== undefined ? " " + String(timestamp) : ""}
|
|
398524
|
+
`;
|
|
398525
|
+
}
|
|
398526
|
+
var NO_REGISTERED_METRICS = "# no registered metrics";
|
|
398527
|
+
|
|
398528
|
+
class PrometheusSerializer {
|
|
398529
|
+
_prefix;
|
|
398530
|
+
_appendTimestamp;
|
|
398531
|
+
_additionalAttributes;
|
|
398532
|
+
_withResourceConstantLabels;
|
|
398533
|
+
_withoutScopeInfo;
|
|
398534
|
+
_withoutTargetInfo;
|
|
398535
|
+
constructor(prefix, appendTimestamp = false, withResourceConstantLabels, withoutTargetInfo, withoutScopeInfo) {
|
|
398536
|
+
if (prefix) {
|
|
398537
|
+
this._prefix = prefix + "_";
|
|
398538
|
+
}
|
|
398539
|
+
this._appendTimestamp = appendTimestamp;
|
|
398540
|
+
this._withResourceConstantLabels = withResourceConstantLabels;
|
|
398541
|
+
this._withoutScopeInfo = !!withoutScopeInfo;
|
|
398542
|
+
this._withoutTargetInfo = !!withoutTargetInfo;
|
|
398543
|
+
}
|
|
398544
|
+
serialize(resourceMetrics) {
|
|
398545
|
+
let str2 = "";
|
|
398546
|
+
this._additionalAttributes = this._filterResourceConstantLabels(resourceMetrics.resource.attributes, this._withResourceConstantLabels);
|
|
398547
|
+
for (const scopeMetrics of resourceMetrics.scopeMetrics) {
|
|
398548
|
+
str2 += this._serializeScopeMetrics(scopeMetrics);
|
|
398549
|
+
}
|
|
398550
|
+
if (str2 === "") {
|
|
398551
|
+
str2 += NO_REGISTERED_METRICS;
|
|
398552
|
+
}
|
|
398553
|
+
return this._serializeResource(resourceMetrics.resource) + str2;
|
|
398554
|
+
}
|
|
398555
|
+
_filterResourceConstantLabels(attributes, pattern) {
|
|
398556
|
+
if (pattern) {
|
|
398557
|
+
const filteredAttributes = {};
|
|
398558
|
+
for (const [key2, value] of Object.entries(attributes)) {
|
|
398559
|
+
if (key2.match(pattern)) {
|
|
398560
|
+
filteredAttributes[key2] = value;
|
|
398561
|
+
}
|
|
398562
|
+
}
|
|
398563
|
+
return filteredAttributes;
|
|
398564
|
+
}
|
|
398565
|
+
return;
|
|
398566
|
+
}
|
|
398567
|
+
_serializeScopeMetrics(scopeMetrics) {
|
|
398568
|
+
let str2 = "";
|
|
398569
|
+
for (const metric of scopeMetrics.metrics) {
|
|
398570
|
+
str2 += this._serializeMetricData(metric, scopeMetrics.scope) + `
|
|
398571
|
+
`;
|
|
398572
|
+
}
|
|
398573
|
+
return str2;
|
|
398574
|
+
}
|
|
398575
|
+
_serializeMetricData(metricData, scope) {
|
|
398576
|
+
let name3 = sanitizePrometheusMetricName(escapeString(metricData.descriptor.name));
|
|
398577
|
+
if (this._prefix) {
|
|
398578
|
+
name3 = `${this._prefix}${name3}`;
|
|
398579
|
+
}
|
|
398580
|
+
const dataPointType = metricData.dataPointType;
|
|
398581
|
+
name3 = enforcePrometheusNamingConvention(name3, metricData);
|
|
398582
|
+
const help = `# HELP ${name3} ${escapeString(metricData.descriptor.description || "description missing")}`;
|
|
398583
|
+
const unit = metricData.descriptor.unit ? `
|
|
398584
|
+
# UNIT ${name3} ${escapeString(metricData.descriptor.unit)}` : "";
|
|
398585
|
+
const type = `# TYPE ${name3} ${toPrometheusType(metricData)}`;
|
|
398586
|
+
let additionalAttributes;
|
|
398587
|
+
if (this._withoutScopeInfo) {
|
|
398588
|
+
additionalAttributes = this._additionalAttributes;
|
|
398589
|
+
} else {
|
|
398590
|
+
const scopeInfo = { [semantic_conventions_1.ATTR_OTEL_SCOPE_NAME]: scope.name };
|
|
398591
|
+
if (scope.schemaUrl) {
|
|
398592
|
+
scopeInfo[ATTR_OTEL_SCOPE_SCHEMA_URL] = scope.schemaUrl;
|
|
398593
|
+
}
|
|
398594
|
+
if (scope.version) {
|
|
398595
|
+
scopeInfo[semantic_conventions_1.ATTR_OTEL_SCOPE_VERSION] = scope.version;
|
|
398596
|
+
}
|
|
398597
|
+
additionalAttributes = Object.assign(scopeInfo, this._additionalAttributes);
|
|
398598
|
+
}
|
|
398599
|
+
let results = "";
|
|
398600
|
+
switch (dataPointType) {
|
|
398601
|
+
case sdk_metrics_1.DataPointType.SUM:
|
|
398602
|
+
case sdk_metrics_1.DataPointType.GAUGE: {
|
|
398603
|
+
results = metricData.dataPoints.map((it) => this._serializeSingularDataPoint(name3, metricData, it, additionalAttributes)).join("");
|
|
398604
|
+
break;
|
|
398605
|
+
}
|
|
398606
|
+
case sdk_metrics_1.DataPointType.HISTOGRAM: {
|
|
398607
|
+
results = metricData.dataPoints.map((it) => this._serializeHistogramDataPoint(name3, metricData, it, additionalAttributes)).join("");
|
|
398608
|
+
break;
|
|
398609
|
+
}
|
|
398610
|
+
default: {
|
|
398611
|
+
api_1.diag.error(`Unrecognizable DataPointType: ${dataPointType} for metric "${name3}"`);
|
|
398612
|
+
}
|
|
398613
|
+
}
|
|
398614
|
+
return `${help}${unit}
|
|
398615
|
+
${type}
|
|
398616
|
+
${results}`.trim();
|
|
398617
|
+
}
|
|
398618
|
+
_serializeSingularDataPoint(name3, data, dataPoint, additionalAttributes) {
|
|
398619
|
+
let results = "";
|
|
398620
|
+
name3 = enforcePrometheusNamingConvention(name3, data);
|
|
398621
|
+
const { value, attributes } = dataPoint;
|
|
398622
|
+
const timestamp = (0, core_1.hrTimeToMilliseconds)(dataPoint.endTime);
|
|
398623
|
+
results += stringify(name3, attributes, value, this._appendTimestamp ? timestamp : undefined, additionalAttributes);
|
|
398624
|
+
return results;
|
|
398625
|
+
}
|
|
398626
|
+
_serializeHistogramDataPoint(name3, data, dataPoint, additionalAttributes) {
|
|
398627
|
+
let results = "";
|
|
398628
|
+
name3 = enforcePrometheusNamingConvention(name3, data);
|
|
398629
|
+
const attributes = dataPoint.attributes;
|
|
398630
|
+
const histogram = dataPoint.value;
|
|
398631
|
+
const timestamp = (0, core_1.hrTimeToMilliseconds)(dataPoint.endTime);
|
|
398632
|
+
for (const key2 of ["count", "sum"]) {
|
|
398633
|
+
const value = histogram[key2];
|
|
398634
|
+
if (value != null)
|
|
398635
|
+
results += stringify(name3 + "_" + key2, attributes, value, this._appendTimestamp ? timestamp : undefined, additionalAttributes);
|
|
398636
|
+
}
|
|
398637
|
+
let cumulativeSum = 0;
|
|
398638
|
+
const countEntries = histogram.buckets.counts.entries();
|
|
398639
|
+
let infiniteBoundaryDefined = false;
|
|
398640
|
+
for (const [idx, val] of countEntries) {
|
|
398641
|
+
cumulativeSum += val;
|
|
398642
|
+
const upperBound = histogram.buckets.boundaries[idx];
|
|
398643
|
+
if (upperBound === undefined && infiniteBoundaryDefined) {
|
|
398644
|
+
break;
|
|
398645
|
+
}
|
|
398646
|
+
if (upperBound === Infinity) {
|
|
398647
|
+
infiniteBoundaryDefined = true;
|
|
398648
|
+
}
|
|
398649
|
+
results += stringify(name3 + "_bucket", attributes, cumulativeSum, this._appendTimestamp ? timestamp : undefined, Object.assign({}, additionalAttributes, {
|
|
398650
|
+
le: upperBound === undefined || upperBound === Infinity ? "+Inf" : String(upperBound)
|
|
398651
|
+
}));
|
|
398652
|
+
}
|
|
398653
|
+
return results;
|
|
398654
|
+
}
|
|
398655
|
+
_serializeResource(resource) {
|
|
398656
|
+
if (this._withoutTargetInfo === true) {
|
|
398657
|
+
return "";
|
|
398658
|
+
}
|
|
398659
|
+
const name3 = "target_info";
|
|
398660
|
+
const help = `# HELP ${name3} Target metadata`;
|
|
398661
|
+
const type = `# TYPE ${name3} gauge`;
|
|
398662
|
+
const results = stringify(name3, resource.attributes, 1).trim();
|
|
398663
|
+
return `${help}
|
|
398664
|
+
${type}
|
|
398665
|
+
${results}
|
|
398666
|
+
`;
|
|
398667
|
+
}
|
|
398668
|
+
}
|
|
398669
|
+
exports.PrometheusSerializer = PrometheusSerializer;
|
|
398670
|
+
});
|
|
398671
|
+
|
|
398672
|
+
// node_modules/.bun/@opentelemetry+exporter-prometheus@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusExporter.js
|
|
398673
|
+
var require_PrometheusExporter = __commonJS((exports) => {
|
|
398674
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
398675
|
+
exports.PrometheusExporter = undefined;
|
|
398676
|
+
var api_1 = require_src11();
|
|
398677
|
+
var core_1 = require_src13();
|
|
398678
|
+
var sdk_metrics_1 = require_src15();
|
|
398679
|
+
var http_1 = __require("http");
|
|
398680
|
+
var PrometheusSerializer_1 = require_PrometheusSerializer();
|
|
398681
|
+
var url_1 = __require("url");
|
|
398682
|
+
|
|
398683
|
+
class PrometheusExporter extends sdk_metrics_1.MetricReader {
|
|
398684
|
+
static DEFAULT_OPTIONS = {
|
|
398685
|
+
host: undefined,
|
|
398686
|
+
port: 9464,
|
|
398687
|
+
endpoint: "/metrics",
|
|
398688
|
+
prefix: "",
|
|
398689
|
+
appendTimestamp: false,
|
|
398690
|
+
withResourceConstantLabels: undefined,
|
|
398691
|
+
withoutScopeInfo: false,
|
|
398692
|
+
withoutTargetInfo: false
|
|
398693
|
+
};
|
|
398694
|
+
_host;
|
|
398695
|
+
_port;
|
|
398696
|
+
_baseUrl;
|
|
398697
|
+
_endpoint;
|
|
398698
|
+
_server;
|
|
398699
|
+
_prefix;
|
|
398700
|
+
_appendTimestamp;
|
|
398701
|
+
_serializer;
|
|
398702
|
+
_startServerPromise;
|
|
398703
|
+
constructor(config6 = {}, callback = () => {}) {
|
|
398704
|
+
super({
|
|
398705
|
+
aggregationSelector: (_instrumentType) => {
|
|
398706
|
+
return {
|
|
398707
|
+
type: sdk_metrics_1.AggregationType.DEFAULT
|
|
398708
|
+
};
|
|
398709
|
+
},
|
|
398710
|
+
aggregationTemporalitySelector: (_instrumentType) => sdk_metrics_1.AggregationTemporality.CUMULATIVE,
|
|
398711
|
+
metricProducers: config6.metricProducers
|
|
398712
|
+
});
|
|
398713
|
+
this._host = config6.host || process.env.OTEL_EXPORTER_PROMETHEUS_HOST || PrometheusExporter.DEFAULT_OPTIONS.host;
|
|
398714
|
+
this._port = config6.port || Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT) || PrometheusExporter.DEFAULT_OPTIONS.port;
|
|
398715
|
+
this._prefix = config6.prefix || PrometheusExporter.DEFAULT_OPTIONS.prefix;
|
|
398716
|
+
this._appendTimestamp = typeof config6.appendTimestamp === "boolean" ? config6.appendTimestamp : PrometheusExporter.DEFAULT_OPTIONS.appendTimestamp;
|
|
398717
|
+
const _withResourceConstantLabels = config6.withResourceConstantLabels || PrometheusExporter.DEFAULT_OPTIONS.withResourceConstantLabels;
|
|
398718
|
+
const _withoutScopeInfo = config6.withoutScopeInfo || PrometheusExporter.DEFAULT_OPTIONS.withoutScopeInfo;
|
|
398719
|
+
const _withoutTargetInfo = config6.withoutTargetInfo || PrometheusExporter.DEFAULT_OPTIONS.withoutTargetInfo;
|
|
398720
|
+
this._server = (0, http_1.createServer)(this._requestHandler).unref();
|
|
398721
|
+
this._serializer = new PrometheusSerializer_1.PrometheusSerializer(this._prefix, this._appendTimestamp, _withResourceConstantLabels, _withoutTargetInfo, _withoutScopeInfo);
|
|
398722
|
+
this._baseUrl = `http://${this._host}:${this._port}/`;
|
|
398723
|
+
this._endpoint = (config6.endpoint || PrometheusExporter.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/, "/$1");
|
|
398724
|
+
if (config6.preventServerStart !== true) {
|
|
398725
|
+
this.startServer().then(callback, (err2) => {
|
|
398726
|
+
api_1.diag.error(err2);
|
|
398727
|
+
callback(err2);
|
|
398728
|
+
});
|
|
398729
|
+
} else if (callback) {
|
|
398730
|
+
queueMicrotask(callback);
|
|
398731
|
+
}
|
|
398732
|
+
}
|
|
398733
|
+
async onForceFlush() {}
|
|
398734
|
+
onShutdown() {
|
|
398735
|
+
return this.stopServer();
|
|
398736
|
+
}
|
|
398737
|
+
stopServer() {
|
|
398738
|
+
if (!this._server) {
|
|
398739
|
+
api_1.diag.debug("Prometheus stopServer() was called but server was never started.");
|
|
398740
|
+
return Promise.resolve();
|
|
398741
|
+
} else {
|
|
398742
|
+
return new Promise((resolve34) => {
|
|
398743
|
+
this._server.close((err2) => {
|
|
398744
|
+
if (!err2) {
|
|
398745
|
+
api_1.diag.debug("Prometheus exporter was stopped");
|
|
398746
|
+
} else {
|
|
398747
|
+
if (err2.code !== "ERR_SERVER_NOT_RUNNING") {
|
|
398748
|
+
(0, core_1.globalErrorHandler)(err2);
|
|
398749
|
+
}
|
|
398750
|
+
}
|
|
398751
|
+
resolve34();
|
|
398752
|
+
});
|
|
398753
|
+
});
|
|
398754
|
+
}
|
|
398755
|
+
}
|
|
398756
|
+
startServer() {
|
|
398757
|
+
this._startServerPromise ??= new Promise((resolve34, reject) => {
|
|
398758
|
+
this._server.once("error", reject);
|
|
398759
|
+
this._server.listen({
|
|
398760
|
+
port: this._port,
|
|
398761
|
+
host: this._host
|
|
398762
|
+
}, () => {
|
|
398763
|
+
api_1.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`);
|
|
398764
|
+
resolve34();
|
|
398765
|
+
});
|
|
398766
|
+
});
|
|
398767
|
+
return this._startServerPromise;
|
|
398768
|
+
}
|
|
398769
|
+
getMetricsRequestHandler(_request, response3) {
|
|
398770
|
+
this._exportMetrics(response3);
|
|
398771
|
+
}
|
|
398772
|
+
_requestHandler = (request2, response3) => {
|
|
398773
|
+
if (request2.url != null && new url_1.URL(request2.url, this._baseUrl).pathname === this._endpoint) {
|
|
398774
|
+
this._exportMetrics(response3);
|
|
398775
|
+
} else {
|
|
398776
|
+
this._notFound(response3);
|
|
398777
|
+
}
|
|
398778
|
+
};
|
|
398779
|
+
_exportMetrics = (response3) => {
|
|
398780
|
+
response3.statusCode = 200;
|
|
398781
|
+
response3.setHeader("content-type", "text/plain");
|
|
398782
|
+
this.collect().then((collectionResult) => {
|
|
398783
|
+
const { resourceMetrics, errors: errors8 } = collectionResult;
|
|
398784
|
+
if (errors8.length) {
|
|
398785
|
+
api_1.diag.error("PrometheusExporter: metrics collection errors", ...errors8);
|
|
398786
|
+
}
|
|
398787
|
+
response3.end(this._serializer.serialize(resourceMetrics));
|
|
398788
|
+
}, (err2) => {
|
|
398789
|
+
response3.end(`# failed to export metrics: ${err2}`);
|
|
398790
|
+
});
|
|
398791
|
+
};
|
|
398792
|
+
_notFound = (response3) => {
|
|
398793
|
+
response3.statusCode = 404;
|
|
398794
|
+
response3.end();
|
|
398795
|
+
};
|
|
398796
|
+
}
|
|
398797
|
+
exports.PrometheusExporter = PrometheusExporter;
|
|
398798
|
+
});
|
|
398799
|
+
|
|
398800
|
+
// node_modules/.bun/@opentelemetry+exporter-prometheus@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-prometheus/build/src/index.js
|
|
398801
|
+
var require_src16 = __commonJS((exports) => {
|
|
398802
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
398803
|
+
exports.PrometheusSerializer = exports.PrometheusExporter = undefined;
|
|
398804
|
+
var PrometheusExporter_1 = require_PrometheusExporter();
|
|
398805
|
+
Object.defineProperty(exports, "PrometheusExporter", { enumerable: true, get: function() {
|
|
398806
|
+
return PrometheusExporter_1.PrometheusExporter;
|
|
398807
|
+
} });
|
|
398808
|
+
var PrometheusSerializer_1 = require_PrometheusSerializer();
|
|
398809
|
+
Object.defineProperty(exports, "PrometheusSerializer", { enumerable: true, get: function() {
|
|
398810
|
+
return PrometheusSerializer_1.PrometheusSerializer;
|
|
398811
|
+
} });
|
|
398812
|
+
});
|
|
398813
|
+
|
|
398814
|
+
// src/utils/telemetry/prometheusExporter.ts
|
|
398815
|
+
function stripUnitLines(exposition) {
|
|
398816
|
+
return exposition.split(`
|
|
398817
|
+
`).filter((line) => !line.startsWith("# UNIT ")).join(`
|
|
398818
|
+
`);
|
|
398819
|
+
}
|
|
398820
|
+
async function createPrometheusExporterWithoutUnitLines() {
|
|
398821
|
+
const { PrometheusExporter } = await Promise.resolve().then(() => __toESM(require_src16(), 1));
|
|
398822
|
+
const exporter = new PrometheusExporter;
|
|
398823
|
+
const serializer = exporter._serializer;
|
|
398824
|
+
const originalSerialize = serializer.serialize.bind(serializer);
|
|
398825
|
+
serializer.serialize = (data) => stripUnitLines(originalSerialize(data));
|
|
398826
|
+
return exporter;
|
|
398827
|
+
}
|
|
398828
|
+
|
|
398222
398829
|
// src/utils/telemetry/logger.ts
|
|
398223
398830
|
class ClaudeCodeDiagLogger {
|
|
398224
398831
|
error(message, ..._2) {
|
|
@@ -399032,7 +399639,7 @@ var require_otlp_network_export_delegate = __commonJS((exports) => {
|
|
|
399032
399639
|
});
|
|
399033
399640
|
|
|
399034
399641
|
// node_modules/.bun/@opentelemetry+otlp-exporter-base@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/otlp-exporter-base/build/src/index.js
|
|
399035
|
-
var
|
|
399642
|
+
var require_src17 = __commonJS((exports) => {
|
|
399036
399643
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
399037
399644
|
exports.createOtlpNetworkExportDelegate = exports.CompressionAlgorithm = exports.getSharedConfigurationDefaults = exports.mergeOtlpSharedConfigurationWithDefaults = exports.OTLPExporterError = exports.OTLPExporterBase = undefined;
|
|
399038
399645
|
var OTLPExporterBase_1 = require_OTLPExporterBase();
|
|
@@ -399067,7 +399674,7 @@ var require_OTLPMetricExporterBase = __commonJS((exports) => {
|
|
|
399067
399674
|
var core_1 = require_src13();
|
|
399068
399675
|
var sdk_metrics_1 = require_src15();
|
|
399069
399676
|
var OTLPMetricExporterOptions_1 = require_OTLPMetricExporterOptions();
|
|
399070
|
-
var otlp_exporter_base_1 =
|
|
399677
|
+
var otlp_exporter_base_1 = require_src17();
|
|
399071
399678
|
var api_1 = require_src11();
|
|
399072
399679
|
var CumulativeTemporalitySelector = () => sdk_metrics_1.AggregationTemporality.CUMULATIVE;
|
|
399073
399680
|
exports.CumulativeTemporalitySelector = CumulativeTemporalitySelector;
|
|
@@ -408720,7 +409327,7 @@ var require_json6 = __commonJS((exports) => {
|
|
|
408720
409327
|
});
|
|
408721
409328
|
|
|
408722
409329
|
// node_modules/.bun/@opentelemetry+otlp-transformer@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/otlp-transformer/build/src/index.js
|
|
408723
|
-
var
|
|
409330
|
+
var require_src18 = __commonJS((exports) => {
|
|
408724
409331
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
408725
409332
|
exports.JsonTraceSerializer = exports.JsonMetricsSerializer = exports.JsonLogsSerializer = exports.ProtobufTraceSerializer = exports.ProtobufMetricsSerializer = exports.ProtobufLogsSerializer = undefined;
|
|
408726
409333
|
var protobuf_1 = require_protobuf3();
|
|
@@ -409366,7 +409973,7 @@ var require_OTLPMetricExporter = __commonJS((exports) => {
|
|
|
409366
409973
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
409367
409974
|
exports.OTLPMetricExporter = undefined;
|
|
409368
409975
|
var OTLPMetricExporterBase_1 = require_OTLPMetricExporterBase();
|
|
409369
|
-
var otlp_transformer_1 =
|
|
409976
|
+
var otlp_transformer_1 = require_src18();
|
|
409370
409977
|
var node_http_1 = require_index_node_http();
|
|
409371
409978
|
|
|
409372
409979
|
class OTLPMetricExporter extends OTLPMetricExporterBase_1.OTLPMetricExporterBase {
|
|
@@ -409400,7 +410007,7 @@ var require_platform3 = __commonJS((exports) => {
|
|
|
409400
410007
|
});
|
|
409401
410008
|
|
|
409402
410009
|
// node_modules/.bun/@opentelemetry+exporter-metrics-otlp-http@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-metrics-otlp-http/build/src/index.js
|
|
409403
|
-
var
|
|
410010
|
+
var require_src19 = __commonJS((exports) => {
|
|
409404
410011
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
409405
410012
|
exports.OTLPMetricExporterBase = exports.LowMemoryTemporalitySelector = exports.DeltaTemporalitySelector = exports.CumulativeTemporalitySelector = exports.AggregationTemporalityPreference = exports.OTLPMetricExporter = undefined;
|
|
409406
410013
|
var platform_1 = require_platform3();
|
|
@@ -417632,7 +418239,7 @@ var require_common4 = __commonJS((exports, module) => {
|
|
|
417632
418239
|
});
|
|
417633
418240
|
|
|
417634
418241
|
// node_modules/.bun/protobufjs@7.5.4/node_modules/protobufjs/src/index.js
|
|
417635
|
-
var
|
|
418242
|
+
var require_src20 = __commonJS((exports, module) => {
|
|
417636
418243
|
var protobuf = module.exports = require_index_light();
|
|
417637
418244
|
protobuf.build = "full";
|
|
417638
418245
|
protobuf.tokenize = require_tokenize();
|
|
@@ -419029,7 +419636,7 @@ var require_descriptor = __commonJS((exports, module) => {
|
|
|
419029
419636
|
|
|
419030
419637
|
// node_modules/.bun/protobufjs@7.5.4/node_modules/protobufjs/ext/descriptor/index.js
|
|
419031
419638
|
var require_descriptor2 = __commonJS((exports, module) => {
|
|
419032
|
-
var $protobuf =
|
|
419639
|
+
var $protobuf = require_src20();
|
|
419033
419640
|
module.exports = exports = $protobuf.descriptor = $protobuf.Root.fromJSON(require_descriptor()).lookup(".google.protobuf");
|
|
419034
419641
|
var Namespace = $protobuf.Namespace;
|
|
419035
419642
|
var Root = $protobuf.Root;
|
|
@@ -419913,7 +420520,7 @@ var require_util11 = __commonJS((exports) => {
|
|
|
419913
420520
|
exports.addCommonProtos = exports.loadProtosWithOptionsSync = exports.loadProtosWithOptions = undefined;
|
|
419914
420521
|
var fs17 = __require("fs");
|
|
419915
420522
|
var path21 = __require("path");
|
|
419916
|
-
var Protobuf =
|
|
420523
|
+
var Protobuf = require_src20();
|
|
419917
420524
|
function addIncludePathResolver(root2, includePaths) {
|
|
419918
420525
|
const originalResolvePath = root2.resolvePath;
|
|
419919
420526
|
root2.resolvePath = (origin2, target) => {
|
|
@@ -420892,11 +421499,11 @@ var require_umd = __commonJS((exports, module) => {
|
|
|
420892
421499
|
});
|
|
420893
421500
|
|
|
420894
421501
|
// node_modules/.bun/@grpc+proto-loader@0.8.0/node_modules/@grpc/proto-loader/build/src/index.js
|
|
420895
|
-
var
|
|
421502
|
+
var require_src21 = __commonJS((exports) => {
|
|
420896
421503
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
420897
421504
|
exports.loadFileDescriptorSetFromObject = exports.loadFileDescriptorSetFromBuffer = exports.fromJSON = exports.loadSync = exports.load = exports.IdempotencyLevel = exports.isAnyExtension = exports.Long = undefined;
|
|
420898
421505
|
var camelCase = require_lodash9();
|
|
420899
|
-
var Protobuf =
|
|
421506
|
+
var Protobuf = require_src20();
|
|
420900
421507
|
var descriptor = require_descriptor2();
|
|
420901
421508
|
var util_1 = require_util11();
|
|
420902
421509
|
var Long = require_umd();
|
|
@@ -421587,7 +422194,7 @@ var require_channelz = __commonJS((exports) => {
|
|
|
421587
422194
|
if (loadedChannelzDefinition) {
|
|
421588
422195
|
return loadedChannelzDefinition;
|
|
421589
422196
|
}
|
|
421590
|
-
const loaderLoadSync =
|
|
422197
|
+
const loaderLoadSync = require_src21().loadSync;
|
|
421591
422198
|
const loadedProto = loaderLoadSync("channelz.proto", {
|
|
421592
422199
|
keepCase: true,
|
|
421593
422200
|
longs: String,
|
|
@@ -426499,7 +427106,7 @@ var require_orca = __commonJS((exports) => {
|
|
|
426499
427106
|
if (loadedOrcaProto) {
|
|
426500
427107
|
return loadedOrcaProto;
|
|
426501
427108
|
}
|
|
426502
|
-
const loaderLoadSync =
|
|
427109
|
+
const loaderLoadSync = require_src21().loadSync;
|
|
426503
427110
|
const loadedProto = loaderLoadSync("xds/service/orca/v3/orca.proto", {
|
|
426504
427111
|
keepCase: true,
|
|
426505
427112
|
longs: String,
|
|
@@ -430794,7 +431401,7 @@ var require_load_balancer_weighted_round_robin = __commonJS((exports) => {
|
|
|
430794
431401
|
});
|
|
430795
431402
|
|
|
430796
431403
|
// node_modules/.bun/@grpc+grpc-js@1.14.3/node_modules/@grpc/grpc-js/build/src/index.js
|
|
430797
|
-
var
|
|
431404
|
+
var require_src22 = __commonJS((exports) => {
|
|
430798
431405
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
430799
431406
|
exports.experimental = exports.ServerMetricRecorder = exports.ServerInterceptingCall = exports.ResponderBuilder = exports.ServerListenerBuilder = exports.addAdminServicesToServer = exports.getChannelzHandlers = exports.getChannelzServiceDefinition = exports.InterceptorConfigurationError = exports.InterceptingCall = exports.RequesterBuilder = exports.ListenerBuilder = exports.StatusBuilder = exports.getClientChannel = exports.ServerCredentials = exports.Server = exports.setLogVerbosity = exports.setLogger = exports.load = exports.loadObject = exports.CallCredentials = exports.ChannelCredentials = exports.waitForClientReady = exports.closeClient = exports.Channel = exports.makeGenericClientConstructor = exports.makeClientConstructor = exports.loadPackageDefinition = exports.Client = exports.compressionAlgorithms = exports.propagate = exports.connectivityState = exports.status = exports.logVerbosity = exports.Metadata = exports.credentials = undefined;
|
|
430800
431407
|
var call_credentials_1 = require_call_credentials();
|
|
@@ -430960,7 +431567,7 @@ var require_src21 = __commonJS((exports) => {
|
|
|
430960
431567
|
var require_create_service_client_constructor = __commonJS((exports) => {
|
|
430961
431568
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
430962
431569
|
exports.createServiceClientConstructor = undefined;
|
|
430963
|
-
var grpc =
|
|
431570
|
+
var grpc = require_src22();
|
|
430964
431571
|
function createServiceClientConstructor(path21, name3) {
|
|
430965
431572
|
const serviceDefinition = {
|
|
430966
431573
|
export: {
|
|
@@ -431006,21 +431613,21 @@ var require_grpc_exporter_transport = __commonJS((exports) => {
|
|
|
431006
431613
|
function createInsecureCredentials() {
|
|
431007
431614
|
const {
|
|
431008
431615
|
credentials
|
|
431009
|
-
} =
|
|
431616
|
+
} = require_src22();
|
|
431010
431617
|
return credentials.createInsecure();
|
|
431011
431618
|
}
|
|
431012
431619
|
exports.createInsecureCredentials = createInsecureCredentials;
|
|
431013
431620
|
function createSslCredentials(rootCert, privateKey, certChain) {
|
|
431014
431621
|
const {
|
|
431015
431622
|
credentials
|
|
431016
|
-
} =
|
|
431623
|
+
} = require_src22();
|
|
431017
431624
|
return credentials.createSsl(rootCert, privateKey, certChain);
|
|
431018
431625
|
}
|
|
431019
431626
|
exports.createSslCredentials = createSslCredentials;
|
|
431020
431627
|
function createEmptyMetadata() {
|
|
431021
431628
|
const {
|
|
431022
431629
|
Metadata
|
|
431023
|
-
} =
|
|
431630
|
+
} = require_src22();
|
|
431024
431631
|
return new Metadata;
|
|
431025
431632
|
}
|
|
431026
431633
|
exports.createEmptyMetadata = createEmptyMetadata;
|
|
@@ -431097,7 +431704,7 @@ var require_grpc_exporter_transport = __commonJS((exports) => {
|
|
|
431097
431704
|
var require_otlp_grpc_configuration = __commonJS((exports) => {
|
|
431098
431705
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431099
431706
|
exports.getOtlpGrpcDefaultConfiguration = exports.mergeOtlpGrpcConfigurationWithDefaults = exports.validateAndNormalizeUrl = undefined;
|
|
431100
|
-
var otlp_exporter_base_1 =
|
|
431707
|
+
var otlp_exporter_base_1 = require_src17();
|
|
431101
431708
|
var grpc_exporter_transport_1 = require_grpc_exporter_transport();
|
|
431102
431709
|
var url_1 = __require("url");
|
|
431103
431710
|
var api_1 = require_src11();
|
|
@@ -431304,7 +431911,7 @@ var require_convert_legacy_otlp_grpc_options = __commonJS((exports) => {
|
|
|
431304
431911
|
var require_otlp_grpc_export_delegate = __commonJS((exports) => {
|
|
431305
431912
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431306
431913
|
exports.createOtlpGrpcExportDelegate = undefined;
|
|
431307
|
-
var otlp_exporter_base_1 =
|
|
431914
|
+
var otlp_exporter_base_1 = require_src17();
|
|
431308
431915
|
var grpc_exporter_transport_1 = require_grpc_exporter_transport();
|
|
431309
431916
|
function createOtlpGrpcExportDelegate(options, serializer, grpcName, grpcPath) {
|
|
431310
431917
|
return (0, otlp_exporter_base_1.createOtlpNetworkExportDelegate)(options, serializer, (0, grpc_exporter_transport_1.createOtlpGrpcExporterTransport)({
|
|
@@ -431321,7 +431928,7 @@ var require_otlp_grpc_export_delegate = __commonJS((exports) => {
|
|
|
431321
431928
|
});
|
|
431322
431929
|
|
|
431323
431930
|
// node_modules/.bun/@opentelemetry+otlp-grpc-exporter-base@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/otlp-grpc-exporter-base/build/src/index.js
|
|
431324
|
-
var
|
|
431931
|
+
var require_src23 = __commonJS((exports) => {
|
|
431325
431932
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431326
431933
|
exports.createOtlpGrpcExportDelegate = exports.convertLegacyOtlpGrpcOptions = undefined;
|
|
431327
431934
|
var convert_legacy_otlp_grpc_options_1 = require_convert_legacy_otlp_grpc_options();
|
|
@@ -431338,9 +431945,9 @@ var require_src22 = __commonJS((exports) => {
|
|
|
431338
431945
|
var require_OTLPMetricExporter2 = __commonJS((exports) => {
|
|
431339
431946
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431340
431947
|
exports.OTLPMetricExporter = undefined;
|
|
431341
|
-
var exporter_metrics_otlp_http_1 =
|
|
431342
|
-
var otlp_grpc_exporter_base_1 =
|
|
431343
|
-
var otlp_transformer_1 =
|
|
431948
|
+
var exporter_metrics_otlp_http_1 = require_src19();
|
|
431949
|
+
var otlp_grpc_exporter_base_1 = require_src23();
|
|
431950
|
+
var otlp_transformer_1 = require_src18();
|
|
431344
431951
|
|
|
431345
431952
|
class OTLPMetricExporter extends exporter_metrics_otlp_http_1.OTLPMetricExporterBase {
|
|
431346
431953
|
constructor(config6) {
|
|
@@ -431351,7 +431958,7 @@ var require_OTLPMetricExporter2 = __commonJS((exports) => {
|
|
|
431351
431958
|
});
|
|
431352
431959
|
|
|
431353
431960
|
// node_modules/.bun/@opentelemetry+exporter-metrics-otlp-grpc@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-metrics-otlp-grpc/build/src/index.js
|
|
431354
|
-
var
|
|
431961
|
+
var require_src24 = __commonJS((exports) => {
|
|
431355
431962
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431356
431963
|
exports.OTLPMetricExporter = undefined;
|
|
431357
431964
|
var OTLPMetricExporter_1 = require_OTLPMetricExporter2();
|
|
@@ -431363,8 +431970,8 @@ var require_src23 = __commonJS((exports) => {
|
|
|
431363
431970
|
// node_modules/.bun/@opentelemetry+exporter-metrics-otlp-proto@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-metrics-otlp-proto/build/esm/platform/node/OTLPMetricExporter.js
|
|
431364
431971
|
var import_exporter_metrics_otlp_http, import_otlp_transformer, import_node_http4, OTLPMetricExporter;
|
|
431365
431972
|
var init_OTLPMetricExporter = __esm(() => {
|
|
431366
|
-
import_exporter_metrics_otlp_http = __toESM(
|
|
431367
|
-
import_otlp_transformer = __toESM(
|
|
431973
|
+
import_exporter_metrics_otlp_http = __toESM(require_src19(), 1);
|
|
431974
|
+
import_otlp_transformer = __toESM(require_src18(), 1);
|
|
431368
431975
|
import_node_http4 = __toESM(require_index_node_http(), 1);
|
|
431369
431976
|
OTLPMetricExporter = class OTLPMetricExporter extends import_exporter_metrics_otlp_http.OTLPMetricExporterBase {
|
|
431370
431977
|
constructor(config6) {
|
|
@@ -431394,375 +432001,13 @@ var init_esm21 = __esm(() => {
|
|
|
431394
432001
|
init_platform6();
|
|
431395
432002
|
});
|
|
431396
432003
|
|
|
431397
|
-
// node_modules/.bun/@opentelemetry+exporter-prometheus@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusSerializer.js
|
|
431398
|
-
var require_PrometheusSerializer = __commonJS((exports) => {
|
|
431399
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431400
|
-
exports.PrometheusSerializer = undefined;
|
|
431401
|
-
var api_1 = require_src11();
|
|
431402
|
-
var sdk_metrics_1 = require_src15();
|
|
431403
|
-
var core_1 = require_src13();
|
|
431404
|
-
var semantic_conventions_1 = require_src12();
|
|
431405
|
-
var ATTR_OTEL_SCOPE_SCHEMA_URL = "otel.scope.schema_url";
|
|
431406
|
-
function escapeString(str2) {
|
|
431407
|
-
return str2.replace(/\\/g, "\\\\").replace(/\n/g, "\\n");
|
|
431408
|
-
}
|
|
431409
|
-
function escapeAttributeValue(str2 = "") {
|
|
431410
|
-
if (typeof str2 !== "string") {
|
|
431411
|
-
str2 = JSON.stringify(str2);
|
|
431412
|
-
}
|
|
431413
|
-
return escapeString(str2).replace(/"/g, "\\\"");
|
|
431414
|
-
}
|
|
431415
|
-
var invalidCharacterRegex = /[^a-z0-9_]/gi;
|
|
431416
|
-
var multipleUnderscoreRegex = /_{2,}/g;
|
|
431417
|
-
function sanitizePrometheusMetricName(name3) {
|
|
431418
|
-
return name3.replace(invalidCharacterRegex, "_").replace(multipleUnderscoreRegex, "_");
|
|
431419
|
-
}
|
|
431420
|
-
function enforcePrometheusNamingConvention(name3, data) {
|
|
431421
|
-
if (!name3.endsWith("_total") && data.dataPointType === sdk_metrics_1.DataPointType.SUM && data.isMonotonic) {
|
|
431422
|
-
name3 = name3 + "_total";
|
|
431423
|
-
}
|
|
431424
|
-
return name3;
|
|
431425
|
-
}
|
|
431426
|
-
function valueString(value) {
|
|
431427
|
-
if (value === Infinity) {
|
|
431428
|
-
return "+Inf";
|
|
431429
|
-
} else if (value === -Infinity) {
|
|
431430
|
-
return "-Inf";
|
|
431431
|
-
} else {
|
|
431432
|
-
return `${value}`;
|
|
431433
|
-
}
|
|
431434
|
-
}
|
|
431435
|
-
function toPrometheusType(metricData) {
|
|
431436
|
-
switch (metricData.dataPointType) {
|
|
431437
|
-
case sdk_metrics_1.DataPointType.SUM:
|
|
431438
|
-
if (metricData.isMonotonic) {
|
|
431439
|
-
return "counter";
|
|
431440
|
-
}
|
|
431441
|
-
return "gauge";
|
|
431442
|
-
case sdk_metrics_1.DataPointType.GAUGE:
|
|
431443
|
-
return "gauge";
|
|
431444
|
-
case sdk_metrics_1.DataPointType.HISTOGRAM:
|
|
431445
|
-
return "histogram";
|
|
431446
|
-
default:
|
|
431447
|
-
return "untyped";
|
|
431448
|
-
}
|
|
431449
|
-
}
|
|
431450
|
-
function stringify(metricName, attributes, value, timestamp, additionalAttributes) {
|
|
431451
|
-
let hasAttribute = false;
|
|
431452
|
-
let attributesStr = "";
|
|
431453
|
-
for (const [key2, val] of Object.entries(attributes)) {
|
|
431454
|
-
const sanitizedAttributeName = sanitizePrometheusMetricName(key2);
|
|
431455
|
-
hasAttribute = true;
|
|
431456
|
-
attributesStr += `${attributesStr.length > 0 ? "," : ""}${sanitizedAttributeName}="${escapeAttributeValue(val)}"`;
|
|
431457
|
-
}
|
|
431458
|
-
if (additionalAttributes) {
|
|
431459
|
-
for (const [key2, val] of Object.entries(additionalAttributes)) {
|
|
431460
|
-
const sanitizedAttributeName = sanitizePrometheusMetricName(key2);
|
|
431461
|
-
hasAttribute = true;
|
|
431462
|
-
attributesStr += `${attributesStr.length > 0 ? "," : ""}${sanitizedAttributeName}="${escapeAttributeValue(val)}"`;
|
|
431463
|
-
}
|
|
431464
|
-
}
|
|
431465
|
-
if (hasAttribute) {
|
|
431466
|
-
metricName += `{${attributesStr}}`;
|
|
431467
|
-
}
|
|
431468
|
-
return `${metricName} ${valueString(value)}${timestamp !== undefined ? " " + String(timestamp) : ""}
|
|
431469
|
-
`;
|
|
431470
|
-
}
|
|
431471
|
-
var NO_REGISTERED_METRICS = "# no registered metrics";
|
|
431472
|
-
|
|
431473
|
-
class PrometheusSerializer {
|
|
431474
|
-
_prefix;
|
|
431475
|
-
_appendTimestamp;
|
|
431476
|
-
_additionalAttributes;
|
|
431477
|
-
_withResourceConstantLabels;
|
|
431478
|
-
_withoutScopeInfo;
|
|
431479
|
-
_withoutTargetInfo;
|
|
431480
|
-
constructor(prefix, appendTimestamp = false, withResourceConstantLabels, withoutTargetInfo, withoutScopeInfo) {
|
|
431481
|
-
if (prefix) {
|
|
431482
|
-
this._prefix = prefix + "_";
|
|
431483
|
-
}
|
|
431484
|
-
this._appendTimestamp = appendTimestamp;
|
|
431485
|
-
this._withResourceConstantLabels = withResourceConstantLabels;
|
|
431486
|
-
this._withoutScopeInfo = !!withoutScopeInfo;
|
|
431487
|
-
this._withoutTargetInfo = !!withoutTargetInfo;
|
|
431488
|
-
}
|
|
431489
|
-
serialize(resourceMetrics) {
|
|
431490
|
-
let str2 = "";
|
|
431491
|
-
this._additionalAttributes = this._filterResourceConstantLabels(resourceMetrics.resource.attributes, this._withResourceConstantLabels);
|
|
431492
|
-
for (const scopeMetrics of resourceMetrics.scopeMetrics) {
|
|
431493
|
-
str2 += this._serializeScopeMetrics(scopeMetrics);
|
|
431494
|
-
}
|
|
431495
|
-
if (str2 === "") {
|
|
431496
|
-
str2 += NO_REGISTERED_METRICS;
|
|
431497
|
-
}
|
|
431498
|
-
return this._serializeResource(resourceMetrics.resource) + str2;
|
|
431499
|
-
}
|
|
431500
|
-
_filterResourceConstantLabels(attributes, pattern) {
|
|
431501
|
-
if (pattern) {
|
|
431502
|
-
const filteredAttributes = {};
|
|
431503
|
-
for (const [key2, value] of Object.entries(attributes)) {
|
|
431504
|
-
if (key2.match(pattern)) {
|
|
431505
|
-
filteredAttributes[key2] = value;
|
|
431506
|
-
}
|
|
431507
|
-
}
|
|
431508
|
-
return filteredAttributes;
|
|
431509
|
-
}
|
|
431510
|
-
return;
|
|
431511
|
-
}
|
|
431512
|
-
_serializeScopeMetrics(scopeMetrics) {
|
|
431513
|
-
let str2 = "";
|
|
431514
|
-
for (const metric of scopeMetrics.metrics) {
|
|
431515
|
-
str2 += this._serializeMetricData(metric, scopeMetrics.scope) + `
|
|
431516
|
-
`;
|
|
431517
|
-
}
|
|
431518
|
-
return str2;
|
|
431519
|
-
}
|
|
431520
|
-
_serializeMetricData(metricData, scope) {
|
|
431521
|
-
let name3 = sanitizePrometheusMetricName(escapeString(metricData.descriptor.name));
|
|
431522
|
-
if (this._prefix) {
|
|
431523
|
-
name3 = `${this._prefix}${name3}`;
|
|
431524
|
-
}
|
|
431525
|
-
const dataPointType = metricData.dataPointType;
|
|
431526
|
-
name3 = enforcePrometheusNamingConvention(name3, metricData);
|
|
431527
|
-
const help = `# HELP ${name3} ${escapeString(metricData.descriptor.description || "description missing")}`;
|
|
431528
|
-
const unit = metricData.descriptor.unit ? `
|
|
431529
|
-
# UNIT ${name3} ${escapeString(metricData.descriptor.unit)}` : "";
|
|
431530
|
-
const type = `# TYPE ${name3} ${toPrometheusType(metricData)}`;
|
|
431531
|
-
let additionalAttributes;
|
|
431532
|
-
if (this._withoutScopeInfo) {
|
|
431533
|
-
additionalAttributes = this._additionalAttributes;
|
|
431534
|
-
} else {
|
|
431535
|
-
const scopeInfo = { [semantic_conventions_1.ATTR_OTEL_SCOPE_NAME]: scope.name };
|
|
431536
|
-
if (scope.schemaUrl) {
|
|
431537
|
-
scopeInfo[ATTR_OTEL_SCOPE_SCHEMA_URL] = scope.schemaUrl;
|
|
431538
|
-
}
|
|
431539
|
-
if (scope.version) {
|
|
431540
|
-
scopeInfo[semantic_conventions_1.ATTR_OTEL_SCOPE_VERSION] = scope.version;
|
|
431541
|
-
}
|
|
431542
|
-
additionalAttributes = Object.assign(scopeInfo, this._additionalAttributes);
|
|
431543
|
-
}
|
|
431544
|
-
let results = "";
|
|
431545
|
-
switch (dataPointType) {
|
|
431546
|
-
case sdk_metrics_1.DataPointType.SUM:
|
|
431547
|
-
case sdk_metrics_1.DataPointType.GAUGE: {
|
|
431548
|
-
results = metricData.dataPoints.map((it) => this._serializeSingularDataPoint(name3, metricData, it, additionalAttributes)).join("");
|
|
431549
|
-
break;
|
|
431550
|
-
}
|
|
431551
|
-
case sdk_metrics_1.DataPointType.HISTOGRAM: {
|
|
431552
|
-
results = metricData.dataPoints.map((it) => this._serializeHistogramDataPoint(name3, metricData, it, additionalAttributes)).join("");
|
|
431553
|
-
break;
|
|
431554
|
-
}
|
|
431555
|
-
default: {
|
|
431556
|
-
api_1.diag.error(`Unrecognizable DataPointType: ${dataPointType} for metric "${name3}"`);
|
|
431557
|
-
}
|
|
431558
|
-
}
|
|
431559
|
-
return `${help}${unit}
|
|
431560
|
-
${type}
|
|
431561
|
-
${results}`.trim();
|
|
431562
|
-
}
|
|
431563
|
-
_serializeSingularDataPoint(name3, data, dataPoint, additionalAttributes) {
|
|
431564
|
-
let results = "";
|
|
431565
|
-
name3 = enforcePrometheusNamingConvention(name3, data);
|
|
431566
|
-
const { value, attributes } = dataPoint;
|
|
431567
|
-
const timestamp = (0, core_1.hrTimeToMilliseconds)(dataPoint.endTime);
|
|
431568
|
-
results += stringify(name3, attributes, value, this._appendTimestamp ? timestamp : undefined, additionalAttributes);
|
|
431569
|
-
return results;
|
|
431570
|
-
}
|
|
431571
|
-
_serializeHistogramDataPoint(name3, data, dataPoint, additionalAttributes) {
|
|
431572
|
-
let results = "";
|
|
431573
|
-
name3 = enforcePrometheusNamingConvention(name3, data);
|
|
431574
|
-
const attributes = dataPoint.attributes;
|
|
431575
|
-
const histogram = dataPoint.value;
|
|
431576
|
-
const timestamp = (0, core_1.hrTimeToMilliseconds)(dataPoint.endTime);
|
|
431577
|
-
for (const key2 of ["count", "sum"]) {
|
|
431578
|
-
const value = histogram[key2];
|
|
431579
|
-
if (value != null)
|
|
431580
|
-
results += stringify(name3 + "_" + key2, attributes, value, this._appendTimestamp ? timestamp : undefined, additionalAttributes);
|
|
431581
|
-
}
|
|
431582
|
-
let cumulativeSum = 0;
|
|
431583
|
-
const countEntries = histogram.buckets.counts.entries();
|
|
431584
|
-
let infiniteBoundaryDefined = false;
|
|
431585
|
-
for (const [idx, val] of countEntries) {
|
|
431586
|
-
cumulativeSum += val;
|
|
431587
|
-
const upperBound = histogram.buckets.boundaries[idx];
|
|
431588
|
-
if (upperBound === undefined && infiniteBoundaryDefined) {
|
|
431589
|
-
break;
|
|
431590
|
-
}
|
|
431591
|
-
if (upperBound === Infinity) {
|
|
431592
|
-
infiniteBoundaryDefined = true;
|
|
431593
|
-
}
|
|
431594
|
-
results += stringify(name3 + "_bucket", attributes, cumulativeSum, this._appendTimestamp ? timestamp : undefined, Object.assign({}, additionalAttributes, {
|
|
431595
|
-
le: upperBound === undefined || upperBound === Infinity ? "+Inf" : String(upperBound)
|
|
431596
|
-
}));
|
|
431597
|
-
}
|
|
431598
|
-
return results;
|
|
431599
|
-
}
|
|
431600
|
-
_serializeResource(resource) {
|
|
431601
|
-
if (this._withoutTargetInfo === true) {
|
|
431602
|
-
return "";
|
|
431603
|
-
}
|
|
431604
|
-
const name3 = "target_info";
|
|
431605
|
-
const help = `# HELP ${name3} Target metadata`;
|
|
431606
|
-
const type = `# TYPE ${name3} gauge`;
|
|
431607
|
-
const results = stringify(name3, resource.attributes, 1).trim();
|
|
431608
|
-
return `${help}
|
|
431609
|
-
${type}
|
|
431610
|
-
${results}
|
|
431611
|
-
`;
|
|
431612
|
-
}
|
|
431613
|
-
}
|
|
431614
|
-
exports.PrometheusSerializer = PrometheusSerializer;
|
|
431615
|
-
});
|
|
431616
|
-
|
|
431617
|
-
// node_modules/.bun/@opentelemetry+exporter-prometheus@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-prometheus/build/src/PrometheusExporter.js
|
|
431618
|
-
var require_PrometheusExporter = __commonJS((exports) => {
|
|
431619
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431620
|
-
exports.PrometheusExporter = undefined;
|
|
431621
|
-
var api_1 = require_src11();
|
|
431622
|
-
var core_1 = require_src13();
|
|
431623
|
-
var sdk_metrics_1 = require_src15();
|
|
431624
|
-
var http_1 = __require("http");
|
|
431625
|
-
var PrometheusSerializer_1 = require_PrometheusSerializer();
|
|
431626
|
-
var url_1 = __require("url");
|
|
431627
|
-
|
|
431628
|
-
class PrometheusExporter extends sdk_metrics_1.MetricReader {
|
|
431629
|
-
static DEFAULT_OPTIONS = {
|
|
431630
|
-
host: undefined,
|
|
431631
|
-
port: 9464,
|
|
431632
|
-
endpoint: "/metrics",
|
|
431633
|
-
prefix: "",
|
|
431634
|
-
appendTimestamp: false,
|
|
431635
|
-
withResourceConstantLabels: undefined,
|
|
431636
|
-
withoutScopeInfo: false,
|
|
431637
|
-
withoutTargetInfo: false
|
|
431638
|
-
};
|
|
431639
|
-
_host;
|
|
431640
|
-
_port;
|
|
431641
|
-
_baseUrl;
|
|
431642
|
-
_endpoint;
|
|
431643
|
-
_server;
|
|
431644
|
-
_prefix;
|
|
431645
|
-
_appendTimestamp;
|
|
431646
|
-
_serializer;
|
|
431647
|
-
_startServerPromise;
|
|
431648
|
-
constructor(config6 = {}, callback = () => {}) {
|
|
431649
|
-
super({
|
|
431650
|
-
aggregationSelector: (_instrumentType) => {
|
|
431651
|
-
return {
|
|
431652
|
-
type: sdk_metrics_1.AggregationType.DEFAULT
|
|
431653
|
-
};
|
|
431654
|
-
},
|
|
431655
|
-
aggregationTemporalitySelector: (_instrumentType) => sdk_metrics_1.AggregationTemporality.CUMULATIVE,
|
|
431656
|
-
metricProducers: config6.metricProducers
|
|
431657
|
-
});
|
|
431658
|
-
this._host = config6.host || process.env.OTEL_EXPORTER_PROMETHEUS_HOST || PrometheusExporter.DEFAULT_OPTIONS.host;
|
|
431659
|
-
this._port = config6.port || Number(process.env.OTEL_EXPORTER_PROMETHEUS_PORT) || PrometheusExporter.DEFAULT_OPTIONS.port;
|
|
431660
|
-
this._prefix = config6.prefix || PrometheusExporter.DEFAULT_OPTIONS.prefix;
|
|
431661
|
-
this._appendTimestamp = typeof config6.appendTimestamp === "boolean" ? config6.appendTimestamp : PrometheusExporter.DEFAULT_OPTIONS.appendTimestamp;
|
|
431662
|
-
const _withResourceConstantLabels = config6.withResourceConstantLabels || PrometheusExporter.DEFAULT_OPTIONS.withResourceConstantLabels;
|
|
431663
|
-
const _withoutScopeInfo = config6.withoutScopeInfo || PrometheusExporter.DEFAULT_OPTIONS.withoutScopeInfo;
|
|
431664
|
-
const _withoutTargetInfo = config6.withoutTargetInfo || PrometheusExporter.DEFAULT_OPTIONS.withoutTargetInfo;
|
|
431665
|
-
this._server = (0, http_1.createServer)(this._requestHandler).unref();
|
|
431666
|
-
this._serializer = new PrometheusSerializer_1.PrometheusSerializer(this._prefix, this._appendTimestamp, _withResourceConstantLabels, _withoutTargetInfo, _withoutScopeInfo);
|
|
431667
|
-
this._baseUrl = `http://${this._host}:${this._port}/`;
|
|
431668
|
-
this._endpoint = (config6.endpoint || PrometheusExporter.DEFAULT_OPTIONS.endpoint).replace(/^([^/])/, "/$1");
|
|
431669
|
-
if (config6.preventServerStart !== true) {
|
|
431670
|
-
this.startServer().then(callback, (err2) => {
|
|
431671
|
-
api_1.diag.error(err2);
|
|
431672
|
-
callback(err2);
|
|
431673
|
-
});
|
|
431674
|
-
} else if (callback) {
|
|
431675
|
-
queueMicrotask(callback);
|
|
431676
|
-
}
|
|
431677
|
-
}
|
|
431678
|
-
async onForceFlush() {}
|
|
431679
|
-
onShutdown() {
|
|
431680
|
-
return this.stopServer();
|
|
431681
|
-
}
|
|
431682
|
-
stopServer() {
|
|
431683
|
-
if (!this._server) {
|
|
431684
|
-
api_1.diag.debug("Prometheus stopServer() was called but server was never started.");
|
|
431685
|
-
return Promise.resolve();
|
|
431686
|
-
} else {
|
|
431687
|
-
return new Promise((resolve34) => {
|
|
431688
|
-
this._server.close((err2) => {
|
|
431689
|
-
if (!err2) {
|
|
431690
|
-
api_1.diag.debug("Prometheus exporter was stopped");
|
|
431691
|
-
} else {
|
|
431692
|
-
if (err2.code !== "ERR_SERVER_NOT_RUNNING") {
|
|
431693
|
-
(0, core_1.globalErrorHandler)(err2);
|
|
431694
|
-
}
|
|
431695
|
-
}
|
|
431696
|
-
resolve34();
|
|
431697
|
-
});
|
|
431698
|
-
});
|
|
431699
|
-
}
|
|
431700
|
-
}
|
|
431701
|
-
startServer() {
|
|
431702
|
-
this._startServerPromise ??= new Promise((resolve34, reject) => {
|
|
431703
|
-
this._server.once("error", reject);
|
|
431704
|
-
this._server.listen({
|
|
431705
|
-
port: this._port,
|
|
431706
|
-
host: this._host
|
|
431707
|
-
}, () => {
|
|
431708
|
-
api_1.diag.debug(`Prometheus exporter server started: ${this._host}:${this._port}/${this._endpoint}`);
|
|
431709
|
-
resolve34();
|
|
431710
|
-
});
|
|
431711
|
-
});
|
|
431712
|
-
return this._startServerPromise;
|
|
431713
|
-
}
|
|
431714
|
-
getMetricsRequestHandler(_request, response3) {
|
|
431715
|
-
this._exportMetrics(response3);
|
|
431716
|
-
}
|
|
431717
|
-
_requestHandler = (request2, response3) => {
|
|
431718
|
-
if (request2.url != null && new url_1.URL(request2.url, this._baseUrl).pathname === this._endpoint) {
|
|
431719
|
-
this._exportMetrics(response3);
|
|
431720
|
-
} else {
|
|
431721
|
-
this._notFound(response3);
|
|
431722
|
-
}
|
|
431723
|
-
};
|
|
431724
|
-
_exportMetrics = (response3) => {
|
|
431725
|
-
response3.statusCode = 200;
|
|
431726
|
-
response3.setHeader("content-type", "text/plain");
|
|
431727
|
-
this.collect().then((collectionResult) => {
|
|
431728
|
-
const { resourceMetrics, errors: errors8 } = collectionResult;
|
|
431729
|
-
if (errors8.length) {
|
|
431730
|
-
api_1.diag.error("PrometheusExporter: metrics collection errors", ...errors8);
|
|
431731
|
-
}
|
|
431732
|
-
response3.end(this._serializer.serialize(resourceMetrics));
|
|
431733
|
-
}, (err2) => {
|
|
431734
|
-
response3.end(`# failed to export metrics: ${err2}`);
|
|
431735
|
-
});
|
|
431736
|
-
};
|
|
431737
|
-
_notFound = (response3) => {
|
|
431738
|
-
response3.statusCode = 404;
|
|
431739
|
-
response3.end();
|
|
431740
|
-
};
|
|
431741
|
-
}
|
|
431742
|
-
exports.PrometheusExporter = PrometheusExporter;
|
|
431743
|
-
});
|
|
431744
|
-
|
|
431745
|
-
// node_modules/.bun/@opentelemetry+exporter-prometheus@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-prometheus/build/src/index.js
|
|
431746
|
-
var require_src24 = __commonJS((exports) => {
|
|
431747
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431748
|
-
exports.PrometheusSerializer = exports.PrometheusExporter = undefined;
|
|
431749
|
-
var PrometheusExporter_1 = require_PrometheusExporter();
|
|
431750
|
-
Object.defineProperty(exports, "PrometheusExporter", { enumerable: true, get: function() {
|
|
431751
|
-
return PrometheusExporter_1.PrometheusExporter;
|
|
431752
|
-
} });
|
|
431753
|
-
var PrometheusSerializer_1 = require_PrometheusSerializer();
|
|
431754
|
-
Object.defineProperty(exports, "PrometheusSerializer", { enumerable: true, get: function() {
|
|
431755
|
-
return PrometheusSerializer_1.PrometheusSerializer;
|
|
431756
|
-
} });
|
|
431757
|
-
});
|
|
431758
|
-
|
|
431759
432004
|
// node_modules/.bun/@opentelemetry+exporter-logs-otlp-grpc@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-logs-otlp-grpc/build/src/OTLPLogExporter.js
|
|
431760
432005
|
var require_OTLPLogExporter = __commonJS((exports) => {
|
|
431761
432006
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431762
432007
|
exports.OTLPLogExporter = undefined;
|
|
431763
|
-
var otlp_grpc_exporter_base_1 =
|
|
431764
|
-
var otlp_transformer_1 =
|
|
431765
|
-
var otlp_exporter_base_1 =
|
|
432008
|
+
var otlp_grpc_exporter_base_1 = require_src23();
|
|
432009
|
+
var otlp_transformer_1 = require_src18();
|
|
432010
|
+
var otlp_exporter_base_1 = require_src17();
|
|
431766
432011
|
|
|
431767
432012
|
class OTLPLogExporter extends otlp_exporter_base_1.OTLPExporterBase {
|
|
431768
432013
|
constructor(config6 = {}) {
|
|
@@ -431785,8 +432030,8 @@ var require_src25 = __commonJS((exports) => {
|
|
|
431785
432030
|
// node_modules/.bun/@opentelemetry+exporter-logs-otlp-http@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-logs-otlp-http/build/esm/platform/node/OTLPLogExporter.js
|
|
431786
432031
|
var import_otlp_exporter_base, import_otlp_transformer2, import_node_http5, OTLPLogExporter;
|
|
431787
432032
|
var init_OTLPLogExporter = __esm(() => {
|
|
431788
|
-
import_otlp_exporter_base = __toESM(
|
|
431789
|
-
import_otlp_transformer2 = __toESM(
|
|
432033
|
+
import_otlp_exporter_base = __toESM(require_src17(), 1);
|
|
432034
|
+
import_otlp_transformer2 = __toESM(require_src18(), 1);
|
|
431790
432035
|
import_node_http5 = __toESM(require_index_node_http(), 1);
|
|
431791
432036
|
OTLPLogExporter = class OTLPLogExporter extends import_otlp_exporter_base.OTLPExporterBase {
|
|
431792
432037
|
constructor(config6 = {}) {
|
|
@@ -431819,8 +432064,8 @@ var init_esm22 = __esm(() => {
|
|
|
431819
432064
|
// node_modules/.bun/@opentelemetry+exporter-logs-otlp-proto@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-logs-otlp-proto/build/esm/platform/node/OTLPLogExporter.js
|
|
431820
432065
|
var import_otlp_exporter_base2, import_otlp_transformer3, import_node_http6, OTLPLogExporter2;
|
|
431821
432066
|
var init_OTLPLogExporter2 = __esm(() => {
|
|
431822
|
-
import_otlp_exporter_base2 = __toESM(
|
|
431823
|
-
import_otlp_transformer3 = __toESM(
|
|
432067
|
+
import_otlp_exporter_base2 = __toESM(require_src17(), 1);
|
|
432068
|
+
import_otlp_transformer3 = __toESM(require_src18(), 1);
|
|
431824
432069
|
import_node_http6 = __toESM(require_index_node_http(), 1);
|
|
431825
432070
|
OTLPLogExporter2 = class OTLPLogExporter2 extends import_otlp_exporter_base2.OTLPExporterBase {
|
|
431826
432071
|
constructor(config6 = {}) {
|
|
@@ -431854,9 +432099,9 @@ var init_esm23 = __esm(() => {
|
|
|
431854
432099
|
var require_OTLPTraceExporter = __commonJS((exports) => {
|
|
431855
432100
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
431856
432101
|
exports.OTLPTraceExporter = undefined;
|
|
431857
|
-
var otlp_grpc_exporter_base_1 =
|
|
431858
|
-
var otlp_transformer_1 =
|
|
431859
|
-
var otlp_exporter_base_1 =
|
|
432102
|
+
var otlp_grpc_exporter_base_1 = require_src23();
|
|
432103
|
+
var otlp_transformer_1 = require_src18();
|
|
432104
|
+
var otlp_exporter_base_1 = require_src17();
|
|
431860
432105
|
|
|
431861
432106
|
class OTLPTraceExporter extends otlp_exporter_base_1.OTLPExporterBase {
|
|
431862
432107
|
constructor(config6 = {}) {
|
|
@@ -431879,8 +432124,8 @@ var require_src26 = __commonJS((exports) => {
|
|
|
431879
432124
|
// node_modules/.bun/@opentelemetry+exporter-trace-otlp-http@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-trace-otlp-http/build/esm/platform/node/OTLPTraceExporter.js
|
|
431880
432125
|
var import_otlp_exporter_base3, import_otlp_transformer4, import_node_http7, OTLPTraceExporter;
|
|
431881
432126
|
var init_OTLPTraceExporter = __esm(() => {
|
|
431882
|
-
import_otlp_exporter_base3 = __toESM(
|
|
431883
|
-
import_otlp_transformer4 = __toESM(
|
|
432127
|
+
import_otlp_exporter_base3 = __toESM(require_src17(), 1);
|
|
432128
|
+
import_otlp_transformer4 = __toESM(require_src18(), 1);
|
|
431884
432129
|
import_node_http7 = __toESM(require_index_node_http(), 1);
|
|
431885
432130
|
OTLPTraceExporter = class OTLPTraceExporter extends import_otlp_exporter_base3.OTLPExporterBase {
|
|
431886
432131
|
constructor(config6 = {}) {
|
|
@@ -431913,8 +432158,8 @@ var init_esm24 = __esm(() => {
|
|
|
431913
432158
|
// node_modules/.bun/@opentelemetry+exporter-trace-otlp-proto@0.214.0+e40b0dfdd726a224/node_modules/@opentelemetry/exporter-trace-otlp-proto/build/esm/platform/node/OTLPTraceExporter.js
|
|
431914
432159
|
var import_otlp_exporter_base4, import_otlp_transformer5, import_node_http8, OTLPTraceExporter2;
|
|
431915
432160
|
var init_OTLPTraceExporter2 = __esm(() => {
|
|
431916
|
-
import_otlp_exporter_base4 = __toESM(
|
|
431917
|
-
import_otlp_transformer5 = __toESM(
|
|
432161
|
+
import_otlp_exporter_base4 = __toESM(require_src17(), 1);
|
|
432162
|
+
import_otlp_transformer5 = __toESM(require_src18(), 1);
|
|
431918
432163
|
import_node_http8 = __toESM(require_index_node_http(), 1);
|
|
431919
432164
|
OTLPTraceExporter2 = class OTLPTraceExporter2 extends import_otlp_exporter_base4.OTLPExporterBase {
|
|
431920
432165
|
constructor(config6 = {}) {
|
|
@@ -431982,6 +432227,7 @@ function bootstrapTelemetry() {
|
|
|
431982
432227
|
if (!process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE) {
|
|
431983
432228
|
process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = "delta";
|
|
431984
432229
|
}
|
|
432230
|
+
applyManagedOtelEndpointGovernance();
|
|
431985
432231
|
}
|
|
431986
432232
|
function parseExporterTypes(value) {
|
|
431987
432233
|
return (value || "").trim().split(",").filter(Boolean).map((t4) => t4.trim()).filter((t4) => t4 !== "none");
|
|
@@ -432010,12 +432256,12 @@ async function getOtlpReaders() {
|
|
|
432010
432256
|
const httpConfig = getOTLPExporterConfig();
|
|
432011
432257
|
switch (protocol) {
|
|
432012
432258
|
case "grpc": {
|
|
432013
|
-
const { OTLPMetricExporter: OTLPMetricExporter2 } = await Promise.resolve().then(() => __toESM(
|
|
432259
|
+
const { OTLPMetricExporter: OTLPMetricExporter2 } = await Promise.resolve().then(() => __toESM(require_src24(), 1));
|
|
432014
432260
|
exporters.push(new OTLPMetricExporter2);
|
|
432015
432261
|
break;
|
|
432016
432262
|
}
|
|
432017
432263
|
case "http/json": {
|
|
432018
|
-
const { OTLPMetricExporter: OTLPMetricExporter2 } = await Promise.resolve().then(() => __toESM(
|
|
432264
|
+
const { OTLPMetricExporter: OTLPMetricExporter2 } = await Promise.resolve().then(() => __toESM(require_src19(), 1));
|
|
432019
432265
|
exporters.push(new OTLPMetricExporter2(httpConfig));
|
|
432020
432266
|
break;
|
|
432021
432267
|
}
|
|
@@ -432028,8 +432274,7 @@ async function getOtlpReaders() {
|
|
|
432028
432274
|
throw new Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${protocol}`);
|
|
432029
432275
|
}
|
|
432030
432276
|
} else if (exporterType === "prometheus") {
|
|
432031
|
-
|
|
432032
|
-
exporters.push(new PrometheusExporter);
|
|
432277
|
+
exporters.push(await createPrometheusExporterWithoutUnitLines());
|
|
432033
432278
|
} else {
|
|
432034
432279
|
throw new Error(`Unknown exporter type set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${exporterType}`);
|
|
432035
432280
|
}
|
|
@@ -432433,6 +432678,7 @@ var init_instrumentation = __esm(() => {
|
|
|
432433
432678
|
init_envUtils();
|
|
432434
432679
|
init_errors();
|
|
432435
432680
|
init_mtls();
|
|
432681
|
+
init_managedOtelEndpoint();
|
|
432436
432682
|
init_proxy();
|
|
432437
432683
|
init_settings2();
|
|
432438
432684
|
init_slowOperations();
|
|
@@ -450989,6 +451235,33 @@ var init_ink3 = __esm(() => {
|
|
|
450989
451235
|
init_agentColorManager();
|
|
450990
451236
|
});
|
|
450991
451237
|
|
|
451238
|
+
// src/utils/srA11y.ts
|
|
451239
|
+
function announceDeletedText(deletedText, sink2 = pushScreenReaderAnnouncement) {
|
|
451240
|
+
if (deletedText.length > 0) {
|
|
451241
|
+
sink2(deletedText);
|
|
451242
|
+
}
|
|
451243
|
+
}
|
|
451244
|
+
function srEchoTypedChar(char) {
|
|
451245
|
+
if (char === " ") {
|
|
451246
|
+
return " ";
|
|
451247
|
+
}
|
|
451248
|
+
return null;
|
|
451249
|
+
}
|
|
451250
|
+
function emitStartupSrAnnouncement(announce, sink2 = pushScreenReaderAnnouncement) {
|
|
451251
|
+
if (announce !== null && announce.length > 0) {
|
|
451252
|
+
sink2(announce);
|
|
451253
|
+
}
|
|
451254
|
+
}
|
|
451255
|
+
function computeSpinnerReducedMotion(settingsReducedMotion, isSr) {
|
|
451256
|
+
return settingsReducedMotion || isSr;
|
|
451257
|
+
}
|
|
451258
|
+
function shouldThinkingRowUpdate(prev, next) {
|
|
451259
|
+
return prev.seconds !== next.seconds || prev.tokens !== next.tokens;
|
|
451260
|
+
}
|
|
451261
|
+
var init_srA11y = __esm(() => {
|
|
451262
|
+
init_screenReader();
|
|
451263
|
+
});
|
|
451264
|
+
|
|
450992
451265
|
// src/components/Spinner/SpinnerAnimationRow.tsx
|
|
450993
451266
|
function SpinnerAnimationRow({
|
|
450994
451267
|
mode,
|
|
@@ -451057,11 +451330,19 @@ function SpinnerAnimationRow({
|
|
|
451057
451330
|
const leaderTokens = Math.round(displayedResponseLength / 4);
|
|
451058
451331
|
const effectiveElapsedMs = hasRunningTeammates ? Math.max(elapsedTimeMs, now2 - turnStartRef.current) : elapsedTimeMs;
|
|
451059
451332
|
const timerText = formatDuration(effectiveElapsedMs);
|
|
451060
|
-
const timerWidth = stringWidth(timerText);
|
|
451061
451333
|
const totalTokens = foregroundedTeammate && !foregroundedTeammate.isIdle ? foregroundedTeammate.progress?.tokenCount ?? 0 : leaderTokens + teammateTokens;
|
|
451062
451334
|
const tokenCount = formatNumber(totalTokens);
|
|
451063
|
-
const
|
|
451064
|
-
const
|
|
451335
|
+
const displayedSeconds = Math.floor(effectiveElapsedMs / 1000);
|
|
451336
|
+
const displayedTokensCount = totalTokens;
|
|
451337
|
+
const thinkingRowGateRef = import_react59.useRef({ seconds: displayedSeconds, tokens: displayedTokensCount, timerText, tokenCount });
|
|
451338
|
+
if (shouldThinkingRowUpdate({ seconds: thinkingRowGateRef.current.seconds, tokens: thinkingRowGateRef.current.tokens }, { seconds: displayedSeconds, tokens: displayedTokensCount })) {
|
|
451339
|
+
thinkingRowGateRef.current = { seconds: displayedSeconds, tokens: displayedTokensCount, timerText, tokenCount };
|
|
451340
|
+
}
|
|
451341
|
+
const stableTimerText = thinkingRowGateRef.current.timerText;
|
|
451342
|
+
const stableTimerWidth = stringWidth(stableTimerText);
|
|
451343
|
+
const stableTokenCount = thinkingRowGateRef.current.tokenCount;
|
|
451344
|
+
const stableTokensText = hasRunningTeammates ? `${stableTokenCount} tokens` : `${figures_default.arrowDown} ${stableTokenCount} tokens`;
|
|
451345
|
+
const stableTokensWidth = stringWidth(stableTokensText);
|
|
451065
451346
|
let thinkingText = thinkingStatus === "thinking" ? `thinking${effortSuffix}` : typeof thinkingStatus === "number" ? `thought for ${Math.max(1, Math.round(thinkingStatus / 1000))}s` : null;
|
|
451066
451347
|
let thinkingWidthValue = thinkingText ? stringWidth(thinkingText) : 0;
|
|
451067
451348
|
const messageWidth = glimmerMessageWidth + 2;
|
|
@@ -451078,9 +451359,9 @@ function SpinnerAnimationRow({
|
|
|
451078
451359
|
}
|
|
451079
451360
|
}
|
|
451080
451361
|
const usedAfterThinking = showThinking ? thinkingWidthValue + sep28 : 0;
|
|
451081
|
-
const showTimer = wantsTimerAndTokens && availableSpace > usedAfterThinking +
|
|
451082
|
-
const usedAfterTimer = usedAfterThinking + (showTimer ?
|
|
451083
|
-
const showTokens = wantsTimerAndTokens && totalTokens > 0 && availableSpace > usedAfterTimer +
|
|
451362
|
+
const showTimer = wantsTimerAndTokens && availableSpace > usedAfterThinking + stableTimerWidth;
|
|
451363
|
+
const usedAfterTimer = usedAfterThinking + (showTimer ? stableTimerWidth + sep28 : 0);
|
|
451364
|
+
const showTokens = wantsTimerAndTokens && totalTokens > 0 && availableSpace > usedAfterTimer + stableTokensWidth;
|
|
451084
451365
|
const thinkingOnly = showThinking && thinkingStatus === "thinking" && !spinnerSuffix && !showTimer && !showTokens && true;
|
|
451085
451366
|
const thinkingElapsedSec = (time3 - THINKING_DELAY_MS) / 1000;
|
|
451086
451367
|
const thinkingOpacity = time3 < THINKING_DELAY_MS ? 0 : (Math.sin(thinkingElapsedSec * Math.PI * 2 / THINKING_GLOW_PERIOD_S) + 1) / 2;
|
|
@@ -451123,7 +451404,7 @@ function SpinnerAnimationRow({
|
|
|
451123
451404
|
children: spinnerSuffix
|
|
451124
451405
|
}, "suffix")] : [], ...showTimer ? [/* @__PURE__ */ jsx_runtime78.jsx(ThemedText, {
|
|
451125
451406
|
dimColor: true,
|
|
451126
|
-
children:
|
|
451407
|
+
children: stableTimerText
|
|
451127
451408
|
}, "elapsedTime")] : [], ...showTokens ? [/* @__PURE__ */ jsx_runtime78.jsxs(ThemedBox_default, {
|
|
451128
451409
|
flexDirection: "row",
|
|
451129
451410
|
children: [
|
|
@@ -451133,7 +451414,7 @@ function SpinnerAnimationRow({
|
|
|
451133
451414
|
/* @__PURE__ */ jsx_runtime78.jsxs(ThemedText, {
|
|
451134
451415
|
dimColor: true,
|
|
451135
451416
|
children: [
|
|
451136
|
-
|
|
451417
|
+
stableTokenCount,
|
|
451137
451418
|
" tokens"
|
|
451138
451419
|
]
|
|
451139
451420
|
})
|
|
@@ -451257,6 +451538,7 @@ var init_SpinnerAnimationRow = __esm(() => {
|
|
|
451257
451538
|
init_ink3();
|
|
451258
451539
|
init_theme();
|
|
451259
451540
|
init_Byline();
|
|
451541
|
+
init_srA11y();
|
|
451260
451542
|
init_GlimmerMessage();
|
|
451261
451543
|
init_SpinnerGlyph();
|
|
451262
451544
|
init_useStalledAnimation();
|
|
@@ -456992,7 +457274,7 @@ function SpinnerWithVerbInner({
|
|
|
456992
457274
|
leaderIsIdle = false
|
|
456993
457275
|
}) {
|
|
456994
457276
|
const settings = useSettings();
|
|
456995
|
-
const reducedMotion = settings.prefersReducedMotion ?? false;
|
|
457277
|
+
const reducedMotion = computeSpinnerReducedMotion(settings.prefersReducedMotion ?? false, isScreenReaderEnabled());
|
|
456996
457278
|
const tasks = useAppState((s4) => s4.tasks);
|
|
456997
457279
|
const viewingAgentTaskId = useAppState((s_0) => s_0.viewingAgentTaskId);
|
|
456998
457280
|
const expandedView = useAppState((s_1) => s_1.expandedView);
|
|
@@ -457569,6 +457851,8 @@ var init_Spinner2 = __esm(() => {
|
|
|
457569
457851
|
init_useSettings();
|
|
457570
457852
|
init_InProcessTeammateTask();
|
|
457571
457853
|
init_effort();
|
|
457854
|
+
init_srA11y();
|
|
457855
|
+
init_screenReader();
|
|
457572
457856
|
init_model();
|
|
457573
457857
|
init_selectors();
|
|
457574
457858
|
init_figures2();
|
|
@@ -461191,6 +461475,13 @@ var init_UserCommandMessage = __esm(() => {
|
|
|
461191
461475
|
jsx_runtime95 = __toESM(require_jsx_runtime(), 1);
|
|
461192
461476
|
});
|
|
461193
461477
|
|
|
461478
|
+
// src/utils/localCommandOutput.ts
|
|
461479
|
+
var LOCAL_COMMAND_ERROR_MARKER = "\u2718";
|
|
461480
|
+
var init_localCommandOutput = __esm(() => {
|
|
461481
|
+
init_xml();
|
|
461482
|
+
init_messages3();
|
|
461483
|
+
});
|
|
461484
|
+
|
|
461194
461485
|
// src/components/messages/UserLocalCommandOutputMessage.tsx
|
|
461195
461486
|
function UserLocalCommandOutputMessage(t0) {
|
|
461196
461487
|
const $3 = import_compiler_runtime81.c(4);
|
|
@@ -461227,8 +461518,21 @@ function UserLocalCommandOutputMessage(t0) {
|
|
|
461227
461518
|
}, "stdout"));
|
|
461228
461519
|
}
|
|
461229
461520
|
if (stderr?.trim()) {
|
|
461230
|
-
lines2.push(/* @__PURE__ */ jsx_runtime96.
|
|
461231
|
-
|
|
461521
|
+
lines2.push(/* @__PURE__ */ jsx_runtime96.jsxs(ThemedBox_default, {
|
|
461522
|
+
flexDirection: "column",
|
|
461523
|
+
children: [
|
|
461524
|
+
/* @__PURE__ */ jsx_runtime96.jsxs(ThemedText, {
|
|
461525
|
+
color: "error",
|
|
461526
|
+
bold: true,
|
|
461527
|
+
children: [
|
|
461528
|
+
LOCAL_COMMAND_ERROR_MARKER,
|
|
461529
|
+
" Error"
|
|
461530
|
+
]
|
|
461531
|
+
}),
|
|
461532
|
+
/* @__PURE__ */ jsx_runtime96.jsx(IndentedContent, {
|
|
461533
|
+
children: stderr.trim()
|
|
461534
|
+
})
|
|
461535
|
+
]
|
|
461232
461536
|
}, "stderr"));
|
|
461233
461537
|
}
|
|
461234
461538
|
}
|
|
@@ -461414,6 +461718,7 @@ var import_compiler_runtime81, jsx_runtime96;
|
|
|
461414
461718
|
var init_UserLocalCommandOutputMessage = __esm(() => {
|
|
461415
461719
|
init_figures2();
|
|
461416
461720
|
init_ink2();
|
|
461721
|
+
init_localCommandOutput();
|
|
461417
461722
|
init_messages3();
|
|
461418
461723
|
init_Markdown();
|
|
461419
461724
|
init_MessageResponse();
|
|
@@ -473488,6 +473793,9 @@ var init_tempfile = () => {};
|
|
|
473488
473793
|
|
|
473489
473794
|
// src/utils/teleport/gitBundle.ts
|
|
473490
473795
|
import { stat as stat31, unlink as unlink13 } from "fs/promises";
|
|
473796
|
+
function getBundleMaxBytes() {
|
|
473797
|
+
return getFeatureValue_CACHED_MAY_BE_STALE("tengu_ccr_bundle_max_bytes", null) ?? DEFAULT_BUNDLE_MAX_BYTES;
|
|
473798
|
+
}
|
|
473491
473799
|
async function _bundleWithFallback(gitRoot, bundlePath, maxBytes, hasStash, signal) {
|
|
473492
473800
|
const extra = hasStash ? ["refs/seed/stash"] : [];
|
|
473493
473801
|
const mkBundle = (base2) => execFileNoThrowWithCwd(gitExe(), ["bundle", "create", bundlePath, base2, ...extra], { cwd: gitRoot, abortSignal: signal });
|
|
@@ -473579,7 +473887,7 @@ async function createAndUploadGitBundle(config6, opts) {
|
|
|
473579
473887
|
}
|
|
473580
473888
|
const bundlePath = generateTempFilePath("ccr-seed", ".bundle");
|
|
473581
473889
|
try {
|
|
473582
|
-
const maxBytes =
|
|
473890
|
+
const maxBytes = getBundleMaxBytes();
|
|
473583
473891
|
const bundle = await _bundleWithFallback(gitRoot, bundlePath, maxBytes, hasWip, opts?.signal);
|
|
473584
473892
|
if (!bundle.ok) {
|
|
473585
473893
|
const failedBundle = bundle;
|
|
@@ -591498,6 +591806,11 @@ var init_toolHooks = __esm(() => {
|
|
|
591498
591806
|
init_utils9();
|
|
591499
591807
|
});
|
|
591500
591808
|
|
|
591809
|
+
// src/services/tools/hookReadFileStateGate.ts
|
|
591810
|
+
function shouldInvalidateReadFileStateAfterHooks(hooksRan) {
|
|
591811
|
+
return hooksRan;
|
|
591812
|
+
}
|
|
591813
|
+
|
|
591501
591814
|
// src/services/tools/toolExecution.ts
|
|
591502
591815
|
function classifyToolError(error52) {
|
|
591503
591816
|
if (error52 instanceof TelemetrySafeError_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS) {
|
|
@@ -591515,49 +591828,6 @@ function classifyToolError(error52) {
|
|
|
591515
591828
|
}
|
|
591516
591829
|
return "UnknownError";
|
|
591517
591830
|
}
|
|
591518
|
-
function ruleSourceToOTelSource(ruleSource, behavior) {
|
|
591519
|
-
switch (ruleSource) {
|
|
591520
|
-
case "session":
|
|
591521
|
-
return behavior === "allow" ? "user_temporary" : "user_reject";
|
|
591522
|
-
case "localSettings":
|
|
591523
|
-
case "userSettings":
|
|
591524
|
-
return behavior === "allow" ? "user_permanent" : "user_reject";
|
|
591525
|
-
default:
|
|
591526
|
-
return "config";
|
|
591527
|
-
}
|
|
591528
|
-
}
|
|
591529
|
-
function decisionReasonToOTelSource(reason, behavior) {
|
|
591530
|
-
if (!reason) {
|
|
591531
|
-
return "config";
|
|
591532
|
-
}
|
|
591533
|
-
switch (reason.type) {
|
|
591534
|
-
case "permissionPromptTool": {
|
|
591535
|
-
const toolResult = reason.toolResult;
|
|
591536
|
-
const classified = toolResult?.decisionClassification;
|
|
591537
|
-
if (classified === "user_temporary" || classified === "user_permanent" || classified === "user_reject") {
|
|
591538
|
-
return classified;
|
|
591539
|
-
}
|
|
591540
|
-
return behavior === "allow" ? "user_temporary" : "user_reject";
|
|
591541
|
-
}
|
|
591542
|
-
case "rule":
|
|
591543
|
-
return ruleSourceToOTelSource(reason.rule.source, behavior);
|
|
591544
|
-
case "hook":
|
|
591545
|
-
return "hook";
|
|
591546
|
-
case "mode":
|
|
591547
|
-
case "classifier":
|
|
591548
|
-
case "subcommandResults":
|
|
591549
|
-
case "asyncAgent":
|
|
591550
|
-
case "sandboxOverride":
|
|
591551
|
-
case "workingDir":
|
|
591552
|
-
case "safetyCheck":
|
|
591553
|
-
case "other":
|
|
591554
|
-
return "config";
|
|
591555
|
-
default: {
|
|
591556
|
-
const _exhaustive = reason;
|
|
591557
|
-
return "config";
|
|
591558
|
-
}
|
|
591559
|
-
}
|
|
591560
|
-
}
|
|
591561
591831
|
function getNextImagePasteId(messages) {
|
|
591562
591832
|
let maxId = 0;
|
|
591563
591833
|
for (const message of messages) {
|
|
@@ -591876,7 +592146,9 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input2, toolUseConte
|
|
|
591876
592146
|
let hookPermissionResult;
|
|
591877
592147
|
const preToolHookInfos = [];
|
|
591878
592148
|
const preToolHookStart = Date.now();
|
|
592149
|
+
let preToolHooksRan = false;
|
|
591879
592150
|
for await (const result of runPreToolUseHooks(toolUseContext, tool, processedInput, toolUseID, assistantMessage.message.id, requestId, mcpServerType, mcpServerBaseUrl)) {
|
|
592151
|
+
preToolHooksRan = true;
|
|
591880
592152
|
switch (result.type) {
|
|
591881
592153
|
case "message":
|
|
591882
592154
|
if (result.message.message.type === "progress") {
|
|
@@ -591908,6 +592180,9 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input2, toolUseConte
|
|
|
591908
592180
|
resultingMessages.push(result.message);
|
|
591909
592181
|
break;
|
|
591910
592182
|
case "stop":
|
|
592183
|
+
if (shouldInvalidateReadFileStateAfterHooks(preToolHooksRan)) {
|
|
592184
|
+
toolUseContext.readFileState.clear();
|
|
592185
|
+
}
|
|
591911
592186
|
getStatsStore()?.observe("pre_tool_hook_duration_ms", Date.now() - preToolHookStart);
|
|
591912
592187
|
resultingMessages.push({
|
|
591913
592188
|
message: createUserMessage({
|
|
@@ -591921,6 +592196,9 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input2, toolUseConte
|
|
|
591921
592196
|
}
|
|
591922
592197
|
const preToolHookDurationMs = Date.now() - preToolHookStart;
|
|
591923
592198
|
getStatsStore()?.observe("pre_tool_hook_duration_ms", preToolHookDurationMs);
|
|
592199
|
+
if (shouldInvalidateReadFileStateAfterHooks(preToolHooksRan)) {
|
|
592200
|
+
toolUseContext.readFileState.clear();
|
|
592201
|
+
}
|
|
591924
592202
|
if (preToolHookDurationMs >= SLOW_PHASE_LOG_THRESHOLD_MS) {
|
|
591925
592203
|
logForDebugging(`Slow PreToolUse hooks: ${preToolHookDurationMs}ms for ${tool.name} (${preToolHookInfos.length} hooks)`, { level: "info" });
|
|
591926
592204
|
}
|
|
@@ -591954,7 +592232,7 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input2, toolUseConte
|
|
|
591954
592232
|
logForDebugging(`Slow permission decision: ${permissionDurationMs}ms for ${tool.name} ` + `(mode=${permissionMode}, behavior=${permissionDecision.behavior})`, { level: "info" });
|
|
591955
592233
|
}
|
|
591956
592234
|
if (permissionDecision.behavior !== "ask" && !toolUseContext.toolDecisions?.has(toolUseID)) {
|
|
591957
|
-
const decision = permissionDecision.behavior
|
|
592235
|
+
const decision = sdkPermissionDecisionLabel(permissionDecision.behavior, permissionDecision.decisionReason);
|
|
591958
592236
|
const source2 = decisionReasonToOTelSource(permissionDecision.decisionReason, permissionDecision.behavior);
|
|
591959
592237
|
logOTelEvent("tool_decision", {
|
|
591960
592238
|
decision,
|
|
@@ -591978,24 +592256,27 @@ async function checkPermissionsAndCallTool(tool, toolUseID, input2, toolUseConte
|
|
|
591978
592256
|
if (permissionDecision.behavior !== "allow") {
|
|
591979
592257
|
logForDebugging(`${tool.name} tool permission denied`);
|
|
591980
592258
|
const decisionInfo2 = toolUseContext.toolDecisions?.get(toolUseID);
|
|
591981
|
-
|
|
592259
|
+
const isAbort = isSdkPermissionAbort(permissionDecision.decisionReason);
|
|
592260
|
+
endToolBlockedOnUserSpan(isAbort ? "abort" : "reject", decisionInfo2?.source || "unknown");
|
|
591982
592261
|
endToolSpan();
|
|
591983
|
-
|
|
591984
|
-
|
|
591985
|
-
|
|
591986
|
-
|
|
591987
|
-
|
|
591988
|
-
|
|
591989
|
-
mcpServerType
|
|
591990
|
-
|
|
591991
|
-
|
|
591992
|
-
mcpServerBaseUrl
|
|
591993
|
-
|
|
591994
|
-
|
|
591995
|
-
requestId
|
|
591996
|
-
|
|
591997
|
-
|
|
591998
|
-
|
|
592262
|
+
if (!isAbort) {
|
|
592263
|
+
logEvent2("tengu_tool_use_can_use_tool_rejected", {
|
|
592264
|
+
messageID: messageId,
|
|
592265
|
+
toolName: sanitizeToolNameForAnalytics(tool.name),
|
|
592266
|
+
queryChainId: toolUseContext.queryTracking?.chainId,
|
|
592267
|
+
queryDepth: toolUseContext.queryTracking?.depth,
|
|
592268
|
+
...mcpServerType && {
|
|
592269
|
+
mcpServerType
|
|
592270
|
+
},
|
|
592271
|
+
...mcpServerBaseUrl && {
|
|
592272
|
+
mcpServerBaseUrl
|
|
592273
|
+
},
|
|
592274
|
+
...requestId && {
|
|
592275
|
+
requestId
|
|
592276
|
+
},
|
|
592277
|
+
...mcpToolDetailsForAnalytics(tool.name, mcpServerType, mcpServerBaseUrl)
|
|
592278
|
+
});
|
|
592279
|
+
}
|
|
591999
592280
|
let errorMessage2 = permissionDecision.message;
|
|
592000
592281
|
if (shouldPreventContinuation && !errorMessage2) {
|
|
592001
592282
|
errorMessage2 = `Execution stopped by PreToolUse hook${stopReason ? `: ${stopReason}` : ""}`;
|
|
@@ -606301,6 +606582,9 @@ import { basename as basename35, dirname as dirname51, join as join118 } from "p
|
|
|
606301
606582
|
function isSkillFile2(filePath) {
|
|
606302
606583
|
return /^skill\.md$/i.test(basename35(filePath));
|
|
606303
606584
|
}
|
|
606585
|
+
function pluginSkillUserFacingName(commandName, _displayName) {
|
|
606586
|
+
return commandName;
|
|
606587
|
+
}
|
|
606304
606588
|
function getCommandNameFromFile(filePath, baseDir, pluginName) {
|
|
606305
606589
|
const isSkill = isSkillFile2(filePath);
|
|
606306
606590
|
if (isSkill) {
|
|
@@ -606424,7 +606708,7 @@ function createPluginCommand(commandName, file2, sourceName, pluginManifest, plu
|
|
|
606424
606708
|
isHidden: !userInvocable,
|
|
606425
606709
|
progressMessage: isSkill || config7.isSkillMode ? "loading" : "running",
|
|
606426
606710
|
userFacingName() {
|
|
606427
|
-
return displayName
|
|
606711
|
+
return pluginSkillUserFacingName(commandName, displayName);
|
|
606428
606712
|
},
|
|
606429
606713
|
async getPromptForCommand(args, context7) {
|
|
606430
606714
|
let finalContent = config7.isSkillMode ? `Base directory for this skill: ${dirname51(file2.filePath)}
|
|
@@ -622294,13 +622578,7 @@ async function revokeToken({
|
|
|
622294
622578
|
}
|
|
622295
622579
|
}
|
|
622296
622580
|
}
|
|
622297
|
-
async function
|
|
622298
|
-
const storage = getSecureStorage();
|
|
622299
|
-
const existingData = storage.read();
|
|
622300
|
-
if (!existingData?.mcpOAuth)
|
|
622301
|
-
return;
|
|
622302
|
-
const serverKey = getServerKey(serverName, serverConfig);
|
|
622303
|
-
const tokenData = existingData.mcpOAuth[serverKey];
|
|
622581
|
+
async function revokeServerSideTokens(serverName, serverConfig, tokenData) {
|
|
622304
622582
|
if (tokenData?.accessToken || tokenData?.refreshToken) {
|
|
622305
622583
|
try {
|
|
622306
622584
|
const asUrl = tokenData.discoveryState?.authorizationServerUrl ?? serverConfig.url;
|
|
@@ -622356,6 +622634,22 @@ async function revokeServerTokens(serverName, serverConfig, { preserveStepUpStat
|
|
|
622356
622634
|
} else {
|
|
622357
622635
|
logMCPDebug(serverName, "No tokens to revoke");
|
|
622358
622636
|
}
|
|
622637
|
+
}
|
|
622638
|
+
async function revokeServerTokens(serverName, serverConfig, {
|
|
622639
|
+
preserveStepUpState = false,
|
|
622640
|
+
capturedTokenData
|
|
622641
|
+
} = {}) {
|
|
622642
|
+
if (capturedTokenData) {
|
|
622643
|
+
await revokeServerSideTokens(serverName, serverConfig, capturedTokenData);
|
|
622644
|
+
return;
|
|
622645
|
+
}
|
|
622646
|
+
const storage = getSecureStorage();
|
|
622647
|
+
const existingData = storage.read();
|
|
622648
|
+
if (!existingData?.mcpOAuth)
|
|
622649
|
+
return;
|
|
622650
|
+
const serverKey = getServerKey(serverName, serverConfig);
|
|
622651
|
+
const tokenData = existingData.mcpOAuth[serverKey];
|
|
622652
|
+
await revokeServerSideTokens(serverName, serverConfig, tokenData);
|
|
622359
622653
|
clearServerTokensFromLocalStorage(serverName, serverConfig);
|
|
622360
622654
|
if (preserveStepUpState && tokenData && (tokenData.stepUpScope || tokenData.discoveryState)) {
|
|
622361
622655
|
const freshData = storage.read() || {};
|
|
@@ -622395,6 +622689,14 @@ function clearServerTokensFromLocalStorage(serverName, serverConfig) {
|
|
|
622395
622689
|
logMCPDebug(serverName, "Cleared stored tokens");
|
|
622396
622690
|
}
|
|
622397
622691
|
}
|
|
622692
|
+
function captureServerTokenData(serverName, serverConfig) {
|
|
622693
|
+
const storage = getSecureStorage();
|
|
622694
|
+
const existingData = storage.read();
|
|
622695
|
+
if (!existingData?.mcpOAuth)
|
|
622696
|
+
return;
|
|
622697
|
+
const serverKey = getServerKey(serverName, serverConfig);
|
|
622698
|
+
return existingData.mcpOAuth[serverKey];
|
|
622699
|
+
}
|
|
622398
622700
|
async function performMCPXaaAuth(serverName, serverConfig, onAuthorizationUrl, abortSignal, skipBrowserOpen) {
|
|
622399
622701
|
if (!serverConfig.oauth?.xaa) {
|
|
622400
622702
|
throw new Error("XAA: oauth.xaa must be set");
|
|
@@ -636398,6 +636700,7 @@ function useTextInput({
|
|
|
636398
636700
|
function killToLineEnd() {
|
|
636399
636701
|
const { cursor: newCursor, killed } = cursor.deleteToLineEnd();
|
|
636400
636702
|
pushToKillRing(killed, "append");
|
|
636703
|
+
announceDeletedText(killed);
|
|
636401
636704
|
return newCursor;
|
|
636402
636705
|
}
|
|
636403
636706
|
function killToLineStart() {
|
|
@@ -636411,11 +636714,13 @@ function useTextInput({
|
|
|
636411
636714
|
timeoutMs: 5000
|
|
636412
636715
|
});
|
|
636413
636716
|
}
|
|
636717
|
+
announceDeletedText(killed);
|
|
636414
636718
|
return newCursor;
|
|
636415
636719
|
}
|
|
636416
636720
|
function killWordBefore() {
|
|
636417
636721
|
const { cursor: newCursor, killed } = cursor.deleteWordBefore();
|
|
636418
636722
|
pushToKillRing(killed, "prepend");
|
|
636723
|
+
announceDeletedText(killed);
|
|
636419
636724
|
return newCursor;
|
|
636420
636725
|
}
|
|
636421
636726
|
function yank() {
|
|
@@ -636574,6 +636879,11 @@ function useTextInput({
|
|
|
636574
636879
|
default: {
|
|
636575
636880
|
const text2 = stripAnsi(input2).replace(/(?<=[^\\\r\n])\r$/, "").replace(/\r/g, `
|
|
636576
636881
|
`);
|
|
636882
|
+
if (isScreenReaderEnabled() && text2 === " " && cursor.offset === cursor.text.length) {
|
|
636883
|
+
const echo = srEchoTypedChar(text2);
|
|
636884
|
+
if (echo !== null)
|
|
636885
|
+
pushScreenReaderAnnouncement(echo);
|
|
636886
|
+
}
|
|
636577
636887
|
if (cursor.isAtStart() && isInputModeCharacter(input2)) {
|
|
636578
636888
|
return cursor.insert(text2).left();
|
|
636579
636889
|
}
|
|
@@ -636659,6 +636969,8 @@ var init_useTextInput = __esm(() => {
|
|
|
636659
636969
|
init_env();
|
|
636660
636970
|
init_fullscreen();
|
|
636661
636971
|
init_useDoublePress();
|
|
636972
|
+
init_srA11y();
|
|
636973
|
+
init_screenReader();
|
|
636662
636974
|
});
|
|
636663
636975
|
|
|
636664
636976
|
// src/hooks/renderPlaceholder.ts
|
|
@@ -650449,6 +650761,7 @@ var init_config11 = __esm(() => {
|
|
|
650449
650761
|
// src/utils/contextSuggestions.ts
|
|
650450
650762
|
function generateContextSuggestions(data) {
|
|
650451
650763
|
const suggestions = [];
|
|
650764
|
+
checkExceedsContextWindow(data, suggestions);
|
|
650452
650765
|
checkNearCapacity(data, suggestions);
|
|
650453
650766
|
checkLargeToolResults(data, suggestions);
|
|
650454
650767
|
checkReadResultBloat(data, suggestions);
|
|
@@ -650567,6 +650880,16 @@ function checkMemoryBloat(data, suggestions) {
|
|
|
650567
650880
|
});
|
|
650568
650881
|
}
|
|
650569
650882
|
}
|
|
650883
|
+
function checkExceedsContextWindow(data, suggestions) {
|
|
650884
|
+
if (data.totalTokens > data.rawMaxTokens && data.rawMaxTokens > 0) {
|
|
650885
|
+
const overBy = data.totalTokens - data.rawMaxTokens;
|
|
650886
|
+
suggestions.push({
|
|
650887
|
+
severity: "warning",
|
|
650888
|
+
title: "Context exceeds the context window",
|
|
650889
|
+
detail: `Conversation is ${formatTokens(overBy)} over the ${formatTokens(data.rawMaxTokens)} token limit. Run /compact to summarize and continue.`
|
|
650890
|
+
});
|
|
650891
|
+
}
|
|
650892
|
+
}
|
|
650570
650893
|
function checkAutoCompactDisabled(data, suggestions) {
|
|
650571
650894
|
if (!data.isAutoCompactEnabled && data.percentage >= 50 && data.percentage < NEAR_CAPACITY_PERCENT) {
|
|
650572
650895
|
suggestions.push({
|
|
@@ -651577,6 +651900,7 @@ var exports_context_noninteractive = {};
|
|
|
651577
651900
|
__export(exports_context_noninteractive, {
|
|
651578
651901
|
stripStaleUsageFromPreservedSegment: () => stripStaleUsageFromPreservedSegment,
|
|
651579
651902
|
rescaleSkillTokensForModel: () => rescaleSkillTokensForModel,
|
|
651903
|
+
formatContextAsMarkdownTable: () => formatContextAsMarkdownTable,
|
|
651580
651904
|
collectContextData: () => collectContextData,
|
|
651581
651905
|
call: () => call22
|
|
651582
651906
|
});
|
|
@@ -651692,6 +652016,12 @@ function formatContextAsMarkdownTable(data) {
|
|
|
651692
652016
|
`;
|
|
651693
652017
|
output2 += `**Tokens:** ${formatTokens(totalTokens)} / ${formatTokens(rawMaxTokens)} (${percentage}%)
|
|
651694
652018
|
`;
|
|
652019
|
+
if (totalTokens > rawMaxTokens && rawMaxTokens > 0) {
|
|
652020
|
+
const overBy = totalTokens - rawMaxTokens;
|
|
652021
|
+
output2 += `
|
|
652022
|
+
> \u26A0 **Context exceeds the context window** \u2014 conversation is ${formatTokens(overBy)} over the ${formatTokens(rawMaxTokens)} token limit. Run \`/compact\` to summarize and continue.
|
|
652023
|
+
`;
|
|
652024
|
+
}
|
|
651695
652025
|
output2 += `
|
|
651696
652026
|
`;
|
|
651697
652027
|
const visibleCategories = categories.filter((cat2) => cat2.tokens > 0 && cat2.name !== "Free space" && cat2.name !== "Autocompact buffer");
|
|
@@ -656449,8 +656779,7 @@ function editFileInEditor(filePath) {
|
|
|
656449
656779
|
if (useAlternateScreen) {
|
|
656450
656780
|
inkInstance.enterAlternateScreen();
|
|
656451
656781
|
} else {
|
|
656452
|
-
inkInstance.
|
|
656453
|
-
inkInstance.suspendStdin();
|
|
656782
|
+
inkInstance.enterGuiEditorHandoff();
|
|
656454
656783
|
}
|
|
656455
656784
|
try {
|
|
656456
656785
|
const editorCommand = EDITOR_OVERRIDES[editor] ?? editor;
|
|
@@ -656475,8 +656804,7 @@ function editFileInEditor(filePath) {
|
|
|
656475
656804
|
if (useAlternateScreen) {
|
|
656476
656805
|
inkInstance.exitAlternateScreen();
|
|
656477
656806
|
} else {
|
|
656478
|
-
inkInstance.
|
|
656479
|
-
inkInstance.resume();
|
|
656807
|
+
inkInstance.exitGuiEditorHandoff();
|
|
656480
656808
|
}
|
|
656481
656809
|
}
|
|
656482
656810
|
}
|
|
@@ -656592,7 +656920,13 @@ function MemoryCommand({
|
|
|
656592
656920
|
throw e4;
|
|
656593
656921
|
}
|
|
656594
656922
|
}
|
|
656595
|
-
|
|
656923
|
+
const editor = getExternalEditor();
|
|
656924
|
+
const isGui = editor ? classifyGuiEditor(editor) !== undefined : false;
|
|
656925
|
+
if (isGui) {
|
|
656926
|
+
openFileInExternalEditor(memoryPath);
|
|
656927
|
+
} else {
|
|
656928
|
+
await editFileInEditor(memoryPath);
|
|
656929
|
+
}
|
|
656596
656930
|
let editorSource = "default";
|
|
656597
656931
|
let editorValue = "";
|
|
656598
656932
|
if (process.env.VISUAL) {
|
|
@@ -656666,6 +657000,7 @@ var init_memory = __esm(() => {
|
|
|
656666
657000
|
init_errors();
|
|
656667
657001
|
init_log3();
|
|
656668
657002
|
init_promptEditor();
|
|
657003
|
+
init_editor();
|
|
656669
657004
|
React62 = __toESM(require_react(), 1);
|
|
656670
657005
|
jsx_runtime212 = __toESM(require_jsx_runtime(), 1);
|
|
656671
657006
|
});
|
|
@@ -664839,6 +665174,14 @@ var init_MCPReconnect = __esm(() => {
|
|
|
664839
665174
|
jsx_runtime236 = __toESM(require_jsx_runtime(), 1);
|
|
664840
665175
|
});
|
|
664841
665176
|
|
|
665177
|
+
// src/services/mcp/reauthOrdering.ts
|
|
665178
|
+
async function reauthenticateWithSafeOrdering(steps) {
|
|
665179
|
+
await steps.performNewSignIn();
|
|
665180
|
+
if (steps.wasAuthenticated) {
|
|
665181
|
+
await steps.revokeOldTokens();
|
|
665182
|
+
}
|
|
665183
|
+
}
|
|
665184
|
+
|
|
664842
665185
|
// src/components/mcp/CapabilitiesSection.tsx
|
|
664843
665186
|
function CapabilitiesSection(t0) {
|
|
664844
665187
|
const $4 = import_compiler_runtime180.c(9);
|
|
@@ -665141,16 +665484,18 @@ function MCPRemoteServerMenu({
|
|
|
665141
665484
|
const controller = new AbortController;
|
|
665142
665485
|
authAbortControllerRef.current = controller;
|
|
665143
665486
|
try {
|
|
665144
|
-
|
|
665145
|
-
await revokeServerTokens(server.name, server.config, {
|
|
665146
|
-
preserveStepUpState: true
|
|
665147
|
-
});
|
|
665148
|
-
}
|
|
665487
|
+
const capturedOldTokens = server.isAuthenticated && server.config ? captureServerTokenData(server.name, server.config) : undefined;
|
|
665149
665488
|
if (server.config) {
|
|
665150
|
-
await
|
|
665151
|
-
|
|
665152
|
-
|
|
665153
|
-
|
|
665489
|
+
await reauthenticateWithSafeOrdering({
|
|
665490
|
+
wasAuthenticated: server.isAuthenticated,
|
|
665491
|
+
performNewSignIn: () => performMCPOAuthFlow(server.name, server.config, setAuthorizationUrl, controller.signal, {
|
|
665492
|
+
onWaitingForCallback: (submit) => {
|
|
665493
|
+
setManualCallbackSubmit(() => submit);
|
|
665494
|
+
}
|
|
665495
|
+
}),
|
|
665496
|
+
revokeOldTokens: () => revokeServerTokens(server.name, server.config, {
|
|
665497
|
+
capturedTokenData: capturedOldTokens
|
|
665498
|
+
})
|
|
665154
665499
|
});
|
|
665155
665500
|
logEvent2("tengu_mcp_auth_config_authenticate", {
|
|
665156
665501
|
wasAuthenticated: server.isAuthenticated
|
|
@@ -684161,6 +684506,16 @@ var init_GuestPassesUpsell = __esm(() => {
|
|
|
684161
684506
|
});
|
|
684162
684507
|
|
|
684163
684508
|
// src/components/LogoV2/OccWelcome.tsx
|
|
684509
|
+
function normalizeLogo(lines2) {
|
|
684510
|
+
const width = Math.max(...lines2.map(stringWidth));
|
|
684511
|
+
return lines2.map((line) => line + " ".repeat(width - stringWidth(line)));
|
|
684512
|
+
}
|
|
684513
|
+
function getOccLogo(mode) {
|
|
684514
|
+
return OCC_LOGOS[mode];
|
|
684515
|
+
}
|
|
684516
|
+
function getOccLogoWidth(art) {
|
|
684517
|
+
return Math.max(...art.map(stringWidth));
|
|
684518
|
+
}
|
|
684164
684519
|
function getOccWelcomeMode(columns, plain = false) {
|
|
684165
684520
|
if (plain || columns < COMPACT_MIN_COLUMNS)
|
|
684166
684521
|
return "plain";
|
|
@@ -684187,14 +684542,16 @@ function welcomeTip(mode, sessionTip) {
|
|
|
684187
684542
|
}
|
|
684188
684543
|
return "Type /help for commands";
|
|
684189
684544
|
}
|
|
684190
|
-
function getShimmerRuns(line, row, progress) {
|
|
684545
|
+
function getShimmerRuns(line, row, progress, art = OCC_LOGOS.wide) {
|
|
684191
684546
|
const chars = [...line];
|
|
684192
684547
|
if (chars.length === 0)
|
|
684193
684548
|
return [];
|
|
684194
684549
|
const runs = [];
|
|
684550
|
+
const artWidth = getOccLogoWidth(art);
|
|
684551
|
+
let displayColumn = 0;
|
|
684195
684552
|
for (let column = 0;column < chars.length; column++) {
|
|
684196
684553
|
const char = chars[column];
|
|
684197
|
-
const diagonal = (
|
|
684554
|
+
const diagonal = (displayColumn + (art.length - 1 - row) * 1.6) / (artWidth + art.length * 1.6);
|
|
684198
684555
|
const bandPosition = progress === null ? -1 : -SHIMMER_BAND_WIDTH + progress * 1.45;
|
|
684199
684556
|
const highlighted = progress !== null && char !== " " && Math.abs(diagonal - bandPosition) < SHIMMER_BAND_WIDTH;
|
|
684200
684557
|
const previous = runs[runs.length - 1];
|
|
@@ -684203,10 +684560,12 @@ function getShimmerRuns(line, row, progress) {
|
|
|
684203
684560
|
} else {
|
|
684204
684561
|
runs.push({ text: char, highlighted });
|
|
684205
684562
|
}
|
|
684563
|
+
displayColumn += stringWidth(char);
|
|
684206
684564
|
}
|
|
684207
684565
|
return runs;
|
|
684208
684566
|
}
|
|
684209
|
-
function
|
|
684567
|
+
function OccLogo({
|
|
684568
|
+
art,
|
|
684210
684569
|
animate
|
|
684211
684570
|
}) {
|
|
684212
684571
|
const [done, setDone] = import_react147.useState(!animate);
|
|
@@ -684227,13 +684586,13 @@ function OccWordmark({
|
|
|
684227
684586
|
ref,
|
|
684228
684587
|
flexDirection: "column",
|
|
684229
684588
|
flexShrink: 0,
|
|
684230
|
-
children:
|
|
684231
|
-
children: getShimmerRuns(line, row, progress).map((run, index2) => /* @__PURE__ */ jsx_runtime263.jsx(ThemedText, {
|
|
684589
|
+
children: art.map((line, row) => /* @__PURE__ */ jsx_runtime263.jsx(ThemedText, {
|
|
684590
|
+
children: getShimmerRuns(line, row, progress, art).map((run, index2) => /* @__PURE__ */ jsx_runtime263.jsx(ThemedText, {
|
|
684232
684591
|
color: run.highlighted ? "claudeShimmer" : "claude",
|
|
684233
684592
|
bold: run.highlighted,
|
|
684234
684593
|
children: run.text
|
|
684235
684594
|
}, `${row}-${index2}`))
|
|
684236
|
-
},
|
|
684595
|
+
}, row))
|
|
684237
684596
|
});
|
|
684238
684597
|
}
|
|
684239
684598
|
function Header({
|
|
@@ -684317,9 +684676,18 @@ function PlainWelcome(props) {
|
|
|
684317
684676
|
const width = Math.max(props.columns, 1);
|
|
684318
684677
|
const location = formatWelcomeLocation(props.branch, props.cwd, width);
|
|
684319
684678
|
const modelLine = truncate(`${props.model} \xB7 ${props.billing}`, width);
|
|
684679
|
+
const logo = getOccLogo("plain");
|
|
684680
|
+
const showLogo = !props.plain && width >= getOccLogoWidth(logo);
|
|
684320
684681
|
return /* @__PURE__ */ jsx_runtime263.jsxs(ThemedBox_default, {
|
|
684321
684682
|
flexDirection: "column",
|
|
684322
684683
|
children: [
|
|
684684
|
+
showLogo && /* @__PURE__ */ jsx_runtime263.jsx(ThemedBox_default, {
|
|
684685
|
+
marginBottom: 1,
|
|
684686
|
+
children: /* @__PURE__ */ jsx_runtime263.jsx(OccLogo, {
|
|
684687
|
+
art: logo,
|
|
684688
|
+
animate: !props.reducedMotion
|
|
684689
|
+
})
|
|
684690
|
+
}),
|
|
684323
684691
|
/* @__PURE__ */ jsx_runtime263.jsxs(ThemedText, {
|
|
684324
684692
|
children: [
|
|
684325
684693
|
/* @__PURE__ */ jsx_runtime263.jsx(ThemedText, {
|
|
@@ -684363,7 +684731,9 @@ function OccWelcome(props) {
|
|
|
684363
684731
|
}
|
|
684364
684732
|
const cardWidth = Math.min(Math.max(props.columns, 1), WELCOME_MAX_WIDTH);
|
|
684365
684733
|
const contentWidth = Math.max(cardWidth - 4, 1);
|
|
684366
|
-
const
|
|
684734
|
+
const logo = getOccLogo(mode);
|
|
684735
|
+
const logoWidth = getOccLogoWidth(logo);
|
|
684736
|
+
const location = formatWelcomeLocation(props.branch, props.cwd, mode === "wide" ? Math.max(contentWidth - logoWidth - 3, 1) : contentWidth);
|
|
684367
684737
|
const animate = !props.reducedMotion;
|
|
684368
684738
|
return /* @__PURE__ */ jsx_runtime263.jsxs(ThemedBox_default, {
|
|
684369
684739
|
width: cardWidth,
|
|
@@ -684384,11 +684754,12 @@ function OccWelcome(props) {
|
|
|
684384
684754
|
gap: 3,
|
|
684385
684755
|
alignItems: "center",
|
|
684386
684756
|
children: [
|
|
684387
|
-
/* @__PURE__ */ jsx_runtime263.jsx(
|
|
684757
|
+
/* @__PURE__ */ jsx_runtime263.jsx(OccLogo, {
|
|
684758
|
+
art: logo,
|
|
684388
684759
|
animate
|
|
684389
684760
|
}),
|
|
684390
684761
|
/* @__PURE__ */ jsx_runtime263.jsx(Metadata, {
|
|
684391
|
-
width: Math.max(contentWidth -
|
|
684762
|
+
width: Math.max(contentWidth - logoWidth - 3, 1),
|
|
684392
684763
|
model: props.model,
|
|
684393
684764
|
billing: props.billing,
|
|
684394
684765
|
location,
|
|
@@ -684400,7 +684771,8 @@ function OccWelcome(props) {
|
|
|
684400
684771
|
flexDirection: "column",
|
|
684401
684772
|
alignItems: "center",
|
|
684402
684773
|
children: [
|
|
684403
|
-
/* @__PURE__ */ jsx_runtime263.jsx(
|
|
684774
|
+
/* @__PURE__ */ jsx_runtime263.jsx(OccLogo, {
|
|
684775
|
+
art: logo,
|
|
684404
684776
|
animate
|
|
684405
684777
|
}),
|
|
684406
684778
|
/* @__PURE__ */ jsx_runtime263.jsx(ThemedBox_default, {
|
|
@@ -684437,19 +684809,32 @@ function OccWelcome(props) {
|
|
|
684437
684809
|
]
|
|
684438
684810
|
});
|
|
684439
684811
|
}
|
|
684440
|
-
var import_react147, jsx_runtime263,
|
|
684812
|
+
var import_react147, jsx_runtime263, WELCOME_MAX_WIDTH = 84, WIDE_MIN_COLUMNS = 76, COMPACT_MIN_COLUMNS = 44, SHIMMER_FRAME_MS = 84, SHIMMER_DURATION_MS = 1850, SHIMMER_BAND_WIDTH = 0.24, OCC_LOGOS;
|
|
684441
684813
|
var init_OccWelcome = __esm(() => {
|
|
684442
684814
|
init_ink2();
|
|
684443
684815
|
init_stringWidth();
|
|
684444
684816
|
init_format();
|
|
684445
684817
|
import_react147 = __toESM(require_react(), 1);
|
|
684446
684818
|
jsx_runtime263 = __toESM(require_jsx_runtime(), 1);
|
|
684447
|
-
|
|
684448
|
-
|
|
684449
|
-
|
|
684450
|
-
|
|
684451
|
-
|
|
684452
|
-
|
|
684819
|
+
OCC_LOGOS = {
|
|
684820
|
+
wide: normalizeLogo([
|
|
684821
|
+
" \u2880\u28E0\u28E4\u28C0",
|
|
684822
|
+
" \u2880\u28FE\u281F\u2809\u2809\u283B\u28F7\u28C4",
|
|
684823
|
+
" \u28F0\u28FF\u2803 \u28C0 \u2818\u28FF\u28C6",
|
|
684824
|
+
" \u28B8\u28FF\u2847 \u28FF\u28FF\u2847 \u28FF\u28FF \u2830\u2844",
|
|
684825
|
+
" \u28BF\u28F7 \u283B\u281F \u28F0\u28FF\u280F \u2880\u281E",
|
|
684826
|
+
" \u283B\u28F7\u28C4 \u28E0\u28FE\u281F \u2870\u280B",
|
|
684827
|
+
" \u2819\u283F\u283F\u281B\u2801 \u2818\u2801"
|
|
684828
|
+
]),
|
|
684829
|
+
compact: normalizeLogo([
|
|
684830
|
+
" \u28E0\u28E4\u28C4",
|
|
684831
|
+
" \u28F0\u287F\u280B\u2819\u28BF\u28C6",
|
|
684832
|
+
"\u28B0\u28FF \u28FF\u2847 \u28FF\u2847\u28A0",
|
|
684833
|
+
" \u28BF\u28E7 \u281B \u28F0\u287F\u28A0\u2803",
|
|
684834
|
+
" \u2819\u283F\u28F6\u283F\u280B \u2818"
|
|
684835
|
+
]),
|
|
684836
|
+
plain: normalizeLogo([" \u28E0\u28C4", "\u28B8\u2847\u28FF\u2847\u28A0", " \u283B\u2836\u280B\u2818"])
|
|
684837
|
+
};
|
|
684453
684838
|
});
|
|
684454
684839
|
|
|
684455
684840
|
// src/components/LogoV2/welcomeTips.ts
|
|
@@ -692254,6 +692639,95 @@ var init_ultrareviewQuota = __esm(() => {
|
|
|
692254
692639
|
init_api2();
|
|
692255
692640
|
});
|
|
692256
692641
|
|
|
692642
|
+
// src/commands/review/diffTooLargeError.ts
|
|
692643
|
+
function formatBytes2(bytes) {
|
|
692644
|
+
if (bytes < 1024)
|
|
692645
|
+
return `${bytes} B`;
|
|
692646
|
+
if (bytes < 1024 * 1024)
|
|
692647
|
+
return `${(bytes / 1024).toFixed(1)} KB`;
|
|
692648
|
+
return `${(bytes / 1024 / 1024).toFixed(0)} MB`;
|
|
692649
|
+
}
|
|
692650
|
+
function formatDiffTooLargeError(opts) {
|
|
692651
|
+
const { configuredLimitBytes, stats } = opts;
|
|
692652
|
+
const lines2 = [
|
|
692653
|
+
`Ultrareview cannot launch: the diff is too large.`,
|
|
692654
|
+
`Configured limit: ${formatBytes2(configuredLimitBytes)} (tengu_ccr_bundle_max_bytes).`,
|
|
692655
|
+
`Measured diff: ${stats.filesChanged} files changed, ${stats.insertions} insertions(+), ${stats.deletions} deletions(-).`
|
|
692656
|
+
];
|
|
692657
|
+
if (stats.largestFiles.length > 0) {
|
|
692658
|
+
lines2.push("Largest contributing files:");
|
|
692659
|
+
for (const f4 of stats.largestFiles) {
|
|
692660
|
+
lines2.push(` ${f4.path} (${f4.linesChanged} changed lines)`);
|
|
692661
|
+
}
|
|
692662
|
+
}
|
|
692663
|
+
lines2.push("Push a PR and use `/ultrareview <PR#>` instead, or split the branch into smaller commits.");
|
|
692664
|
+
return lines2.join(`
|
|
692665
|
+
`);
|
|
692666
|
+
}
|
|
692667
|
+
function parseNumstatTopFiles(numstatStdout, limit = DIFF_TOO_LARGE_TOP_FILES) {
|
|
692668
|
+
const rows = [];
|
|
692669
|
+
for (const line of numstatStdout.split(`
|
|
692670
|
+
`)) {
|
|
692671
|
+
if (!line.trim())
|
|
692672
|
+
continue;
|
|
692673
|
+
const parts = line.split("\t");
|
|
692674
|
+
if (parts.length < 3)
|
|
692675
|
+
continue;
|
|
692676
|
+
const added = Number(parts[0]);
|
|
692677
|
+
const deleted = Number(parts[1]);
|
|
692678
|
+
if (!Number.isFinite(added) || !Number.isFinite(deleted))
|
|
692679
|
+
continue;
|
|
692680
|
+
rows.push({ path: parts.slice(2).join("\t"), linesChanged: added + deleted });
|
|
692681
|
+
}
|
|
692682
|
+
rows.sort((a6, b6) => b6.linesChanged - a6.linesChanged);
|
|
692683
|
+
return rows.slice(0, limit);
|
|
692684
|
+
}
|
|
692685
|
+
function parseShortstat2(stdout) {
|
|
692686
|
+
const filesMatch = stdout.match(/(\d+) files? changed/);
|
|
692687
|
+
const insMatch = stdout.match(/(\d+) insertions?\(\+\)/);
|
|
692688
|
+
const delMatch = stdout.match(/(\d+) deletions?\(-\)/);
|
|
692689
|
+
return {
|
|
692690
|
+
filesChanged: filesMatch ? Number(filesMatch[1]) : 0,
|
|
692691
|
+
insertions: insMatch ? Number(insMatch[1]) : 0,
|
|
692692
|
+
deletions: delMatch ? Number(delMatch[1]) : 0
|
|
692693
|
+
};
|
|
692694
|
+
}
|
|
692695
|
+
async function collectDiffTooLargeStats(mergeBaseSha, deps = {}) {
|
|
692696
|
+
const exec5 = deps.exec ?? (async (args) => {
|
|
692697
|
+
const r4 = await execFileNoThrow(gitExe(), args, {
|
|
692698
|
+
preserveOutputOnError: false
|
|
692699
|
+
});
|
|
692700
|
+
return { stdout: r4.stdout, code: r4.code };
|
|
692701
|
+
});
|
|
692702
|
+
const shortRes = await exec5(["diff", "--shortstat", mergeBaseSha]);
|
|
692703
|
+
const { filesChanged, insertions, deletions } = shortRes.code === 0 ? parseShortstat2(shortRes.stdout) : { filesChanged: 0, insertions: 0, deletions: 0 };
|
|
692704
|
+
const numstatRes = await exec5(["diff", "--numstat", mergeBaseSha]);
|
|
692705
|
+
const largestFiles = numstatRes.code === 0 ? parseNumstatTopFiles(numstatRes.stdout) : [];
|
|
692706
|
+
return { filesChanged, insertions, deletions, largestFiles };
|
|
692707
|
+
}
|
|
692708
|
+
function configuredDiffLimitBytes() {
|
|
692709
|
+
return getBundleMaxBytes();
|
|
692710
|
+
}
|
|
692711
|
+
var DIFF_TOO_LARGE_TOP_FILES = 5;
|
|
692712
|
+
var init_diffTooLargeError = __esm(() => {
|
|
692713
|
+
init_execFileNoThrow();
|
|
692714
|
+
init_git();
|
|
692715
|
+
init_gitBundle();
|
|
692716
|
+
});
|
|
692717
|
+
|
|
692718
|
+
// src/commands/review/reviewNote.ts
|
|
692719
|
+
function reviewNoteEnv(args) {
|
|
692720
|
+
const trimmed = args.trim();
|
|
692721
|
+
if (trimmed === "" || PR_NUMBER_RE.test(trimmed)) {
|
|
692722
|
+
return {};
|
|
692723
|
+
}
|
|
692724
|
+
return { BUGHUNTER_REVIEW_NOTE: trimmed };
|
|
692725
|
+
}
|
|
692726
|
+
var PR_NUMBER_RE;
|
|
692727
|
+
var init_reviewNote = __esm(() => {
|
|
692728
|
+
PR_NUMBER_RE = /^\d+$/;
|
|
692729
|
+
});
|
|
692730
|
+
|
|
692257
692731
|
// src/commands/review/reviewRemote.ts
|
|
692258
692732
|
var exports_reviewRemote = {};
|
|
692259
692733
|
__export(exports_reviewRemote, {
|
|
@@ -692401,15 +692875,25 @@ ${reasons}`
|
|
|
692401
692875
|
environmentId: CODE_REVIEW_ENV_ID,
|
|
692402
692876
|
environmentVariables: {
|
|
692403
692877
|
BUGHUNTER_BASE_BRANCH: mergeBaseSha,
|
|
692404
|
-
...commonEnvVars
|
|
692878
|
+
...commonEnvVars,
|
|
692879
|
+
...reviewNoteEnv(args)
|
|
692405
692880
|
}
|
|
692406
692881
|
});
|
|
692407
692882
|
if (!session) {
|
|
692883
|
+
const stats = await collectDiffTooLargeStats(mergeBaseSha).catch(() => ({
|
|
692884
|
+
filesChanged: 0,
|
|
692885
|
+
insertions: 0,
|
|
692886
|
+
deletions: 0,
|
|
692887
|
+
largestFiles: []
|
|
692888
|
+
}));
|
|
692408
692889
|
logEvent2("tengu_review_remote_teleport_failed", {});
|
|
692409
692890
|
return [
|
|
692410
692891
|
{
|
|
692411
692892
|
type: "text",
|
|
692412
|
-
text:
|
|
692893
|
+
text: formatDiffTooLargeError({
|
|
692894
|
+
configuredLimitBytes: configuredDiffLimitBytes(),
|
|
692895
|
+
stats
|
|
692896
|
+
})
|
|
692413
692897
|
}
|
|
692414
692898
|
];
|
|
692415
692899
|
}
|
|
@@ -692448,6 +692932,8 @@ var init_reviewRemote = __esm(() => {
|
|
|
692448
692932
|
init_execFileNoThrow();
|
|
692449
692933
|
init_git();
|
|
692450
692934
|
init_teleport();
|
|
692935
|
+
init_diffTooLargeError();
|
|
692936
|
+
init_reviewNote();
|
|
692451
692937
|
});
|
|
692452
692938
|
|
|
692453
692939
|
// src/commands/review/UltrareviewOverageDialog.tsx
|
|
@@ -715981,6 +716467,12 @@ function deriveForkName(directive) {
|
|
|
715981
716467
|
}
|
|
715982
716468
|
var FORK_NAME_FALLBACK = "fork";
|
|
715983
716469
|
|
|
716470
|
+
// src/commands/fork/confirmation.ts
|
|
716471
|
+
function formatForkConfirmation(forkName, sessionId, sharesCheckout) {
|
|
716472
|
+
const base2 = `Forked session ${forkName} (claude attach ${sessionId})`;
|
|
716473
|
+
return sharesCheckout ? `${base2} (shares your checkout)` : base2;
|
|
716474
|
+
}
|
|
716475
|
+
|
|
715984
716476
|
// src/commands/fork/fork.ts
|
|
715985
716477
|
var exports_fork = {};
|
|
715986
716478
|
__export(exports_fork, {
|
|
@@ -716012,7 +716504,8 @@ var call88 = async (onDone, context8, args) => {
|
|
|
716012
716504
|
const forkName = deriveForkName(directive);
|
|
716013
716505
|
const source2 = directive ? "user" : "auto";
|
|
716014
716506
|
await saveCustomTitle(forkedSessionId, forkName, forkPath, source2);
|
|
716015
|
-
|
|
716507
|
+
const sharesCheckout = true;
|
|
716508
|
+
onDone(formatForkConfirmation(forkName, forkedSessionId, sharesCheckout), { display: "system" });
|
|
716016
716509
|
return null;
|
|
716017
716510
|
};
|
|
716018
716511
|
var init_fork = __esm(() => {
|
|
@@ -718783,6 +719276,7 @@ var exports_sessionStorage = {};
|
|
|
718783
719276
|
__export(exports_sessionStorage, {
|
|
718784
719277
|
writeRemoteAgentMetadata: () => writeRemoteAgentMetadata,
|
|
718785
719278
|
writeAgentMetadata: () => writeAgentMetadata,
|
|
719279
|
+
transcriptWriteFs: () => transcriptWriteFs,
|
|
718786
719280
|
setSessionFileForTesting: () => setSessionFileForTesting,
|
|
718787
719281
|
setRemoteIngressUrlForTesting: () => setRemoteIngressUrlForTesting,
|
|
718788
719282
|
setInternalEventWriter: () => setInternalEventWriter,
|
|
@@ -718800,6 +719294,7 @@ __export(exports_sessionStorage, {
|
|
|
718800
719294
|
saveAgentName: () => saveAgentName,
|
|
718801
719295
|
saveAgentColor: () => saveAgentColor,
|
|
718802
719296
|
restoreSessionMetadata: () => restoreSessionMetadata,
|
|
719297
|
+
resetTranscriptWriteWarnings: () => resetTranscriptWriteWarnings,
|
|
718803
719298
|
resetSessionFilePointer: () => resetSessionFilePointer,
|
|
718804
719299
|
resetProjectForTesting: () => resetProjectForTesting,
|
|
718805
719300
|
resetProjectFlushStateForTesting: () => resetProjectFlushStateForTesting,
|
|
@@ -718871,6 +719366,7 @@ __export(exports_sessionStorage, {
|
|
|
718871
719366
|
checkResumeConsistency: () => checkResumeConsistency,
|
|
718872
719367
|
cacheSessionTitle: () => cacheSessionTitle,
|
|
718873
719368
|
buildConversationChain: () => buildConversationChain,
|
|
719369
|
+
appendEntryForTesting: () => appendEntryForTesting,
|
|
718874
719370
|
appendDeletedSession: () => appendDeletedSession,
|
|
718875
719371
|
adoptResumedSessionFile: () => adoptResumedSessionFile,
|
|
718876
719372
|
MAX_TRANSCRIPT_READ_BYTES: () => MAX_TRANSCRIPT_READ_BYTES
|
|
@@ -718887,6 +719383,34 @@ import {
|
|
|
718887
719383
|
writeFile as writeFile55
|
|
718888
719384
|
} from "fs/promises";
|
|
718889
719385
|
import { basename as basename48, dirname as dirname72, join as join161 } from "path";
|
|
719386
|
+
function resetTranscriptWriteWarnings() {
|
|
719387
|
+
transcriptWriteFailureWarned = false;
|
|
719388
|
+
sessionSavingOffWarned = false;
|
|
719389
|
+
}
|
|
719390
|
+
function warnTranscriptWriteFailure(error52) {
|
|
719391
|
+
if (transcriptWriteFailureWarned)
|
|
719392
|
+
return;
|
|
719393
|
+
transcriptWriteFailureWarned = true;
|
|
719394
|
+
try {
|
|
719395
|
+
const errObj = error52;
|
|
719396
|
+
const code = errObj?.code ?? "unknown";
|
|
719397
|
+
const message = errObj?.message ?? String(error52);
|
|
719398
|
+
const warning = `Warning: transcript write failed (${code}: ${message}). ` + `Session transcripts are not being saved (e.g. disk full, permissions). ` + `This warning will not repeat; fix the underlying issue to resume saving.
|
|
719399
|
+
`;
|
|
719400
|
+
process.stderr.write(warning);
|
|
719401
|
+
} catch {}
|
|
719402
|
+
logError2(error52 instanceof Error ? error52 : new Error(String(error52)));
|
|
719403
|
+
}
|
|
719404
|
+
function warnSessionSavingOff(envVarName) {
|
|
719405
|
+
if (sessionSavingOffWarned)
|
|
719406
|
+
return;
|
|
719407
|
+
sessionSavingOffWarned = true;
|
|
719408
|
+
try {
|
|
719409
|
+
const warning = `Warning: session transcript saving is OFF \u2014 ${envVarName} is set in ` + `the environment. Transcripts will not be persisted. ` + `This warning will not repeat; unset ${envVarName} to resume saving.
|
|
719410
|
+
`;
|
|
719411
|
+
process.stderr.write(warning);
|
|
719412
|
+
} catch {}
|
|
719413
|
+
}
|
|
718890
719414
|
function isTranscriptMessage(entry) {
|
|
718891
719415
|
return entry.type === "user" || entry.type === "assistant" || entry.type === "attachment" || entry.type === "system";
|
|
718892
719416
|
}
|
|
@@ -719077,6 +719601,9 @@ function resetProjectForTesting() {
|
|
|
719077
719601
|
function setSessionFileForTesting(path39) {
|
|
719078
719602
|
getProject().sessionFile = path39;
|
|
719079
719603
|
}
|
|
719604
|
+
async function appendEntryForTesting(entry) {
|
|
719605
|
+
await getProject().appendEntry(entry);
|
|
719606
|
+
}
|
|
719080
719607
|
function setInternalEventWriter(writer) {
|
|
719081
719608
|
getProject().setInternalEventWriter(writer);
|
|
719082
719609
|
}
|
|
@@ -719170,10 +719697,14 @@ class Project {
|
|
|
719170
719697
|
}
|
|
719171
719698
|
async appendToFile(filePath, data) {
|
|
719172
719699
|
try {
|
|
719173
|
-
await
|
|
719174
|
-
} catch {
|
|
719175
|
-
|
|
719176
|
-
|
|
719700
|
+
await transcriptWriteFs.appendFile(filePath, data, { mode: 384 });
|
|
719701
|
+
} catch (firstError) {
|
|
719702
|
+
try {
|
|
719703
|
+
await transcriptWriteFs.mkdir(dirname72(filePath), { recursive: true, mode: 448 });
|
|
719704
|
+
await transcriptWriteFs.appendFile(filePath, data, { mode: 384 });
|
|
719705
|
+
} catch (retryError) {
|
|
719706
|
+
warnTranscriptWriteFailure(retryError);
|
|
719707
|
+
}
|
|
719177
719708
|
}
|
|
719178
719709
|
}
|
|
719179
719710
|
async drainWriteQueue() {
|
|
@@ -719486,6 +720017,11 @@ class Project {
|
|
|
719486
720017
|
}
|
|
719487
720018
|
async appendEntry(entry, sessionId = getSessionId()) {
|
|
719488
720019
|
if (this.shouldSkipPersistence()) {
|
|
720020
|
+
if (isEnvTruthy(process.env.CLAUDE_CODE_SKIP_PROMPT_HISTORY)) {
|
|
720021
|
+
warnSessionSavingOff("CLAUDE_CODE_SKIP_PROMPT_HISTORY");
|
|
720022
|
+
} else if (isSessionPersistenceDisabled()) {
|
|
720023
|
+
warnSessionSavingOff("session persistence disabled");
|
|
720024
|
+
}
|
|
719489
720025
|
return;
|
|
719490
720026
|
}
|
|
719491
720027
|
const currentSessionId = getSessionId();
|
|
@@ -721751,7 +722287,7 @@ async function enrichLogs(allLogs, startIndex, count4) {
|
|
|
721751
722287
|
}
|
|
721752
722288
|
return { logs: result, nextIndex: i6 };
|
|
721753
722289
|
}
|
|
721754
|
-
var VERSION6, MAX_TOMBSTONE_REWRITE_BYTES, SKIP_FIRST_PROMPT_PATTERN, EPHEMERAL_PROGRESS_TYPES, MAX_TRANSCRIPT_READ_BYTES, agentTranscriptSubdirs, getProjectDir2, project = null, cleanupRegistered6 = false, REMOTE_FLUSH_INTERVAL_MS = 10, METADATA_TYPE_MARKERS, METADATA_MARKER_BUFS, METADATA_PREFIX_BOUND = 25, getSessionMessages, INITIAL_ENRICH_COUNT = 50;
|
|
722290
|
+
var VERSION6, transcriptWriteFs, transcriptWriteFailureWarned = false, sessionSavingOffWarned = false, MAX_TOMBSTONE_REWRITE_BYTES, SKIP_FIRST_PROMPT_PATTERN, EPHEMERAL_PROGRESS_TYPES, MAX_TRANSCRIPT_READ_BYTES, agentTranscriptSubdirs, getProjectDir2, project = null, cleanupRegistered6 = false, REMOTE_FLUSH_INTERVAL_MS = 10, METADATA_TYPE_MARKERS, METADATA_MARKER_BUFS, METADATA_PREFIX_BOUND = 25, getSessionMessages, INITIAL_ENRICH_COUNT = 50;
|
|
721755
722291
|
var init_sessionStorage = __esm(() => {
|
|
721756
722292
|
init_featureFlags();
|
|
721757
722293
|
init_memoize();
|
|
@@ -721784,6 +722320,10 @@ var init_sessionStorage = __esm(() => {
|
|
|
721784
722320
|
init_slowOperations();
|
|
721785
722321
|
init_uuid();
|
|
721786
722322
|
VERSION6 = typeof MACRO !== "undefined" ? MACRO.VERSION : "unknown";
|
|
722323
|
+
transcriptWriteFs = {
|
|
722324
|
+
appendFile: fsAppendFile,
|
|
722325
|
+
mkdir: mkdir52
|
|
722326
|
+
};
|
|
721787
722327
|
MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
|
|
721788
722328
|
SKIP_FIRST_PROMPT_PATTERN = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
|
|
721789
722329
|
EPHEMERAL_PROGRESS_TYPES = new Set([
|
|
@@ -729282,7 +729822,7 @@ function getSessionSpecificGuidanceSection(enabledTools, skillToolCommands) {
|
|
|
729282
729822
|
return ["# Session-specific guidance", ...prependBullets(items)].join(`
|
|
729283
729823
|
`);
|
|
729284
729824
|
}
|
|
729285
|
-
async function getSystemPrompt(tools, model, additionalWorkingDirectories, mcpClients) {
|
|
729825
|
+
async function getSystemPrompt(tools, model, additionalWorkingDirectories, mcpClients, opts) {
|
|
729286
729826
|
if (isEnvTruthy(process.env.CLAUDE_CODE_SIMPLE)) {
|
|
729287
729827
|
return [
|
|
729288
729828
|
`You are Claude Code, Anthropic's official CLI for Claude.
|
|
@@ -729345,7 +729885,7 @@ ${CYBER_RISK_INSTRUCTION}`,
|
|
|
729345
729885
|
getSimpleSystemSection(model),
|
|
729346
729886
|
outputStyleConfig === null || outputStyleConfig.keepCodingInstructions === true ? getSimpleDoingTasksSection() : null,
|
|
729347
729887
|
getActionsSection(),
|
|
729348
|
-
...shouldUseGlobalCacheScope() ? [SYSTEM_PROMPT_DYNAMIC_BOUNDARY] : [],
|
|
729888
|
+
...shouldUseGlobalCacheScope() || opts?.excludeDynamicSections ? [SYSTEM_PROMPT_DYNAMIC_BOUNDARY] : [],
|
|
729349
729889
|
...resolvedDynamicSections,
|
|
729350
729890
|
`# Context management
|
|
729351
729891
|
When the conversation grows long, some or all of the current context is summarized; the summary, along with any remaining unsummarized context, is provided in the next context window so work can continue \u2014 you don't need to wrap up early or hand off mid-task.`
|
|
@@ -758353,7 +758893,7 @@ var MS_PER_DAY = 86400000, LOGIN_EXPIRY_WARN_WINDOW_MS;
|
|
|
758353
758893
|
var init_oauthLoginExpiry = __esm(() => {
|
|
758354
758894
|
init_providers();
|
|
758355
758895
|
init_auth6();
|
|
758356
|
-
LOGIN_EXPIRY_WARN_WINDOW_MS =
|
|
758896
|
+
LOGIN_EXPIRY_WARN_WINDOW_MS = 3 * MS_PER_DAY;
|
|
758357
758897
|
});
|
|
758358
758898
|
|
|
758359
758899
|
// src/components/PromptInput/OAuthExpiryNotice.tsx
|
|
@@ -767190,6 +767730,7 @@ function executePaste(after, count4, ctx) {
|
|
|
767190
767730
|
ctx.setText(newText);
|
|
767191
767731
|
ctx.setOffset(Math.max(insertPoint, newOffset));
|
|
767192
767732
|
}
|
|
767733
|
+
ctx.recordChange({ type: "paste", after, count: count4, linewise: isLinewise });
|
|
767193
767734
|
}
|
|
767194
767735
|
function executeIndent(dir, count4, ctx) {
|
|
767195
767736
|
const text2 = ctx.text;
|
|
@@ -767481,6 +768022,18 @@ function replayVisualChange(span, linewise, text2, ctx) {
|
|
|
767481
768022
|
const lastGr = lastGrapheme(text2);
|
|
767482
768023
|
ctx.setOffset(Math.max(range.from, range.from + text2.length - (lastGr.length || 1)));
|
|
767483
768024
|
}
|
|
768025
|
+
function replayOperatorChange(motion, count4, text2, ctx) {
|
|
768026
|
+
const target = resolveMotion(motion, ctx.cursor, count4);
|
|
768027
|
+
if (target.equals(ctx.cursor) && !text2)
|
|
768028
|
+
return;
|
|
768029
|
+
const range = getOperatorRange(ctx.cursor, target, motion, "change", count4);
|
|
768030
|
+
const content = ctx.text.slice(range.from, range.to);
|
|
768031
|
+
ctx.setRegister(content, range.linewise);
|
|
768032
|
+
const newText = ctx.text.slice(0, range.from) + text2 + ctx.text.slice(range.to);
|
|
768033
|
+
ctx.setText(newText);
|
|
768034
|
+
const lastGr = lastGrapheme(text2);
|
|
768035
|
+
ctx.setOffset(Math.max(range.from, range.from + text2.length - (lastGr.length || 1)));
|
|
768036
|
+
}
|
|
767484
768037
|
function replayVisualReplace(char, span, linewise, ctx) {
|
|
767485
768038
|
const range = getVisualRangeFromSpan(span, linewise, ctx);
|
|
767486
768039
|
if (range.from === range.to)
|
|
@@ -767598,6 +768151,34 @@ var init_operators = __esm(() => {
|
|
|
767598
768151
|
init_textObjects();
|
|
767599
768152
|
});
|
|
767600
768153
|
|
|
768154
|
+
// src/vim/lastChangeUpgrade.ts
|
|
768155
|
+
function upgradeLastChangeOnInsertExit(last3, insertedText) {
|
|
768156
|
+
if (last3?.type === "visualOp" && last3.op === "change") {
|
|
768157
|
+
return {
|
|
768158
|
+
type: "visualChange",
|
|
768159
|
+
span: last3.span,
|
|
768160
|
+
linewise: last3.linewise,
|
|
768161
|
+
text: insertedText
|
|
768162
|
+
};
|
|
768163
|
+
}
|
|
768164
|
+
if (last3?.type === "operator" && last3.op === "change" && isRealMotion(last3.motion, last3.op)) {
|
|
768165
|
+
return {
|
|
768166
|
+
type: "operatorChange",
|
|
768167
|
+
op: last3.op,
|
|
768168
|
+
motion: last3.motion,
|
|
768169
|
+
count: last3.count,
|
|
768170
|
+
text: insertedText
|
|
768171
|
+
};
|
|
768172
|
+
}
|
|
768173
|
+
if (insertedText) {
|
|
768174
|
+
return { type: "insert", text: insertedText };
|
|
768175
|
+
}
|
|
768176
|
+
return;
|
|
768177
|
+
}
|
|
768178
|
+
function isRealMotion(motion, op) {
|
|
768179
|
+
return motion !== op[0];
|
|
768180
|
+
}
|
|
768181
|
+
|
|
767601
768182
|
// src/vim/types.ts
|
|
767602
768183
|
function isOperatorKey(key4) {
|
|
767603
768184
|
return key4 in OPERATORS;
|
|
@@ -768188,19 +768769,9 @@ function useVimInput(props) {
|
|
|
768188
768769
|
pendingRemapRef.current = null;
|
|
768189
768770
|
const current = vimStateRef.current;
|
|
768190
768771
|
if (current.mode === "INSERT") {
|
|
768191
|
-
const
|
|
768192
|
-
if (
|
|
768193
|
-
persistentRef.current.lastChange =
|
|
768194
|
-
type: "visualChange",
|
|
768195
|
-
span: last3.span,
|
|
768196
|
-
linewise: last3.linewise,
|
|
768197
|
-
text: current.insertedText ?? ""
|
|
768198
|
-
};
|
|
768199
|
-
} else if (current.insertedText) {
|
|
768200
|
-
persistentRef.current.lastChange = {
|
|
768201
|
-
type: "insert",
|
|
768202
|
-
text: current.insertedText
|
|
768203
|
-
};
|
|
768772
|
+
const upgraded = upgradeLastChangeOnInsertExit(persistentRef.current.lastChange, current.insertedText ?? "");
|
|
768773
|
+
if (upgraded) {
|
|
768774
|
+
persistentRef.current.lastChange = upgraded;
|
|
768204
768775
|
}
|
|
768205
768776
|
}
|
|
768206
768777
|
if (!opts?.keepOffset) {
|
|
@@ -768307,6 +768878,12 @@ function useVimInput(props) {
|
|
|
768307
768878
|
case "visualCase":
|
|
768308
768879
|
replayVisualCase(change.op, change.span, change.linewise, ctx);
|
|
768309
768880
|
break;
|
|
768881
|
+
case "paste":
|
|
768882
|
+
executePaste(change.after, change.count, ctx);
|
|
768883
|
+
break;
|
|
768884
|
+
case "operatorChange":
|
|
768885
|
+
replayOperatorChange(change.motion, change.count, change.text, ctx);
|
|
768886
|
+
break;
|
|
768310
768887
|
}
|
|
768311
768888
|
}
|
|
768312
768889
|
function handleVimInput(rawInput, key4) {
|
|
@@ -768748,6 +769325,11 @@ var init_pasteNewlineDecoder = __esm(() => {
|
|
|
768748
769325
|
CSIU_RE = new RegExp(String.fromCodePoint(27) + "\\[(\\d+)(?:;\\d+)?u", "g");
|
|
768749
769326
|
});
|
|
768750
769327
|
|
|
769328
|
+
// src/components/statusLineUpdateGate.ts
|
|
769329
|
+
function initStatusLinePreviousMessageId(initialLastAssistantMessageId) {
|
|
769330
|
+
return initialLastAssistantMessageId;
|
|
769331
|
+
}
|
|
769332
|
+
|
|
768751
769333
|
// src/components/StatusLine.tsx
|
|
768752
769334
|
function statusLineShouldDisplay(settings) {
|
|
768753
769335
|
if (feature("KAIROS") && getKairosActive())
|
|
@@ -768883,7 +769465,7 @@ function StatusLineInner({
|
|
|
768883
769465
|
const mainLoopModelRef = import_react251.useRef(mainLoopModel);
|
|
768884
769466
|
mainLoopModelRef.current = mainLoopModel;
|
|
768885
769467
|
const previousStateRef = import_react251.useRef({
|
|
768886
|
-
messageId:
|
|
769468
|
+
messageId: initStatusLinePreviousMessageId(lastAssistantMessageId),
|
|
768887
769469
|
exceeds200kTokens: false,
|
|
768888
769470
|
permissionMode,
|
|
768889
769471
|
vimMode,
|
|
@@ -791314,9 +791896,16 @@ function recordTipShown(tipId) {
|
|
|
791314
791896
|
const numStartups = getGlobalConfig().numStartups;
|
|
791315
791897
|
saveGlobalConfig((c9) => {
|
|
791316
791898
|
const history = c9.tipsHistory ?? {};
|
|
791317
|
-
|
|
791318
|
-
|
|
791319
|
-
|
|
791899
|
+
const shownCount = c9.tipsShownCount ?? {};
|
|
791900
|
+
const nextShownCount = { ...shownCount, [tipId]: (shownCount[tipId] ?? 0) + 1 };
|
|
791901
|
+
if (history[tipId] === numStartups && shownCount[tipId] !== undefined) {
|
|
791902
|
+
return { ...c9, tipsShownCount: nextShownCount };
|
|
791903
|
+
}
|
|
791904
|
+
return {
|
|
791905
|
+
...c9,
|
|
791906
|
+
tipsHistory: { ...history, [tipId]: numStartups },
|
|
791907
|
+
tipsShownCount: nextShownCount
|
|
791908
|
+
};
|
|
791320
791909
|
});
|
|
791321
791910
|
}
|
|
791322
791911
|
function getSessionsSinceLastShown(tipId) {
|
|
@@ -791326,6 +791915,15 @@ function getSessionsSinceLastShown(tipId) {
|
|
|
791326
791915
|
return Infinity;
|
|
791327
791916
|
return config8.numStartups - lastShown;
|
|
791328
791917
|
}
|
|
791918
|
+
function getTipShownCount(tipId) {
|
|
791919
|
+
return getGlobalConfig().tipsShownCount?.[tipId] ?? 0;
|
|
791920
|
+
}
|
|
791921
|
+
function isTipLifetimeCapped(tipId, maxImpressions) {
|
|
791922
|
+
if (maxImpressions === undefined || maxImpressions <= 0)
|
|
791923
|
+
return false;
|
|
791924
|
+
return getTipShownCount(tipId) >= maxImpressions;
|
|
791925
|
+
}
|
|
791926
|
+
var FRONTEND_DESIGN_TIP_MAX_IMPRESSIONS = 3;
|
|
791329
791927
|
var init_tipHistory = __esm(() => {
|
|
791330
791928
|
init_config4();
|
|
791331
791929
|
});
|
|
@@ -791571,7 +792169,7 @@ async function getRelevantTips(context8) {
|
|
|
791571
792169
|
}
|
|
791572
792170
|
const tips = [...externalTips, ...internalOnlyTips];
|
|
791573
792171
|
const isRelevant = await Promise.all(tips.map((_4) => _4.isRelevant(context8)));
|
|
791574
|
-
const filtered = tips.filter((_4, index2) => isRelevant[index2]).filter((_4) => getSessionsSinceLastShown(_4.id) >= _4.cooldownSessions);
|
|
792172
|
+
const filtered = tips.filter((_4, index2) => isRelevant[index2]).filter((_4) => !isTipLifetimeCapped(_4.id, _4.maxImpressions)).filter((_4) => getSessionsSinceLastShown(_4.id) >= _4.cooldownSessions);
|
|
791575
792173
|
return [...filtered, ...customTips];
|
|
791576
792174
|
}
|
|
791577
792175
|
var _isOfficialMarketplaceInstalledCache, externalTips, internalOnlyTips;
|
|
@@ -791943,6 +792541,7 @@ var init_tipRegistry = __esm(() => {
|
|
|
791943
792541
|
${blue2(`/plugin install frontend-design@${OFFICIAL_MARKETPLACE_NAME}`)}`;
|
|
791944
792542
|
},
|
|
791945
792543
|
cooldownSessions: 3,
|
|
792544
|
+
maxImpressions: FRONTEND_DESIGN_TIP_MAX_IMPRESSIONS,
|
|
791946
792545
|
isRelevant: async (context8) => isMarketplacePluginRelevant("frontend-design", context8, {
|
|
791947
792546
|
filePath: /\.(html|css|htm)$/i
|
|
791948
792547
|
})
|
|
@@ -807367,6 +807966,14 @@ var init_TeleportRepoMismatchDialog = __esm(() => {
|
|
|
807367
807966
|
jsx_runtime494 = __toESM(require_jsx_runtime(), 1);
|
|
807368
807967
|
});
|
|
807369
807968
|
|
|
807969
|
+
// src/screens/resumeFailureGate.ts
|
|
807970
|
+
function shouldRethrowResumeError(isCallerAwaiting) {
|
|
807971
|
+
return isCallerAwaiting;
|
|
807972
|
+
}
|
|
807973
|
+
function shouldResetResumingOnError(_error) {
|
|
807974
|
+
return true;
|
|
807975
|
+
}
|
|
807976
|
+
|
|
807370
807977
|
// src/screens/ResumeConversation.tsx
|
|
807371
807978
|
var exports_ResumeConversation = {};
|
|
807372
807979
|
__export(exports_ResumeConversation, {
|
|
@@ -807588,7 +808195,12 @@ function ResumeConversation({
|
|
|
807588
808195
|
success: false
|
|
807589
808196
|
});
|
|
807590
808197
|
logError2(e4);
|
|
807591
|
-
|
|
808198
|
+
if (shouldResetResumingOnError(e4)) {
|
|
808199
|
+
setResuming(false);
|
|
808200
|
+
}
|
|
808201
|
+
if (shouldRethrowResumeError(false)) {
|
|
808202
|
+
throw e4;
|
|
808203
|
+
}
|
|
807592
808204
|
}
|
|
807593
808205
|
}
|
|
807594
808206
|
if (crossProjectCommand) {
|
|
@@ -809156,6 +809768,7 @@ function parseCodeReviewArgs(args) {
|
|
|
809156
809768
|
function registerCodeReviewSkill() {
|
|
809157
809769
|
registerBundledSkill({
|
|
809158
809770
|
name: "code-review",
|
|
809771
|
+
context: "fork",
|
|
809159
809772
|
description: "Review the current diff for correctness bugs and reuse/simplification/efficiency cleanups at the given effort level (low/medium: fewer, high-confidence findings; high\u2192max: broader coverage, may include uncertain findings). Pass --comment to post findings as inline PR comments, or --fix to apply the findings to the working tree after the review.",
|
|
809160
809773
|
argumentHint: CODE_REVIEW_ARGUMENT_HINT,
|
|
809161
809774
|
userInvocable: true,
|
|
@@ -812717,17 +813330,114 @@ var init_protocolHandler = __esm(() => {
|
|
|
812717
813330
|
init_terminalLauncher();
|
|
812718
813331
|
});
|
|
812719
813332
|
|
|
813333
|
+
// src/utils/plugins/fetchPluginZip.ts
|
|
813334
|
+
var exports_fetchPluginZip = {};
|
|
813335
|
+
__export(exports_fetchPluginZip, {
|
|
813336
|
+
validatePluginZipUrl: () => validatePluginZipUrl,
|
|
813337
|
+
fetchPluginZipFromUrl: () => fetchPluginZipFromUrl,
|
|
813338
|
+
MAX_PLUGIN_ZIP_BYTES: () => MAX_PLUGIN_ZIP_BYTES,
|
|
813339
|
+
DEFAULT_PLUGIN_ZIP_TIMEOUT_MS: () => DEFAULT_PLUGIN_ZIP_TIMEOUT_MS
|
|
813340
|
+
});
|
|
813341
|
+
import { randomUUID as randomUUID64 } from "crypto";
|
|
813342
|
+
import { mkdir as mkdir60, open as open17, rm as rm14 } from "fs/promises";
|
|
813343
|
+
import { tmpdir as tmpdir19 } from "os";
|
|
813344
|
+
import { join as join186 } from "path";
|
|
813345
|
+
function validatePluginZipUrl(raw) {
|
|
813346
|
+
let parsed;
|
|
813347
|
+
try {
|
|
813348
|
+
parsed = new URL(raw);
|
|
813349
|
+
} catch {
|
|
813350
|
+
throw new Error(`--plugin-url: invalid URL "${raw}". Expected an https:// URL to a plugin .zip.`);
|
|
813351
|
+
}
|
|
813352
|
+
if (parsed.protocol !== "https:") {
|
|
813353
|
+
throw new Error(`--plugin-url: only https:// URLs are accepted (got "${parsed.protocol}"). OCC fetches plugin zips over HTTPS only.`);
|
|
813354
|
+
}
|
|
813355
|
+
return parsed;
|
|
813356
|
+
}
|
|
813357
|
+
async function openForWrite(path43) {
|
|
813358
|
+
const handle2 = await open17(path43, "w");
|
|
813359
|
+
return {
|
|
813360
|
+
write: async (chunk) => {
|
|
813361
|
+
await handle2.writeFile(chunk);
|
|
813362
|
+
},
|
|
813363
|
+
close: async () => {
|
|
813364
|
+
await handle2.close();
|
|
813365
|
+
}
|
|
813366
|
+
};
|
|
813367
|
+
}
|
|
813368
|
+
async function fetchPluginZipFromUrl(rawUrl, options = {}) {
|
|
813369
|
+
const url3 = validatePluginZipUrl(rawUrl);
|
|
813370
|
+
const maxBytes = options.maxBytes ?? MAX_PLUGIN_ZIP_BYTES;
|
|
813371
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_PLUGIN_ZIP_TIMEOUT_MS;
|
|
813372
|
+
const doFetch = options.fetchImpl ?? fetch;
|
|
813373
|
+
const controller = new AbortController;
|
|
813374
|
+
const timer2 = setTimeout(() => controller.abort(), timeoutMs);
|
|
813375
|
+
let sessionTmp = null;
|
|
813376
|
+
try {
|
|
813377
|
+
const response3 = await doFetch(url3, {
|
|
813378
|
+
method: "GET",
|
|
813379
|
+
redirect: "error",
|
|
813380
|
+
signal: controller.signal
|
|
813381
|
+
});
|
|
813382
|
+
if (!response3.ok) {
|
|
813383
|
+
throw new Error(`--plugin-url: fetch "${rawUrl}" failed: HTTP ${response3.status}${response3.statusText ? ` ${response3.statusText}` : ""}`);
|
|
813384
|
+
}
|
|
813385
|
+
if (response3.body === null) {
|
|
813386
|
+
throw new Error(`--plugin-url: response from "${rawUrl}" has no body`);
|
|
813387
|
+
}
|
|
813388
|
+
sessionTmp = join186(tmpdir19(), `occ-plugin-url-${randomUUID64()}`);
|
|
813389
|
+
await mkdir60(sessionTmp, { recursive: true });
|
|
813390
|
+
const zipPath = join186(sessionTmp, "plugin.zip");
|
|
813391
|
+
const reader = response3.body.getReader();
|
|
813392
|
+
const writer = await openForWrite(zipPath);
|
|
813393
|
+
let received = 0;
|
|
813394
|
+
try {
|
|
813395
|
+
for (;; ) {
|
|
813396
|
+
const { done, value } = await reader.read();
|
|
813397
|
+
if (done) {
|
|
813398
|
+
break;
|
|
813399
|
+
}
|
|
813400
|
+
received += value.byteLength;
|
|
813401
|
+
if (received > maxBytes) {
|
|
813402
|
+
throw new Error(`--plugin-url: zip from "${rawUrl}" exceeds the ${maxBytes}-byte limit (received >= ${received} bytes).`);
|
|
813403
|
+
}
|
|
813404
|
+
await writer.write(value);
|
|
813405
|
+
}
|
|
813406
|
+
} finally {
|
|
813407
|
+
await writer.close();
|
|
813408
|
+
}
|
|
813409
|
+
if (received === 0) {
|
|
813410
|
+
throw new Error(`--plugin-url: response from "${rawUrl}" was empty`);
|
|
813411
|
+
}
|
|
813412
|
+
return { path: zipPath, url: rawUrl };
|
|
813413
|
+
} catch (error52) {
|
|
813414
|
+
if (sessionTmp !== null) {
|
|
813415
|
+
await rm14(sessionTmp, { recursive: true, force: true }).catch(() => {});
|
|
813416
|
+
}
|
|
813417
|
+
if (controller.signal.aborted) {
|
|
813418
|
+
throw new Error(`--plugin-url: fetch "${rawUrl}" timed out after ${timeoutMs}ms.`);
|
|
813419
|
+
}
|
|
813420
|
+
throw error52;
|
|
813421
|
+
} finally {
|
|
813422
|
+
clearTimeout(timer2);
|
|
813423
|
+
}
|
|
813424
|
+
}
|
|
813425
|
+
var MAX_PLUGIN_ZIP_BYTES, DEFAULT_PLUGIN_ZIP_TIMEOUT_MS = 45000;
|
|
813426
|
+
var init_fetchPluginZip = __esm(() => {
|
|
813427
|
+
MAX_PLUGIN_ZIP_BYTES = 100 * 1024 * 1024;
|
|
813428
|
+
});
|
|
813429
|
+
|
|
812720
813430
|
// src/utils/computerUse/setup.ts
|
|
812721
813431
|
var exports_setup = {};
|
|
812722
813432
|
__export(exports_setup, {
|
|
812723
813433
|
setupComputerUseMCP: () => setupComputerUseMCP
|
|
812724
813434
|
});
|
|
812725
|
-
import { join as
|
|
813435
|
+
import { join as join187 } from "path";
|
|
812726
813436
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
812727
813437
|
function setupComputerUseMCP() {
|
|
812728
813438
|
const allowedTools = buildComputerUseTools(CLI_CU_CAPABILITIES, getChicagoCoordinateMode()).map((t4) => buildMcpToolName(COMPUTER_USE_MCP_SERVER_NAME, t4.name));
|
|
812729
813439
|
const args = isInBundledMode() ? ["--computer-use-mcp"] : [
|
|
812730
|
-
|
|
813440
|
+
join187(fileURLToPath10(import.meta.url), "..", "cli.js"),
|
|
812731
813441
|
"--computer-use-mcp"
|
|
812732
813442
|
];
|
|
812733
813443
|
return {
|
|
@@ -812949,7 +813659,7 @@ var init_sessionMemory = __esm(() => {
|
|
|
812949
813659
|
// src/utils/iTermBackup.ts
|
|
812950
813660
|
import { copyFile as copyFile12, stat as stat54 } from "fs/promises";
|
|
812951
813661
|
import { homedir as homedir52 } from "os";
|
|
812952
|
-
import { join as
|
|
813662
|
+
import { join as join188 } from "path";
|
|
812953
813663
|
function markITerm2SetupComplete() {
|
|
812954
813664
|
saveGlobalConfig((current) => ({
|
|
812955
813665
|
...current,
|
|
@@ -812964,7 +813674,7 @@ function getIterm2RecoveryInfo() {
|
|
|
812964
813674
|
};
|
|
812965
813675
|
}
|
|
812966
813676
|
function getITerm2PlistPath() {
|
|
812967
|
-
return
|
|
813677
|
+
return join188(homedir52(), "Library", "Preferences", "com.googlecode.iterm2.plist");
|
|
812968
813678
|
}
|
|
812969
813679
|
async function checkAndRestoreITerm2Backup() {
|
|
812970
813680
|
const { inProgress, backupPath } = getIterm2RecoveryInfo();
|
|
@@ -813692,7 +814402,7 @@ var init_queryContext = __esm(() => {
|
|
|
813692
814402
|
});
|
|
813693
814403
|
|
|
813694
814404
|
// src/QueryEngine.ts
|
|
813695
|
-
import { randomUUID as
|
|
814405
|
+
import { randomUUID as randomUUID65 } from "crypto";
|
|
813696
814406
|
function monotonicNow() {
|
|
813697
814407
|
if (typeof performance !== "undefined" && typeof performance.now === "function") {
|
|
813698
814408
|
return performance.now();
|
|
@@ -814010,7 +814720,7 @@ class QueryEngine {
|
|
|
814010
814720
|
modelUsage: getModelUsage(),
|
|
814011
814721
|
permission_denials: this.permissionDenials,
|
|
814012
814722
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
814013
|
-
uuid:
|
|
814723
|
+
uuid: randomUUID65()
|
|
814014
814724
|
};
|
|
814015
814725
|
return;
|
|
814016
814726
|
}
|
|
@@ -814134,7 +814844,7 @@ class QueryEngine {
|
|
|
814134
814844
|
event,
|
|
814135
814845
|
session_id: getSessionId(),
|
|
814136
814846
|
parent_tool_use_id: null,
|
|
814137
|
-
uuid:
|
|
814847
|
+
uuid: randomUUID65()
|
|
814138
814848
|
};
|
|
814139
814849
|
}
|
|
814140
814850
|
break;
|
|
@@ -814169,7 +814879,7 @@ class QueryEngine {
|
|
|
814169
814879
|
modelUsage: getModelUsage(),
|
|
814170
814880
|
permission_denials: this.permissionDenials,
|
|
814171
814881
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
814172
|
-
uuid:
|
|
814882
|
+
uuid: randomUUID65(),
|
|
814173
814883
|
errors: [
|
|
814174
814884
|
`Reached maximum number of turns (${attachment.maxTurns})`
|
|
814175
814885
|
]
|
|
@@ -814277,7 +814987,7 @@ class QueryEngine {
|
|
|
814277
814987
|
modelUsage: getModelUsage(),
|
|
814278
814988
|
permission_denials: this.permissionDenials,
|
|
814279
814989
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
814280
|
-
uuid:
|
|
814990
|
+
uuid: randomUUID65(),
|
|
814281
814991
|
errors: [`Reached maximum budget ($${maxBudgetUsd})`]
|
|
814282
814992
|
};
|
|
814283
814993
|
return;
|
|
@@ -814306,7 +815016,7 @@ class QueryEngine {
|
|
|
814306
815016
|
modelUsage: getModelUsage(),
|
|
814307
815017
|
permission_denials: this.permissionDenials,
|
|
814308
815018
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
814309
|
-
uuid:
|
|
815019
|
+
uuid: randomUUID65(),
|
|
814310
815020
|
errors: [
|
|
814311
815021
|
`Failed to provide valid structured output after ${maxRetries} attempts`
|
|
814312
815022
|
]
|
|
@@ -814338,7 +815048,7 @@ class QueryEngine {
|
|
|
814338
815048
|
modelUsage: getModelUsage(),
|
|
814339
815049
|
permission_denials: this.permissionDenials,
|
|
814340
815050
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
814341
|
-
uuid:
|
|
815051
|
+
uuid: randomUUID65(),
|
|
814342
815052
|
errors: (() => {
|
|
814343
815053
|
const all4 = getInMemoryErrors();
|
|
814344
815054
|
const start = errorLogWatermark ? all4.lastIndexOf(errorLogWatermark) + 1 : 0;
|
|
@@ -814375,7 +815085,7 @@ class QueryEngine {
|
|
|
814375
815085
|
permission_denials: this.permissionDenials,
|
|
814376
815086
|
structured_output: structuredOutputFromTool,
|
|
814377
815087
|
fast_mode_state: getFastModeState(mainLoopModel, initialAppState.fastMode),
|
|
814378
|
-
uuid:
|
|
815088
|
+
uuid: randomUUID65()
|
|
814379
815089
|
};
|
|
814380
815090
|
}
|
|
814381
815091
|
interrupt() {
|
|
@@ -814529,7 +815239,7 @@ var init_QueryEngine = __esm(() => {
|
|
|
814529
815239
|
var FILE_COUNT_LIMIT = 1e4, OUTPUTS_SUBDIR = ".claude-code/outputs", DEFAULT_UPLOAD_CONCURRENCY = 5;
|
|
814530
815240
|
|
|
814531
815241
|
// src/utils/filePersistence/filePersistence.ts
|
|
814532
|
-
import { join as
|
|
815242
|
+
import { join as join189, relative as relative39 } from "path";
|
|
814533
815243
|
async function runFilePersistence(turnStartTime, signal) {
|
|
814534
815244
|
const environmentKind = getEnvironmentKind();
|
|
814535
815245
|
if (environmentKind !== "byoc") {
|
|
@@ -814548,7 +815258,7 @@ async function runFilePersistence(turnStartTime, signal) {
|
|
|
814548
815258
|
oauthToken: sessionAccessToken,
|
|
814549
815259
|
sessionId
|
|
814550
815260
|
};
|
|
814551
|
-
const outputsDir =
|
|
815261
|
+
const outputsDir = join189(getCwd(), sessionId, OUTPUTS_SUBDIR);
|
|
814552
815262
|
if (signal?.aborted) {
|
|
814553
815263
|
logDebug("Persistence aborted before processing");
|
|
814554
815264
|
return null;
|
|
@@ -814719,11 +815429,11 @@ var init_idleTimeout = __esm(() => {
|
|
|
814719
815429
|
});
|
|
814720
815430
|
|
|
814721
815431
|
// src/utils/sessionUrl.ts
|
|
814722
|
-
import { randomUUID as
|
|
815432
|
+
import { randomUUID as randomUUID66 } from "crypto";
|
|
814723
815433
|
function parseSessionIdentifier(resumeIdentifier) {
|
|
814724
815434
|
if (resumeIdentifier.toLowerCase().endsWith(".jsonl")) {
|
|
814725
815435
|
return {
|
|
814726
|
-
sessionId:
|
|
815436
|
+
sessionId: randomUUID66(),
|
|
814727
815437
|
ingressUrl: null,
|
|
814728
815438
|
isUrl: false,
|
|
814729
815439
|
jsonlFile: resumeIdentifier,
|
|
@@ -814742,7 +815452,7 @@ function parseSessionIdentifier(resumeIdentifier) {
|
|
|
814742
815452
|
try {
|
|
814743
815453
|
const url3 = new URL(resumeIdentifier);
|
|
814744
815454
|
return {
|
|
814745
|
-
sessionId:
|
|
815455
|
+
sessionId: randomUUID66(),
|
|
814746
815456
|
ingressUrl: url3.href,
|
|
814747
815457
|
isUrl: true,
|
|
814748
815458
|
jsonlFile: null,
|
|
@@ -814757,7 +815467,7 @@ var init_sessionUrl = __esm(() => {
|
|
|
814757
815467
|
|
|
814758
815468
|
// src/utils/plugins/zipCacheAdapters.ts
|
|
814759
815469
|
import { readFile as readFile68 } from "fs/promises";
|
|
814760
|
-
import { join as
|
|
815470
|
+
import { join as join190 } from "path";
|
|
814761
815471
|
async function readZipCacheKnownMarketplaces() {
|
|
814762
815472
|
try {
|
|
814763
815473
|
const content = await readFile68(getZipCacheKnownMarketplacesPath(), "utf-8");
|
|
@@ -814782,13 +815492,13 @@ async function saveMarketplaceJsonToZipCache(marketplaceName, installLocation) {
|
|
|
814782
815492
|
const content = await readMarketplaceJsonContent(installLocation);
|
|
814783
815493
|
if (content !== null) {
|
|
814784
815494
|
const relPath = getMarketplaceJsonRelativePath(marketplaceName);
|
|
814785
|
-
await atomicWriteToZipCache(
|
|
815495
|
+
await atomicWriteToZipCache(join190(zipCachePath, relPath), content);
|
|
814786
815496
|
}
|
|
814787
815497
|
}
|
|
814788
815498
|
async function readMarketplaceJsonContent(dir) {
|
|
814789
815499
|
const candidates = [
|
|
814790
|
-
|
|
814791
|
-
|
|
815500
|
+
join190(dir, ".claude-plugin", "marketplace.json"),
|
|
815501
|
+
join190(dir, "marketplace.json"),
|
|
814792
815502
|
dir
|
|
814793
815503
|
];
|
|
814794
815504
|
for (const candidate of candidates) {
|
|
@@ -814928,7 +815638,7 @@ __export(exports_print, {
|
|
|
814928
815638
|
import { readFile as readFile69, stat as stat55 } from "fs/promises";
|
|
814929
815639
|
import { dirname as dirname84 } from "path";
|
|
814930
815640
|
import { cwd as cwd2 } from "process";
|
|
814931
|
-
import { randomUUID as
|
|
815641
|
+
import { randomUUID as randomUUID67 } from "crypto";
|
|
814932
815642
|
function trackReceivedMessageUuid(uuid5) {
|
|
814933
815643
|
if (receivedMessageUuids.has(uuid5)) {
|
|
814934
815644
|
return false;
|
|
@@ -815058,7 +815768,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
815058
815768
|
hook_id: event.hookId,
|
|
815059
815769
|
hook_name: event.hookName,
|
|
815060
815770
|
hook_event: event.hookEvent,
|
|
815061
|
-
uuid:
|
|
815771
|
+
uuid: randomUUID67(),
|
|
815062
815772
|
session_id: getSessionId()
|
|
815063
815773
|
};
|
|
815064
815774
|
case "progress":
|
|
@@ -815071,7 +815781,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
815071
815781
|
stdout: event.stdout,
|
|
815072
815782
|
stderr: event.stderr,
|
|
815073
815783
|
output: event.output,
|
|
815074
|
-
uuid:
|
|
815784
|
+
uuid: randomUUID67(),
|
|
815075
815785
|
session_id: getSessionId()
|
|
815076
815786
|
};
|
|
815077
815787
|
case "response":
|
|
@@ -815086,7 +815796,7 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
815086
815796
|
stderr: event.stderr,
|
|
815087
815797
|
exit_code: event.exitCode,
|
|
815088
815798
|
outcome: event.outcome,
|
|
815089
|
-
uuid:
|
|
815799
|
+
uuid: randomUUID67(),
|
|
815090
815800
|
session_id: getSessionId()
|
|
815091
815801
|
};
|
|
815092
815802
|
}
|
|
@@ -815130,6 +815840,32 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
815130
815840
|
saveAgentSetting(restoredAgent.agentType);
|
|
815131
815841
|
}
|
|
815132
815842
|
}
|
|
815843
|
+
if (options.excludeDynamicSections && !options.systemPrompt) {
|
|
815844
|
+
const { getSystemPrompt: getSystemPrompt2, SYSTEM_PROMPT_DYNAMIC_BOUNDARY: SYSTEM_PROMPT_DYNAMIC_BOUNDARY2 } = await Promise.resolve().then(() => (init_prompts4(), exports_prompts));
|
|
815845
|
+
const addDirs = options.addDir;
|
|
815846
|
+
const parts = await getSystemPrompt2(tools, options.userSpecifiedModel ?? getMainLoopModel(), addDirs, [], { excludeDynamicSections: true });
|
|
815847
|
+
const joined = parts.join(`
|
|
815848
|
+
|
|
815849
|
+
`);
|
|
815850
|
+
const boundaryIdx = joined.indexOf(SYSTEM_PROMPT_DYNAMIC_BOUNDARY2);
|
|
815851
|
+
if (boundaryIdx !== -1) {
|
|
815852
|
+
const staticPre = joined.slice(0, boundaryIdx).replace(/\s+$/, "");
|
|
815853
|
+
const after = joined.slice(boundaryIdx + SYSTEM_PROMPT_DYNAMIC_BOUNDARY2.length);
|
|
815854
|
+
const tailMarker = "# Context management";
|
|
815855
|
+
const tailIdx = after.indexOf(tailMarker);
|
|
815856
|
+
const dynamicPart = (tailIdx !== -1 ? after.slice(0, tailIdx) : after).trim();
|
|
815857
|
+
const tailPart = tailIdx !== -1 ? after.slice(tailIdx).trim() : "";
|
|
815858
|
+
const staticSystemPrompt = [staticPre, tailPart].filter(Boolean).join(`
|
|
815859
|
+
|
|
815860
|
+
`);
|
|
815861
|
+
if (staticSystemPrompt) {
|
|
815862
|
+
options.systemPrompt = staticSystemPrompt;
|
|
815863
|
+
}
|
|
815864
|
+
if (dynamicPart) {
|
|
815865
|
+
structuredIO.prependUserMessage(dynamicPart);
|
|
815866
|
+
}
|
|
815867
|
+
}
|
|
815868
|
+
}
|
|
815133
815869
|
if (initialMessages.length === 0 && process.exitCode !== undefined) {
|
|
815134
815870
|
return;
|
|
815135
815871
|
}
|
|
@@ -815293,7 +816029,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815293
816029
|
subtype: "status",
|
|
815294
816030
|
status: null,
|
|
815295
816031
|
permissionMode: newMode,
|
|
815296
|
-
uuid:
|
|
816032
|
+
uuid: randomUUID67(),
|
|
815297
816033
|
session_id: getSessionId()
|
|
815298
816034
|
});
|
|
815299
816035
|
}
|
|
@@ -815314,7 +816050,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815314
816050
|
isAuthenticating: status2.isAuthenticating,
|
|
815315
816051
|
output: status2.output,
|
|
815316
816052
|
error: status2.error,
|
|
815317
|
-
uuid:
|
|
816053
|
+
uuid: randomUUID67(),
|
|
815318
816054
|
session_id: getSessionId()
|
|
815319
816055
|
});
|
|
815320
816056
|
});
|
|
@@ -815325,7 +816061,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815325
816061
|
output2.enqueue({
|
|
815326
816062
|
type: "rate_limit_event",
|
|
815327
816063
|
rate_limit_info: rateLimitInfo,
|
|
815328
|
-
uuid:
|
|
816064
|
+
uuid: randomUUID67(),
|
|
815329
816065
|
session_id: getSessionId()
|
|
815330
816066
|
});
|
|
815331
816067
|
}
|
|
@@ -815341,7 +816077,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815341
816077
|
enqueue({
|
|
815342
816078
|
mode: "prompt",
|
|
815343
816079
|
value: turnInterruptionState.message.message.content,
|
|
815344
|
-
uuid:
|
|
816080
|
+
uuid: randomUUID67()
|
|
815345
816081
|
});
|
|
815346
816082
|
}
|
|
815347
816083
|
const modelOptions = getModelOptions();
|
|
@@ -815436,7 +816172,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815436
816172
|
subtype: "elicitation_complete",
|
|
815437
816173
|
mcp_server_name: serverName,
|
|
815438
816174
|
elicitation_id: elicitationId,
|
|
815439
|
-
uuid:
|
|
816175
|
+
uuid: randomUUID67(),
|
|
815440
816176
|
session_id: getSessionId()
|
|
815441
816177
|
});
|
|
815442
816178
|
});
|
|
@@ -815682,7 +816418,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815682
816418
|
enqueue({
|
|
815683
816419
|
mode: "prompt",
|
|
815684
816420
|
value: tickContent,
|
|
815685
|
-
uuid:
|
|
816421
|
+
uuid: randomUUID67(),
|
|
815686
816422
|
priority: "later",
|
|
815687
816423
|
isMeta: true
|
|
815688
816424
|
});
|
|
@@ -815806,7 +816542,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815806
816542
|
duration_ms: durationMsMatch ? parseInt(durationMsMatch[1], 10) : 0
|
|
815807
816543
|
} : undefined,
|
|
815808
816544
|
session_id: getSessionId(),
|
|
815809
|
-
uuid:
|
|
816545
|
+
uuid: randomUUID67()
|
|
815810
816546
|
});
|
|
815811
816547
|
}
|
|
815812
816548
|
}
|
|
@@ -815881,7 +816617,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815881
816617
|
subtype: "status",
|
|
815882
816618
|
status: status2,
|
|
815883
816619
|
session_id: getSessionId(),
|
|
815884
|
-
uuid:
|
|
816620
|
+
uuid: randomUUID67()
|
|
815885
816621
|
});
|
|
815886
816622
|
}
|
|
815887
816623
|
})) {
|
|
@@ -815918,7 +816654,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815918
816654
|
files: result.persistedFiles,
|
|
815919
816655
|
failed: result.failedFiles,
|
|
815920
816656
|
processed_at: new Date().toISOString(),
|
|
815921
|
-
uuid:
|
|
816657
|
+
uuid: randomUUID67(),
|
|
815922
816658
|
session_id: getSessionId()
|
|
815923
816659
|
});
|
|
815924
816660
|
});
|
|
@@ -815941,7 +816677,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
815941
816677
|
const suggestionMsg = {
|
|
815942
816678
|
type: "prompt_suggestion",
|
|
815943
816679
|
suggestion: result.suggestion,
|
|
815944
|
-
uuid:
|
|
816680
|
+
uuid: randomUUID67(),
|
|
815945
816681
|
session_id: getSessionId()
|
|
815946
816682
|
};
|
|
815947
816683
|
const lastEmittedEntry = {
|
|
@@ -816031,7 +816767,7 @@ function runHeadlessStreaming(structuredIO, mcpClients, commands7, tools, initia
|
|
|
816031
816767
|
usage: EMPTY_USAGE,
|
|
816032
816768
|
modelUsage: {},
|
|
816033
816769
|
permission_denials: [],
|
|
816034
|
-
uuid:
|
|
816770
|
+
uuid: randomUUID67(),
|
|
816035
816771
|
errors: [
|
|
816036
816772
|
errorMessage(error52),
|
|
816037
816773
|
...getInMemoryErrors().map((_4) => _4.error)
|
|
@@ -816120,7 +816856,7 @@ ${m5.text}
|
|
|
816120
816856
|
enqueue({
|
|
816121
816857
|
mode: "prompt",
|
|
816122
816858
|
value: formatted,
|
|
816123
|
-
uuid:
|
|
816859
|
+
uuid: randomUUID67()
|
|
816124
816860
|
});
|
|
816125
816861
|
run();
|
|
816126
816862
|
return;
|
|
@@ -816131,7 +816867,7 @@ ${m5.text}
|
|
|
816131
816867
|
enqueue({
|
|
816132
816868
|
mode: "prompt",
|
|
816133
816869
|
value: SHUTDOWN_TEAM_PROMPT,
|
|
816134
|
-
uuid:
|
|
816870
|
+
uuid: randomUUID67()
|
|
816135
816871
|
});
|
|
816136
816872
|
run();
|
|
816137
816873
|
return;
|
|
@@ -816155,7 +816891,7 @@ ${m5.text}
|
|
|
816155
816891
|
enqueue({
|
|
816156
816892
|
mode: "prompt",
|
|
816157
816893
|
value: SHUTDOWN_TEAM_PROMPT,
|
|
816158
|
-
uuid:
|
|
816894
|
+
uuid: randomUUID67()
|
|
816159
816895
|
});
|
|
816160
816896
|
run();
|
|
816161
816897
|
} else {
|
|
@@ -816189,7 +816925,7 @@ ${m5.text}
|
|
|
816189
816925
|
enqueue({
|
|
816190
816926
|
mode: "prompt",
|
|
816191
816927
|
value: prompt,
|
|
816192
|
-
uuid:
|
|
816928
|
+
uuid: randomUUID67(),
|
|
816193
816929
|
priority: "later",
|
|
816194
816930
|
isMeta: true,
|
|
816195
816931
|
workload: WORKLOAD_CRON
|
|
@@ -816955,7 +817691,7 @@ ${m5.text}
|
|
|
816955
817691
|
subtype: "bridge_state",
|
|
816956
817692
|
state: state4,
|
|
816957
817693
|
detail,
|
|
816958
|
-
uuid:
|
|
817694
|
+
uuid: randomUUID67(),
|
|
816959
817695
|
session_id: getSessionId()
|
|
816960
817696
|
});
|
|
816961
817697
|
},
|
|
@@ -817285,7 +818021,7 @@ async function handleInitializeRequest(request5, requestId, initialized5, output
|
|
|
817285
818021
|
isAuthenticating: status2.isAuthenticating,
|
|
817286
818022
|
output: status2.output,
|
|
817287
818023
|
error: status2.error,
|
|
817288
|
-
uuid:
|
|
818024
|
+
uuid: randomUUID67(),
|
|
817289
818025
|
session_id: getSessionId()
|
|
817290
818026
|
});
|
|
817291
818027
|
}
|
|
@@ -817486,7 +818222,7 @@ function emitLoadError(message, outputFormat) {
|
|
|
817486
818222
|
usage: EMPTY_USAGE,
|
|
817487
818223
|
modelUsage: {},
|
|
817488
818224
|
permission_denials: [],
|
|
817489
|
-
uuid:
|
|
818225
|
+
uuid: randomUUID67(),
|
|
817490
818226
|
errors: [message]
|
|
817491
818227
|
};
|
|
817492
818228
|
process.stdout.write(jsonStringify(errorResult) + `
|
|
@@ -819107,14 +819843,14 @@ __export(exports_claudeDesktop, {
|
|
|
819107
819843
|
});
|
|
819108
819844
|
import { readdir as readdir38, readFile as readFile70, stat as stat56 } from "fs/promises";
|
|
819109
819845
|
import { homedir as homedir53 } from "os";
|
|
819110
|
-
import { join as
|
|
819846
|
+
import { join as join191 } from "path";
|
|
819111
819847
|
async function getClaudeDesktopConfigPath() {
|
|
819112
819848
|
const platform7 = getPlatform();
|
|
819113
819849
|
if (!SUPPORTED_PLATFORMS.includes(platform7)) {
|
|
819114
819850
|
throw new Error(`Unsupported platform: ${platform7} - Claude Desktop integration only works on macOS and WSL.`);
|
|
819115
819851
|
}
|
|
819116
819852
|
if (platform7 === "macos") {
|
|
819117
|
-
return
|
|
819853
|
+
return join191(homedir53(), "Library", "Application Support", "Claude", "claude_desktop_config.json");
|
|
819118
819854
|
}
|
|
819119
819855
|
const windowsHome = process.env.USERPROFILE ? process.env.USERPROFILE.replace(/\\/g, "/") : null;
|
|
819120
819856
|
if (windowsHome) {
|
|
@@ -819133,7 +819869,7 @@ async function getClaudeDesktopConfigPath() {
|
|
|
819133
819869
|
if (user.name === "Public" || user.name === "Default" || user.name === "Default User" || user.name === "All Users") {
|
|
819134
819870
|
continue;
|
|
819135
819871
|
}
|
|
819136
|
-
const potentialConfigPath =
|
|
819872
|
+
const potentialConfigPath = join191(usersDir, user.name, "AppData", "Roaming", "Claude", "claude_desktop_config.json");
|
|
819137
819873
|
try {
|
|
819138
819874
|
await stat56(potentialConfigPath);
|
|
819139
819875
|
return potentialConfigPath;
|
|
@@ -819323,7 +820059,7 @@ async function mcpListHandler() {
|
|
|
819323
820059
|
if (Object.keys(configs).length === 0) {
|
|
819324
820060
|
console.log("No MCP servers configured. Use `claude mcp add` to add a server.");
|
|
819325
820061
|
} else {
|
|
819326
|
-
console.log(`Checking MCP server health
|
|
820062
|
+
console.log(`Checking MCP server health\u2026
|
|
819327
820063
|
`);
|
|
819328
820064
|
const entries = Object.entries(configs);
|
|
819329
820065
|
const results = await pMap(entries, async ([name3, server]) => ({
|
|
@@ -820116,12 +820852,12 @@ __export(exports_install, {
|
|
|
820116
820852
|
install: () => install2
|
|
820117
820853
|
});
|
|
820118
820854
|
import { homedir as homedir54 } from "os";
|
|
820119
|
-
import { join as
|
|
820855
|
+
import { join as join192 } from "path";
|
|
820120
820856
|
function getInstallationPath2() {
|
|
820121
820857
|
const isWindows3 = env4.platform === "win32";
|
|
820122
820858
|
const homeDir = homedir54();
|
|
820123
820859
|
if (isWindows3) {
|
|
820124
|
-
const windowsPath =
|
|
820860
|
+
const windowsPath = join192(homeDir, ".local", "bin", "claude.exe");
|
|
820125
820861
|
return windowsPath.replace(/\//g, "\\");
|
|
820126
820862
|
}
|
|
820127
820863
|
return "~/.local/bin/claude";
|
|
@@ -820849,7 +821585,7 @@ var exports_projectPurge = {};
|
|
|
820849
821585
|
__export(exports_projectPurge, {
|
|
820850
821586
|
purgeProjectHandler: () => purgeProjectHandler
|
|
820851
821587
|
});
|
|
820852
|
-
import { join as
|
|
821588
|
+
import { join as join193 } from "path";
|
|
820853
821589
|
function resolveAbsolutePath(input2) {
|
|
820854
821590
|
if (!input2) {
|
|
820855
821591
|
return getCwd();
|
|
@@ -820868,7 +821604,7 @@ async function discoverAllProjectPaths() {
|
|
|
820868
821604
|
try {
|
|
820869
821605
|
const entries = await fs27.readdir(projectsDir);
|
|
820870
821606
|
for (const entry of entries) {
|
|
820871
|
-
paths2.add(
|
|
821607
|
+
paths2.add(join193(projectsDir, entry.name));
|
|
820872
821608
|
}
|
|
820873
821609
|
} catch {}
|
|
820874
821610
|
return [...paths2];
|
|
@@ -820878,7 +821614,7 @@ async function collectItemsForProject(projectPath) {
|
|
|
820878
821614
|
const warnings = [];
|
|
820879
821615
|
const fs27 = getFsImplementation();
|
|
820880
821616
|
const projectsDir = getProjectsDir2();
|
|
820881
|
-
const transcriptDir =
|
|
821617
|
+
const transcriptDir = join193(projectsDir, sanitizePath2(projectPath));
|
|
820882
821618
|
try {
|
|
820883
821619
|
const stat58 = await fs27.stat(transcriptDir);
|
|
820884
821620
|
if (stat58.isDirectory()) {
|
|
@@ -822186,9 +822922,26 @@ async function run() {
|
|
|
822186
822922
|
initSinks2();
|
|
822187
822923
|
profileCheckpoint("preAction_after_sinks");
|
|
822188
822924
|
const pluginDir = thisCommand.getOptionValue("pluginDir");
|
|
822925
|
+
const pluginUrl = thisCommand.getOptionValue("pluginUrl");
|
|
822926
|
+
const inlinePluginPaths = [];
|
|
822189
822927
|
if (Array.isArray(pluginDir) && pluginDir.length > 0 && pluginDir.every((p4) => typeof p4 === "string")) {
|
|
822190
|
-
|
|
822191
|
-
|
|
822928
|
+
inlinePluginPaths.push(...pluginDir);
|
|
822929
|
+
}
|
|
822930
|
+
if (Array.isArray(pluginUrl) && pluginUrl.length > 0 && pluginUrl.every((p4) => typeof p4 === "string")) {
|
|
822931
|
+
const { fetchPluginZipFromUrl: fetchPluginZipFromUrl2 } = await Promise.resolve().then(() => (init_fetchPluginZip(), exports_fetchPluginZip));
|
|
822932
|
+
for (const url3 of pluginUrl) {
|
|
822933
|
+
try {
|
|
822934
|
+
const fetched = await fetchPluginZipFromUrl2(url3);
|
|
822935
|
+
inlinePluginPaths.push(fetched.path);
|
|
822936
|
+
} catch (error52) {
|
|
822937
|
+
const { exitWithError: exitWithError3 } = await Promise.resolve().then(() => (init_process(), exports_process));
|
|
822938
|
+
exitWithError3(error52 instanceof Error ? error52.message : String(error52));
|
|
822939
|
+
}
|
|
822940
|
+
}
|
|
822941
|
+
}
|
|
822942
|
+
if (inlinePluginPaths.length > 0) {
|
|
822943
|
+
setInlinePlugins(inlinePluginPaths);
|
|
822944
|
+
clearPluginCache("preAction: --plugin-dir/--plugin-url inline plugins");
|
|
822192
822945
|
}
|
|
822193
822946
|
runMigrations();
|
|
822194
822947
|
profileCheckpoint("preAction_after_migrations");
|
|
@@ -822233,8 +822986,19 @@ async function run() {
|
|
|
822233
822986
|
throw new InvalidArgumentError(`It must be one of: ${allowed.join(", ")}`);
|
|
822234
822987
|
}
|
|
822235
822988
|
return value;
|
|
822236
|
-
})).option("--agent <agent>", `Agent for the current session. Overrides the 'agent' setting.`).option("--betas <betas...>", "Beta headers to include in API requests (API key users only)").option("--fallback-model <model>", "Enable automatic fallback to specified model when default model is overloaded (only works with --print)").addOption(new Option("--workload <tag>", "Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)").hideHelp()).option("--settings <file-or-json>", "Path to a settings JSON file or a JSON string to load additional settings from").option("--add-dir <directories...>", "Additional directories to allow tool access to").option("--ide", "Automatically connect to IDE on startup if exactly one valid IDE is available", () => true).option("--strict-mcp-config", "Only use MCP servers from --mcp-config, ignoring all other MCP configurations", () => true).option("--session-id <uuid>", "Use a specific session ID for the conversation (must be a valid UUID)").option("-n, --name <name>", "Set a display name for this session (shown in /resume and terminal title)").option("--agents <json>", `JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option("--setting-sources <sources>", "Comma-separated list of setting sources to load (user, project, local).").
|
|
822989
|
+
})).option("--agent <agent>", `Agent for the current session. Overrides the 'agent' setting.`).option("--betas <betas...>", "Beta headers to include in API requests (API key users only)").option("--fallback-model <model>", "Enable automatic fallback to specified model when default model is overloaded (only works with --print)").addOption(new Option("--workload <tag>", "Workload tag for billing-header attribution (cc_workload). Process-scoped; set by SDK daemon callers that spawn subprocesses for cron work. (only works with --print)").hideHelp()).option("--settings <file-or-json>", "Path to a settings JSON file or a JSON string to load additional settings from").option("--add-dir <directories...>", "Additional directories to allow tool access to").option("--ide", "Automatically connect to IDE on startup if exactly one valid IDE is available", () => true).option("--strict-mcp-config", "Only use MCP servers from --mcp-config, ignoring all other MCP configurations", () => true).option("--session-id <uuid>", "Use a specific session ID for the conversation (must be a valid UUID)").option("-n, --name <name>", "Set a display name for this session (shown in /resume and terminal title)").option("--agents <json>", `JSON object defining custom agents (e.g. '{"reviewer": {"description": "Reviews code", "prompt": "You are a code reviewer"}}')`).option("--setting-sources <sources>", "Comma-separated list of setting sources to load (user, project, local).").addOption(new Option("--prompt-suggestions [value]", "Enable prompt suggestions. In print/SDK mode, emits a prompt_suggestion message after each turn with a predicted next user prompt").choices(["true", "false", "1", "0", "yes", "no", "on", "off"]).preset("true").argParser((raw) => {
|
|
822990
|
+
const allowed = ["true", "false", "1", "0", "yes", "no", "on", "off"];
|
|
822991
|
+
if (!allowed.includes(raw)) {
|
|
822992
|
+
throw new InvalidArgumentError("Allowed choices are true, false, 1, 0, yes, no, on, off.");
|
|
822993
|
+
}
|
|
822994
|
+
return !["false", "0", "no", "off"].includes(raw);
|
|
822995
|
+
})).addOption(new Option("--exclude-dynamic-system-prompt-sections", "Move per-machine sections (cwd, env info, memory paths, git status) from the system prompt into the first user message. Improves cross-user prompt-cache reuse. Only applies with the default system prompt (ignored with --system-prompt).").default(false)).option("--plugin-url <url>", "Fetch a plugin .zip from a URL for this session only (repeatable: --plugin-url A --plugin-url B)", (val, prev) => [...prev, val], []).option("--bg, --background", "Start the session as a background agent. OCC note: background sessions are managed via the `daemon` and `agents` subcommands (e.g. `occ daemon start`, `occ agents`, `occ attach <id>`) \u2014 see `occ daemon --help`. This flag is accepted for CLI compatibility but does not start a foreground REPL.").option("--plugin-dir <path>", "Load plugins from a directory for this session only (repeatable: --plugin-dir A --plugin-dir B)", (val, prev) => [...prev, val], []).option("--disable-slash-commands", "Disable all skills", () => true).option("--chrome", "Enable Claude in Chrome integration").option("--no-chrome", "Disable Claude in Chrome integration").option("--file <specs...>", "File resources to download at startup. Format: file_id:relative_path (e.g., --file file_abc:doc.txt file_def:img.png)").action(async (prompt, options) => {
|
|
822237
822996
|
profileCheckpoint("action_handler_start");
|
|
822997
|
+
const bgFlag = options.bg || options.background;
|
|
822998
|
+
if (bgFlag) {
|
|
822999
|
+
console.error("Error: OCC manages background sessions via the `daemon` and `agents` subcommands, not the `--bg` flag.\n Start a background daemon: `occ daemon start`\n View background sessions: `occ agents`\n Resume a background session: `occ attach <id>`\n See `occ daemon --help` and `occ agents --help`.");
|
|
823000
|
+
process.exit(1);
|
|
823001
|
+
}
|
|
822238
823002
|
if (options.bare) {
|
|
822239
823003
|
process.env.CLAUDE_CODE_SIMPLE = "1";
|
|
822240
823004
|
}
|
|
@@ -822319,8 +823083,7 @@ async function run() {
|
|
|
822319
823083
|
const maintenance = options.maintenance ?? false;
|
|
822320
823084
|
if (!print && process.stdout.isTTY && isScreenReaderEnabled()) {
|
|
822321
823085
|
const announce = getScreenReaderAnnouncement();
|
|
822322
|
-
|
|
822323
|
-
console.log(announce);
|
|
823086
|
+
emitStartupSrAnnouncement(announce);
|
|
822324
823087
|
}
|
|
822325
823088
|
const disableSlashCommands = options.disableSlashCommands || false;
|
|
822326
823089
|
const tasksOption = false;
|
|
@@ -822401,6 +823164,10 @@ ${getTmuxInstallInstructions2()}
|
|
|
822401
823164
|
print = true;
|
|
822402
823165
|
}
|
|
822403
823166
|
}
|
|
823167
|
+
if (options.promptSuggestions !== undefined && !(print && outputFormat === "stream-json")) {
|
|
823168
|
+
console.error("Error: --prompt-suggestions requires --print and --output-format=stream-json (prompt_suggestion messages are only surfaced in stream-json output).");
|
|
823169
|
+
process.exit(1);
|
|
823170
|
+
}
|
|
822404
823171
|
const teleport = options.teleport ?? null;
|
|
822405
823172
|
const remoteOption = options.remote;
|
|
822406
823173
|
const remote = remoteOption === true ? "" : remoteOption ?? null;
|
|
@@ -823541,7 +824308,9 @@ ${inputPrompt}` : mergePrompt;
|
|
|
823541
824308
|
agent: agentCli,
|
|
823542
824309
|
workload: options.workload,
|
|
823543
824310
|
setupTrigger: setupTrigger ?? undefined,
|
|
823544
|
-
sessionStartHooksPromise
|
|
824311
|
+
sessionStartHooksPromise,
|
|
824312
|
+
promptSuggestions: options.promptSuggestions,
|
|
824313
|
+
excludeDynamicSections: options.excludeDynamicSystemPromptSections || undefined
|
|
823545
824314
|
});
|
|
823546
824315
|
return;
|
|
823547
824316
|
}
|
|
@@ -824916,6 +825685,7 @@ var init_main7 = __esm(() => {
|
|
|
824916
825685
|
init_keychainPrefetch();
|
|
824917
825686
|
init_featureFlags();
|
|
824918
825687
|
init_screenReader();
|
|
825688
|
+
init_srA11y();
|
|
824919
825689
|
init_esm28();
|
|
824920
825690
|
init_source();
|
|
824921
825691
|
init_mapValues();
|