zidane 5.4.2 → 5.4.3
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 +15 -0
- package/dist/{agent-DxBoKDba.d.ts → agent-Yu8uhpy-.d.ts} +74 -3
- package/dist/{agent-DxBoKDba.d.ts.map → agent-Yu8uhpy-.d.ts.map} +1 -1
- package/dist/chat.d.ts +49 -6
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/{errors-Byb0F8B9.js → errors-CDwtPIMX.js} +4 -2
- package/dist/{errors-Byb0F8B9.js.map → errors-CDwtPIMX.js.map} +1 -1
- package/dist/{index-BOtXdQkW.d.ts → index-DklfxeYy.d.ts} +8 -2
- package/dist/index-DklfxeYy.d.ts.map +1 -0
- package/dist/{index-B2VOOijU.d.ts → index-j9tY28ah.d.ts} +16 -3
- package/dist/index-j9tY28ah.d.ts.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +10 -10
- package/dist/{interpolate-ERgZUxgg.js → interpolate-CmtjEyRJ.js} +155 -18
- package/dist/interpolate-CmtjEyRJ.js.map +1 -0
- package/dist/{login-CJbeAadS.js → login-DxyAERe1.js} +3 -3
- package/dist/{login-CJbeAadS.js.map → login-DxyAERe1.js.map} +1 -1
- package/dist/{mcp-DhmmJfxK.js → mcp-CNUbvbsy.js} +2 -2
- package/dist/{mcp-DhmmJfxK.js.map → mcp-CNUbvbsy.js.map} +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{messages-D0xT979U.js → messages-fTR19Ga6.js} +2 -2
- package/dist/{messages-D0xT979U.js.map → messages-fTR19Ga6.js.map} +1 -1
- package/dist/{presets-MCcvxiNT.js → presets-D9IbaI40.js} +2 -2
- package/dist/{presets-MCcvxiNT.js.map → presets-D9IbaI40.js.map} +1 -1
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +1 -1
- package/dist/{providers-x3LZByR5.js → providers-CEzRFYtS.js} +3 -3
- package/dist/{providers-x3LZByR5.js.map → providers-CEzRFYtS.js.map} +1 -1
- package/dist/providers.d.ts +1 -1
- package/dist/providers.js +2 -2
- package/dist/session/sqlite.d.ts +1 -1
- package/dist/session/sqlite.js +1 -1
- package/dist/{session-BHZwxmfr.js → session-kwsNnOmt.js} +2 -2
- package/dist/{session-BHZwxmfr.js.map → session-kwsNnOmt.js.map} +1 -1
- package/dist/session.d.ts +1 -1
- package/dist/session.js +2 -2
- package/dist/skills.d.ts +2 -2
- package/dist/skills.js +1 -1
- package/dist/{tools-BNfyY14s.js → tools-BK2vG9UX.js} +149 -32
- package/dist/tools-BK2vG9UX.js.map +1 -0
- package/dist/tools.d.ts +2 -2
- package/dist/tools.js +1 -1
- package/dist/{transcript-anchors-DonKvoh4.d.ts → transcript-anchors-DnaBcJej.d.ts} +52 -8
- package/dist/transcript-anchors-DnaBcJej.d.ts.map +1 -0
- package/dist/tui.d.ts +4 -2
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +651 -42
- package/dist/tui.js.map +1 -1
- package/dist/{turn-operations-TKvy0q29.js → turn-operations-OzKEOXul.js} +240 -52
- package/dist/turn-operations-OzKEOXul.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/docs/ARCHITECTURE.md +16 -3
- package/docs/CHAT.md +1 -1
- package/docs/SKILL.md +24 -14
- package/docs/TUI.md +24 -0
- package/package.json +3 -3
- package/dist/index-B2VOOijU.d.ts.map +0 -1
- package/dist/index-BOtXdQkW.d.ts.map +0 -1
- package/dist/interpolate-ERgZUxgg.js.map +0 -1
- package/dist/tools-BNfyY14s.js.map +0 -1
- package/dist/transcript-anchors-DonKvoh4.d.ts.map +0 -1
- package/dist/turn-operations-TKvy0q29.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as multiEdit, c as grep, d as resolveOldString, f as styleReplacementForVia, i as readFile$1, l as glob, n as createSpawnTool, o as listFiles, r as shell, t as writeFile$1, u as edit } from "./tools-
|
|
2
|
-
import { s as errorMessage } from "./errors-
|
|
1
|
+
import { a as multiEdit, c as grep, d as resolveOldString, f as styleReplacementForVia, i as readFile$1, l as glob, n as createSpawnTool, o as listFiles, r as shell, t as writeFile$1, u as edit } from "./tools-BK2vG9UX.js";
|
|
2
|
+
import { s as errorMessage } from "./errors-CDwtPIMX.js";
|
|
3
3
|
import { n as toolResultToText } from "./types-IcokUOyC.js";
|
|
4
|
-
import { r as normalizeMcpServers } from "./mcp-
|
|
5
|
-
import { a as discoverSkills } from "./interpolate-
|
|
4
|
+
import { r as normalizeMcpServers } from "./mcp-CNUbvbsy.js";
|
|
5
|
+
import { a as discoverSkills } from "./interpolate-CmtjEyRJ.js";
|
|
6
6
|
import { n as formatTokenUsage } from "./stats-DgOvY7wd.js";
|
|
7
|
-
import { n as definePreset, t as composePresets } from "./presets-
|
|
8
|
-
import { a as writeFileAtomic, i as anthropic, n as openai, r as cerebras, t as openrouter } from "./providers-
|
|
7
|
+
import { n as definePreset, t as composePresets } from "./presets-D9IbaI40.js";
|
|
8
|
+
import { a as writeFileAtomic, i as anthropic, n as openai, r as cerebras, t as openrouter } from "./providers-CEzRFYtS.js";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
10
10
|
import { readdir, stat, writeFile } from "node:fs/promises";
|
|
11
11
|
import { dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
@@ -2144,6 +2144,12 @@ const KEYBINDING_DEFS = [
|
|
|
2144
2144
|
label: "messages",
|
|
2145
2145
|
description: "enter select-turn mode to navigate previous messages"
|
|
2146
2146
|
},
|
|
2147
|
+
{
|
|
2148
|
+
action: "cancelToolCall",
|
|
2149
|
+
default: "ctrl+k",
|
|
2150
|
+
label: "cancel tool",
|
|
2151
|
+
description: "open the in-flight tool picker to cancel a single tool call without aborting the run (esc still aborts the whole run)"
|
|
2152
|
+
},
|
|
2147
2153
|
{
|
|
2148
2154
|
action: "enterQueueSelection",
|
|
2149
2155
|
default: "",
|
|
@@ -2180,6 +2186,12 @@ const KEYBINDING_DEFS = [
|
|
|
2180
2186
|
label: "copy",
|
|
2181
2187
|
description: "copy the selected turn content to the clipboard (OSC 52)"
|
|
2182
2188
|
},
|
|
2189
|
+
{
|
|
2190
|
+
action: "turnEdit",
|
|
2191
|
+
default: "e",
|
|
2192
|
+
label: "edit",
|
|
2193
|
+
description: "edit the text content of the selected turn"
|
|
2194
|
+
},
|
|
2183
2195
|
{
|
|
2184
2196
|
action: "sessionDelete",
|
|
2185
2197
|
default: "d",
|
|
@@ -2754,7 +2766,8 @@ function extractEditPayload(name, input, priorContent) {
|
|
|
2754
2766
|
oldString,
|
|
2755
2767
|
newString,
|
|
2756
2768
|
...input.replace_all === true ? { replaceAll: true } : {}
|
|
2757
|
-
}]
|
|
2769
|
+
}],
|
|
2770
|
+
...priorContent !== void 0 ? { priorContent } : {}
|
|
2758
2771
|
};
|
|
2759
2772
|
}
|
|
2760
2773
|
if (name === "multi_edit") {
|
|
@@ -2772,7 +2785,8 @@ function extractEditPayload(name, input, priorContent) {
|
|
|
2772
2785
|
return {
|
|
2773
2786
|
tool: "multi_edit",
|
|
2774
2787
|
path,
|
|
2775
|
-
hunks
|
|
2788
|
+
hunks,
|
|
2789
|
+
...priorContent !== void 0 ? { priorContent } : {}
|
|
2776
2790
|
};
|
|
2777
2791
|
}
|
|
2778
2792
|
if (name === "write_file") {
|
|
@@ -2784,7 +2798,8 @@ function extractEditPayload(name, input, priorContent) {
|
|
|
2784
2798
|
hunks: [{
|
|
2785
2799
|
oldString: priorContent ?? "",
|
|
2786
2800
|
newString: content
|
|
2787
|
-
}]
|
|
2801
|
+
}],
|
|
2802
|
+
...priorContent !== void 0 ? { priorContent } : {}
|
|
2788
2803
|
};
|
|
2789
2804
|
}
|
|
2790
2805
|
}
|
|
@@ -2985,6 +3000,104 @@ function buildContextualDiff(payload, priorContent, contextLines = 3) {
|
|
|
2985
3000
|
}
|
|
2986
3001
|
return `${parts.join("\n")}\n`;
|
|
2987
3002
|
}
|
|
3003
|
+
/**
|
|
3004
|
+
* Build a per-hunk digest used by the compact diff view.
|
|
3005
|
+
*
|
|
3006
|
+
* Strategy:
|
|
3007
|
+
* - When `priorContent` is present and the payload describes a real
|
|
3008
|
+
* file transformation, compute the contextual diff once, then walk
|
|
3009
|
+
* the LCS ops splitting at runs of `add` / `remove` to anchor each
|
|
3010
|
+
* summary entry to the **real** file line. This guarantees the
|
|
3011
|
+
* summary's `L<n>` matches what the user sees in their editor.
|
|
3012
|
+
* - Otherwise, fall back to per-hunk LCS over the (oldString,
|
|
3013
|
+
* newString) snippet pair. Line numbers are absent because the
|
|
3014
|
+
* snippet has no file position.
|
|
3015
|
+
*/
|
|
3016
|
+
function summarizeEditPayload(payload) {
|
|
3017
|
+
const prior = payload.priorContent;
|
|
3018
|
+
if (prior !== void 0) return summarizeOpsByHunk(computeLineDiff(prior, applyEditPayload(payload, prior)));
|
|
3019
|
+
const hunks = [];
|
|
3020
|
+
let totalAdded = 0;
|
|
3021
|
+
let totalRemoved = 0;
|
|
3022
|
+
for (const hunk of payload.hunks) {
|
|
3023
|
+
const ops = computeLineDiff(hunk.oldString, hunk.newString);
|
|
3024
|
+
let added = 0;
|
|
3025
|
+
let removed = 0;
|
|
3026
|
+
let firstOld;
|
|
3027
|
+
let firstNew;
|
|
3028
|
+
for (const op of ops) if (op.op === "add") {
|
|
3029
|
+
added++;
|
|
3030
|
+
if (firstNew === void 0) firstNew = op.text;
|
|
3031
|
+
} else if (op.op === "remove") {
|
|
3032
|
+
removed++;
|
|
3033
|
+
if (firstOld === void 0) firstOld = op.text;
|
|
3034
|
+
}
|
|
3035
|
+
totalAdded += added;
|
|
3036
|
+
totalRemoved += removed;
|
|
3037
|
+
hunks.push({
|
|
3038
|
+
added,
|
|
3039
|
+
removed,
|
|
3040
|
+
...firstOld !== void 0 ? { firstOld } : {},
|
|
3041
|
+
...firstNew !== void 0 ? { firstNew } : {}
|
|
3042
|
+
});
|
|
3043
|
+
}
|
|
3044
|
+
return {
|
|
3045
|
+
totalAdded,
|
|
3046
|
+
totalRemoved,
|
|
3047
|
+
hunks
|
|
3048
|
+
};
|
|
3049
|
+
}
|
|
3050
|
+
/**
|
|
3051
|
+
* Walk an LCS op stream and emit one summary entry per *run* of
|
|
3052
|
+
* non-context ops, with the new-file line number where each run
|
|
3053
|
+
* starts. Adjacent add/remove ops collapse into the same entry —
|
|
3054
|
+
* matches git's hunk grouping at zero context.
|
|
3055
|
+
*/
|
|
3056
|
+
function summarizeOpsByHunk(ops) {
|
|
3057
|
+
const hunks = [];
|
|
3058
|
+
let totalAdded = 0;
|
|
3059
|
+
let totalRemoved = 0;
|
|
3060
|
+
let nl = 1;
|
|
3061
|
+
let i = 0;
|
|
3062
|
+
while (i < ops.length) {
|
|
3063
|
+
if (ops[i].op === "context") {
|
|
3064
|
+
nl++;
|
|
3065
|
+
i++;
|
|
3066
|
+
continue;
|
|
3067
|
+
}
|
|
3068
|
+
const runStartLine = nl;
|
|
3069
|
+
let added = 0;
|
|
3070
|
+
let removed = 0;
|
|
3071
|
+
let firstOld;
|
|
3072
|
+
let firstNew;
|
|
3073
|
+
while (i < ops.length && ops[i].op !== "context") {
|
|
3074
|
+
const cur = ops[i];
|
|
3075
|
+
if (cur.op === "add") {
|
|
3076
|
+
added++;
|
|
3077
|
+
if (firstNew === void 0) firstNew = cur.text;
|
|
3078
|
+
nl++;
|
|
3079
|
+
} else {
|
|
3080
|
+
removed++;
|
|
3081
|
+
if (firstOld === void 0) firstOld = cur.text;
|
|
3082
|
+
}
|
|
3083
|
+
i++;
|
|
3084
|
+
}
|
|
3085
|
+
totalAdded += added;
|
|
3086
|
+
totalRemoved += removed;
|
|
3087
|
+
hunks.push({
|
|
3088
|
+
line: runStartLine,
|
|
3089
|
+
added,
|
|
3090
|
+
removed,
|
|
3091
|
+
...firstOld !== void 0 ? { firstOld } : {},
|
|
3092
|
+
...firstNew !== void 0 ? { firstNew } : {}
|
|
3093
|
+
});
|
|
3094
|
+
}
|
|
3095
|
+
return {
|
|
3096
|
+
totalAdded,
|
|
3097
|
+
totalRemoved,
|
|
3098
|
+
hunks
|
|
3099
|
+
};
|
|
3100
|
+
}
|
|
2988
3101
|
function previewEditPayload(payload, priorContent, contextLines = 3) {
|
|
2989
3102
|
const resolution = [];
|
|
2990
3103
|
const resolvedHunks = [];
|
|
@@ -4845,6 +4958,7 @@ const DEFAULT_SETTINGS = {
|
|
|
4845
4958
|
autoCompact: true,
|
|
4846
4959
|
autoCompactThreshold: .8,
|
|
4847
4960
|
showEditDiffs: true,
|
|
4961
|
+
editDiffDisplay: "full",
|
|
4848
4962
|
targetFps: 60,
|
|
4849
4963
|
allowInteraction: true,
|
|
4850
4964
|
smoothStreaming: true,
|
|
@@ -4996,6 +5110,18 @@ const SETTINGS_CHOICES = [
|
|
|
4996
5110
|
}
|
|
4997
5111
|
]
|
|
4998
5112
|
},
|
|
5113
|
+
{
|
|
5114
|
+
key: "editDiffDisplay",
|
|
5115
|
+
label: "Edit diff density",
|
|
5116
|
+
description: "full unified diff with line numbers · or compact per-hunk summary list",
|
|
5117
|
+
options: [{
|
|
5118
|
+
value: "full",
|
|
5119
|
+
label: "Full"
|
|
5120
|
+
}, {
|
|
5121
|
+
value: "compact",
|
|
5122
|
+
label: "Compact"
|
|
5123
|
+
}]
|
|
5124
|
+
},
|
|
4999
5125
|
{
|
|
5000
5126
|
key: "autoCompactThreshold",
|
|
5001
5127
|
label: "Auto-compact threshold",
|
|
@@ -6703,7 +6829,7 @@ function getSafelist(dataDir, projectDir) {
|
|
|
6703
6829
|
return readProjects(dataDir)[projectDir]?.safelist ?? [];
|
|
6704
6830
|
}
|
|
6705
6831
|
/**
|
|
6706
|
-
* Tools that always pass without prompting.
|
|
6832
|
+
* Tools that always pass without prompting. Four categories:
|
|
6707
6833
|
*
|
|
6708
6834
|
* - **Pure reads** (`read_file`, `list_files`, `glob`, `grep`) — no
|
|
6709
6835
|
* side effects on disk or the model's own state.
|
|
@@ -6717,6 +6843,18 @@ function getSafelist(dataDir, projectDir) {
|
|
|
6717
6843
|
* a per-call approval prompt would drown the conversation in
|
|
6718
6844
|
* interruptions that buy no safety since the tool's surface is
|
|
6719
6845
|
* read/write on a metadata bag we already trust the agent with.
|
|
6846
|
+
* - **Skill activation** (`skills_use`) — mutates a small per-agent
|
|
6847
|
+
* Map of active skills and returns the activated skill's bundled
|
|
6848
|
+
* instructions (or releases an entry on `mode: "deactivate"`).
|
|
6849
|
+
* Pure state on the agent — no shell, no disk writes, no network.
|
|
6850
|
+
* Gating it would also defeat the "model recovers from
|
|
6851
|
+
* `AgentToolNotAllowedError` by calling
|
|
6852
|
+
* `skills_use({ mode: "deactivate", name })`" path: a stuck model
|
|
6853
|
+
* would have to ask the user permission to *unstick* itself on
|
|
6854
|
+
* every retry. `skills_read` and `skills_run_script` are
|
|
6855
|
+
* intentionally NOT on this list — the former touches disk and
|
|
6856
|
+
* the latter executes arbitrary scripts, so both keep going
|
|
6857
|
+
* through the regular gate.
|
|
6720
6858
|
*
|
|
6721
6859
|
* Users who want to gate any of these must disable safe-mode entirely
|
|
6722
6860
|
* (or fork this list in their own embedding).
|
|
@@ -6729,7 +6867,8 @@ const IMPLICITLY_SAFE_TOOLS = [
|
|
|
6729
6867
|
"ask_user",
|
|
6730
6868
|
"present_plan",
|
|
6731
6869
|
"todowrite",
|
|
6732
|
-
"todoread"
|
|
6870
|
+
"todoread",
|
|
6871
|
+
"skills_use"
|
|
6733
6872
|
];
|
|
6734
6873
|
/** Common input keys carrying the "primary argument" we scope safelists on. */
|
|
6735
6874
|
const PRIMARY_ARG_KEYS = [
|
|
@@ -7245,33 +7384,40 @@ const TICK_INTERVAL_MS = 16;
|
|
|
7245
7384
|
/**
|
|
7246
7385
|
* Smooth-streaming display rate, in characters per second.
|
|
7247
7386
|
*
|
|
7248
|
-
* -
|
|
7249
|
-
*
|
|
7250
|
-
*
|
|
7251
|
-
* - {@link
|
|
7252
|
-
*
|
|
7253
|
-
*
|
|
7254
|
-
*
|
|
7255
|
-
*
|
|
7256
|
-
*
|
|
7257
|
-
*
|
|
7258
|
-
*
|
|
7259
|
-
*
|
|
7260
|
-
*
|
|
7261
|
-
*
|
|
7262
|
-
*
|
|
7387
|
+
* Three-segment continuous ramp (no step functions, no cliff) so the
|
|
7388
|
+
* typewriter cadence never visibly "jumps" mid-stream:
|
|
7389
|
+
*
|
|
7390
|
+
* - {@link SMOOTH_BASE_CPS} — calm-state floor. ~200 CPS is a fast
|
|
7391
|
+
* typist's pace; comfortably readable without feeling like a
|
|
7392
|
+
* deliberate performance.
|
|
7393
|
+
* - {@link SMOOTH_BURST_CPS} at {@link SMOOTH_BURST_BACKLOG_CHARS} —
|
|
7394
|
+
* moderate catch-up speed once the buffer is one paragraph behind
|
|
7395
|
+
* the provider.
|
|
7396
|
+
* - {@link SMOOTH_MAX_CPS} at {@link SMOOTH_MAX_BACKLOG_CHARS} —
|
|
7397
|
+
* bounded ceiling. Past this we plateau at max-cps rather than
|
|
7398
|
+
* instant-draining; max-cps is already well above any human reading
|
|
7399
|
+
* rate so even a 10K-char dump completes in ~2.5s of fast typewriter
|
|
7400
|
+
* instead of a single-frame teleport.
|
|
7401
|
+
*
|
|
7402
|
+
* The previous failsafe (instant drain at 2K chars) was a literal
|
|
7403
|
+
* step from ~10 chars/frame to "everything in one frame" — the worst
|
|
7404
|
+
* jump in the smooth pipeline. The continued ramp eliminates it
|
|
7405
|
+
* without losing bounded latency, since CPS keeps growing with
|
|
7406
|
+
* backlog up to the cap.
|
|
7263
7407
|
*/
|
|
7264
7408
|
const SMOOTH_BASE_CPS = 200;
|
|
7265
7409
|
const SMOOTH_BURST_CPS = 600;
|
|
7266
7410
|
const SMOOTH_BURST_BACKLOG_CHARS = 400;
|
|
7267
|
-
const
|
|
7411
|
+
const SMOOTH_MAX_CPS = 4e3;
|
|
7412
|
+
const SMOOTH_MAX_BACKLOG_CHARS = 4e3;
|
|
7268
7413
|
const PARENT_OWNER = "parent";
|
|
7269
7414
|
function emptyBucket(owner, depth) {
|
|
7270
7415
|
return {
|
|
7271
7416
|
markdown: "",
|
|
7272
7417
|
thinking: "",
|
|
7273
7418
|
owner,
|
|
7274
|
-
depth
|
|
7419
|
+
depth,
|
|
7420
|
+
smoothCarry: 0
|
|
7275
7421
|
};
|
|
7276
7422
|
}
|
|
7277
7423
|
function applyBucket(prev, bucket) {
|
|
@@ -7383,23 +7529,52 @@ function turnContextSize(usage) {
|
|
|
7383
7529
|
return (usage.input ?? 0) + (usage.cacheRead ?? 0) + (usage.cacheCreation ?? 0);
|
|
7384
7530
|
}
|
|
7385
7531
|
/**
|
|
7386
|
-
*
|
|
7387
|
-
* current backlog
|
|
7388
|
-
*
|
|
7389
|
-
*
|
|
7532
|
+
* Target chars-per-second for the next smooth-mode tick given the
|
|
7533
|
+
* current bucket backlog. Two linear segments — base→burst over the
|
|
7534
|
+
* first {@link SMOOTH_BURST_BACKLOG_CHARS}, burst→max over the rest of
|
|
7535
|
+
* the ramp — so the function is continuous everywhere and plateaus
|
|
7536
|
+
* (rather than cliffs) once backlog passes {@link SMOOTH_MAX_BACKLOG_CHARS}.
|
|
7390
7537
|
*
|
|
7391
|
-
*
|
|
7392
|
-
*
|
|
7393
|
-
*
|
|
7394
|
-
* legacy step at the burst threshold) so the chars-per-frame count never
|
|
7395
|
-
* jumps mid-stream — visible jumps in the typewriter cadence read as the
|
|
7396
|
-
* text itself jumping.
|
|
7538
|
+
* Exported for tests; the runtime path goes through
|
|
7539
|
+
* {@link smoothCharsForTick} which folds in the per-bucket fractional
|
|
7540
|
+
* remainder.
|
|
7397
7541
|
*/
|
|
7398
|
-
function
|
|
7542
|
+
function smoothCpsForBacklog(backlog) {
|
|
7399
7543
|
if (backlog <= 0) return 0;
|
|
7400
|
-
if (backlog >=
|
|
7401
|
-
|
|
7402
|
-
return
|
|
7544
|
+
if (backlog >= SMOOTH_MAX_BACKLOG_CHARS) return SMOOTH_MAX_CPS;
|
|
7545
|
+
if (backlog <= SMOOTH_BURST_BACKLOG_CHARS) return SMOOTH_BASE_CPS + backlog / SMOOTH_BURST_BACKLOG_CHARS * (SMOOTH_BURST_CPS - SMOOTH_BASE_CPS);
|
|
7546
|
+
return SMOOTH_BURST_CPS + (backlog - SMOOTH_BURST_BACKLOG_CHARS) / (SMOOTH_MAX_BACKLOG_CHARS - SMOOTH_BURST_BACKLOG_CHARS) * (SMOOTH_MAX_CPS - SMOOTH_BURST_CPS);
|
|
7547
|
+
}
|
|
7548
|
+
/**
|
|
7549
|
+
* Number of characters to drain on the next smooth-mode tick + the
|
|
7550
|
+
* fractional remainder to carry into the next tick.
|
|
7551
|
+
*
|
|
7552
|
+
* Combining the CPS curve with a fractional accumulator means the
|
|
7553
|
+
* effective draining rate matches the target CPS exactly. The legacy
|
|
7554
|
+
* `Math.ceil(cps * dt)` rounded UP on every tick — at 200 CPS / 16ms,
|
|
7555
|
+
* that's 4 chars/tick (= 250 CPS effective), a 25 % speed-up. Worse,
|
|
7556
|
+
* `ceil` produced visible step transitions (4 → 5 → 7 → 8 → 10 as
|
|
7557
|
+
* backlog grew) that read as the typewriter cadence jumping.
|
|
7558
|
+
*/
|
|
7559
|
+
function smoothCharsForTick(backlog, carry, dtMs) {
|
|
7560
|
+
if (backlog <= 0) return {
|
|
7561
|
+
take: 0,
|
|
7562
|
+
carry: 0
|
|
7563
|
+
};
|
|
7564
|
+
const want = smoothCpsForBacklog(backlog) * dtMs / 1e3 + carry;
|
|
7565
|
+
const take = Math.floor(want);
|
|
7566
|
+
if (take <= 0) return {
|
|
7567
|
+
take: 0,
|
|
7568
|
+
carry: want
|
|
7569
|
+
};
|
|
7570
|
+
if (take >= backlog) return {
|
|
7571
|
+
take: backlog,
|
|
7572
|
+
carry: 0
|
|
7573
|
+
};
|
|
7574
|
+
return {
|
|
7575
|
+
take,
|
|
7576
|
+
carry: want - take
|
|
7577
|
+
};
|
|
7403
7578
|
}
|
|
7404
7579
|
/**
|
|
7405
7580
|
* Slice `n` chars off the front of `buf` without splitting a UTF-16
|
|
@@ -7423,6 +7598,7 @@ function takeChars(buf, n) {
|
|
|
7423
7598
|
function useStreamBuffer(setEvents, options) {
|
|
7424
7599
|
const bucketsRef = useRef(/* @__PURE__ */ new Map());
|
|
7425
7600
|
const tickerRef = useRef(null);
|
|
7601
|
+
const lastTickMsRef = useRef(0);
|
|
7426
7602
|
const getSmoothRef = useRef(options?.getSmooth);
|
|
7427
7603
|
getSmoothRef.current = options?.getSmooth;
|
|
7428
7604
|
/**
|
|
@@ -7443,6 +7619,7 @@ function useStreamBuffer(setEvents, options) {
|
|
|
7443
7619
|
clearInterval(tickerRef.current);
|
|
7444
7620
|
tickerRef.current = null;
|
|
7445
7621
|
}
|
|
7622
|
+
lastTickMsRef.current = 0;
|
|
7446
7623
|
}, []);
|
|
7447
7624
|
/**
|
|
7448
7625
|
* Has at least one bucket got unflushed *markdown* content?
|
|
@@ -7494,25 +7671,34 @@ function useStreamBuffer(setEvents, options) {
|
|
|
7494
7671
|
const buckets = bucketsRef.current;
|
|
7495
7672
|
const portions = [];
|
|
7496
7673
|
let stillHasContent = false;
|
|
7674
|
+
const now = Date.now();
|
|
7675
|
+
const dtMs = lastTickMsRef.current === 0 ? TICK_INTERVAL_MS : Math.min(TICK_INTERVAL_MS * 4, Math.max(1, now - lastTickMsRef.current));
|
|
7676
|
+
lastTickMsRef.current = now;
|
|
7497
7677
|
for (const bucket of buckets.values()) {
|
|
7498
7678
|
const thinking = bucket.thinking;
|
|
7499
7679
|
bucket.thinking = "";
|
|
7500
7680
|
let taken = "";
|
|
7501
7681
|
if (bucket.markdown.length > 0) if (smooth) {
|
|
7502
|
-
const
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
|
|
7682
|
+
const { take, carry } = smoothCharsForTick(bucket.markdown.length, bucket.smoothCarry, dtMs);
|
|
7683
|
+
bucket.smoothCarry = carry;
|
|
7684
|
+
if (take > 0) {
|
|
7685
|
+
const result = takeChars(bucket.markdown, take);
|
|
7686
|
+
taken = result.taken;
|
|
7687
|
+
bucket.markdown = result.rest;
|
|
7688
|
+
if (bucket.markdown.length === 0) bucket.smoothCarry = 0;
|
|
7689
|
+
}
|
|
7506
7690
|
} else {
|
|
7507
7691
|
taken = bucket.markdown;
|
|
7508
7692
|
bucket.markdown = "";
|
|
7693
|
+
bucket.smoothCarry = 0;
|
|
7509
7694
|
}
|
|
7510
7695
|
if (taken || thinking) portions.push({
|
|
7511
7696
|
markdown: taken,
|
|
7512
7697
|
thinking,
|
|
7513
7698
|
owner: bucket.owner,
|
|
7514
7699
|
depth: bucket.depth,
|
|
7515
|
-
turnId: bucket.turnId
|
|
7700
|
+
turnId: bucket.turnId,
|
|
7701
|
+
smoothCarry: 0
|
|
7516
7702
|
});
|
|
7517
7703
|
if (bucket.markdown.length > 0) stillHasContent = true;
|
|
7518
7704
|
}
|
|
@@ -7752,7 +7938,9 @@ const TOOL_DISPLAY = {
|
|
|
7752
7938
|
}
|
|
7753
7939
|
},
|
|
7754
7940
|
skills_use: {
|
|
7755
|
-
displayName:
|
|
7941
|
+
displayName: (input) => {
|
|
7942
|
+
return (input ? stringField(input, "mode") : void 0) === "deactivate" ? "Disable skill" : "Enable skill";
|
|
7943
|
+
},
|
|
7756
7944
|
format: (input) => {
|
|
7757
7945
|
const name = stringField(input, "name");
|
|
7758
7946
|
if (!name) return null;
|
|
@@ -7846,9 +8034,9 @@ const TOOL_DISPLAY = {
|
|
|
7846
8034
|
* affordance ("everything starting with `Github` came from the github
|
|
7847
8035
|
* MCP server").
|
|
7848
8036
|
*/
|
|
7849
|
-
function displayNameFor(name) {
|
|
8037
|
+
function displayNameFor(name, input) {
|
|
7850
8038
|
const entry = TOOL_DISPLAY[name];
|
|
7851
|
-
if (entry) return entry.displayName;
|
|
8039
|
+
if (entry) return typeof entry.displayName === "function" ? entry.displayName(input) : entry.displayName;
|
|
7852
8040
|
return sentenceCase(name.startsWith("mcp_") ? name.slice(4) : name);
|
|
7853
8041
|
}
|
|
7854
8042
|
/**
|
|
@@ -8058,6 +8246,6 @@ function countNeighbors(turnIds, turnId) {
|
|
|
8058
8246
|
};
|
|
8059
8247
|
}
|
|
8060
8248
|
//#endregion
|
|
8061
|
-
export { useMcpAuthDispatch as $,
|
|
8249
|
+
export { useMcpAuthDispatch as $, mergeReferences as $n, IDENTITY_PREFIX as $r, isTurnHighlighted as $t, getSafelist as A, rewriteMultiEditHeader as An, DEFAULT_AGENT_ID as Ar, clampFps as At, supportsOAuth as B, mergeKeybindings as Bn, TODO_WRITE_COUNTS_METADATA_KEY as Br, CATPPUCCIN_MOCHA as Bt, resolveSessionExportTarget as C, summarizeEditPayload as Cn, modelSupportsReasoning as Cr, shortId as Ct, useSafeModeQueue as D, mergeApprovalAndBodyOutcomes as Dn, piIdOf as Dr, SETTINGS_CHOICES as Dt, useSafeModeActions as E, maskToOutcomeKinds as En, openrouterDescriptor as Er, DEFAULT_SETTINGS as Et, suggestSafelistEntry as F, KEYBINDING_DEFS as Fn, singleAgentRegistry as Fr, resolveTheme as Ft, defaultMcpsConfigPaths as G, createSkillsCompletionProvider as Gn, pickActiveRunId as Gr, ConfigProvider as Gt, filterModelCatalog as H, readKeybindings as Hn, getArchivedTodosForRun as Hr, DiscoveryProvider as Ht, writeProjects as I, KEYBINDING_DEF_BY_ACTION as In, TODOREAD_TOOL as Ir, VAPORWAVE_THEME as It, projectUserPaths as J, createFilesCompletionProvider as Jn, setTodosForRun as Jr, EDIT_TOOL_NAMES as Jt, discoverProjectMcps as K, uniqueSkillNamesFromReferences as Kn, pruneTodosByRun as Kr, useConfig as Kt, splitPromptSegments as L, ensureKeybindingsFile as Ln, TODOS_METADATA_KEY as Lr, CATPPUCCIN_FRAPPE as Lt, matchesSafelistEntry as M, summarizeOutcomes as Mn, PLAN_AGENT as Mr, BUILTIN_THEMES as Mt, projectsFilePath as N, findGitRoot$1 as Nn, accentColor as Nr, DEFAULT_THEME as Nt, IMPLICITLY_SAFE_TOOLS as O, parseEditOutcomesFromResult as On, BUILD_AGENT as Or, SETTINGS_TOGGLES as Ot, readProjects as P, DEFAULT_KEYBINDINGS as Pn, resolveAgentId as Pr, resolveChipColor as Pt, McpAuthProvider as Q, findActiveTrigger as Qn, DOING_TASKS_DOCTRINE as Qr, isEditErrorResult as Qt, formatPathForCwd as R, keybindingsPath as Rn, TODOWRITE_TOOL as Rr, CATPPUCCIN_LATTE as Rt, renderSession as S, splitLines as Sn, getModelInfo as Sr, fmtTokens as St, SafeModeProvider as T, buildEditOutcomesAnnotation as Tn, openaiDescriptor as Tr, useEnabledToggleSet as Tt, indexOfEntry as U, stripJsonComments as Un, getTodosForRun as Ur, useDiscovery as Ut, buildModelCatalog as V, parseBindingSpec as Vn, createTodoTools as Vr, createDiscoverySlot as Vt, buildMcpServers as W, SKILLS_TRIGGER as Wn, isTodoTool as Wr, useDiscoveryOptional as Wt, mcpCredentialsPath as X, applyInsert as Xn, ACTIONS_WITH_CARE_DOCTRINE as Xr, deriveSessionTitle as Xt, createFileMcpCredentialStore as Y, uniqueFilesFromReferences as Yn, useActiveTodos as Yr, createStateStore as Yt, patchMcpCredential as Z, collectReferences as Zn, COMMUNICATION_DOCTRINE as Zr, eventsFromTurns as Zt, turnContextSize as _, computeInlineDiff as _n, anthropicDescriptor as _r, truncateTrailing as _t, computeTurnAnchors as a, TOKEN_DISCIPLINE_DOCTRINE as ai, saveState as an, bootTick as ar, InteractionsProvider as at, defaultSkillScanPaths as b, filetypeFromPath as bn, effectiveContextWindow as br, ageString as bt, formatToolCall as c, envSection as ci, sumRunCosts as cn, applyApiKeyEnv as cr, createInteractionTools as ct, useSelectStyle as d, toolResultText as dn, readProviderCredential as dr, pendingInteractionsFromTurns as dt, INTERACTION_GUIDANCE as ei, isVisible as en, useCompletion as er, useMcpAuthState as et, useSurfaces as f, turnSelectionOwnership as fn, removeProviderCredential as fr, serializeInteractionResponse as ft, finalizeStreamingMarkdownForOwner as g, buildUnifiedDiff as gn, OUTPUT_RESERVE_TOKENS as gr, hintsLength as gt, finalizeStreamingMarkdown as h, buildContextualDiff as hn, BUILTIN_PROVIDERS as hr, clipHintsToWidth as ht, turnAsText as i, SUBAGENT_GUIDANCE as ii, marginTopFor as in, bootProfileEnabled as ir, ASK_USER_TOOL as it, isOnSafelist as j, stripEditOutcomesAnnotation as jn, DEFAULT_PERSIST_EXCLUDE_TOOLS as jr, useSettings as jt, addToSafelist as k, resolveApprovalForPayload as kn, BUILTIN_AGENTS as kr, SettingsProvider as kt, ThemeProvider as l, titleFromTurns as ln, credentialsPath as lr, isInteractionTool as lt, useTheme as m, applyEditPayload as mn, writeCredentials as mr, useInteractionsQueue as mt, deleteTurnSafely as n, PLAN_MODE_DOCTRINE as ni, listSessionMeta as nn, buildLinearRamp as nr, reduceMcpAuth as nt, TOOL_DISPLAY as o, buildBuildSystem as oi, selectableTurnIds as on, shouldAutoCompact as or, PRESENT_PLAN_TOOL as ot, useSyntaxStyles as p, updateToolEventOutcomes as pn, setProviderCredential as pr, useInteractionsActions as pt, parseMcpsFile as q, FILES_TRIGGER as qn, selectActiveTodos as qr, resolveConfig as qt, truncateTurnsAt as r, PLAN_MODE_DOCTRINE_NO_PROMPTS as ri, loadState as rn, tryOpenBrowser as rr, splitMarkdownCodeBlocks as rt, displayNameFor as s, buildPlanSystem as si, stripSpawnTokensLine as sn, detectAuth as sr, buildResumedToolResultsTurn as st, countNeighbors as t, INTERACTION_GUIDANCE_NO_PROMPTS as ti, lastContextSizeFromTurns as tn, blendHsl as tr, getMcpAuthStatus as tt, useColors as u, toolCallPreview as un, readCredentials as ur, makeRequestInteraction as ut, useStreamBuffer as v, computeLineDiff as vn, cerebrasDescriptor as vr, cleanTitle as vt, writeSessionExport as w, tokenize as wn, modelsForDescriptor as wr, listProjectFiles as wt, discoverProjectSkills as x, previewEditPayload as xn, getContextWindow as xr, compactPath as xt, buildSkillsConfig as y, extractEditPayload as yn, credKeyOf as yr, generateSessionTitle as yt, runOAuthLogin as z, matchesBinding as zn, TODO_STATUS_GLYPHS as zr, CATPPUCCIN_MACCHIATO as zt };
|
|
8062
8250
|
|
|
8063
|
-
//# sourceMappingURL=turn-operations-
|
|
8251
|
+
//# sourceMappingURL=turn-operations-OzKEOXul.js.map
|