@aiwayds/dsh-opentui 0.26.4 → 0.27.0
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/CHANGELOG.md +94 -0
- package/dist/bridge/bundle-fingerprint.json +1 -1
- package/dist/bridge/index.js +283 -8
- package/dist/client/index.js +1267 -693
- package/dist/client/index.js.map +32 -29
- package/dist/locales/en.json +18 -1
- package/dist/locales/zh-CN.json +20 -3
- package/package.json +1 -1
- package/scripts/lib/patch-runtime-merge.mjs +172 -0
- package/scripts/provision-inproc-profile.mjs +29 -2
package/dist/client/index.js
CHANGED
|
@@ -23264,6 +23264,8 @@ var init_keybind = __esm(() => {
|
|
|
23264
23264
|
"session.half.page.down": keybind("ctrl+alt+d", "Scroll messages down by half page"),
|
|
23265
23265
|
"session.dock.scroll.up": keybind("ctrl+alt+up", "Scroll the activity lower zone up"),
|
|
23266
23266
|
"session.dock.scroll.down": keybind("ctrl+alt+down", "Scroll the activity lower zone down"),
|
|
23267
|
+
"session.dock.tab.main": keybind("alt+1", "Show activity main panel"),
|
|
23268
|
+
"session.dock.tab.todo": keybind("alt+2", "Show activity todo details"),
|
|
23267
23269
|
"session.first": keybind("ctrl+home,home,alt+home", "Navigate to first message"),
|
|
23268
23270
|
"session.last": keybind("ctrl+alt+g,end", "Navigate to last message"),
|
|
23269
23271
|
"session.message.next": keybind("none", "Navigate to next message"),
|
|
@@ -23321,6 +23323,7 @@ var init_keybind = __esm(() => {
|
|
|
23321
23323
|
"input.delete.word.forward": keybind("alt+d,alt+delete,ctrl+delete", "Delete word forward in input"),
|
|
23322
23324
|
"input.delete.word.backward": keybind("ctrl+w,ctrl+backspace,alt+backspace", "Delete word backward in input"),
|
|
23323
23325
|
"input.select.all": keybind("super+a", "Select all in input"),
|
|
23326
|
+
"input.copy": keybind("ctrl+c,super+c", "Copy selected input text"),
|
|
23324
23327
|
"prompt.history.previous": keybind("up", "Previous history item"),
|
|
23325
23328
|
"prompt.history.next": keybind("down", "Next history item"),
|
|
23326
23329
|
"composer.subagent.up": keybind("up", "Previous subagent"),
|
|
@@ -35050,213 +35053,6 @@ var init_theme3 = __esm(() => {
|
|
|
35050
35053
|
ThemeProvider = themeContext.provider;
|
|
35051
35054
|
});
|
|
35052
35055
|
|
|
35053
|
-
// ../i18n/src/registry.ts
|
|
35054
|
-
import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync10 } from "fs";
|
|
35055
|
-
import { homedir as homedir5 } from "os";
|
|
35056
|
-
import { dirname as dirname4, join as join12 } from "path";
|
|
35057
|
-
function validateLocaleFile(raw) {
|
|
35058
|
-
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
35059
|
-
return { ok: false, errors: [{ key: "(file)", reason: "not a flat JSON object" }] };
|
|
35060
|
-
}
|
|
35061
|
-
const errors = [];
|
|
35062
|
-
const record = raw;
|
|
35063
|
-
const name = record["name"];
|
|
35064
|
-
if (typeof name !== "string" || name.length === 0) {
|
|
35065
|
-
errors.push({ key: "name", reason: "missing or not a non-empty string" });
|
|
35066
|
-
}
|
|
35067
|
-
for (const [key, value] of Object.entries(record)) {
|
|
35068
|
-
if (key === "name")
|
|
35069
|
-
continue;
|
|
35070
|
-
if (typeof value !== "string") {
|
|
35071
|
-
errors.push({ key, reason: `not a string (${value === null ? "null" : Array.isArray(value) ? "array" : typeof value})` });
|
|
35072
|
-
continue;
|
|
35073
|
-
}
|
|
35074
|
-
if (value.length === 0) {
|
|
35075
|
-
errors.push({ key, reason: "empty string" });
|
|
35076
|
-
continue;
|
|
35077
|
-
}
|
|
35078
|
-
const bad = hasIncompatiblePlaceholder(value);
|
|
35079
|
-
if (bad !== undefined)
|
|
35080
|
-
errors.push({ key, reason: `incompatible placeholder ${bad} (expected {param})` });
|
|
35081
|
-
}
|
|
35082
|
-
if (errors.length > 0)
|
|
35083
|
-
return { ok: false, errors };
|
|
35084
|
-
return { ok: true, table: raw };
|
|
35085
|
-
}
|
|
35086
|
-
function parseLocaleFile(text) {
|
|
35087
|
-
let raw;
|
|
35088
|
-
try {
|
|
35089
|
-
raw = JSON.parse(text);
|
|
35090
|
-
} catch (error) {
|
|
35091
|
-
const reason = error instanceof Error ? error.message : String(error);
|
|
35092
|
-
return { ok: false, errors: [{ key: "(file)", reason: `invalid JSON: ${reason}` }] };
|
|
35093
|
-
}
|
|
35094
|
-
return validateLocaleFile(raw);
|
|
35095
|
-
}
|
|
35096
|
-
function mergeTables(bundled, override) {
|
|
35097
|
-
return { ...bundled, ...override };
|
|
35098
|
-
}
|
|
35099
|
-
function userLocalesDir(dshHome) {
|
|
35100
|
-
const home = dshHome ?? process.env.DSH_HOME ?? join12(homedir5(), ".dsh");
|
|
35101
|
-
return join12(home, "locales");
|
|
35102
|
-
}
|
|
35103
|
-
function bundledLocalesDir() {
|
|
35104
|
-
let dir = dirname4(new URL(import.meta.url).pathname);
|
|
35105
|
-
for (let up = 0;up < 6; up++) {
|
|
35106
|
-
const candidate = join12(dir, "locales");
|
|
35107
|
-
if (existsSync9(join12(candidate, `${DEFAULT_LANGUAGE}.json`)))
|
|
35108
|
-
return candidate;
|
|
35109
|
-
const parent = dirname4(dir);
|
|
35110
|
-
if (parent === dir)
|
|
35111
|
-
break;
|
|
35112
|
-
dir = parent;
|
|
35113
|
-
}
|
|
35114
|
-
return join12(dirname4(new URL(import.meta.url).pathname), "..", "locales");
|
|
35115
|
-
}
|
|
35116
|
-
function loadLocales(options) {
|
|
35117
|
-
const bundledDir = options?.bundledDir ?? bundledLocalesDir();
|
|
35118
|
-
const languages = new Map;
|
|
35119
|
-
const warnings = [];
|
|
35120
|
-
if (existsSync9(bundledDir)) {
|
|
35121
|
-
for (const entry of readdirSync2(bundledDir)) {
|
|
35122
|
-
if (!entry.endsWith(".json"))
|
|
35123
|
-
continue;
|
|
35124
|
-
const id = entry.slice(0, -".json".length);
|
|
35125
|
-
const result = parseLocaleFile(readFileSync10(join12(bundledDir, entry), "utf8"));
|
|
35126
|
-
if (!result.ok) {
|
|
35127
|
-
warnings.push(`[i18n] bundled locale file rejected, skipping '${entry}': ${formatErrors(result.errors)}`);
|
|
35128
|
-
continue;
|
|
35129
|
-
}
|
|
35130
|
-
languages.set(id, result.table);
|
|
35131
|
-
}
|
|
35132
|
-
} else {
|
|
35133
|
-
warnings.push(`[i18n] bundled locales dir not found: ${bundledDir}`);
|
|
35134
|
-
}
|
|
35135
|
-
const userDir = options?.userDir ?? userLocalesDir();
|
|
35136
|
-
if (existsSync9(userDir)) {
|
|
35137
|
-
for (const entry of readdirSync2(userDir)) {
|
|
35138
|
-
if (!entry.endsWith(".json"))
|
|
35139
|
-
continue;
|
|
35140
|
-
const id = entry.slice(0, -".json".length);
|
|
35141
|
-
const result = parseLocaleFile(readFileSync10(join12(userDir, entry), "utf8"));
|
|
35142
|
-
if (!result.ok) {
|
|
35143
|
-
warnings.push(`[i18n] user locale file rejected, skipping '${entry}': ${formatErrors(result.errors)}`);
|
|
35144
|
-
continue;
|
|
35145
|
-
}
|
|
35146
|
-
const bundled = languages.get(id);
|
|
35147
|
-
languages.set(id, bundled ? mergeTables(bundled, result.table) : result.table);
|
|
35148
|
-
}
|
|
35149
|
-
}
|
|
35150
|
-
return { languages, warnings };
|
|
35151
|
-
}
|
|
35152
|
-
var DEFAULT_LANGUAGE = "en", PLACEHOLDER_NAME, PLACEHOLDER_SCAN, hasIncompatiblePlaceholder = (value) => {
|
|
35153
|
-
for (const match of value.matchAll(PLACEHOLDER_SCAN)) {
|
|
35154
|
-
const token = match[1] ?? "";
|
|
35155
|
-
if (!PLACEHOLDER_NAME.test(token))
|
|
35156
|
-
return match[0];
|
|
35157
|
-
}
|
|
35158
|
-
const legacy = value.match(/%[-0-9.]*[sdif@]/);
|
|
35159
|
-
if (legacy)
|
|
35160
|
-
return legacy[0];
|
|
35161
|
-
return;
|
|
35162
|
-
}, formatErrors = (errors) => errors.map((e) => `${e.key}: ${e.reason}`).join("; ");
|
|
35163
|
-
var init_registry = __esm(() => {
|
|
35164
|
-
PLACEHOLDER_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
35165
|
-
PLACEHOLDER_SCAN = /\{([^{}]*)\}/g;
|
|
35166
|
-
});
|
|
35167
|
-
|
|
35168
|
-
// ../i18n/src/t.ts
|
|
35169
|
-
function localeFromConfig(value) {
|
|
35170
|
-
if (typeof value !== "string")
|
|
35171
|
-
return DEFAULT_LANGUAGE;
|
|
35172
|
-
const norm = value.trim().replace(/[_]/g, "-").toLowerCase();
|
|
35173
|
-
if (norm === "" || norm === "en" || norm === "en-us" || norm === "en-gb")
|
|
35174
|
-
return DEFAULT_LANGUAGE;
|
|
35175
|
-
if (norm === "zh-cn" || norm === "zh" || norm === "zh-hans" || norm === "zh-hans-cn" || norm === "zh-sg" || norm === "zh-my") {
|
|
35176
|
-
return "zh-CN";
|
|
35177
|
-
}
|
|
35178
|
-
return DEFAULT_LANGUAGE;
|
|
35179
|
-
}
|
|
35180
|
-
function applyI18nConfig(config, options) {
|
|
35181
|
-
try {
|
|
35182
|
-
const loaded = loadLocales(options);
|
|
35183
|
-
state.languages = loaded.languages;
|
|
35184
|
-
state.warnings = [...loaded.warnings];
|
|
35185
|
-
const requested = config?.lang !== undefined ? config.lang : config?.hintsLocale;
|
|
35186
|
-
state.active = localeFromConfig(requested);
|
|
35187
|
-
if (typeof requested === "string" && /^(ja|ko)([-_].*)?$/i.test(requested.trim()) && !state.languages.has(requested.trim())) {
|
|
35188
|
-
state.warnings.push(`[i18n] language '${requested.trim()}' is not bundled \u2014 degraded to '${DEFAULT_LANGUAGE}'`);
|
|
35189
|
-
}
|
|
35190
|
-
if (!state.languages.has(state.active)) {
|
|
35191
|
-
state.warnings.push(`[i18n] language '${state.active}' not installed \u2014 falling back to '${DEFAULT_LANGUAGE}'`);
|
|
35192
|
-
state.active = DEFAULT_LANGUAGE;
|
|
35193
|
-
}
|
|
35194
|
-
} catch (error) {
|
|
35195
|
-
state.warnings.push(`[i18n] boot load failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
35196
|
-
state.languages = new Map;
|
|
35197
|
-
state.active = DEFAULT_LANGUAGE;
|
|
35198
|
-
}
|
|
35199
|
-
for (const warning of state.warnings)
|
|
35200
|
-
console.warn(warning);
|
|
35201
|
-
setLanguageSignal(state.active);
|
|
35202
|
-
return { language: state.active, warnings: state.warnings };
|
|
35203
|
-
}
|
|
35204
|
-
function activeLanguage() {
|
|
35205
|
-
const id = languageSignal();
|
|
35206
|
-
return state.languages.size === 0 ? DEFAULT_LANGUAGE : id;
|
|
35207
|
-
}
|
|
35208
|
-
function installedLanguages() {
|
|
35209
|
-
return [...state.languages.keys()].sort();
|
|
35210
|
-
}
|
|
35211
|
-
function setLanguage(id) {
|
|
35212
|
-
if (state.languages.size > 0 && !state.languages.has(id)) {
|
|
35213
|
-
console.warn(`[i18n] setLanguage('${id}') has no table \u2014 keeping '${state.active}'`);
|
|
35214
|
-
return;
|
|
35215
|
-
}
|
|
35216
|
-
state.active = id;
|
|
35217
|
-
setLanguageSignal(id);
|
|
35218
|
-
}
|
|
35219
|
-
function t(key, params) {
|
|
35220
|
-
try {
|
|
35221
|
-
const active = activeLanguage();
|
|
35222
|
-
const raw = table(active)?.[key] ?? table(DEFAULT_LANGUAGE)?.[key];
|
|
35223
|
-
if (typeof raw !== "string")
|
|
35224
|
-
return key;
|
|
35225
|
-
return params ? interpolate2(raw, params) : raw;
|
|
35226
|
-
} catch {
|
|
35227
|
-
return key;
|
|
35228
|
-
}
|
|
35229
|
-
}
|
|
35230
|
-
var state, languageSignal, setLanguageSignal, LANGUAGE_CHOICES, table = (id) => state.languages.get(id), safeString = (value) => {
|
|
35231
|
-
try {
|
|
35232
|
-
return String(value);
|
|
35233
|
-
} catch {
|
|
35234
|
-
return;
|
|
35235
|
-
}
|
|
35236
|
-
}, interpolate2 = (template, params) => template.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (placeholder, name) => {
|
|
35237
|
-
if (!Object.prototype.hasOwnProperty.call(params, name))
|
|
35238
|
-
return placeholder;
|
|
35239
|
-
return safeString(params[name]) ?? placeholder;
|
|
35240
|
-
});
|
|
35241
|
-
var init_t = __esm(() => {
|
|
35242
|
-
init_server();
|
|
35243
|
-
init_registry();
|
|
35244
|
-
state = { languages: new Map, active: DEFAULT_LANGUAGE, warnings: [] };
|
|
35245
|
-
[languageSignal, setLanguageSignal] = createSignal(DEFAULT_LANGUAGE);
|
|
35246
|
-
LANGUAGE_CHOICES = ["en", "zh-CN"];
|
|
35247
|
-
});
|
|
35248
|
-
|
|
35249
|
-
// ../i18n/src/index.ts
|
|
35250
|
-
var init_src = __esm(() => {
|
|
35251
|
-
init_registry();
|
|
35252
|
-
init_t();
|
|
35253
|
-
});
|
|
35254
|
-
|
|
35255
|
-
// ../tui-base/src/i18n.ts
|
|
35256
|
-
var init_i18n = __esm(() => {
|
|
35257
|
-
init_src();
|
|
35258
|
-
});
|
|
35259
|
-
|
|
35260
35056
|
// ../../node_modules/.pnpm/@opentui+keymap@0.8.1_@opentui+solid@0.8.1_solid-js@1.9.17_typescript@5.9.3_web-tree-si_cf27251ea086cee0c05f2add925b23c0/node_modules/@opentui/keymap/chunks/index-pjh5rp2p.js
|
|
35261
35057
|
function createLayerSlot(keymap) {
|
|
35262
35058
|
const { layers } = keymap[KEYMAP_EXTENSION_CONTEXT2]();
|
|
@@ -39923,7 +39719,7 @@ function getKeyMatchKey(input) {
|
|
|
39923
39719
|
return resolveKeyMatch(input);
|
|
39924
39720
|
}
|
|
39925
39721
|
var RESERVED_COMMAND_FIELDS, RESERVED_BINDING_FIELDS, RESERVED_LAYER_FIELDS, DEPTH_MAX = 16, COMPILED_DEPTH_MAX = 32, PLAIN_FUNCTION_KEYS, forwardTargets, external, DEFAULT_COMMAND_SEARCH_FIELDS, EMPTY_COMMAND_FIELDS, commandSearchCache, EMPTY_COMPILE_FIELDS, EMPTY_REQUIRES, EMPTY_MATCHERS, KEY_DISAMBIGUATION_DECISION, KEY_DEFERRED_DISAMBIGUATION_DECISION, NOOP = () => {}, NOOP2 = () => {}, MAX_STATE_CHANGE_FLUSH_ITERATIONS = 1000, EMPTY_DATA, Keymap;
|
|
39926
|
-
var
|
|
39722
|
+
var init_src = __esm(() => {
|
|
39927
39723
|
init_index_pjh5rp2p();
|
|
39928
39724
|
init_index_0a7ve4a3();
|
|
39929
39725
|
RESERVED_COMMAND_FIELDS = new Set(["name", "run", "fields", "attrs", "rejectedResult"]);
|
|
@@ -40818,8 +40614,8 @@ var namedSingleStrokeKeys, modifierKeyNames, namedSingleStrokeKeyPrefixes, modif
|
|
|
40818
40614
|
}));
|
|
40819
40615
|
}, DEAD_BINDING_WARNINGS_RESOURCE, ENABLED_FIELDS_RESOURCE, EMACS_BINDINGS_RESOURCE, EX_COMMANDS_RESOURCE, METADATA_FIELDS_RESOURCE, MOD_BINDINGS_RESOURCE, UNRESOLVED_COMMAND_WARNINGS_RESOURCE;
|
|
40820
40616
|
var init_addons = __esm(() => {
|
|
40821
|
-
|
|
40822
|
-
|
|
40617
|
+
init_src();
|
|
40618
|
+
init_src();
|
|
40823
40619
|
namedSingleStrokeKeys = new Set([
|
|
40824
40620
|
"up",
|
|
40825
40621
|
"down",
|
|
@@ -41512,7 +41308,7 @@ function createDefaultOpenTuiKeymap(renderer) {
|
|
|
41512
41308
|
return keymap;
|
|
41513
41309
|
}
|
|
41514
41310
|
var init_opentui2 = __esm(() => {
|
|
41515
|
-
|
|
41311
|
+
init_src();
|
|
41516
41312
|
init_addons();
|
|
41517
41313
|
});
|
|
41518
41314
|
|
|
@@ -41590,6 +41386,48 @@ var init_solid = __esm(() => {
|
|
|
41590
41386
|
KeymapContext = createContext();
|
|
41591
41387
|
});
|
|
41592
41388
|
|
|
41389
|
+
// ../tui-base/src/util/key-trace.ts
|
|
41390
|
+
import { appendFileSync as appendFileSync3 } from "fs";
|
|
41391
|
+
function createTraceSink(path) {
|
|
41392
|
+
let failed = false;
|
|
41393
|
+
const write = (record) => {
|
|
41394
|
+
if (failed)
|
|
41395
|
+
return;
|
|
41396
|
+
try {
|
|
41397
|
+
appendFileSync3(path, JSON.stringify({ t: Date.now(), ...record }) + `
|
|
41398
|
+
`);
|
|
41399
|
+
} catch {
|
|
41400
|
+
failed = true;
|
|
41401
|
+
}
|
|
41402
|
+
};
|
|
41403
|
+
return {
|
|
41404
|
+
key(event) {
|
|
41405
|
+
write({
|
|
41406
|
+
src: "key",
|
|
41407
|
+
key: event.key,
|
|
41408
|
+
ctrl: Boolean(event.ctrl),
|
|
41409
|
+
alt: Boolean(event.alt),
|
|
41410
|
+
shift: Boolean(event.shift),
|
|
41411
|
+
super: Boolean(event.super)
|
|
41412
|
+
});
|
|
41413
|
+
},
|
|
41414
|
+
contentChange(len, head) {
|
|
41415
|
+
write({ src: "contentChange", len, head: head.slice(0, HEAD_CHARS) });
|
|
41416
|
+
},
|
|
41417
|
+
composerSet(from, len) {
|
|
41418
|
+
write({ src: "composerSet", from, len });
|
|
41419
|
+
}
|
|
41420
|
+
};
|
|
41421
|
+
}
|
|
41422
|
+
function resolveTraceFromEnv(env) {
|
|
41423
|
+
const configured = env[ENV_NAME];
|
|
41424
|
+
return configured ? createTraceSink(configured) : undefined;
|
|
41425
|
+
}
|
|
41426
|
+
var ENV_NAME = "DSH_OPENTUI_KEY_TRACE", HEAD_CHARS = 32, keyTrace;
|
|
41427
|
+
var init_key_trace = __esm(() => {
|
|
41428
|
+
keyTrace = resolveTraceFromEnv(process.env);
|
|
41429
|
+
});
|
|
41430
|
+
|
|
41593
41431
|
// ../tui-base/src/context/interactivity.tsx
|
|
41594
41432
|
function useInteractivity() {
|
|
41595
41433
|
return useContext(Context4);
|
|
@@ -41772,6 +41610,20 @@ function Provider(props) {
|
|
|
41772
41610
|
},
|
|
41773
41611
|
bindings: ["input.move.left", "input.move.right", "input.move.up", "input.move.down", "input.select.left", "input.select.right", "input.select.up", "input.select.down", "input.line.home", "input.line.end", "input.select.line.home", "input.select.line.end", "input.visual.line.home", "input.visual.line.end", "input.select.visual.line.home", "input.select.visual.line.end", "input.buffer.home", "input.buffer.end", "input.select.buffer.home", "input.select.buffer.end", "input.delete.line", "input.delete.to.line.end", "input.delete.to.line.start", "input.backspace", "input.delete", "input.newline", "input.undo", "input.redo", "input.word.forward", "input.word.backward", "input.select.word.forward", "input.select.word.backward", "input.delete.word.forward", "input.delete.word.backward", "input.select.all", "input.submit"].flatMap((command) => config.keybinds.get(command))
|
|
41774
41612
|
})];
|
|
41613
|
+
if (keyTrace) {
|
|
41614
|
+
const trace = keyTrace;
|
|
41615
|
+
dispose.push(keymap.intercept("key", ({
|
|
41616
|
+
event
|
|
41617
|
+
}) => {
|
|
41618
|
+
trace.key({
|
|
41619
|
+
key: event.name,
|
|
41620
|
+
ctrl: event.ctrl,
|
|
41621
|
+
alt: event.meta,
|
|
41622
|
+
shift: event.shift,
|
|
41623
|
+
super: event.super ?? false
|
|
41624
|
+
});
|
|
41625
|
+
}));
|
|
41626
|
+
}
|
|
41775
41627
|
const leader = config.keybinds.get("leader")?.[0]?.key;
|
|
41776
41628
|
if (leader) {
|
|
41777
41629
|
dispose.push(registerTimedLeader(keymap, {
|
|
@@ -42136,7 +41988,7 @@ function formatOptions(config) {
|
|
|
42136
41988
|
var MODE, Context7, Keymap2;
|
|
42137
41989
|
var init_keymap = __esm(() => {
|
|
42138
41990
|
init_index_bun();
|
|
42139
|
-
|
|
41991
|
+
init_src();
|
|
42140
41992
|
init_opentui();
|
|
42141
41993
|
init_extras();
|
|
42142
41994
|
init_opentui2();
|
|
@@ -42145,6 +41997,7 @@ var init_keymap = __esm(() => {
|
|
|
42145
41997
|
init_server();
|
|
42146
41998
|
init_config();
|
|
42147
41999
|
init_keybind();
|
|
42000
|
+
init_key_trace();
|
|
42148
42001
|
init_interactivity();
|
|
42149
42002
|
init_focus_router();
|
|
42150
42003
|
MODE = {
|
|
@@ -42168,9 +42021,410 @@ var init_keymap = __esm(() => {
|
|
|
42168
42021
|
};
|
|
42169
42022
|
});
|
|
42170
42023
|
|
|
42024
|
+
// ../tui-base/src/routes/session/pane-focus.tsx
|
|
42025
|
+
import { CliRenderEvents as CliRenderEvents4 } from "@opentui/core";
|
|
42026
|
+
function markPanelActive(panel) {
|
|
42027
|
+
setActivePanelSignal(panel);
|
|
42028
|
+
}
|
|
42029
|
+
function composerInteraction() {
|
|
42030
|
+
markPanelActive("composer");
|
|
42031
|
+
}
|
|
42032
|
+
function resetActivePanel() {
|
|
42033
|
+
setActivePanelSignal(DEFAULT_ACTIVE_PANEL);
|
|
42034
|
+
}
|
|
42035
|
+
function withinRenderable(node, ancestor) {
|
|
42036
|
+
if (!node || !ancestor)
|
|
42037
|
+
return false;
|
|
42038
|
+
let current = node;
|
|
42039
|
+
while (current) {
|
|
42040
|
+
if (current === ancestor)
|
|
42041
|
+
return true;
|
|
42042
|
+
current = current.parent;
|
|
42043
|
+
}
|
|
42044
|
+
return false;
|
|
42045
|
+
}
|
|
42046
|
+
function paneForFocused(current, nodes) {
|
|
42047
|
+
if (!current)
|
|
42048
|
+
return;
|
|
42049
|
+
if (withinRenderable(current, nodes.transcript?.()))
|
|
42050
|
+
return "transcript";
|
|
42051
|
+
if (withinRenderable(current, nodes.composer?.()))
|
|
42052
|
+
return "composer";
|
|
42053
|
+
return;
|
|
42054
|
+
}
|
|
42055
|
+
function paneToggleEnabled(gate) {
|
|
42056
|
+
return gate.keysEnabled && gate.pane !== undefined && !gate.slashOpen;
|
|
42057
|
+
}
|
|
42058
|
+
function transcriptKeysEnabled(gate) {
|
|
42059
|
+
return gate.keysEnabled && gate.pane === "transcript";
|
|
42060
|
+
}
|
|
42061
|
+
function createPaneFocus(nodes) {
|
|
42062
|
+
const renderer = useRenderer();
|
|
42063
|
+
const pane = createPaneFocusSignal(renderer, nodes);
|
|
42064
|
+
const focus = (which) => {
|
|
42065
|
+
const node = which === "transcript" ? nodes.transcript?.() : nodes.composer?.();
|
|
42066
|
+
node?.focus();
|
|
42067
|
+
};
|
|
42068
|
+
return {
|
|
42069
|
+
pane,
|
|
42070
|
+
composerFocused: () => pane() === "composer",
|
|
42071
|
+
transcriptFocused: () => pane() === "transcript",
|
|
42072
|
+
focusComposer: () => focus("composer"),
|
|
42073
|
+
focusTranscript: () => focus("transcript"),
|
|
42074
|
+
toggle: () => focus(pane() === "transcript" ? "composer" : "transcript")
|
|
42075
|
+
};
|
|
42076
|
+
}
|
|
42077
|
+
function createPaneFocusSignal(renderer, nodes) {
|
|
42078
|
+
const [pane, setPane] = createSignal(undefined);
|
|
42079
|
+
const refresh = () => setPane(paneForFocused(renderer.currentFocusedRenderable, nodes));
|
|
42080
|
+
onMount(() => {
|
|
42081
|
+
renderer.on(CliRenderEvents4.FOCUSED_RENDERABLE, refresh);
|
|
42082
|
+
refresh();
|
|
42083
|
+
});
|
|
42084
|
+
onCleanup(() => renderer.off(CliRenderEvents4.FOCUSED_RENDERABLE, refresh));
|
|
42085
|
+
return pane;
|
|
42086
|
+
}
|
|
42087
|
+
function PaneFocusKeys(props) {
|
|
42088
|
+
const scroll = () => {
|
|
42089
|
+
const box = props.scroll();
|
|
42090
|
+
return box && !box.isDestroyed ? box : undefined;
|
|
42091
|
+
};
|
|
42092
|
+
const line = (delta) => {
|
|
42093
|
+
scroll()?.scrollBy(delta);
|
|
42094
|
+
return true;
|
|
42095
|
+
};
|
|
42096
|
+
const page = (delta) => {
|
|
42097
|
+
scroll()?.scrollBy(delta, "viewport");
|
|
42098
|
+
return true;
|
|
42099
|
+
};
|
|
42100
|
+
const top = () => {
|
|
42101
|
+
scroll()?.scrollTo(0);
|
|
42102
|
+
return true;
|
|
42103
|
+
};
|
|
42104
|
+
const bottom = () => {
|
|
42105
|
+
scroll()?.scrollTo(Infinity);
|
|
42106
|
+
return true;
|
|
42107
|
+
};
|
|
42108
|
+
Keymap2.createLayer(() => ({
|
|
42109
|
+
mode: "global",
|
|
42110
|
+
priority: 1,
|
|
42111
|
+
capture: "main",
|
|
42112
|
+
enabled: paneToggleEnabled({
|
|
42113
|
+
pane: props.pane(),
|
|
42114
|
+
keysEnabled: props.keysEnabled(),
|
|
42115
|
+
slashOpen: props.slashOpen()
|
|
42116
|
+
}),
|
|
42117
|
+
commands: [{
|
|
42118
|
+
id: "pane.focus.toggle",
|
|
42119
|
+
title: "Toggle transcript / composer focus",
|
|
42120
|
+
group: "Session",
|
|
42121
|
+
bind: "f6",
|
|
42122
|
+
run: () => {
|
|
42123
|
+
props.toggle();
|
|
42124
|
+
return true;
|
|
42125
|
+
}
|
|
42126
|
+
}]
|
|
42127
|
+
}));
|
|
42128
|
+
Keymap2.createLayer(() => ({
|
|
42129
|
+
mode: "global",
|
|
42130
|
+
priority: 1,
|
|
42131
|
+
capture: "main",
|
|
42132
|
+
enabled: transcriptKeysEnabled({
|
|
42133
|
+
pane: props.pane(),
|
|
42134
|
+
keysEnabled: props.keysEnabled()
|
|
42135
|
+
}),
|
|
42136
|
+
commands: [{
|
|
42137
|
+
id: "pane.transcript.line.up",
|
|
42138
|
+
title: "Scroll transcript up one line",
|
|
42139
|
+
group: "Session",
|
|
42140
|
+
bind: "up",
|
|
42141
|
+
run: () => line(-1)
|
|
42142
|
+
}, {
|
|
42143
|
+
id: "pane.transcript.line.down",
|
|
42144
|
+
title: "Scroll transcript down one line",
|
|
42145
|
+
group: "Session",
|
|
42146
|
+
bind: "down",
|
|
42147
|
+
run: () => line(1)
|
|
42148
|
+
}, {
|
|
42149
|
+
id: "pane.transcript.page.up",
|
|
42150
|
+
title: "Scroll transcript up one page",
|
|
42151
|
+
group: "Session",
|
|
42152
|
+
bind: "pageup",
|
|
42153
|
+
run: () => page(-1)
|
|
42154
|
+
}, {
|
|
42155
|
+
id: "pane.transcript.page.down",
|
|
42156
|
+
title: "Scroll transcript down one page",
|
|
42157
|
+
group: "Session",
|
|
42158
|
+
bind: "pagedown",
|
|
42159
|
+
run: () => page(1)
|
|
42160
|
+
}, {
|
|
42161
|
+
id: "pane.transcript.top",
|
|
42162
|
+
title: "Transcript top",
|
|
42163
|
+
group: "Session",
|
|
42164
|
+
bind: "home",
|
|
42165
|
+
run: top
|
|
42166
|
+
}, {
|
|
42167
|
+
id: "pane.transcript.bottom",
|
|
42168
|
+
title: "Transcript bottom",
|
|
42169
|
+
group: "Session",
|
|
42170
|
+
bind: "end",
|
|
42171
|
+
run: bottom
|
|
42172
|
+
}, {
|
|
42173
|
+
id: "pane.transcript.composer",
|
|
42174
|
+
title: "Focus the composer",
|
|
42175
|
+
group: "Session",
|
|
42176
|
+
bind: "tab",
|
|
42177
|
+
run: () => {
|
|
42178
|
+
props.focusComposer();
|
|
42179
|
+
return true;
|
|
42180
|
+
}
|
|
42181
|
+
}, {
|
|
42182
|
+
id: "pane.transcript.escape",
|
|
42183
|
+
title: "Focus the composer",
|
|
42184
|
+
group: "Session",
|
|
42185
|
+
bind: "escape",
|
|
42186
|
+
run: () => {
|
|
42187
|
+
if (props.busy())
|
|
42188
|
+
return false;
|
|
42189
|
+
props.focusComposer();
|
|
42190
|
+
return true;
|
|
42191
|
+
}
|
|
42192
|
+
}]
|
|
42193
|
+
}));
|
|
42194
|
+
return null;
|
|
42195
|
+
}
|
|
42196
|
+
var DEFAULT_ACTIVE_PANEL = "composer", activePanel, setActivePanelSignal;
|
|
42197
|
+
var init_pane_focus = __esm(() => {
|
|
42198
|
+
init_server();
|
|
42199
|
+
init_index_bun();
|
|
42200
|
+
init_keymap();
|
|
42201
|
+
[activePanel, setActivePanelSignal] = createSignal(DEFAULT_ACTIVE_PANEL);
|
|
42202
|
+
});
|
|
42203
|
+
|
|
42204
|
+
// ../i18n/src/registry.ts
|
|
42205
|
+
import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync10 } from "fs";
|
|
42206
|
+
import { homedir as homedir5 } from "os";
|
|
42207
|
+
import { dirname as dirname4, join as join12 } from "path";
|
|
42208
|
+
function validateLocaleFile(raw) {
|
|
42209
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
42210
|
+
return { ok: false, errors: [{ key: "(file)", reason: "not a flat JSON object" }] };
|
|
42211
|
+
}
|
|
42212
|
+
const errors = [];
|
|
42213
|
+
const record = raw;
|
|
42214
|
+
const name = record["name"];
|
|
42215
|
+
if (typeof name !== "string" || name.length === 0) {
|
|
42216
|
+
errors.push({ key: "name", reason: "missing or not a non-empty string" });
|
|
42217
|
+
}
|
|
42218
|
+
for (const [key, value] of Object.entries(record)) {
|
|
42219
|
+
if (key === "name")
|
|
42220
|
+
continue;
|
|
42221
|
+
if (typeof value !== "string") {
|
|
42222
|
+
errors.push({ key, reason: `not a string (${value === null ? "null" : Array.isArray(value) ? "array" : typeof value})` });
|
|
42223
|
+
continue;
|
|
42224
|
+
}
|
|
42225
|
+
if (value.length === 0) {
|
|
42226
|
+
errors.push({ key, reason: "empty string" });
|
|
42227
|
+
continue;
|
|
42228
|
+
}
|
|
42229
|
+
const bad = hasIncompatiblePlaceholder(value);
|
|
42230
|
+
if (bad !== undefined)
|
|
42231
|
+
errors.push({ key, reason: `incompatible placeholder ${bad} (expected {param})` });
|
|
42232
|
+
}
|
|
42233
|
+
if (errors.length > 0)
|
|
42234
|
+
return { ok: false, errors };
|
|
42235
|
+
return { ok: true, table: raw };
|
|
42236
|
+
}
|
|
42237
|
+
function parseLocaleFile(text) {
|
|
42238
|
+
let raw;
|
|
42239
|
+
try {
|
|
42240
|
+
raw = JSON.parse(text);
|
|
42241
|
+
} catch (error) {
|
|
42242
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
42243
|
+
return { ok: false, errors: [{ key: "(file)", reason: `invalid JSON: ${reason}` }] };
|
|
42244
|
+
}
|
|
42245
|
+
return validateLocaleFile(raw);
|
|
42246
|
+
}
|
|
42247
|
+
function mergeTables(bundled, override) {
|
|
42248
|
+
return { ...bundled, ...override };
|
|
42249
|
+
}
|
|
42250
|
+
function userLocalesDir(dshHome) {
|
|
42251
|
+
const home = dshHome ?? process.env.DSH_HOME ?? join12(homedir5(), ".dsh");
|
|
42252
|
+
return join12(home, "locales");
|
|
42253
|
+
}
|
|
42254
|
+
function bundledLocalesDir() {
|
|
42255
|
+
let dir = dirname4(new URL(import.meta.url).pathname);
|
|
42256
|
+
for (let up = 0;up < 6; up++) {
|
|
42257
|
+
const candidate = join12(dir, "locales");
|
|
42258
|
+
if (existsSync9(join12(candidate, `${DEFAULT_LANGUAGE}.json`)))
|
|
42259
|
+
return candidate;
|
|
42260
|
+
const parent = dirname4(dir);
|
|
42261
|
+
if (parent === dir)
|
|
42262
|
+
break;
|
|
42263
|
+
dir = parent;
|
|
42264
|
+
}
|
|
42265
|
+
return join12(dirname4(new URL(import.meta.url).pathname), "..", "locales");
|
|
42266
|
+
}
|
|
42267
|
+
function loadLocales(options) {
|
|
42268
|
+
const bundledDir = options?.bundledDir ?? bundledLocalesDir();
|
|
42269
|
+
const languages = new Map;
|
|
42270
|
+
const warnings = [];
|
|
42271
|
+
if (existsSync9(bundledDir)) {
|
|
42272
|
+
for (const entry of readdirSync2(bundledDir)) {
|
|
42273
|
+
if (!entry.endsWith(".json"))
|
|
42274
|
+
continue;
|
|
42275
|
+
const id = entry.slice(0, -".json".length);
|
|
42276
|
+
const result = parseLocaleFile(readFileSync10(join12(bundledDir, entry), "utf8"));
|
|
42277
|
+
if (!result.ok) {
|
|
42278
|
+
warnings.push(`[i18n] bundled locale file rejected, skipping '${entry}': ${formatErrors(result.errors)}`);
|
|
42279
|
+
continue;
|
|
42280
|
+
}
|
|
42281
|
+
languages.set(id, result.table);
|
|
42282
|
+
}
|
|
42283
|
+
} else {
|
|
42284
|
+
warnings.push(`[i18n] bundled locales dir not found: ${bundledDir}`);
|
|
42285
|
+
}
|
|
42286
|
+
const userDir = options?.userDir ?? userLocalesDir();
|
|
42287
|
+
if (existsSync9(userDir)) {
|
|
42288
|
+
for (const entry of readdirSync2(userDir)) {
|
|
42289
|
+
if (!entry.endsWith(".json"))
|
|
42290
|
+
continue;
|
|
42291
|
+
const id = entry.slice(0, -".json".length);
|
|
42292
|
+
const result = parseLocaleFile(readFileSync10(join12(userDir, entry), "utf8"));
|
|
42293
|
+
if (!result.ok) {
|
|
42294
|
+
warnings.push(`[i18n] user locale file rejected, skipping '${entry}': ${formatErrors(result.errors)}`);
|
|
42295
|
+
continue;
|
|
42296
|
+
}
|
|
42297
|
+
const bundled = languages.get(id);
|
|
42298
|
+
languages.set(id, bundled ? mergeTables(bundled, result.table) : result.table);
|
|
42299
|
+
}
|
|
42300
|
+
}
|
|
42301
|
+
return { languages, warnings };
|
|
42302
|
+
}
|
|
42303
|
+
var DEFAULT_LANGUAGE = "en", PLACEHOLDER_NAME, PLACEHOLDER_SCAN, hasIncompatiblePlaceholder = (value) => {
|
|
42304
|
+
for (const match of value.matchAll(PLACEHOLDER_SCAN)) {
|
|
42305
|
+
const token = match[1] ?? "";
|
|
42306
|
+
if (!PLACEHOLDER_NAME.test(token))
|
|
42307
|
+
return match[0];
|
|
42308
|
+
}
|
|
42309
|
+
const legacy = value.match(/%[-0-9.]*[sdif@]/);
|
|
42310
|
+
if (legacy)
|
|
42311
|
+
return legacy[0];
|
|
42312
|
+
return;
|
|
42313
|
+
}, formatErrors = (errors) => errors.map((e) => `${e.key}: ${e.reason}`).join("; ");
|
|
42314
|
+
var init_registry = __esm(() => {
|
|
42315
|
+
PLACEHOLDER_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
42316
|
+
PLACEHOLDER_SCAN = /\{([^{}]*)\}/g;
|
|
42317
|
+
});
|
|
42318
|
+
|
|
42319
|
+
// ../i18n/src/t.ts
|
|
42320
|
+
function localeFromConfig(value) {
|
|
42321
|
+
if (typeof value !== "string")
|
|
42322
|
+
return DEFAULT_LANGUAGE;
|
|
42323
|
+
const norm = value.trim().replace(/[_]/g, "-").toLowerCase();
|
|
42324
|
+
if (norm === "" || norm === "en" || norm === "en-us" || norm === "en-gb")
|
|
42325
|
+
return DEFAULT_LANGUAGE;
|
|
42326
|
+
if (norm === "zh-cn" || norm === "zh" || norm === "zh-hans" || norm === "zh-hans-cn" || norm === "zh-sg" || norm === "zh-my") {
|
|
42327
|
+
return "zh-CN";
|
|
42328
|
+
}
|
|
42329
|
+
return DEFAULT_LANGUAGE;
|
|
42330
|
+
}
|
|
42331
|
+
function applyI18nConfig(config, options) {
|
|
42332
|
+
try {
|
|
42333
|
+
const loaded = loadLocales(options);
|
|
42334
|
+
state.languages = loaded.languages;
|
|
42335
|
+
state.warnings = [...loaded.warnings];
|
|
42336
|
+
const requested = config?.lang !== undefined ? config.lang : config?.hintsLocale;
|
|
42337
|
+
state.active = localeFromConfig(requested);
|
|
42338
|
+
if (typeof requested === "string" && /^(ja|ko)([-_].*)?$/i.test(requested.trim()) && !state.languages.has(requested.trim())) {
|
|
42339
|
+
state.warnings.push(`[i18n] language '${requested.trim()}' is not bundled \u2014 degraded to '${DEFAULT_LANGUAGE}'`);
|
|
42340
|
+
}
|
|
42341
|
+
if (!state.languages.has(state.active)) {
|
|
42342
|
+
state.warnings.push(`[i18n] language '${state.active}' not installed \u2014 falling back to '${DEFAULT_LANGUAGE}'`);
|
|
42343
|
+
state.active = DEFAULT_LANGUAGE;
|
|
42344
|
+
}
|
|
42345
|
+
} catch (error) {
|
|
42346
|
+
state.warnings.push(`[i18n] boot load failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
42347
|
+
state.languages = new Map;
|
|
42348
|
+
state.active = DEFAULT_LANGUAGE;
|
|
42349
|
+
}
|
|
42350
|
+
for (const warning of state.warnings)
|
|
42351
|
+
console.warn(warning);
|
|
42352
|
+
setLanguageSignal(state.active);
|
|
42353
|
+
return { language: state.active, warnings: state.warnings };
|
|
42354
|
+
}
|
|
42355
|
+
function activeLanguage() {
|
|
42356
|
+
const id = languageSignal();
|
|
42357
|
+
return state.languages.size === 0 ? DEFAULT_LANGUAGE : id;
|
|
42358
|
+
}
|
|
42359
|
+
function installedLanguages() {
|
|
42360
|
+
return [...state.languages.keys()].sort();
|
|
42361
|
+
}
|
|
42362
|
+
function setLanguage(id) {
|
|
42363
|
+
if (state.languages.size > 0 && !state.languages.has(id)) {
|
|
42364
|
+
console.warn(`[i18n] setLanguage('${id}') has no table \u2014 keeping '${state.active}'`);
|
|
42365
|
+
return;
|
|
42366
|
+
}
|
|
42367
|
+
state.active = id;
|
|
42368
|
+
setLanguageSignal(id);
|
|
42369
|
+
}
|
|
42370
|
+
function t(key, params) {
|
|
42371
|
+
try {
|
|
42372
|
+
const active = activeLanguage();
|
|
42373
|
+
const raw = table(active)?.[key] ?? table(DEFAULT_LANGUAGE)?.[key];
|
|
42374
|
+
if (typeof raw !== "string")
|
|
42375
|
+
return key;
|
|
42376
|
+
return params ? interpolate2(raw, params) : raw;
|
|
42377
|
+
} catch {
|
|
42378
|
+
return key;
|
|
42379
|
+
}
|
|
42380
|
+
}
|
|
42381
|
+
var state, languageSignal, setLanguageSignal, LANGUAGE_CHOICES, table = (id) => state.languages.get(id), safeString = (value) => {
|
|
42382
|
+
try {
|
|
42383
|
+
return String(value);
|
|
42384
|
+
} catch {
|
|
42385
|
+
return;
|
|
42386
|
+
}
|
|
42387
|
+
}, interpolate2 = (template, params) => template.replace(/\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (placeholder, name) => {
|
|
42388
|
+
if (!Object.prototype.hasOwnProperty.call(params, name))
|
|
42389
|
+
return placeholder;
|
|
42390
|
+
return safeString(params[name]) ?? placeholder;
|
|
42391
|
+
});
|
|
42392
|
+
var init_t = __esm(() => {
|
|
42393
|
+
init_server();
|
|
42394
|
+
init_registry();
|
|
42395
|
+
state = { languages: new Map, active: DEFAULT_LANGUAGE, warnings: [] };
|
|
42396
|
+
[languageSignal, setLanguageSignal] = createSignal(DEFAULT_LANGUAGE);
|
|
42397
|
+
LANGUAGE_CHOICES = ["en", "zh-CN"];
|
|
42398
|
+
});
|
|
42399
|
+
|
|
42400
|
+
// ../i18n/src/index.ts
|
|
42401
|
+
var init_src2 = __esm(() => {
|
|
42402
|
+
init_registry();
|
|
42403
|
+
init_t();
|
|
42404
|
+
});
|
|
42405
|
+
|
|
42406
|
+
// ../tui-base/src/i18n.ts
|
|
42407
|
+
var init_i18n = __esm(() => {
|
|
42408
|
+
init_src2();
|
|
42409
|
+
});
|
|
42410
|
+
|
|
42171
42411
|
// ../tui-base/src/skin/semantic.ts
|
|
42412
|
+
import { parseColor } from "@opentui/core";
|
|
42413
|
+
function mixSkinColor(a, b, t) {
|
|
42414
|
+
const ca = parseColor(a);
|
|
42415
|
+
const cb = parseColor(b);
|
|
42416
|
+
const k = Math.max(0, Math.min(1, t));
|
|
42417
|
+
const channel = (x, y) => Math.round((x + (y - x) * k) * 255);
|
|
42418
|
+
return `#${[channel(ca.r, cb.r), channel(ca.g, cb.g), channel(ca.b, cb.b)].map((value) => value.toString(16).padStart(2, "0")).join("")}`;
|
|
42419
|
+
}
|
|
42172
42420
|
function unfocusedBorderColor(theme) {
|
|
42173
|
-
|
|
42421
|
+
const base = theme?.border.base;
|
|
42422
|
+
if (base === undefined)
|
|
42423
|
+
return SKIN_FALLBACK.border;
|
|
42424
|
+
const muted = theme?.text.muted;
|
|
42425
|
+
if (muted === undefined)
|
|
42426
|
+
return base;
|
|
42427
|
+
return mixSkinColor(base, muted, UNFOCUSED_BORDER_MUTED_MIX);
|
|
42174
42428
|
}
|
|
42175
42429
|
function focusedBorderColor(theme) {
|
|
42176
42430
|
return theme?.hue.interactive[500] ?? SKIN_FALLBACK.accent;
|
|
@@ -42187,6 +42441,10 @@ function surfaceBorder(state) {
|
|
|
42187
42441
|
borderColor: state.busy ? warningColor(state.theme) : state.focused ? focusedBorderColor(state.theme) : unfocusedBorderColor(state.theme)
|
|
42188
42442
|
};
|
|
42189
42443
|
}
|
|
42444
|
+
function panelFocusFrame(state) {
|
|
42445
|
+
const face = surfaceBorder({ focused: state.focused, theme: state.theme });
|
|
42446
|
+
return { borderStyle: face.borderStyle, borderColor: face.borderColor, titleColor: face.borderColor };
|
|
42447
|
+
}
|
|
42190
42448
|
function currentRowColors(theme) {
|
|
42191
42449
|
return {
|
|
42192
42450
|
backgroundColor: theme?.background.action.primary.focused,
|
|
@@ -42225,7 +42483,7 @@ function composerLayout(input) {
|
|
|
42225
42483
|
const content = Math.max(1, input.textareaLines) + Math.max(0, input.footerRows) + Math.max(0, input.paletteRows);
|
|
42226
42484
|
return { height: content + borderRows, border };
|
|
42227
42485
|
}
|
|
42228
|
-
var SKIN_FALLBACK, COMPOSER_BORDER_ROWS = 2, COMPOSER_COMPACT_TERMINAL_ROWS = 30, SKIN_FOCUS_BLUR_DEBOUNCE_MS = 50;
|
|
42486
|
+
var SKIN_FALLBACK, UNFOCUSED_BORDER_MUTED_MIX = 0.5, COMPOSER_BORDER_ROWS = 2, COMPOSER_COMPACT_TERMINAL_ROWS = 30, SKIN_FOCUS_BLUR_DEBOUNCE_MS = 50;
|
|
42229
42487
|
var init_semantic = __esm(() => {
|
|
42230
42488
|
SKIN_FALLBACK = {
|
|
42231
42489
|
border: "#7aa2f7",
|
|
@@ -42239,6 +42497,7 @@ var init_semantic = __esm(() => {
|
|
|
42239
42497
|
import { measureEditText, RenderableEvents as RenderableEvents2 } from "@opentui/core";
|
|
42240
42498
|
function SessionComposer(props) {
|
|
42241
42499
|
const FOOTER_HEIGHT = props.footerHint === false ? 0 : 1;
|
|
42500
|
+
const traceSet = (from, text) => keyTrace?.composerSet(from, text.length);
|
|
42242
42501
|
const renderer = useRenderer();
|
|
42243
42502
|
const dimensions = useTerminalSize();
|
|
42244
42503
|
const theme = useThemeOptional();
|
|
@@ -42306,7 +42565,7 @@ function SessionComposer(props) {
|
|
|
42306
42565
|
const cursor = () => skinCursor(configCursorStyle?.());
|
|
42307
42566
|
const border = () => surfaceBorder({
|
|
42308
42567
|
busy: busy(),
|
|
42309
|
-
focused: visuallyFocused(),
|
|
42568
|
+
focused: activePanel() === "composer" && visuallyFocused(),
|
|
42310
42569
|
theme: theme ?? undefined
|
|
42311
42570
|
});
|
|
42312
42571
|
const busyColor = () => warningColor(theme ?? undefined);
|
|
@@ -42322,8 +42581,12 @@ function SessionComposer(props) {
|
|
|
42322
42581
|
return;
|
|
42323
42582
|
if (props.disabled?.())
|
|
42324
42583
|
return;
|
|
42325
|
-
if (props.interceptSubmit?.(editor.plainText, (text) =>
|
|
42584
|
+
if (props.interceptSubmit?.(editor.plainText, (text) => {
|
|
42585
|
+
editor.setText(text);
|
|
42586
|
+
traceSet("other", text);
|
|
42587
|
+
})) {
|
|
42326
42588
|
editor.setText("");
|
|
42589
|
+
traceSet("other", "");
|
|
42327
42590
|
syncHeight();
|
|
42328
42591
|
return;
|
|
42329
42592
|
}
|
|
@@ -42337,13 +42600,16 @@ function SessionComposer(props) {
|
|
|
42337
42600
|
if (editor.plainText !== buffer)
|
|
42338
42601
|
return;
|
|
42339
42602
|
editor.setText("");
|
|
42603
|
+
traceSet(result === "sent" ? "submit-clear" : "steer-queue", "");
|
|
42340
42604
|
syncHeight();
|
|
42341
42605
|
});
|
|
42342
42606
|
return;
|
|
42343
42607
|
}
|
|
42344
42608
|
const result = controller.submit(buffer);
|
|
42345
|
-
if (result !== "ignored")
|
|
42609
|
+
if (result !== "ignored") {
|
|
42346
42610
|
editor.setText("");
|
|
42611
|
+
traceSet("submit-clear", "");
|
|
42612
|
+
}
|
|
42347
42613
|
}
|
|
42348
42614
|
function recallStep(direction) {
|
|
42349
42615
|
if (!textarea || textarea.isDestroyed)
|
|
@@ -42365,6 +42631,7 @@ function SessionComposer(props) {
|
|
|
42365
42631
|
if (step === undefined)
|
|
42366
42632
|
return false;
|
|
42367
42633
|
textarea.setText(step.text);
|
|
42634
|
+
traceSet("history", step.text);
|
|
42368
42635
|
textarea.cursorOffset = step.cursor ?? 0;
|
|
42369
42636
|
return true;
|
|
42370
42637
|
}
|
|
@@ -42381,6 +42648,7 @@ function SessionComposer(props) {
|
|
|
42381
42648
|
if (step === undefined)
|
|
42382
42649
|
return false;
|
|
42383
42650
|
textarea.setText(step.text);
|
|
42651
|
+
traceSet("history", step.text);
|
|
42384
42652
|
textarea.cursorOffset = step.cursor ?? measure(step.text);
|
|
42385
42653
|
return true;
|
|
42386
42654
|
}
|
|
@@ -42401,6 +42669,7 @@ function SessionComposer(props) {
|
|
|
42401
42669
|
return false;
|
|
42402
42670
|
if (result.text !== buffer) {
|
|
42403
42671
|
textarea.setText(result.text);
|
|
42672
|
+
traceSet("other", result.text);
|
|
42404
42673
|
textarea.cursorOffset = measure(result.text.slice(0, result.cursor));
|
|
42405
42674
|
props.slashSync?.(result.text);
|
|
42406
42675
|
syncHeight();
|
|
@@ -42475,6 +42744,7 @@ function SessionComposer(props) {
|
|
|
42475
42744
|
setProp(_el$, "width", "100%");
|
|
42476
42745
|
setProp(_el$, "flexDirection", "column");
|
|
42477
42746
|
setProp(_el$, "paddingLeft", 1);
|
|
42747
|
+
setProp(_el$, "onMouseUp", () => composerInteraction());
|
|
42478
42748
|
insert(_el$, () => props.slashPalette?.(), _el$2);
|
|
42479
42749
|
use((value) => {
|
|
42480
42750
|
textarea = value;
|
|
@@ -42516,8 +42786,16 @@ function SessionComposer(props) {
|
|
|
42516
42786
|
setProp(_el$2, "minHeight", 1);
|
|
42517
42787
|
setProp(_el$2, "keyBindings", keyBindings);
|
|
42518
42788
|
setProp(_el$2, "onSubmit", submit);
|
|
42519
|
-
setProp(_el$2, "onKeyDown",
|
|
42789
|
+
setProp(_el$2, "onKeyDown", (event) => {
|
|
42790
|
+
composerInteraction();
|
|
42791
|
+
recall(event);
|
|
42792
|
+
});
|
|
42520
42793
|
setProp(_el$2, "onContentChange", () => {
|
|
42794
|
+
if (keyTrace !== undefined && textarea && !textarea.isDestroyed) {
|
|
42795
|
+
const value = textarea.plainText;
|
|
42796
|
+
keyTrace.contentChange(value.length, value);
|
|
42797
|
+
}
|
|
42798
|
+
composerInteraction();
|
|
42521
42799
|
syncHeight();
|
|
42522
42800
|
if (textarea && !textarea.isDestroyed)
|
|
42523
42801
|
props.slashSync?.(textarea.plainText);
|
|
@@ -42595,10 +42873,12 @@ var init_session_composer = __esm(() => {
|
|
|
42595
42873
|
init_terminal_size();
|
|
42596
42874
|
init_composer_keybinds();
|
|
42597
42875
|
init_theme3();
|
|
42876
|
+
init_pane_focus();
|
|
42598
42877
|
init_i18n();
|
|
42599
42878
|
init_keymap();
|
|
42600
42879
|
init_config();
|
|
42601
42880
|
init_semantic();
|
|
42881
|
+
init_key_trace();
|
|
42602
42882
|
PALETTE_NAV_KEYS = new Set(["pageup", "pagedown", "home", "end"]);
|
|
42603
42883
|
});
|
|
42604
42884
|
|
|
@@ -44674,7 +44954,7 @@ function moveSelection(selected, input) {
|
|
|
44674
44954
|
}
|
|
44675
44955
|
|
|
44676
44956
|
// ../tui-base/src/ui/dialog-select.tsx
|
|
44677
|
-
import { CliRenderEvents as
|
|
44957
|
+
import { CliRenderEvents as CliRenderEvents5, RGBA as RGBA8, TextAttributes as TextAttributes4 } from "@opentui/core";
|
|
44678
44958
|
function dialogSelectContentWidth(dialogWidth) {
|
|
44679
44959
|
return dialogWidth - DIALOG_LIST_INSET * 2 - 4;
|
|
44680
44960
|
}
|
|
@@ -44695,14 +44975,14 @@ function DialogSelect(props) {
|
|
|
44695
44975
|
let pendingScroll;
|
|
44696
44976
|
function scrollAfterLayout(center, value) {
|
|
44697
44977
|
if (pendingScroll)
|
|
44698
|
-
renderer.off(
|
|
44978
|
+
renderer.off(CliRenderEvents5.FRAME, pendingScroll);
|
|
44699
44979
|
pendingScroll = () => {
|
|
44700
44980
|
pendingScroll = undefined;
|
|
44701
44981
|
if (!k(selected()?.value, value))
|
|
44702
44982
|
return;
|
|
44703
44983
|
scrollToSelection(center);
|
|
44704
44984
|
};
|
|
44705
|
-
renderer.once(
|
|
44985
|
+
renderer.once(CliRenderEvents5.FRAME, pendingScroll);
|
|
44706
44986
|
renderer.requestRender();
|
|
44707
44987
|
}
|
|
44708
44988
|
createEffect(on([() => props.focusTarget ?? props.current, () => props.focusTarget === undefined ? undefined : flat()], ([current]) => {
|
|
@@ -44876,7 +45156,7 @@ function DialogSelect(props) {
|
|
|
44876
45156
|
onCleanup(() => {
|
|
44877
45157
|
if (!pendingScroll)
|
|
44878
45158
|
return;
|
|
44879
|
-
renderer.off(
|
|
45159
|
+
renderer.off(CliRenderEvents5.FRAME, pendingScroll);
|
|
44880
45160
|
pendingScroll = undefined;
|
|
44881
45161
|
});
|
|
44882
45162
|
createEffect(on([() => store.filter, () => props.focusTarget ?? props.current], ([filter, current]) => {
|
|
@@ -46154,7 +46434,7 @@ var init_identity = __esm(() => {
|
|
|
46154
46434
|
});
|
|
46155
46435
|
|
|
46156
46436
|
// ../tui-base/src/component/gradient-text.tsx
|
|
46157
|
-
import { fonts, measureText, parseColor, Renderable as Renderable4 } from "@opentui/core";
|
|
46437
|
+
import { fonts, measureText, parseColor as parseColor2, Renderable as Renderable4 } from "@opentui/core";
|
|
46158
46438
|
function stripFontTags(line) {
|
|
46159
46439
|
return line.replace(/<\/?c\d+>/g, "");
|
|
46160
46440
|
}
|
|
@@ -46261,12 +46541,12 @@ var init_gradient_text = __esm(() => {
|
|
|
46261
46541
|
}
|
|
46262
46542
|
colorAt(col) {
|
|
46263
46543
|
const t = this.totalWidth > 0 ? (col + 0.5) / this.totalWidth : 0;
|
|
46264
|
-
return
|
|
46544
|
+
return parseColor2(identityHexAt(t, this._mode));
|
|
46265
46545
|
}
|
|
46266
46546
|
renderSelf(buffer) {
|
|
46267
46547
|
if (!this.visible || this.isDestroyed || this.totalWidth <= 0)
|
|
46268
46548
|
return;
|
|
46269
|
-
const bg =
|
|
46549
|
+
const bg = parseColor2("transparent");
|
|
46270
46550
|
for (const glyph of this.glyphRows) {
|
|
46271
46551
|
for (let line = 0;line < glyph.lines.length; line++) {
|
|
46272
46552
|
const row = glyph.lines[line];
|
|
@@ -46501,7 +46781,7 @@ function dockLineVisibility(stopAt, now, decorated) {
|
|
|
46501
46781
|
return { phase: "hidden", progress: 1 };
|
|
46502
46782
|
return { phase: "fading", progress: (elapsed - DOCK_LINGER_MS) / DOCK_FADE_OUT_MS };
|
|
46503
46783
|
}
|
|
46504
|
-
var DOCK_LINGER_MS = 2000, DOCK_FADE_OUT_MS =
|
|
46784
|
+
var DOCK_LINGER_MS = 2000, DOCK_FADE_OUT_MS = 0, DOCK_LINE_RETENTION_MS, DOCK_WIDGET_MAX_LINES = 3, DOCK_COMPACT_MAX_LINES = 1;
|
|
46505
46785
|
var init_dock_visibility = __esm(() => {
|
|
46506
46786
|
DOCK_LINE_RETENTION_MS = DOCK_LINGER_MS + DOCK_FADE_OUT_MS;
|
|
46507
46787
|
});
|
|
@@ -46744,6 +47024,19 @@ function createSeamRows(seam, sessionID, options) {
|
|
|
46744
47024
|
if (partType !== "text" && partType !== "reasoning")
|
|
46745
47025
|
return;
|
|
46746
47026
|
const text = typeof part.text === "string" ? part.text : "";
|
|
47027
|
+
if (messageID === "cmd") {
|
|
47028
|
+
const key = `system:${messageID}:${partID}`;
|
|
47029
|
+
const existing = rows.find((row) => row.key === key);
|
|
47030
|
+
if (!existing && !text.trim())
|
|
47031
|
+
return;
|
|
47032
|
+
upsert({
|
|
47033
|
+
key,
|
|
47034
|
+
kind: "system",
|
|
47035
|
+
text: existing && existing.kind === "system" ? existing.text + text : text,
|
|
47036
|
+
final: true
|
|
47037
|
+
});
|
|
47038
|
+
return;
|
|
47039
|
+
}
|
|
46747
47040
|
const kind = partType === "text" ? "assistant" : "reasoning";
|
|
46748
47041
|
if (partType === "text" && !turnOpen && pendingTurns.length > 0 && typeof details.sessionID === "string") {
|
|
46749
47042
|
const group = pendingTurns.shift();
|
|
@@ -48009,6 +48302,18 @@ function mergedTitle(parts) {
|
|
|
48009
48302
|
function mergedPositionSuffix(info) {
|
|
48010
48303
|
return info.overflow ? `${info.position}/${info.total}` : null;
|
|
48011
48304
|
}
|
|
48305
|
+
function combineBriefText(todoBrief, subagentBrief) {
|
|
48306
|
+
if (todoBrief === "" && subagentBrief === "")
|
|
48307
|
+
return "";
|
|
48308
|
+
if (subagentBrief === "")
|
|
48309
|
+
return todoBrief;
|
|
48310
|
+
if (todoBrief === "")
|
|
48311
|
+
return subagentBrief;
|
|
48312
|
+
return `${todoBrief} \xB7 ${subagentBrief}`;
|
|
48313
|
+
}
|
|
48314
|
+
function fittedBriefLine(text, innerWidth) {
|
|
48315
|
+
return fitLine({ kind: "todo", segments: [{ text, tone: "running" }] }, innerWidth);
|
|
48316
|
+
}
|
|
48012
48317
|
function lineWidth(line) {
|
|
48013
48318
|
return line.segments.reduce((sum, segment) => sum + stringWidth(segment.text), 0);
|
|
48014
48319
|
}
|
|
@@ -48173,7 +48478,7 @@ function buildMergedDock(data, options) {
|
|
|
48173
48478
|
const latest = tools.length > 0 ? tools[tools.length - 1] : undefined;
|
|
48174
48479
|
if (latest !== undefined)
|
|
48175
48480
|
upperLines.push(coexistenceToolLine(latest, now, spin));
|
|
48176
|
-
const brief = todoBriefLine(data.todos, now, data.todoStartedAt);
|
|
48481
|
+
const brief = combineBriefText(todoBriefLine(data.todos, now, data.todoStartedAt), options.subagentBrief ?? "");
|
|
48177
48482
|
if (brief !== "")
|
|
48178
48483
|
upperLines.push({ kind: "todo", segments: [{ text: brief, tone: "running" }] });
|
|
48179
48484
|
lowerRaw = agents.map((agent, i) => agentLine(agent, i, agents.length, undefined, now));
|
|
@@ -48261,19 +48566,19 @@ var init_merged_dock = __esm(() => {
|
|
|
48261
48566
|
});
|
|
48262
48567
|
|
|
48263
48568
|
// ../tui-base/src/routes/session/widgets-dock.tsx
|
|
48264
|
-
import { parseColor as
|
|
48265
|
-
function
|
|
48266
|
-
const ca =
|
|
48267
|
-
const cb =
|
|
48569
|
+
import { MouseButton as MouseButton2, parseColor as parseColor3, TextAttributes as TextAttributes5 } from "@opentui/core";
|
|
48570
|
+
function mixSkinColor2(a, b, t) {
|
|
48571
|
+
const ca = parseColor3(a);
|
|
48572
|
+
const cb = parseColor3(b);
|
|
48268
48573
|
const k = Math.max(0, Math.min(1, t));
|
|
48269
48574
|
const ch = (x, y) => Math.round((x + (y - x) * k) * 255);
|
|
48270
48575
|
return `#${[ch(ca.r, cb.r), ch(ca.g, cb.g), ch(ca.b, cb.b)].map((v) => v.toString(16).padStart(2, "0")).join("")}`;
|
|
48271
48576
|
}
|
|
48272
48577
|
function skinFaintColor(target, background) {
|
|
48273
|
-
return
|
|
48578
|
+
return mixSkinColor2(target, background, SKIN_FAINT_MIX);
|
|
48274
48579
|
}
|
|
48275
48580
|
function skinFadeInColor(target, background, elapsedMs) {
|
|
48276
|
-
return
|
|
48581
|
+
return mixSkinColor2(skinFaintColor(target, background), target, elapsedMs / SKIN_FADE_IN_MS);
|
|
48277
48582
|
}
|
|
48278
48583
|
function dockLineCap(terminalRows) {
|
|
48279
48584
|
if (terminalRows === undefined)
|
|
@@ -48418,7 +48723,7 @@ function skinDockLineFg(ctx, target, line) {
|
|
|
48418
48723
|
if (line.fadeOutAt !== undefined) {
|
|
48419
48724
|
const visibility = dockLineVisibility(line.fadeOutAt, Date.now(), ctx.decorated);
|
|
48420
48725
|
if (visibility.phase === "fading")
|
|
48421
|
-
return
|
|
48726
|
+
return mixSkinColor2(target, ctx.background, visibility.progress);
|
|
48422
48727
|
if (visibility.phase === "hidden")
|
|
48423
48728
|
return ctx.background;
|
|
48424
48729
|
}
|
|
@@ -48431,6 +48736,23 @@ function skinDockLineFg(ctx, target, line) {
|
|
|
48431
48736
|
function resetMergedDockCursor() {
|
|
48432
48737
|
setMergedDockCursor(0);
|
|
48433
48738
|
}
|
|
48739
|
+
function selectActivityDockTab(tab) {
|
|
48740
|
+
setActivityDockTab(tab);
|
|
48741
|
+
markPanelActive("activity");
|
|
48742
|
+
}
|
|
48743
|
+
function onActivityPanelMouseUp(event) {
|
|
48744
|
+
if (event.button !== MouseButton2.LEFT)
|
|
48745
|
+
return;
|
|
48746
|
+
markPanelActive("activity");
|
|
48747
|
+
}
|
|
48748
|
+
function resetActivityDockTab() {
|
|
48749
|
+
setActivityDockTab("main");
|
|
48750
|
+
}
|
|
48751
|
+
function onDockTabMouseUp(tab, event) {
|
|
48752
|
+
if (event.button !== MouseButton2.LEFT)
|
|
48753
|
+
return;
|
|
48754
|
+
selectActivityDockTab(tab);
|
|
48755
|
+
}
|
|
48434
48756
|
function todoArray(value) {
|
|
48435
48757
|
if (value === undefined || value === null)
|
|
48436
48758
|
return;
|
|
@@ -48505,6 +48827,57 @@ function todoTreeLines(todos) {
|
|
|
48505
48827
|
});
|
|
48506
48828
|
return lines;
|
|
48507
48829
|
}
|
|
48830
|
+
function todoTabLines(rows, innerWidth, cursor = 0) {
|
|
48831
|
+
const data = {
|
|
48832
|
+
tools: [],
|
|
48833
|
+
think: [],
|
|
48834
|
+
todos: latestTodos(rows),
|
|
48835
|
+
agents: []
|
|
48836
|
+
};
|
|
48837
|
+
return mergedDockLines(data, {
|
|
48838
|
+
innerWidth,
|
|
48839
|
+
totalLines: MERGED_DOCK_TOTAL_LINES,
|
|
48840
|
+
cursor
|
|
48841
|
+
});
|
|
48842
|
+
}
|
|
48843
|
+
function dockTabBarLayout(innerWidth, mainLabel, todoLabel, tailText) {
|
|
48844
|
+
const width = Math.max(0, Math.floor(innerWidth));
|
|
48845
|
+
const between = " ";
|
|
48846
|
+
const main = takeWidth(mainLabel, Math.max(0, width - stringWidth(between)));
|
|
48847
|
+
const todo = takeWidth(todoLabel, Math.max(0, width - stringWidth(main) - stringWidth(between)));
|
|
48848
|
+
const tail = takeWidth(tailText, Math.max(0, width - stringWidth(main) - stringWidth(between) - stringWidth(todo)));
|
|
48849
|
+
const tailGap = " ".repeat(Math.max(0, width - stringWidth(main) - stringWidth(between) - stringWidth(todo) - stringWidth(tail)));
|
|
48850
|
+
return {
|
|
48851
|
+
mainLabel: main,
|
|
48852
|
+
todoLabel: todo,
|
|
48853
|
+
between,
|
|
48854
|
+
tailGap,
|
|
48855
|
+
tail
|
|
48856
|
+
};
|
|
48857
|
+
}
|
|
48858
|
+
function activityDockTabLabels(tab, mainLabel, todoLabel) {
|
|
48859
|
+
return tab === "main" ? {
|
|
48860
|
+
main: `[${mainLabel}]`,
|
|
48861
|
+
todo: todoLabel
|
|
48862
|
+
} : {
|
|
48863
|
+
main: mainLabel,
|
|
48864
|
+
todo: `[${todoLabel}]`
|
|
48865
|
+
};
|
|
48866
|
+
}
|
|
48867
|
+
function dockTabAtPosition(x, y, screenX, screenY, layout) {
|
|
48868
|
+
const relX = x - screenX - 2;
|
|
48869
|
+
const relY = y - screenY;
|
|
48870
|
+
if (relY < 0 || relY > 1)
|
|
48871
|
+
return;
|
|
48872
|
+
const mainEnd = stringWidth(layout.mainLabel);
|
|
48873
|
+
const todoStart = mainEnd + stringWidth(layout.between);
|
|
48874
|
+
const todoEnd = todoStart + stringWidth(layout.todoLabel);
|
|
48875
|
+
if (relX >= 0 && relX < mainEnd)
|
|
48876
|
+
return "main";
|
|
48877
|
+
if (relX >= todoStart && relX < todoEnd)
|
|
48878
|
+
return "todo";
|
|
48879
|
+
return;
|
|
48880
|
+
}
|
|
48508
48881
|
function todoSetStartedAt(todos, now = Date.now()) {
|
|
48509
48882
|
const sig = todoSetSignature(todos);
|
|
48510
48883
|
const first = todoSetFirstSeen.get(sig);
|
|
@@ -48528,6 +48901,34 @@ function todoBriefLine(todos, now = Date.now(), startedAt) {
|
|
|
48528
48901
|
function resetTodoBriefClock() {
|
|
48529
48902
|
todoSetFirstSeen.clear();
|
|
48530
48903
|
}
|
|
48904
|
+
function subagentBatchAnchor(running, now = Date.now()) {
|
|
48905
|
+
if (running === 0) {
|
|
48906
|
+
subagentBatchStartedAt = undefined;
|
|
48907
|
+
} else if (prevSubagentRunning === 0) {
|
|
48908
|
+
subagentBatchStartedAt = now;
|
|
48909
|
+
}
|
|
48910
|
+
prevSubagentRunning = running;
|
|
48911
|
+
return subagentBatchStartedAt;
|
|
48912
|
+
}
|
|
48913
|
+
function resetSubagentBriefClock() {
|
|
48914
|
+
subagentBatchStartedAt = undefined;
|
|
48915
|
+
prevSubagentRunning = 0;
|
|
48916
|
+
}
|
|
48917
|
+
function subagentBriefText(running, elapsedSec) {
|
|
48918
|
+
if (running === 0)
|
|
48919
|
+
return "";
|
|
48920
|
+
return t("overlay.widgets.subagentBrief", {
|
|
48921
|
+
running,
|
|
48922
|
+
elapsedSec
|
|
48923
|
+
});
|
|
48924
|
+
}
|
|
48925
|
+
function subagentBriefLine(running, now = Date.now()) {
|
|
48926
|
+
const anchor = subagentBatchAnchor(running, now);
|
|
48927
|
+
if (running === 0 || anchor === undefined)
|
|
48928
|
+
return "";
|
|
48929
|
+
const elapsedSec = Math.max(0, Math.floor((now - anchor) / 1000));
|
|
48930
|
+
return subagentBriefText(running, elapsedSec);
|
|
48931
|
+
}
|
|
48531
48932
|
function toolMarker(status) {
|
|
48532
48933
|
return status === "running" ? "\u2699" : status === "failed" ? "\u2718" : "\u2714";
|
|
48533
48934
|
}
|
|
@@ -48684,43 +49085,6 @@ function activityRuleLines(rows, options = {}) {
|
|
|
48684
49085
|
function activityFrameMode(terminalRows, compactRows = COMPOSER_COMPACT_TERMINAL_ROWS) {
|
|
48685
49086
|
return terminalRows <= compactRows ? "rule" : "frame";
|
|
48686
49087
|
}
|
|
48687
|
-
function looksBlue(color) {
|
|
48688
|
-
const [r, g, b] = colorRgb(color);
|
|
48689
|
-
const max = Math.max(r, g, b);
|
|
48690
|
-
const delta = max - Math.min(r, g, b);
|
|
48691
|
-
if (max === 0 || delta / max < BLUE_MIN_SATURATION)
|
|
48692
|
-
return false;
|
|
48693
|
-
const hue = hueAngle(color);
|
|
48694
|
-
return hue >= BLUE_HUE_MIN && hue <= BLUE_HUE_MAX;
|
|
48695
|
-
}
|
|
48696
|
-
function blueCandidates(scale) {
|
|
48697
|
-
if (!scale)
|
|
48698
|
-
return [];
|
|
48699
|
-
return ACTIVITY_BLUE_STEPS.map((step) => scale[step]).filter((value) => value !== undefined);
|
|
48700
|
-
}
|
|
48701
|
-
function readableBlue(candidates, background) {
|
|
48702
|
-
if (candidates.length === 0)
|
|
48703
|
-
return;
|
|
48704
|
-
const preferred = candidates[0];
|
|
48705
|
-
if (!background)
|
|
48706
|
-
return preferred;
|
|
48707
|
-
if (contrastRatio(preferred, background) >= ACTIVITY_FRAME_MIN_CONTRAST)
|
|
48708
|
-
return preferred;
|
|
48709
|
-
const best = candidates.reduce((a, b) => contrastRatio(b, background) > contrastRatio(a, background) ? b : a);
|
|
48710
|
-
if (contrastRatio(best, background) >= ACTIVITY_FRAME_MIN_CONTRAST)
|
|
48711
|
-
return best;
|
|
48712
|
-
return boostUntilContrast(best, background, ACTIVITY_FRAME_MIN_CONTRAST).color;
|
|
48713
|
-
}
|
|
48714
|
-
function hueAngle(color) {
|
|
48715
|
-
const [r, g, b] = colorRgb(color);
|
|
48716
|
-
const max = Math.max(r, g, b);
|
|
48717
|
-
const min = Math.min(r, g, b);
|
|
48718
|
-
const delta = max - min;
|
|
48719
|
-
if (delta === 0)
|
|
48720
|
-
return 0;
|
|
48721
|
-
const raw = max === r ? (g - b) / delta % 6 : max === g ? (b - r) / delta + 2 : (r - g) / delta + 4;
|
|
48722
|
-
return (raw * 60 + 360) % 360;
|
|
48723
|
-
}
|
|
48724
49088
|
function boostUntilContrast(color, background, min = 4.5) {
|
|
48725
49089
|
let candidate = typeof color === "string" ? color : mixPowerlineColor(color, "#000000", 0);
|
|
48726
49090
|
const pole = contrastRatio(background, AUTO_POLE_LIGHT) >= contrastRatio(background, AUTO_POLE_DARK) ? AUTO_POLE_LIGHT : AUTO_POLE_DARK;
|
|
@@ -48734,30 +49098,6 @@ function boostUntilContrast(color, background, min = 4.5) {
|
|
|
48734
49098
|
meetsContrast: contrast >= min
|
|
48735
49099
|
};
|
|
48736
49100
|
}
|
|
48737
|
-
function activityFrameBorderColor(theme) {
|
|
48738
|
-
const background = theme?.background?.base;
|
|
48739
|
-
const blueScale = (theme?.categorical ?? []).find((scale) => {
|
|
48740
|
-
const swatch = scale[500] ?? scale[400] ?? scale[300];
|
|
48741
|
-
return swatch !== undefined && looksBlue(swatch);
|
|
48742
|
-
});
|
|
48743
|
-
const fromCategorical = readableBlue(blueCandidates(blueScale), background);
|
|
48744
|
-
if (fromCategorical)
|
|
48745
|
-
return fromCategorical;
|
|
48746
|
-
const interactive = theme?.hue?.interactive;
|
|
48747
|
-
const interactiveSwatch = interactive?.[500] ?? interactive?.[400] ?? interactive?.[300];
|
|
48748
|
-
if (interactiveSwatch && looksBlue(interactiveSwatch)) {
|
|
48749
|
-
const fromInteractive = readableBlue(blueCandidates(interactive), background);
|
|
48750
|
-
if (fromInteractive)
|
|
48751
|
-
return fromInteractive;
|
|
48752
|
-
}
|
|
48753
|
-
const action = theme?.text?.action?.primary?.base;
|
|
48754
|
-
if (action) {
|
|
48755
|
-
if (!background || contrastRatio(action, background) >= ACTIVITY_FRAME_MIN_CONTRAST)
|
|
48756
|
-
return action;
|
|
48757
|
-
return boostUntilContrast(action, background, ACTIVITY_FRAME_MIN_CONTRAST).color;
|
|
48758
|
-
}
|
|
48759
|
-
return ACTIVITY_FRAME_BORDER_FALLBACK;
|
|
48760
|
-
}
|
|
48761
49101
|
function dockAccentColor(theme, accent) {
|
|
48762
49102
|
const background = theme?.background?.base;
|
|
48763
49103
|
const validatedFallback = (bg) => {
|
|
@@ -48894,6 +49234,13 @@ function mergedCompactLowerLines(rows) {
|
|
|
48894
49234
|
}
|
|
48895
49235
|
return tree;
|
|
48896
49236
|
}
|
|
49237
|
+
function mergedCompactBriefLines(rows, now, innerWidth) {
|
|
49238
|
+
const subagent = subagentBriefLine(mergedRunningAgents(rows).length, now);
|
|
49239
|
+
if (subagent === "")
|
|
49240
|
+
return [];
|
|
49241
|
+
const text = combineBriefText(todoBriefLine(latestTodos(rows), now), subagent);
|
|
49242
|
+
return [fittedBriefLine(text, innerWidth)];
|
|
49243
|
+
}
|
|
48897
49244
|
function WidgetsDock(props) {
|
|
48898
49245
|
const dimensions = useTerminalSize();
|
|
48899
49246
|
const theme = useThemeOptional();
|
|
@@ -48917,6 +49264,10 @@ function WidgetsDock(props) {
|
|
|
48917
49264
|
const turnActive = () => props.turnActive?.() ?? dockTurnActive(props.rows);
|
|
48918
49265
|
createEffect(() => activityFrameLatch.push(turnActive() || mergedLowerHasContent(props.rows) || mergedThinkRows(props.rows, Date.now(), motionDecorationsEnabled()).length > 0 || mergedToolRows(props.rows, Date.now(), motionDecorationsEnabled()).length > 0));
|
|
48919
49266
|
onCleanup(activityFrameLatch.dispose);
|
|
49267
|
+
createEffect(() => {
|
|
49268
|
+
if (!activityFrameLatch.shown() && untrack(activePanel) === "activity")
|
|
49269
|
+
resetActivePanel();
|
|
49270
|
+
});
|
|
48920
49271
|
const frame = () => activityFrameMode(dimensions().height);
|
|
48921
49272
|
const capSpec = () => activityPanelCapSpec(activityPanelGear(), dimensions().height);
|
|
48922
49273
|
const thinkCap = () => capSpec().maxLines;
|
|
@@ -48938,23 +49289,37 @@ function WidgetsDock(props) {
|
|
|
48938
49289
|
now,
|
|
48939
49290
|
totalLines: MERGED_DOCK_TOTAL_LINES,
|
|
48940
49291
|
thinkLines: thinkCap(),
|
|
48941
|
-
cursor: mergedDockCursor()
|
|
49292
|
+
cursor: mergedDockCursor(),
|
|
49293
|
+
subagentBrief: subagentBriefLine(data.agents.length, now)
|
|
48942
49294
|
};
|
|
48943
49295
|
return {
|
|
48944
49296
|
lines: mergedDockLines(data, options),
|
|
48945
49297
|
info: mergedWindowInfo(data, options)
|
|
48946
49298
|
};
|
|
48947
49299
|
};
|
|
49300
|
+
const tabContentLines = () => {
|
|
49301
|
+
dockSpin();
|
|
49302
|
+
return activityDockTab() === "main" ? frameLines() : todoTabLines(props.rows, width(), mergedDockCursor());
|
|
49303
|
+
};
|
|
49304
|
+
const tabTargetLineCount = () => activityDockTab() === "main" ? mergedFrame().lines.length : todoTabLines(props.rows, width(), mergedDockCursor()).length;
|
|
48948
49305
|
createEffect(() => {
|
|
48949
49306
|
if (!activityFrameLatch.shown())
|
|
48950
49307
|
return;
|
|
48951
|
-
setDockHeightTarget(
|
|
49308
|
+
setDockHeightTarget(tabTargetLineCount());
|
|
48952
49309
|
});
|
|
48953
49310
|
onCleanup(() => {
|
|
48954
49311
|
resetDockHeight();
|
|
48955
49312
|
resetTodoBriefClock();
|
|
49313
|
+
resetSubagentBriefClock();
|
|
49314
|
+
resetActivityDockTab();
|
|
49315
|
+
resetActivePanel();
|
|
48956
49316
|
});
|
|
48957
49317
|
const titleSlotWidth = () => dimensions().width - 4;
|
|
49318
|
+
const tabLabels = () => activityDockTabLabels(activityDockTab(), t("overlay.widgets.tab.main"), t("overlay.widgets.tab.todo"));
|
|
49319
|
+
const tabBar = () => {
|
|
49320
|
+
const labels = tabLabels();
|
|
49321
|
+
return dockTabBarLayout(titleSlotWidth(), labels.main, labels.todo, "");
|
|
49322
|
+
};
|
|
48958
49323
|
const mergedTitleText = () => {
|
|
48959
49324
|
const {
|
|
48960
49325
|
lines,
|
|
@@ -48966,12 +49331,24 @@ function WidgetsDock(props) {
|
|
|
48966
49331
|
subagent: mergedRunningAgents(props.rows).length > 0
|
|
48967
49332
|
});
|
|
48968
49333
|
const suffix = mergedPositionSuffix(info);
|
|
49334
|
+
const bar = tabBar();
|
|
49335
|
+
const head = `${bar.mainLabel}${bar.between}${bar.todoLabel} `;
|
|
49336
|
+
const title = takeWidth(head + base, titleSlotWidth());
|
|
48969
49337
|
if (suffix === null)
|
|
48970
|
-
return
|
|
48971
|
-
const gap = titleSlotWidth() - stringWidth(
|
|
49338
|
+
return title;
|
|
49339
|
+
const gap = titleSlotWidth() - stringWidth(title) - stringWidth(suffix);
|
|
48972
49340
|
if (gap < 1)
|
|
48973
|
-
return `${
|
|
48974
|
-
return
|
|
49341
|
+
return `${title} \xB7 ${suffix}`;
|
|
49342
|
+
return title + " ".repeat(gap) + suffix;
|
|
49343
|
+
};
|
|
49344
|
+
let dockBox;
|
|
49345
|
+
const onDockTitleMouseUp = (event) => {
|
|
49346
|
+
onActivityPanelMouseUp(event);
|
|
49347
|
+
if (dockBox === undefined)
|
|
49348
|
+
return;
|
|
49349
|
+
const tab = dockTabAtPosition(event.x, event.y, dockBox.screenX, dockBox.screenY, tabBar());
|
|
49350
|
+
if (tab !== undefined)
|
|
49351
|
+
onDockTabMouseUp(tab, event);
|
|
48975
49352
|
};
|
|
48976
49353
|
const onMergedWheel = (event) => {
|
|
48977
49354
|
const info = mergedFrame().info;
|
|
@@ -49007,6 +49384,22 @@ function WidgetsDock(props) {
|
|
|
49007
49384
|
}],
|
|
49008
49385
|
bindings: ["session.dock.scroll.up", "session.dock.scroll.down"]
|
|
49009
49386
|
}));
|
|
49387
|
+
Keymap2.createLayer(() => ({
|
|
49388
|
+
mode: "global",
|
|
49389
|
+
enabled: pageOwns(),
|
|
49390
|
+
commands: [{
|
|
49391
|
+
id: "session.dock.tab.main",
|
|
49392
|
+
title: "Show activity main panel",
|
|
49393
|
+
group: "Session",
|
|
49394
|
+
run: () => selectActivityDockTab("main")
|
|
49395
|
+
}, {
|
|
49396
|
+
id: "session.dock.tab.todo",
|
|
49397
|
+
title: "Show activity todo details",
|
|
49398
|
+
group: "Session",
|
|
49399
|
+
run: () => selectActivityDockTab("todo")
|
|
49400
|
+
}],
|
|
49401
|
+
bindings: ["session.dock.tab.main", "session.dock.tab.todo"]
|
|
49402
|
+
}));
|
|
49010
49403
|
}
|
|
49011
49404
|
const frameLines = () => {
|
|
49012
49405
|
const lines = mergedFrame().lines;
|
|
@@ -49016,10 +49409,40 @@ function WidgetsDock(props) {
|
|
|
49016
49409
|
const count = !animating || tweened >= target ? target : Math.min(target, tweened);
|
|
49017
49410
|
return lines.slice(0, count);
|
|
49018
49411
|
};
|
|
49019
|
-
const frameHeight = () => 2 +
|
|
49412
|
+
const frameHeight = () => 2 + tabContentLines().length;
|
|
49413
|
+
const compactTabBar = () => {
|
|
49414
|
+
const labels = tabLabels();
|
|
49415
|
+
return dockTabBarLayout(width(), labels.main, labels.todo, "");
|
|
49416
|
+
};
|
|
49417
|
+
const compactTabBarLine = () => {
|
|
49418
|
+
const bar = compactTabBar();
|
|
49419
|
+
return {
|
|
49420
|
+
kind: "tool",
|
|
49421
|
+
segments: [{
|
|
49422
|
+
text: `${bar.mainLabel}${bar.between}${bar.todoLabel}`,
|
|
49423
|
+
tone: "muted"
|
|
49424
|
+
}]
|
|
49425
|
+
};
|
|
49426
|
+
};
|
|
49020
49427
|
const compactLower = () => mergedCompactLowerLines(props.rows);
|
|
49021
|
-
const
|
|
49428
|
+
const compactBrief = () => mergedCompactBriefLines(props.rows, Date.now(), width());
|
|
49429
|
+
const compactContent = () => activityDockTab() === "main" ? [...compactBrief(), ...compactLower()] : todoTabLines(props.rows, width(), mergedDockCursor());
|
|
49430
|
+
const compactRuleCount = () => activityDockTab() === "main" ? 2 : 0;
|
|
49431
|
+
const compactHeight = () => 1 + compactRuleCount() + compactContent().length;
|
|
49432
|
+
let compactDockBox;
|
|
49433
|
+
const onCompactTitleMouseUp = (event) => {
|
|
49434
|
+
onActivityPanelMouseUp(event);
|
|
49435
|
+
if (compactDockBox === undefined)
|
|
49436
|
+
return;
|
|
49437
|
+
const tab = dockTabAtPosition(event.x, event.y, compactDockBox.screenX + 1, compactDockBox.screenY, compactTabBar());
|
|
49438
|
+
if (tab !== undefined)
|
|
49439
|
+
onDockTabMouseUp(tab, event);
|
|
49440
|
+
};
|
|
49022
49441
|
const accentFg = (accent) => dockAccentColor(theme, accent);
|
|
49442
|
+
const activityFrame = () => panelFocusFrame({
|
|
49443
|
+
focused: activePanel() === "activity",
|
|
49444
|
+
theme: theme ?? undefined
|
|
49445
|
+
});
|
|
49023
49446
|
const lineView = (line) => dockLineNode(line, width(), skinCtx(), fgFor, accentFg);
|
|
49024
49447
|
const mergedLineView = (line) => {
|
|
49025
49448
|
const ctx = skinCtx();
|
|
@@ -49089,19 +49512,29 @@ function WidgetsDock(props) {
|
|
|
49089
49512
|
get fallback() {
|
|
49090
49513
|
return (() => {
|
|
49091
49514
|
var _el$5 = createElement("box");
|
|
49515
|
+
use((el) => {
|
|
49516
|
+
compactDockBox = el;
|
|
49517
|
+
}, _el$5);
|
|
49092
49518
|
setProp(_el$5, "flexShrink", 0);
|
|
49093
49519
|
setProp(_el$5, "flexDirection", "column");
|
|
49094
49520
|
setProp(_el$5, "width", "100%");
|
|
49095
49521
|
setProp(_el$5, "paddingLeft", 3);
|
|
49522
|
+
setProp(_el$5, "onMouseUp", onCompactTitleMouseUp);
|
|
49523
|
+
insert(_el$5, createComponent2(For, {
|
|
49524
|
+
get each() {
|
|
49525
|
+
return [compactTabBarLine()];
|
|
49526
|
+
},
|
|
49527
|
+
children: mergedLineView
|
|
49528
|
+
}), null);
|
|
49096
49529
|
insert(_el$5, createComponent2(For, {
|
|
49097
49530
|
get each() {
|
|
49098
|
-
return activityRuleLines(props.rows);
|
|
49531
|
+
return memo2(() => activityDockTab() === "main")() ? activityRuleLines(props.rows) : [];
|
|
49099
49532
|
},
|
|
49100
49533
|
children: lineView
|
|
49101
49534
|
}), null);
|
|
49102
49535
|
insert(_el$5, createComponent2(For, {
|
|
49103
49536
|
get each() {
|
|
49104
|
-
return
|
|
49537
|
+
return compactContent();
|
|
49105
49538
|
},
|
|
49106
49539
|
children: mergedLineView
|
|
49107
49540
|
}), null);
|
|
@@ -49111,29 +49544,36 @@ function WidgetsDock(props) {
|
|
|
49111
49544
|
},
|
|
49112
49545
|
get children() {
|
|
49113
49546
|
var _el$4 = createElement("box");
|
|
49547
|
+
use((el) => {
|
|
49548
|
+
dockBox = el;
|
|
49549
|
+
}, _el$4);
|
|
49114
49550
|
setProp(_el$4, "flexShrink", 0);
|
|
49115
49551
|
setProp(_el$4, "flexDirection", "column");
|
|
49116
49552
|
setProp(_el$4, "width", "100%");
|
|
49117
49553
|
setProp(_el$4, "border", ["top", "bottom", "left", "right"]);
|
|
49118
|
-
setProp(_el$4, "borderStyle", "heavy");
|
|
49119
49554
|
setProp(_el$4, "titleAlignment", "left");
|
|
49120
49555
|
setProp(_el$4, "onMouseScroll", onMergedWheel);
|
|
49556
|
+
setProp(_el$4, "onMouseUp", onDockTitleMouseUp);
|
|
49121
49557
|
insert(_el$4, createComponent2(For, {
|
|
49122
49558
|
get each() {
|
|
49123
|
-
return
|
|
49559
|
+
return tabContentLines();
|
|
49124
49560
|
},
|
|
49125
49561
|
children: mergedLineView
|
|
49126
49562
|
}));
|
|
49127
49563
|
effect((_p$) => {
|
|
49128
|
-
var _v$ = frameHeight(), _v$2 =
|
|
49564
|
+
var _v$ = frameHeight(), _v$2 = activityFrame().borderStyle, _v$3 = activityFrame().borderColor, _v$4 = mergedTitleText(), _v$5 = activityFrame().titleColor;
|
|
49129
49565
|
_v$ !== _p$.e && (_p$.e = setProp(_el$4, "height", _v$, _p$.e));
|
|
49130
|
-
_v$2 !== _p$.t && (_p$.t = setProp(_el$4, "
|
|
49131
|
-
_v$3 !== _p$.a && (_p$.a = setProp(_el$4, "
|
|
49566
|
+
_v$2 !== _p$.t && (_p$.t = setProp(_el$4, "borderStyle", _v$2, _p$.t));
|
|
49567
|
+
_v$3 !== _p$.a && (_p$.a = setProp(_el$4, "borderColor", _v$3, _p$.a));
|
|
49568
|
+
_v$4 !== _p$.o && (_p$.o = setProp(_el$4, "title", _v$4, _p$.o));
|
|
49569
|
+
_v$5 !== _p$.i && (_p$.i = setProp(_el$4, "titleColor", _v$5, _p$.i));
|
|
49132
49570
|
return _p$;
|
|
49133
49571
|
}, {
|
|
49134
49572
|
e: undefined,
|
|
49135
49573
|
t: undefined,
|
|
49136
|
-
a: undefined
|
|
49574
|
+
a: undefined,
|
|
49575
|
+
o: undefined,
|
|
49576
|
+
i: undefined
|
|
49137
49577
|
});
|
|
49138
49578
|
return _el$4;
|
|
49139
49579
|
}
|
|
@@ -49210,7 +49650,7 @@ function dockLineNode(line, width, ctx, fgFor, accentFg) {
|
|
|
49210
49650
|
return _el$8;
|
|
49211
49651
|
})();
|
|
49212
49652
|
}
|
|
49213
|
-
var SKIN_FADE_IN_MS = 400, SKIN_NOTICE_FADE_MS = 500, SKIN_PULSE_MS = 1200, SKIN_PULSE_CYCLES = 3, SKIN_PULSE_DIM = 0.45, SKIN_FAINT_MIX = 0.78, ACTIVITY_PANEL_GEARS, ACTIVITY_PANEL_ALL_LINES = 10, activityPanelGear, setActivityPanelGear, DOCK_HEIGHT_ANIM_MS = 200, dockHeightTween, setDockHeightTween, dockHeightSettled = undefined, dockFrameNow = 0, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, todoSetSignature = (todos) => todos.map((todo) => todo.content).sort().join("\x01"), todoSetFirstSeen,
|
|
49653
|
+
var SKIN_FADE_IN_MS = 400, SKIN_NOTICE_FADE_MS = 500, SKIN_PULSE_MS = 1200, SKIN_PULSE_CYCLES = 3, SKIN_PULSE_DIM = 0.45, SKIN_FAINT_MIX = 0.78, ACTIVITY_PANEL_GEARS, ACTIVITY_PANEL_ALL_LINES = 10, activityPanelGear, setActivityPanelGear, DOCK_HEIGHT_ANIM_MS = 200, dockHeightTween, setDockHeightTween, dockHeightSettled = undefined, dockFrameNow = 0, LINE_FIRST_SEEN_MAX = 512, lineFirstSeen, dockSpin, setDockSpin, mergedDockCursor, setMergedDockCursor, activityDockTab, setActivityDockTab, todoSetSignature = (todos) => todos.map((todo) => todo.content).sort().join("\x01"), todoSetFirstSeen, subagentBatchStartedAt, prevSubagentRunning = 0, TODO_TOOL_NAMES, AUTO_POLE_LIGHT = "#ffffff", AUTO_POLE_DARK = "#000000", DOCK_ACCENT_STEPS, DOCK_ACCENT_HUES, DOCK_ACCENT_MIN_CONTRAST = 4.5, DOCK_ACCENT_FALLBACK, ACTIVITY_FRAME_DEFER_MS = 60, activityFrameLatch, COMPACT_TREE_MAX_LINES = 8;
|
|
49214
49654
|
var init_widgets_dock = __esm(() => {
|
|
49215
49655
|
init_index_bun();
|
|
49216
49656
|
init_index_bun();
|
|
@@ -49218,16 +49658,20 @@ var init_widgets_dock = __esm(() => {
|
|
|
49218
49658
|
init_index_bun();
|
|
49219
49659
|
init_index_bun();
|
|
49220
49660
|
init_index_bun();
|
|
49661
|
+
init_index_bun();
|
|
49662
|
+
init_index_bun();
|
|
49221
49663
|
init_server();
|
|
49222
49664
|
init_index_bun();
|
|
49223
49665
|
init_terminal_size();
|
|
49224
49666
|
init_tool_summarize();
|
|
49225
49667
|
init_todo();
|
|
49226
49668
|
init_string_width();
|
|
49669
|
+
init_locale();
|
|
49227
49670
|
init_theme3();
|
|
49228
49671
|
init_i18n();
|
|
49229
49672
|
init_motion();
|
|
49230
49673
|
init_semantic();
|
|
49674
|
+
init_pane_focus();
|
|
49231
49675
|
init_dock_visibility();
|
|
49232
49676
|
init_powerline();
|
|
49233
49677
|
init_merged_dock();
|
|
@@ -49239,9 +49683,9 @@ var init_widgets_dock = __esm(() => {
|
|
|
49239
49683
|
lineFirstSeen = new Map;
|
|
49240
49684
|
[dockSpin, setDockSpin] = createSignal(0);
|
|
49241
49685
|
[mergedDockCursor, setMergedDockCursor] = createSignal(0);
|
|
49686
|
+
[activityDockTab, setActivityDockTab] = createSignal("main");
|
|
49242
49687
|
todoSetFirstSeen = new Map;
|
|
49243
49688
|
TODO_TOOL_NAMES = new Set(["todowrite", "todo_write"]);
|
|
49244
|
-
ACTIVITY_BLUE_STEPS = [200, 100, 300, 400, 500, 600, 700];
|
|
49245
49689
|
DOCK_ACCENT_STEPS = {
|
|
49246
49690
|
think: [200, 300, 100, 400, 500, 600, 700, 800, 900],
|
|
49247
49691
|
tool: [300, 200, 100, 400, 500, 600, 700, 800, 900],
|
|
@@ -49389,6 +49833,7 @@ function Transcript(props) {
|
|
|
49389
49833
|
failed: () => theme?.text.feedback.error.base ?? "#f7768e",
|
|
49390
49834
|
failedMuted: () => theme?.text.feedback.error.muted ?? "#8a4b5c",
|
|
49391
49835
|
loading: () => theme?.text.feedback.info.base ?? "#565f89",
|
|
49836
|
+
system: () => theme?.text.feedback.info.base ?? "#565f89",
|
|
49392
49837
|
background: () => theme?.background.base ?? "black",
|
|
49393
49838
|
pendingQueue: () => theme?.text.muted ?? "#9aa5ce",
|
|
49394
49839
|
pendingSteer: () => theme?.text.action.primary.base ?? "#7aa2f7"
|
|
@@ -49488,6 +49933,13 @@ function Transcript(props) {
|
|
|
49488
49933
|
})();
|
|
49489
49934
|
case "assistant":
|
|
49490
49935
|
return assistantRow(row);
|
|
49936
|
+
case "system":
|
|
49937
|
+
return (() => {
|
|
49938
|
+
var _el$7 = createElement("text");
|
|
49939
|
+
insert(_el$7, () => row.text);
|
|
49940
|
+
effect((_$p) => setProp(_el$7, "fg", color.system(), _$p));
|
|
49941
|
+
return _el$7;
|
|
49942
|
+
})();
|
|
49491
49943
|
case "ask":
|
|
49492
49944
|
return askRow(row);
|
|
49493
49945
|
default:
|
|
@@ -49498,68 +49950,68 @@ function Transcript(props) {
|
|
|
49498
49950
|
props.scrollRef?.(undefined);
|
|
49499
49951
|
});
|
|
49500
49952
|
return (() => {
|
|
49501
|
-
var _el$
|
|
49502
|
-
insertNode(_el$7, _el$8);
|
|
49503
|
-
setProp(_el$7, "flexDirection", "column");
|
|
49504
|
-
setProp(_el$7, "flexGrow", 1);
|
|
49505
|
-
setProp(_el$7, "minHeight", 0);
|
|
49506
|
-
setProp(_el$7, "width", "100%");
|
|
49953
|
+
var _el$8 = createElement("box"), _el$9 = createElement("box"), _el$0 = createElement("box"), _el$1 = createElement("scrollbox");
|
|
49507
49954
|
insertNode(_el$8, _el$9);
|
|
49508
|
-
setProp(_el$8, "flexDirection", "
|
|
49955
|
+
setProp(_el$8, "flexDirection", "column");
|
|
49509
49956
|
setProp(_el$8, "flexGrow", 1);
|
|
49510
49957
|
setProp(_el$8, "minHeight", 0);
|
|
49958
|
+
setProp(_el$8, "width", "100%");
|
|
49511
49959
|
insertNode(_el$9, _el$0);
|
|
49960
|
+
setProp(_el$9, "flexDirection", "row");
|
|
49512
49961
|
setProp(_el$9, "flexGrow", 1);
|
|
49513
49962
|
setProp(_el$9, "minHeight", 0);
|
|
49514
|
-
|
|
49515
|
-
setProp(_el$
|
|
49963
|
+
insertNode(_el$0, _el$1);
|
|
49964
|
+
setProp(_el$0, "flexGrow", 1);
|
|
49965
|
+
setProp(_el$0, "minHeight", 0);
|
|
49966
|
+
setProp(_el$0, "position", "relative");
|
|
49967
|
+
setProp(_el$0, "paddingBottom", 1);
|
|
49516
49968
|
use((value) => {
|
|
49517
49969
|
props.scrollRef?.(value);
|
|
49518
|
-
}, _el$
|
|
49519
|
-
setProp(_el$
|
|
49520
|
-
setProp(_el$
|
|
49521
|
-
setProp(_el$
|
|
49522
|
-
setProp(_el$
|
|
49523
|
-
insert(_el$
|
|
49970
|
+
}, _el$1);
|
|
49971
|
+
setProp(_el$1, "flexGrow", 1);
|
|
49972
|
+
setProp(_el$1, "overflow", "hidden");
|
|
49973
|
+
setProp(_el$1, "stickyScroll", true);
|
|
49974
|
+
setProp(_el$1, "stickyStart", "bottom");
|
|
49975
|
+
insert(_el$1, createComponent2(For, {
|
|
49524
49976
|
get each() {
|
|
49525
49977
|
return visibleRows();
|
|
49526
49978
|
},
|
|
49527
49979
|
children: (row) => (() => {
|
|
49528
|
-
var _el$
|
|
49529
|
-
setProp(_el$
|
|
49530
|
-
setProp(_el$
|
|
49531
|
-
insert(_el$
|
|
49532
|
-
effect((_$p) => setProp(_el$
|
|
49533
|
-
return _el$
|
|
49980
|
+
var _el$13 = createElement("box");
|
|
49981
|
+
setProp(_el$13, "marginTop", 1);
|
|
49982
|
+
setProp(_el$13, "flexShrink", 0);
|
|
49983
|
+
insert(_el$13, () => rowView(row));
|
|
49984
|
+
effect((_$p) => setProp(_el$13, "id", `seam-row-${row.key}`, _$p));
|
|
49985
|
+
return _el$13;
|
|
49534
49986
|
})()
|
|
49535
49987
|
}), null);
|
|
49536
|
-
insert(_el$
|
|
49988
|
+
insert(_el$1, createComponent2(Show, {
|
|
49537
49989
|
get when() {
|
|
49538
49990
|
return projection.hydrated() === false;
|
|
49539
49991
|
},
|
|
49540
49992
|
get children() {
|
|
49541
|
-
var _el$
|
|
49542
|
-
insertNode(_el$
|
|
49543
|
-
setProp(_el$
|
|
49544
|
-
insert(_el$
|
|
49545
|
-
effect((_$p) => setProp(_el$
|
|
49546
|
-
return _el$
|
|
49993
|
+
var _el$10 = createElement("box"), _el$11 = createElement("text");
|
|
49994
|
+
insertNode(_el$10, _el$11);
|
|
49995
|
+
setProp(_el$10, "flexShrink", 0);
|
|
49996
|
+
insert(_el$11, () => t("transcript.loading"));
|
|
49997
|
+
effect((_$p) => setProp(_el$11, "fg", color.loading(), _$p));
|
|
49998
|
+
return _el$10;
|
|
49547
49999
|
}
|
|
49548
50000
|
}), null);
|
|
49549
|
-
insert(_el$
|
|
50001
|
+
insert(_el$1, createComponent2(For, {
|
|
49550
50002
|
get each() {
|
|
49551
50003
|
return props.pending?.() ?? [];
|
|
49552
50004
|
},
|
|
49553
50005
|
children: (row) => (() => {
|
|
49554
|
-
var _el$
|
|
49555
|
-
setProp(_el$
|
|
49556
|
-
setProp(_el$
|
|
49557
|
-
insert(_el$
|
|
50006
|
+
var _el$14 = createElement("box");
|
|
50007
|
+
setProp(_el$14, "marginTop", 1);
|
|
50008
|
+
setProp(_el$14, "flexShrink", 0);
|
|
50009
|
+
insert(_el$14, (() => {
|
|
49558
50010
|
var _c$ = memo2(() => row.kind === "queue");
|
|
49559
50011
|
return () => _c$() ? (() => {
|
|
49560
|
-
var _el$
|
|
49561
|
-
setProp(_el$
|
|
49562
|
-
insert(_el$
|
|
50012
|
+
var _el$15 = createElement("text");
|
|
50013
|
+
setProp(_el$15, "wrapMode", "word");
|
|
50014
|
+
insert(_el$15, (() => {
|
|
49563
50015
|
var _c$2 = memo2(() => row.state === "paused");
|
|
49564
50016
|
return () => _c$2() ? t("transcript.pending.queue.paused", {
|
|
49565
50017
|
order: row.order ?? 1,
|
|
@@ -49571,18 +50023,18 @@ function Transcript(props) {
|
|
|
49571
50023
|
})());
|
|
49572
50024
|
effect((_p$) => {
|
|
49573
50025
|
var _v$14 = color.pendingQueue(), _v$15 = TextAttributes6.ITALIC;
|
|
49574
|
-
_v$14 !== _p$.e && (_p$.e = setProp(_el$
|
|
49575
|
-
_v$15 !== _p$.t && (_p$.t = setProp(_el$
|
|
50026
|
+
_v$14 !== _p$.e && (_p$.e = setProp(_el$15, "fg", _v$14, _p$.e));
|
|
50027
|
+
_v$15 !== _p$.t && (_p$.t = setProp(_el$15, "attributes", _v$15, _p$.t));
|
|
49576
50028
|
return _p$;
|
|
49577
50029
|
}, {
|
|
49578
50030
|
e: undefined,
|
|
49579
50031
|
t: undefined
|
|
49580
50032
|
});
|
|
49581
|
-
return _el$
|
|
50033
|
+
return _el$15;
|
|
49582
50034
|
})() : (() => {
|
|
49583
|
-
var _el$
|
|
49584
|
-
setProp(_el$
|
|
49585
|
-
insert(_el$
|
|
50035
|
+
var _el$16 = createElement("text");
|
|
50036
|
+
setProp(_el$16, "wrapMode", "word");
|
|
50037
|
+
insert(_el$16, (() => {
|
|
49586
50038
|
var _c$3 = memo2(() => row.state === "delivered");
|
|
49587
50039
|
return () => _c$3() ? t("transcript.pending.steer.delivered", {
|
|
49588
50040
|
text: row.text
|
|
@@ -49590,29 +50042,29 @@ function Transcript(props) {
|
|
|
49590
50042
|
text: row.text
|
|
49591
50043
|
});
|
|
49592
50044
|
})());
|
|
49593
|
-
effect((_$p) => setProp(_el$
|
|
49594
|
-
return _el$
|
|
50045
|
+
effect((_$p) => setProp(_el$16, "fg", color.pendingSteer(), _$p));
|
|
50046
|
+
return _el$16;
|
|
49595
50047
|
})();
|
|
49596
50048
|
})());
|
|
49597
|
-
effect((_$p) => setProp(_el$
|
|
49598
|
-
return _el$
|
|
50049
|
+
effect((_$p) => setProp(_el$14, "id", `pending-row-${row.id}`, _$p));
|
|
50050
|
+
return _el$14;
|
|
49599
50051
|
})()
|
|
49600
50052
|
}), null);
|
|
49601
|
-
insert(_el$
|
|
50053
|
+
insert(_el$8, createComponent2(Show, {
|
|
49602
50054
|
get when() {
|
|
49603
50055
|
return props.status || props.widgets || props.children || props.footer || props.notices;
|
|
49604
50056
|
},
|
|
49605
50057
|
get children() {
|
|
49606
|
-
var _el$
|
|
49607
|
-
setProp(_el$
|
|
49608
|
-
setProp(_el$
|
|
49609
|
-
setProp(_el$
|
|
49610
|
-
insert(_el$
|
|
49611
|
-
insert(_el$
|
|
49612
|
-
insert(_el$
|
|
49613
|
-
insert(_el$
|
|
49614
|
-
insert(_el$
|
|
49615
|
-
return _el$
|
|
50058
|
+
var _el$12 = createElement("box");
|
|
50059
|
+
setProp(_el$12, "width", "100%");
|
|
50060
|
+
setProp(_el$12, "flexShrink", 0);
|
|
50061
|
+
setProp(_el$12, "flexDirection", "column");
|
|
50062
|
+
insert(_el$12, () => props.status, null);
|
|
50063
|
+
insert(_el$12, () => props.widgets, null);
|
|
50064
|
+
insert(_el$12, () => props.children, null);
|
|
50065
|
+
insert(_el$12, () => props.footer, null);
|
|
50066
|
+
insert(_el$12, () => props.notices, null);
|
|
50067
|
+
return _el$12;
|
|
49616
50068
|
}
|
|
49617
50069
|
}), null);
|
|
49618
50070
|
effect((_p$) => {
|
|
@@ -49626,14 +50078,14 @@ function Transcript(props) {
|
|
|
49626
50078
|
foregroundColor: color.reasoningBorder()
|
|
49627
50079
|
}
|
|
49628
50080
|
};
|
|
49629
|
-
_v$8 !== _p$.e && (_p$.e = setProp(_el$
|
|
49630
|
-
_v$9 !== _p$.t && (_p$.t = setProp(_el$
|
|
49631
|
-
_v$0 !== _p$.a && (_p$.a = setProp(_el$
|
|
49632
|
-
_v$1 !== _p$.o && (_p$.o = setProp(_el$
|
|
49633
|
-
_v$10 !== _p$.i && (_p$.i = setProp(_el$
|
|
49634
|
-
_v$11 !== _p$.n && (_p$.n = setProp(_el$
|
|
49635
|
-
_v$12 !== _p$.s && (_p$.s = setProp(_el$
|
|
49636
|
-
_v$13 !== _p$.h && (_p$.h = setProp(_el$
|
|
50081
|
+
_v$8 !== _p$.e && (_p$.e = setProp(_el$8, "backgroundColor", _v$8, _p$.e));
|
|
50082
|
+
_v$9 !== _p$.t && (_p$.t = setProp(_el$9, "border", _v$9, _p$.t));
|
|
50083
|
+
_v$0 !== _p$.a && (_p$.a = setProp(_el$9, "borderStyle", _v$0, _p$.a));
|
|
50084
|
+
_v$1 !== _p$.o && (_p$.o = setProp(_el$9, "borderColor", _v$1, _p$.o));
|
|
50085
|
+
_v$10 !== _p$.i && (_p$.i = setProp(_el$9, "title", _v$10, _p$.i));
|
|
50086
|
+
_v$11 !== _p$.n && (_p$.n = setProp(_el$9, "titleColor", _v$11, _p$.n));
|
|
50087
|
+
_v$12 !== _p$.s && (_p$.s = setProp(_el$1, "viewportOptions", _v$12, _p$.s));
|
|
50088
|
+
_v$13 !== _p$.h && (_p$.h = setProp(_el$1, "verticalScrollbarOptions", _v$13, _p$.h));
|
|
49637
50089
|
return _p$;
|
|
49638
50090
|
}, {
|
|
49639
50091
|
e: undefined,
|
|
@@ -49645,7 +50097,7 @@ function Transcript(props) {
|
|
|
49645
50097
|
s: undefined,
|
|
49646
50098
|
h: undefined
|
|
49647
50099
|
});
|
|
49648
|
-
return _el$
|
|
50100
|
+
return _el$8;
|
|
49649
50101
|
})();
|
|
49650
50102
|
}
|
|
49651
50103
|
function AskReplayBlock(props) {
|
|
@@ -49655,55 +50107,55 @@ function AskReplayBlock(props) {
|
|
|
49655
50107
|
const askAnswerOf = (entry) => entry.selected.map((label) => splitRecommended(label).label).join(", ") || entry.custom || t("transcript.ask.declined");
|
|
49656
50108
|
const askDeclinedOf = (entry) => entry.declined || entry.selected.length === 0 && !entry.custom;
|
|
49657
50109
|
return (() => {
|
|
49658
|
-
var _el$
|
|
49659
|
-
setProp(_el$
|
|
49660
|
-
setProp(_el$
|
|
49661
|
-
insert(_el$
|
|
50110
|
+
var _el$17 = createElement("box");
|
|
50111
|
+
setProp(_el$17, "flexDirection", "column");
|
|
50112
|
+
setProp(_el$17, "gap", 1);
|
|
50113
|
+
insert(_el$17, createComponent2(For, {
|
|
49662
50114
|
get each() {
|
|
49663
50115
|
return props.row.entries;
|
|
49664
50116
|
},
|
|
49665
50117
|
children: (entry) => (() => {
|
|
49666
|
-
var _el$
|
|
49667
|
-
insertNode(_el$
|
|
49668
|
-
insertNode(_el$
|
|
49669
|
-
setProp(_el$
|
|
49670
|
-
insert(_el$
|
|
50118
|
+
var _el$18 = createElement("box"), _el$19 = createElement("text"), _el$20 = createElement("text");
|
|
50119
|
+
insertNode(_el$18, _el$19);
|
|
50120
|
+
insertNode(_el$18, _el$20);
|
|
50121
|
+
setProp(_el$18, "flexDirection", "column");
|
|
50122
|
+
insert(_el$18, createComponent2(Show, {
|
|
49671
50123
|
get when() {
|
|
49672
50124
|
return entry.header;
|
|
49673
50125
|
},
|
|
49674
50126
|
children: (header) => (() => {
|
|
49675
|
-
var _el$
|
|
49676
|
-
insert(_el$
|
|
49677
|
-
effect((_$p) => setProp(_el$
|
|
49678
|
-
return _el$
|
|
50127
|
+
var _el$21 = createElement("text");
|
|
50128
|
+
insert(_el$21, header);
|
|
50129
|
+
effect((_$p) => setProp(_el$21, "fg", reasoning(), _$p));
|
|
50130
|
+
return _el$21;
|
|
49679
50131
|
})()
|
|
49680
|
-
}), _el$
|
|
49681
|
-
insert(_el$
|
|
49682
|
-
insert(_el$
|
|
50132
|
+
}), _el$19);
|
|
50133
|
+
insert(_el$19, () => `\u2713 ${entry.question}`);
|
|
50134
|
+
insert(_el$18, createComponent2(Show, {
|
|
49683
50135
|
get when() {
|
|
49684
50136
|
return entry.detail;
|
|
49685
50137
|
},
|
|
49686
50138
|
children: (detail) => (() => {
|
|
49687
|
-
var _el$
|
|
49688
|
-
insert(_el$
|
|
49689
|
-
effect((_$p) => setProp(_el$
|
|
49690
|
-
return _el$
|
|
50139
|
+
var _el$22 = createElement("text");
|
|
50140
|
+
insert(_el$22, detail);
|
|
50141
|
+
effect((_$p) => setProp(_el$22, "fg", reasoning(), _$p));
|
|
50142
|
+
return _el$22;
|
|
49691
50143
|
})()
|
|
49692
|
-
}), _el$
|
|
49693
|
-
insert(_el$
|
|
50144
|
+
}), _el$20);
|
|
50145
|
+
insert(_el$20, () => ` \u2192 ${askAnswerOf(entry)}`);
|
|
49694
50146
|
effect((_p$) => {
|
|
49695
50147
|
var _v$16 = reasoning(), _v$17 = askDeclinedOf(entry) ? reasoning() : answer();
|
|
49696
|
-
_v$16 !== _p$.e && (_p$.e = setProp(_el$
|
|
49697
|
-
_v$17 !== _p$.t && (_p$.t = setProp(_el$
|
|
50148
|
+
_v$16 !== _p$.e && (_p$.e = setProp(_el$19, "fg", _v$16, _p$.e));
|
|
50149
|
+
_v$17 !== _p$.t && (_p$.t = setProp(_el$20, "fg", _v$17, _p$.t));
|
|
49698
50150
|
return _p$;
|
|
49699
50151
|
}, {
|
|
49700
50152
|
e: undefined,
|
|
49701
50153
|
t: undefined
|
|
49702
50154
|
});
|
|
49703
|
-
return _el$
|
|
50155
|
+
return _el$18;
|
|
49704
50156
|
})()
|
|
49705
50157
|
}));
|
|
49706
|
-
return _el$
|
|
50158
|
+
return _el$17;
|
|
49707
50159
|
})();
|
|
49708
50160
|
}
|
|
49709
50161
|
var SIDES_RULE, SIDES_FRAME, CODE_RENDER_NODE_CACHE_MAX = 256, codeRenderNodeCache;
|
|
@@ -49824,6 +50276,7 @@ function LastRequestDock(props) {
|
|
|
49824
50276
|
setProp(_el$, "flexDirection", "column");
|
|
49825
50277
|
setProp(_el$, "width", "100%");
|
|
49826
50278
|
setProp(_el$, "paddingLeft", 1);
|
|
50279
|
+
setProp(_el$, "onMouseUp", () => markPanelActive("lastrequest"));
|
|
49827
50280
|
insert(_el$, createComponent2(For, {
|
|
49828
50281
|
get each() {
|
|
49829
50282
|
return lines();
|
|
@@ -49855,6 +50308,7 @@ var init_lastrequest_dock = __esm(() => {
|
|
|
49855
50308
|
init_i18n();
|
|
49856
50309
|
init_motion();
|
|
49857
50310
|
init_widgets_dock();
|
|
50311
|
+
init_pane_focus();
|
|
49858
50312
|
SPINNER_FRAMES2 = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
49859
50313
|
});
|
|
49860
50314
|
|
|
@@ -49914,7 +50368,7 @@ function NoticesDock() {
|
|
|
49914
50368
|
const elapsed = Date.now() - notice.startedAt;
|
|
49915
50369
|
const out = skinNoticeFadeProgress(elapsed, notice.ttlMs);
|
|
49916
50370
|
if (out > 0)
|
|
49917
|
-
return
|
|
50371
|
+
return mixSkinColor2(target, bg(), out);
|
|
49918
50372
|
const t = Math.min(1, elapsed / SKIN_FADE_IN_MS);
|
|
49919
50373
|
return t >= 1 ? target : skinFadeInColor(target, bg(), t * SKIN_FADE_IN_MS);
|
|
49920
50374
|
};
|
|
@@ -49924,7 +50378,7 @@ function NoticesDock() {
|
|
|
49924
50378
|
if (!decorated())
|
|
49925
50379
|
return target;
|
|
49926
50380
|
const bright = skinPulseBrightness(Date.now() - notice.startedAt);
|
|
49927
|
-
return bright >= 1 ? target :
|
|
50381
|
+
return bright >= 1 ? target : mixSkinColor2(target, bg(), 1 - bright);
|
|
49928
50382
|
};
|
|
49929
50383
|
const width = () => Math.max(8, dimensions().width - 2);
|
|
49930
50384
|
return (() => {
|
|
@@ -49933,6 +50387,7 @@ function NoticesDock() {
|
|
|
49933
50387
|
setProp(_el$, "flexDirection", "column");
|
|
49934
50388
|
setProp(_el$, "width", "100%");
|
|
49935
50389
|
setProp(_el$, "paddingLeft", 1);
|
|
50390
|
+
setProp(_el$, "onMouseUp", () => markPanelActive("notices"));
|
|
49936
50391
|
insert(_el$, createComponent2(For, {
|
|
49937
50392
|
get each() {
|
|
49938
50393
|
return noticeList();
|
|
@@ -49982,6 +50437,7 @@ var init_notices_dock = __esm(() => {
|
|
|
49982
50437
|
init_theme3();
|
|
49983
50438
|
init_motion();
|
|
49984
50439
|
init_widgets_dock();
|
|
50440
|
+
init_pane_focus();
|
|
49985
50441
|
[notices, setNotices] = createSignal([]);
|
|
49986
50442
|
timers = new Map;
|
|
49987
50443
|
noticeList = notices;
|
|
@@ -50234,7 +50690,7 @@ class RecoveryUiController {
|
|
|
50234
50690
|
var RECOVERY_NOTICE_TTL_MS = 4000, RECOVERY_RECONNECT_BIND = "r", RECOVERY_RECONNECT_COMMAND = "session.bridge.recover";
|
|
50235
50691
|
|
|
50236
50692
|
// ../tui-base/src/routes/session/comet-track.tsx
|
|
50237
|
-
import { parseColor as
|
|
50693
|
+
import { parseColor as parseColor4, Renderable as Renderable5 } from "@opentui/core";
|
|
50238
50694
|
function cometHeadColor(theme) {
|
|
50239
50695
|
return theme?.hue.accent[500] ?? COMET_FALLBACK_HEAD;
|
|
50240
50696
|
}
|
|
@@ -50268,8 +50724,8 @@ var init_comet_track = __esm(() => {
|
|
|
50268
50724
|
_step = 0;
|
|
50269
50725
|
constructor(ctx, options = {}) {
|
|
50270
50726
|
super(ctx, options);
|
|
50271
|
-
this._headFg =
|
|
50272
|
-
this._trackFg =
|
|
50727
|
+
this._headFg = parseColor4(options.headFg ?? COMET_FALLBACK_HEAD);
|
|
50728
|
+
this._trackFg = parseColor4(options.trackFg ?? COMET_FALLBACK_TRACK);
|
|
50273
50729
|
this._mode = options.mode ?? "dark";
|
|
50274
50730
|
this._gradient = options.gradient ?? false;
|
|
50275
50731
|
this.setMeasureProvider(() => ({
|
|
@@ -50284,14 +50740,14 @@ var init_comet_track = __esm(() => {
|
|
|
50284
50740
|
this.requestRender();
|
|
50285
50741
|
}
|
|
50286
50742
|
set headFg(value) {
|
|
50287
|
-
const next =
|
|
50743
|
+
const next = parseColor4(value);
|
|
50288
50744
|
if (next.equals(this._headFg))
|
|
50289
50745
|
return;
|
|
50290
50746
|
this._headFg = next;
|
|
50291
50747
|
this.requestRender();
|
|
50292
50748
|
}
|
|
50293
50749
|
set trackFg(value) {
|
|
50294
|
-
const next =
|
|
50750
|
+
const next = parseColor4(value);
|
|
50295
50751
|
if (next.equals(this._trackFg))
|
|
50296
50752
|
return;
|
|
50297
50753
|
this._trackFg = next;
|
|
@@ -50312,7 +50768,7 @@ var init_comet_track = __esm(() => {
|
|
|
50312
50768
|
renderSelf(buffer) {
|
|
50313
50769
|
if (!this.visible || this.isDestroyed)
|
|
50314
50770
|
return;
|
|
50315
|
-
const bg =
|
|
50771
|
+
const bg = parseColor4("transparent");
|
|
50316
50772
|
const {
|
|
50317
50773
|
start,
|
|
50318
50774
|
dirRight,
|
|
@@ -50330,7 +50786,7 @@ var init_comet_track = __esm(() => {
|
|
|
50330
50786
|
const inTail = dirRight ? c < stern && c > tailEnd : c > stern && c < tailEnd;
|
|
50331
50787
|
if (inTail && behind >= 0) {
|
|
50332
50788
|
if (this._gradient) {
|
|
50333
|
-
const color =
|
|
50789
|
+
const color = parseColor4(identityHexAt(Math.min(1, behind / TAIL), this._mode));
|
|
50334
50790
|
buffer.drawText("\u2588", this.screenX + c, this.screenY, color, bg);
|
|
50335
50791
|
} else {
|
|
50336
50792
|
buffer.drawText(cometRampChar(behind), this.screenX + c, this.screenY, this._trackFg, bg);
|
|
@@ -50829,6 +51285,7 @@ function rowSearchText(row) {
|
|
|
50829
51285
|
case "assistant":
|
|
50830
51286
|
case "reasoning":
|
|
50831
51287
|
case "interrupted":
|
|
51288
|
+
case "system":
|
|
50832
51289
|
return row.text;
|
|
50833
51290
|
case "tool":
|
|
50834
51291
|
return `${row.name}${row.args ? `(${row.args})` : ""}${row.output ? ` ${row.output}` : ""}`;
|
|
@@ -51117,175 +51574,6 @@ var init_transcript_scroll = __esm(() => {
|
|
|
51117
51574
|
init_keymap();
|
|
51118
51575
|
});
|
|
51119
51576
|
|
|
51120
|
-
// ../tui-base/src/routes/session/pane-focus.tsx
|
|
51121
|
-
import { CliRenderEvents as CliRenderEvents5 } from "@opentui/core";
|
|
51122
|
-
function withinRenderable(node, ancestor) {
|
|
51123
|
-
if (!node || !ancestor)
|
|
51124
|
-
return false;
|
|
51125
|
-
let current = node;
|
|
51126
|
-
while (current) {
|
|
51127
|
-
if (current === ancestor)
|
|
51128
|
-
return true;
|
|
51129
|
-
current = current.parent;
|
|
51130
|
-
}
|
|
51131
|
-
return false;
|
|
51132
|
-
}
|
|
51133
|
-
function paneForFocused(current, nodes) {
|
|
51134
|
-
if (!current)
|
|
51135
|
-
return;
|
|
51136
|
-
if (withinRenderable(current, nodes.transcript?.()))
|
|
51137
|
-
return "transcript";
|
|
51138
|
-
if (withinRenderable(current, nodes.composer?.()))
|
|
51139
|
-
return "composer";
|
|
51140
|
-
return;
|
|
51141
|
-
}
|
|
51142
|
-
function paneToggleEnabled(gate) {
|
|
51143
|
-
return gate.keysEnabled && gate.pane !== undefined && !gate.slashOpen;
|
|
51144
|
-
}
|
|
51145
|
-
function transcriptKeysEnabled(gate) {
|
|
51146
|
-
return gate.keysEnabled && gate.pane === "transcript";
|
|
51147
|
-
}
|
|
51148
|
-
function createPaneFocus(nodes) {
|
|
51149
|
-
const renderer = useRenderer();
|
|
51150
|
-
const pane = createPaneFocusSignal(renderer, nodes);
|
|
51151
|
-
const focus = (which) => {
|
|
51152
|
-
const node = which === "transcript" ? nodes.transcript?.() : nodes.composer?.();
|
|
51153
|
-
node?.focus();
|
|
51154
|
-
};
|
|
51155
|
-
return {
|
|
51156
|
-
pane,
|
|
51157
|
-
composerFocused: () => pane() === "composer",
|
|
51158
|
-
transcriptFocused: () => pane() === "transcript",
|
|
51159
|
-
focusComposer: () => focus("composer"),
|
|
51160
|
-
focusTranscript: () => focus("transcript"),
|
|
51161
|
-
toggle: () => focus(pane() === "transcript" ? "composer" : "transcript")
|
|
51162
|
-
};
|
|
51163
|
-
}
|
|
51164
|
-
function createPaneFocusSignal(renderer, nodes) {
|
|
51165
|
-
const [pane, setPane] = createSignal(undefined);
|
|
51166
|
-
const refresh = () => setPane(paneForFocused(renderer.currentFocusedRenderable, nodes));
|
|
51167
|
-
onMount(() => {
|
|
51168
|
-
renderer.on(CliRenderEvents5.FOCUSED_RENDERABLE, refresh);
|
|
51169
|
-
refresh();
|
|
51170
|
-
});
|
|
51171
|
-
onCleanup(() => renderer.off(CliRenderEvents5.FOCUSED_RENDERABLE, refresh));
|
|
51172
|
-
return pane;
|
|
51173
|
-
}
|
|
51174
|
-
function PaneFocusKeys(props) {
|
|
51175
|
-
const scroll = () => {
|
|
51176
|
-
const box = props.scroll();
|
|
51177
|
-
return box && !box.isDestroyed ? box : undefined;
|
|
51178
|
-
};
|
|
51179
|
-
const line = (delta) => {
|
|
51180
|
-
scroll()?.scrollBy(delta);
|
|
51181
|
-
return true;
|
|
51182
|
-
};
|
|
51183
|
-
const page = (delta) => {
|
|
51184
|
-
scroll()?.scrollBy(delta, "viewport");
|
|
51185
|
-
return true;
|
|
51186
|
-
};
|
|
51187
|
-
const top = () => {
|
|
51188
|
-
scroll()?.scrollTo(0);
|
|
51189
|
-
return true;
|
|
51190
|
-
};
|
|
51191
|
-
const bottom = () => {
|
|
51192
|
-
scroll()?.scrollTo(Infinity);
|
|
51193
|
-
return true;
|
|
51194
|
-
};
|
|
51195
|
-
Keymap2.createLayer(() => ({
|
|
51196
|
-
mode: "global",
|
|
51197
|
-
priority: 1,
|
|
51198
|
-
capture: "main",
|
|
51199
|
-
enabled: paneToggleEnabled({
|
|
51200
|
-
pane: props.pane(),
|
|
51201
|
-
keysEnabled: props.keysEnabled(),
|
|
51202
|
-
slashOpen: props.slashOpen()
|
|
51203
|
-
}),
|
|
51204
|
-
commands: [{
|
|
51205
|
-
id: "pane.focus.toggle",
|
|
51206
|
-
title: "Toggle transcript / composer focus",
|
|
51207
|
-
group: "Session",
|
|
51208
|
-
bind: "f6",
|
|
51209
|
-
run: () => {
|
|
51210
|
-
props.toggle();
|
|
51211
|
-
return true;
|
|
51212
|
-
}
|
|
51213
|
-
}]
|
|
51214
|
-
}));
|
|
51215
|
-
Keymap2.createLayer(() => ({
|
|
51216
|
-
mode: "global",
|
|
51217
|
-
priority: 1,
|
|
51218
|
-
capture: "main",
|
|
51219
|
-
enabled: transcriptKeysEnabled({
|
|
51220
|
-
pane: props.pane(),
|
|
51221
|
-
keysEnabled: props.keysEnabled()
|
|
51222
|
-
}),
|
|
51223
|
-
commands: [{
|
|
51224
|
-
id: "pane.transcript.line.up",
|
|
51225
|
-
title: "Scroll transcript up one line",
|
|
51226
|
-
group: "Session",
|
|
51227
|
-
bind: "up",
|
|
51228
|
-
run: () => line(-1)
|
|
51229
|
-
}, {
|
|
51230
|
-
id: "pane.transcript.line.down",
|
|
51231
|
-
title: "Scroll transcript down one line",
|
|
51232
|
-
group: "Session",
|
|
51233
|
-
bind: "down",
|
|
51234
|
-
run: () => line(1)
|
|
51235
|
-
}, {
|
|
51236
|
-
id: "pane.transcript.page.up",
|
|
51237
|
-
title: "Scroll transcript up one page",
|
|
51238
|
-
group: "Session",
|
|
51239
|
-
bind: "pageup",
|
|
51240
|
-
run: () => page(-1)
|
|
51241
|
-
}, {
|
|
51242
|
-
id: "pane.transcript.page.down",
|
|
51243
|
-
title: "Scroll transcript down one page",
|
|
51244
|
-
group: "Session",
|
|
51245
|
-
bind: "pagedown",
|
|
51246
|
-
run: () => page(1)
|
|
51247
|
-
}, {
|
|
51248
|
-
id: "pane.transcript.top",
|
|
51249
|
-
title: "Transcript top",
|
|
51250
|
-
group: "Session",
|
|
51251
|
-
bind: "home",
|
|
51252
|
-
run: top
|
|
51253
|
-
}, {
|
|
51254
|
-
id: "pane.transcript.bottom",
|
|
51255
|
-
title: "Transcript bottom",
|
|
51256
|
-
group: "Session",
|
|
51257
|
-
bind: "end",
|
|
51258
|
-
run: bottom
|
|
51259
|
-
}, {
|
|
51260
|
-
id: "pane.transcript.composer",
|
|
51261
|
-
title: "Focus the composer",
|
|
51262
|
-
group: "Session",
|
|
51263
|
-
bind: "tab",
|
|
51264
|
-
run: () => {
|
|
51265
|
-
props.focusComposer();
|
|
51266
|
-
return true;
|
|
51267
|
-
}
|
|
51268
|
-
}, {
|
|
51269
|
-
id: "pane.transcript.escape",
|
|
51270
|
-
title: "Focus the composer",
|
|
51271
|
-
group: "Session",
|
|
51272
|
-
bind: "escape",
|
|
51273
|
-
run: () => {
|
|
51274
|
-
if (props.busy())
|
|
51275
|
-
return false;
|
|
51276
|
-
props.focusComposer();
|
|
51277
|
-
return true;
|
|
51278
|
-
}
|
|
51279
|
-
}]
|
|
51280
|
-
}));
|
|
51281
|
-
return null;
|
|
51282
|
-
}
|
|
51283
|
-
var init_pane_focus = __esm(() => {
|
|
51284
|
-
init_server();
|
|
51285
|
-
init_index_bun();
|
|
51286
|
-
init_keymap();
|
|
51287
|
-
});
|
|
51288
|
-
|
|
51289
51577
|
// ../tui-base/src/routes/session/ask-keys.ts
|
|
51290
51578
|
function printableText(event) {
|
|
51291
51579
|
const text = event.sequence;
|
|
@@ -52409,7 +52697,9 @@ function ApprovalCard(props) {
|
|
|
52409
52697
|
get message() {
|
|
52410
52698
|
return memo2(() => !!invalidated())() ? t("overlay.ask.invalidated", {
|
|
52411
52699
|
reason: props.invalidatedReason ?? ""
|
|
52412
|
-
}) : summarizeArgs(props.name, props.args)
|
|
52700
|
+
}) : `${summarizeArgs(props.name, props.args)}${props.escalation === true ? `
|
|
52701
|
+
${t("overlay.ask.alwaysHint")}
|
|
52702
|
+
${t("overlay.ask.sessionHint")}` : ""}`;
|
|
52413
52703
|
},
|
|
52414
52704
|
get label() {
|
|
52415
52705
|
return memo2(() => !!invalidated())() ? {
|
|
@@ -52447,7 +52737,7 @@ function ReminderBadge() {
|
|
|
52447
52737
|
if (!motionDecorationsEnabled())
|
|
52448
52738
|
return target;
|
|
52449
52739
|
const bright = skinPulseBrightness(Date.now() - startedAt);
|
|
52450
|
-
return bright >= 1 ? target :
|
|
52740
|
+
return bright >= 1 ? target : mixSkinColor2(target, theme?.background.base ?? "#000000", 1 - bright);
|
|
52451
52741
|
};
|
|
52452
52742
|
return (() => {
|
|
52453
52743
|
var _el$ = createElement("text");
|
|
@@ -53950,17 +54240,6 @@ function cwdBasename(cwd) {
|
|
|
53950
54240
|
const parts = trimmed.split(/[\\/]/);
|
|
53951
54241
|
return parts[parts.length - 1] || trimmed;
|
|
53952
54242
|
}
|
|
53953
|
-
function permissionCatalogLines(catalog) {
|
|
53954
|
-
const names = catalog.options.map((option) => option.value).join(", ");
|
|
53955
|
-
const lines = [`available presets: ${names}`];
|
|
53956
|
-
for (const option of catalog.options) {
|
|
53957
|
-
const detail = option.description === undefined || option.description === "" ? "" : ` \u2014 ${option.description}`;
|
|
53958
|
-
lines.push(`${option.value}${detail}`);
|
|
53959
|
-
}
|
|
53960
|
-
lines.push(`default preset: ${catalog.defaultPreset}`);
|
|
53961
|
-
lines.push("current session preset is host-authoritative (not readable here); use /permission <preset> to set it");
|
|
53962
|
-
return lines;
|
|
53963
|
-
}
|
|
53964
54243
|
function loginStepTitle(stepTitle, error) {
|
|
53965
54244
|
return error ? `${stepTitle} \u2014 ${error}` : stepTitle;
|
|
53966
54245
|
}
|
|
@@ -54987,12 +55266,23 @@ function coreCommands() {
|
|
|
54987
55266
|
ctx.say(t("command.permission.catalogUnavailable"));
|
|
54988
55267
|
return;
|
|
54989
55268
|
}
|
|
54990
|
-
const
|
|
54991
|
-
|
|
54992
|
-
|
|
54993
|
-
|
|
55269
|
+
const boundId = ctx.seam.currentSessionId();
|
|
55270
|
+
const stagedId = ctx.seam.stagedSessionId?.();
|
|
55271
|
+
if ((boundId === undefined || boundId === "") && (stagedId === undefined || stagedId === "")) {
|
|
55272
|
+
ctx.say(t("command.permission.noSession"));
|
|
54994
55273
|
return;
|
|
54995
55274
|
}
|
|
55275
|
+
let arg = argText.trim();
|
|
55276
|
+
if (arg === "") {
|
|
55277
|
+
const picked = await ctx.pickOne(t("command.permission.pickerTitle"), catalog.options.map((option) => ({
|
|
55278
|
+
title: option.name ?? option.value,
|
|
55279
|
+
value: option.value,
|
|
55280
|
+
description: option.description
|
|
55281
|
+
})), t("command.permission.defaultMarkerHint"), catalog.defaultPreset);
|
|
55282
|
+
if (picked === undefined)
|
|
55283
|
+
return;
|
|
55284
|
+
arg = picked;
|
|
55285
|
+
}
|
|
54996
55286
|
const target = catalog.options.find((option) => option.value === arg || option.name === arg);
|
|
54997
55287
|
if (target === undefined) {
|
|
54998
55288
|
const names = catalog.options.map((option) => option.value).join(", ");
|
|
@@ -59724,7 +60014,7 @@ var init_confirm = __esm(() => {
|
|
|
59724
60014
|
init_index_bun();
|
|
59725
60015
|
init_index_bun();
|
|
59726
60016
|
init_server();
|
|
59727
|
-
|
|
60017
|
+
init_src2();
|
|
59728
60018
|
init_theme4();
|
|
59729
60019
|
init_button();
|
|
59730
60020
|
init_theme4();
|
|
@@ -60310,6 +60600,12 @@ function buildHostItems(document, writable, catalog) {
|
|
|
60310
60600
|
item.note = t("settings.note.hostUnavailable");
|
|
60311
60601
|
return item;
|
|
60312
60602
|
}
|
|
60603
|
+
if (document.source === "local-file") {
|
|
60604
|
+
item.note = t("settings.note.hostLocalFile", {
|
|
60605
|
+
reason: document.sourceDetail?.reason ?? t("settings.note.hostUnavailable")
|
|
60606
|
+
});
|
|
60607
|
+
return item;
|
|
60608
|
+
}
|
|
60313
60609
|
if (row === undefined)
|
|
60314
60610
|
return item;
|
|
60315
60611
|
const raw = valueAtPath(row.value, spec.path);
|
|
@@ -60352,6 +60648,19 @@ function buildHostItems(document, writable, catalog) {
|
|
|
60352
60648
|
if (info.max !== undefined)
|
|
60353
60649
|
item.max = info.max;
|
|
60354
60650
|
}
|
|
60651
|
+
if (permissionRow) {
|
|
60652
|
+
const scope = t("settings.note.permissionPresetScope");
|
|
60653
|
+
if (item.note !== undefined)
|
|
60654
|
+
item.note = `${item.note} \xB7 ${scope}`;
|
|
60655
|
+
else {
|
|
60656
|
+
item.source = item.source === "" ? scope : `${item.source} \xB7 ${scope}`;
|
|
60657
|
+
item.note = scope;
|
|
60658
|
+
}
|
|
60659
|
+
}
|
|
60660
|
+
if (document.source === "host" && spec.id === "subagent.maxDepth") {
|
|
60661
|
+
item.editable = false;
|
|
60662
|
+
item.note = t("settings.note.maxDepthPinned");
|
|
60663
|
+
}
|
|
60355
60664
|
return item;
|
|
60356
60665
|
});
|
|
60357
60666
|
}
|
|
@@ -60571,6 +60880,11 @@ function planHostWrite(item, raw) {
|
|
|
60571
60880
|
};
|
|
60572
60881
|
}
|
|
60573
60882
|
if (item.kind === "number") {
|
|
60883
|
+
if (String(raw).trim() === "")
|
|
60884
|
+
return {
|
|
60885
|
+
ok: false,
|
|
60886
|
+
error: t("settings.error.hostEmptyNumber")
|
|
60887
|
+
};
|
|
60574
60888
|
const parsed = parseIntegerInput(String(raw), item.min, item.max);
|
|
60575
60889
|
if (!parsed.ok)
|
|
60576
60890
|
return parsed;
|
|
@@ -60703,6 +61017,15 @@ function settingsWritable(document, describeError, hasFace) {
|
|
|
60703
61017
|
})
|
|
60704
61018
|
};
|
|
60705
61019
|
}
|
|
61020
|
+
if (document?.source === "local-file") {
|
|
61021
|
+
return {
|
|
61022
|
+
local: true,
|
|
61023
|
+
host: false,
|
|
61024
|
+
reason: t("settings.writable.localFileDegraded", {
|
|
61025
|
+
reason: document.sourceDetail?.reason ?? t("settings.note.hostUnavailable")
|
|
61026
|
+
})
|
|
61027
|
+
};
|
|
61028
|
+
}
|
|
60706
61029
|
if (document !== undefined && document.writable === false) {
|
|
60707
61030
|
return {
|
|
60708
61031
|
local: false,
|
|
@@ -60715,6 +61038,19 @@ function settingsWritable(document, describeError, hasFace) {
|
|
|
60715
61038
|
host: true
|
|
60716
61039
|
};
|
|
60717
61040
|
}
|
|
61041
|
+
function settingsWriteStatus(source, label) {
|
|
61042
|
+
if (source === "local-file")
|
|
61043
|
+
return t("settings.status.savedLocalFile", {
|
|
61044
|
+
label
|
|
61045
|
+
});
|
|
61046
|
+
if (source === "host")
|
|
61047
|
+
return t("settings.status.savedLive", {
|
|
61048
|
+
label
|
|
61049
|
+
});
|
|
61050
|
+
return t("settings.status.saved", {
|
|
61051
|
+
label
|
|
61052
|
+
});
|
|
61053
|
+
}
|
|
60718
61054
|
function settingsSummary(changed) {
|
|
60719
61055
|
return changed.length > 0 ? t("settings.summary.updated", {
|
|
60720
61056
|
labels: changed.join(", ")
|
|
@@ -61019,10 +61355,17 @@ function agentLimitsRows(agent, caps) {
|
|
|
61019
61355
|
value: agent.background === true ? t("panel.agents.value.on") : t("panel.agents.value.off")
|
|
61020
61356
|
});
|
|
61021
61357
|
}
|
|
61358
|
+
const capsUnavailable = caps?.source === "unavailable";
|
|
61359
|
+
const capsNote = capsUnavailable && caps?.reason ? t("panel.agents.capsUnavailable", {
|
|
61360
|
+
reason: caps.reason
|
|
61361
|
+
}) : undefined;
|
|
61022
61362
|
rows.push({
|
|
61023
61363
|
key: "maxActiveSubagents",
|
|
61024
61364
|
editable: false,
|
|
61025
|
-
value: caps?.maxActiveSubagents === undefined ? t("panel.agents.value.na") : String(caps.maxActiveSubagents)
|
|
61365
|
+
value: caps?.maxActiveSubagents === undefined ? t("panel.agents.value.na") : String(caps.maxActiveSubagents),
|
|
61366
|
+
...capsNote !== undefined ? {
|
|
61367
|
+
note: capsNote
|
|
61368
|
+
} : {}
|
|
61026
61369
|
});
|
|
61027
61370
|
rows.push({
|
|
61028
61371
|
key: "maxDepth",
|
|
@@ -61042,7 +61385,7 @@ function agentLimitsItem(row) {
|
|
|
61042
61385
|
tone: "muted"
|
|
61043
61386
|
},
|
|
61044
61387
|
cells: {
|
|
61045
|
-
value: `${row.value} \xB7 ${limitDescription(row.key)}`
|
|
61388
|
+
value: `${row.value} \xB7 ${limitDescription(row.key)}${row.note !== undefined ? ` \xB7 ${row.note}` : ""}`
|
|
61046
61389
|
}
|
|
61047
61390
|
};
|
|
61048
61391
|
}
|
|
@@ -61432,6 +61775,10 @@ function AgentsPanel(props) {
|
|
|
61432
61775
|
setCaps(next);
|
|
61433
61776
|
}
|
|
61434
61777
|
function openSettingsRow(key) {
|
|
61778
|
+
if (caps()?.source === "unavailable") {
|
|
61779
|
+
setStatus(t("panel.agents.status.capsUnavailable"));
|
|
61780
|
+
return;
|
|
61781
|
+
}
|
|
61435
61782
|
panels.closeAll();
|
|
61436
61783
|
setTimeout(() => openSettingsPanel(officialCapSettingsRow(key)), 3);
|
|
61437
61784
|
}
|
|
@@ -62998,12 +63345,12 @@ var init_history_panel = __esm(() => {
|
|
|
62998
63345
|
|
|
62999
63346
|
// ../tui-base/src/component/spinner-renderable.ts
|
|
63000
63347
|
import {
|
|
63001
|
-
parseColor as
|
|
63348
|
+
parseColor as parseColor5,
|
|
63002
63349
|
Renderable as Renderable6,
|
|
63003
63350
|
RGBA as RGBA11
|
|
63004
63351
|
} from "@opentui/core";
|
|
63005
63352
|
function toColor(value) {
|
|
63006
|
-
return typeof value === "function" ? value :
|
|
63353
|
+
return typeof value === "function" ? value : parseColor5(value);
|
|
63007
63354
|
}
|
|
63008
63355
|
var graphemes4, SpinnerRenderable;
|
|
63009
63356
|
var init_spinner_renderable = __esm(() => {
|
|
@@ -63025,7 +63372,7 @@ var init_spinner_renderable = __esm(() => {
|
|
|
63025
63372
|
this._interval = options.interval ?? 80;
|
|
63026
63373
|
this._autoplay = options.autoplay ?? true;
|
|
63027
63374
|
this._color = toColor(options.color ?? RGBA11.defaultForeground());
|
|
63028
|
-
this._backgroundColor =
|
|
63375
|
+
this._backgroundColor = parseColor5(options.backgroundColor ?? "transparent");
|
|
63029
63376
|
this.setMeasureProvider(() => ({ width: this.frameWidth, height: 1 }));
|
|
63030
63377
|
this.frames = options.frames ?? SPINNER_FRAMES;
|
|
63031
63378
|
}
|
|
@@ -63059,7 +63406,7 @@ var init_spinner_renderable = __esm(() => {
|
|
|
63059
63406
|
this.requestRender();
|
|
63060
63407
|
}
|
|
63061
63408
|
set backgroundColor(value) {
|
|
63062
|
-
this._backgroundColor =
|
|
63409
|
+
this._backgroundColor = parseColor5(value);
|
|
63063
63410
|
this.requestRender();
|
|
63064
63411
|
}
|
|
63065
63412
|
restart() {
|
|
@@ -63076,7 +63423,7 @@ var init_spinner_renderable = __esm(() => {
|
|
|
63076
63423
|
return;
|
|
63077
63424
|
let x = this.screenX;
|
|
63078
63425
|
glyphs.forEach((glyph, char) => {
|
|
63079
|
-
const color = typeof this._color === "function" ?
|
|
63426
|
+
const color = typeof this._color === "function" ? parseColor5(this._color(this.index, char, this.glyphs.length, glyphs.length)) : this._color;
|
|
63080
63427
|
buffer.drawText(glyph.char, x, this.screenY, color, this._backgroundColor);
|
|
63081
63428
|
x += glyph.width;
|
|
63082
63429
|
});
|
|
@@ -64608,7 +64955,7 @@ var init_subagents_viewer = __esm(() => {
|
|
|
64608
64955
|
import { TextAttributes as TextAttributes12 } from "@opentui/core";
|
|
64609
64956
|
function resolveVersion() {
|
|
64610
64957
|
try {
|
|
64611
|
-
return "0.
|
|
64958
|
+
return "0.27.0";
|
|
64612
64959
|
} catch {
|
|
64613
64960
|
return "dev";
|
|
64614
64961
|
}
|
|
@@ -65091,10 +65438,8 @@ function SettingsModalBody(props) {
|
|
|
65091
65438
|
const currentRow = createMemo(() => currentRows()[rowIndex()]);
|
|
65092
65439
|
const savedLabels = [];
|
|
65093
65440
|
let statusTimer;
|
|
65094
|
-
function flashSaved(label) {
|
|
65095
|
-
setStatus(
|
|
65096
|
-
label
|
|
65097
|
-
}));
|
|
65441
|
+
function flashSaved(label, source) {
|
|
65442
|
+
setStatus(settingsWriteStatus(source, label));
|
|
65098
65443
|
if (statusTimer !== undefined)
|
|
65099
65444
|
clearTimeout(statusTimer);
|
|
65100
65445
|
statusTimer = setTimeout(() => {
|
|
@@ -65244,7 +65589,7 @@ function SettingsModalBody(props) {
|
|
|
65244
65589
|
return true;
|
|
65245
65590
|
}
|
|
65246
65591
|
savedLabels.push(row.label);
|
|
65247
|
-
flashSaved(row.label);
|
|
65592
|
+
flashSaved(row.label, result.document?.source ?? document()?.source);
|
|
65248
65593
|
props.onApplied?.([...savedLabels]);
|
|
65249
65594
|
return true;
|
|
65250
65595
|
} finally {
|
|
@@ -66280,6 +66625,14 @@ function createClipboardAdapter(clipboard) {
|
|
|
66280
66625
|
}
|
|
66281
66626
|
var init_clipboard2 = () => {};
|
|
66282
66627
|
|
|
66628
|
+
// ../tui-base/src/component/prompt/copy.ts
|
|
66629
|
+
function copyComposerSelection(source, clipboard, onError = () => {}) {
|
|
66630
|
+
if (!source.hasSelection())
|
|
66631
|
+
return false;
|
|
66632
|
+
clipboard.write(source.getSelectedText()).catch(onError);
|
|
66633
|
+
return true;
|
|
66634
|
+
}
|
|
66635
|
+
|
|
66283
66636
|
// ../tui-base/src/theme/contrast.ts
|
|
66284
66637
|
function relativeLuminance3(color) {
|
|
66285
66638
|
const [r, g, b] = color.toInts();
|
|
@@ -66839,7 +67192,7 @@ class LocalSettingsStore {
|
|
|
66839
67192
|
}
|
|
66840
67193
|
others.sort((a, b) => a.ns === "agent-default-model" ? -1 : b.ns === "agent-default-model" ? 1 : 0);
|
|
66841
67194
|
namespaces.push(...others);
|
|
66842
|
-
return { writable: true, hasDocument: existsSync12(this.#patchPath), namespaces };
|
|
67195
|
+
return { writable: true, hasDocument: existsSync12(this.#patchPath), namespaces, source: "local-file" };
|
|
66843
67196
|
}
|
|
66844
67197
|
mutate(ns, ops, _revision) {
|
|
66845
67198
|
if (!SETTINGS_NAMESPACES.includes(ns)) {
|
|
@@ -67722,6 +68075,122 @@ function projectPermissionSwitch(raw) {
|
|
|
67722
68075
|
}
|
|
67723
68076
|
var MAX_TEXT4 = 4096, MAX_SHORT4 = 240;
|
|
67724
68077
|
|
|
68078
|
+
// src/client/bridge-settings-route.ts
|
|
68079
|
+
function asRecord11(value) {
|
|
68080
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
68081
|
+
}
|
|
68082
|
+
function settingsFailureReason(err) {
|
|
68083
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
68084
|
+
return message.replace(/\s+/g, " ").trim().slice(0, 160) || "host settings unavailable";
|
|
68085
|
+
}
|
|
68086
|
+
function projectRow(raw) {
|
|
68087
|
+
const source = asRecord11(raw);
|
|
68088
|
+
const ns = source.ns;
|
|
68089
|
+
if (typeof ns !== "string")
|
|
68090
|
+
return;
|
|
68091
|
+
const revision = typeof source.revision === "number" ? source.revision : undefined;
|
|
68092
|
+
const fields = SETTINGS_NS_VALUE_FIELDS[ns];
|
|
68093
|
+
if (fields === undefined) {
|
|
68094
|
+
return { ns, ...revision !== undefined ? { revision } : {} };
|
|
68095
|
+
}
|
|
68096
|
+
const rawValue = asRecord11(source.value);
|
|
68097
|
+
const value = {};
|
|
68098
|
+
for (const field of fields)
|
|
68099
|
+
if (field in rawValue)
|
|
68100
|
+
value[field] = rawValue[field];
|
|
68101
|
+
const schema = {};
|
|
68102
|
+
for (const field of fields)
|
|
68103
|
+
schema[field] = { type: typeof value[field] };
|
|
68104
|
+
if (ns === "permission" && typeof value.presets === "object" && value.presets !== null) {
|
|
68105
|
+
schema.defaultPreset = { type: "string", enum: Object.keys(value.presets) };
|
|
68106
|
+
}
|
|
68107
|
+
const row = { ns, value, schema, secrets: [] };
|
|
68108
|
+
if (revision !== undefined)
|
|
68109
|
+
row.revision = revision;
|
|
68110
|
+
for (const layer of ["base", "user"]) {
|
|
68111
|
+
const rawLayer = asRecord11(source[layer]);
|
|
68112
|
+
const projected = {};
|
|
68113
|
+
for (const field of fields)
|
|
68114
|
+
if (field in rawLayer)
|
|
68115
|
+
projected[field] = rawLayer[field];
|
|
68116
|
+
if (Object.keys(projected).length > 0)
|
|
68117
|
+
row[layer] = projected;
|
|
68118
|
+
}
|
|
68119
|
+
if (Array.isArray(source.secrets)) {
|
|
68120
|
+
row.secrets = source.secrets.filter((s) => s !== null && typeof s === "object").map((s) => {
|
|
68121
|
+
const secret = asRecord11(s);
|
|
68122
|
+
return {
|
|
68123
|
+
path: Array.isArray(secret.path) ? secret.path.map(String) : [],
|
|
68124
|
+
set: secret.set === true
|
|
68125
|
+
};
|
|
68126
|
+
});
|
|
68127
|
+
}
|
|
68128
|
+
return row;
|
|
68129
|
+
}
|
|
68130
|
+
function projectHostSettingsDocument(raw) {
|
|
68131
|
+
const root = asRecord11(raw);
|
|
68132
|
+
const sourceNs = Array.isArray(root.namespaces) ? root.namespaces : [];
|
|
68133
|
+
const rows = sourceNs.map(projectRow).filter((row) => row !== undefined);
|
|
68134
|
+
const whitelisted = new Set(Object.keys(SETTINGS_NS_VALUE_FIELDS));
|
|
68135
|
+
const ordered = rows.sort((a, b) => {
|
|
68136
|
+
if (whitelisted.has(a.ns) !== whitelisted.has(b.ns))
|
|
68137
|
+
return whitelisted.has(a.ns) ? -1 : 1;
|
|
68138
|
+
if (!whitelisted.has(a.ns) && !whitelisted.has(b.ns)) {
|
|
68139
|
+
if (a.ns === "agent-default-model")
|
|
68140
|
+
return -1;
|
|
68141
|
+
if (b.ns === "agent-default-model")
|
|
68142
|
+
return 1;
|
|
68143
|
+
}
|
|
68144
|
+
return 0;
|
|
68145
|
+
});
|
|
68146
|
+
return {
|
|
68147
|
+
writable: root.writable === true,
|
|
68148
|
+
hasDocument: root.hasDocument === true,
|
|
68149
|
+
namespaces: ordered,
|
|
68150
|
+
source: "host"
|
|
68151
|
+
};
|
|
68152
|
+
}
|
|
68153
|
+
function officialCapsFromDocument(document) {
|
|
68154
|
+
if (document === undefined || document.source !== "host") {
|
|
68155
|
+
return { source: "unavailable", ...document?.sourceDetail?.reason ? { reason: document.sourceDetail.reason } : {} };
|
|
68156
|
+
}
|
|
68157
|
+
const row = document.namespaces.find((candidate) => candidate.ns === "subagent");
|
|
68158
|
+
const value = asRecord11(row?.value);
|
|
68159
|
+
const caps = { source: "host" };
|
|
68160
|
+
if (typeof value.maxActiveSubagents === "number" && Number.isFinite(value.maxActiveSubagents)) {
|
|
68161
|
+
caps.maxActiveSubagents = value.maxActiveSubagents;
|
|
68162
|
+
}
|
|
68163
|
+
if (typeof value.maxDepth === "number" && Number.isFinite(value.maxDepth)) {
|
|
68164
|
+
caps.maxDepth = value.maxDepth;
|
|
68165
|
+
}
|
|
68166
|
+
return caps;
|
|
68167
|
+
}
|
|
68168
|
+
function isConflictError(err) {
|
|
68169
|
+
const rec = asRecord11(err);
|
|
68170
|
+
return rec.code === "SETTINGS_CONFLICT" || rec.code === "settings/conflict" || rec.name === "SettingsConflictError";
|
|
68171
|
+
}
|
|
68172
|
+
function hostMutateError(err) {
|
|
68173
|
+
const message = settingsFailureReason(err);
|
|
68174
|
+
return { ok: false, conflict: isConflictError(err), error: message };
|
|
68175
|
+
}
|
|
68176
|
+
function projectHostMutateResult(raw) {
|
|
68177
|
+
const result = asRecord11(raw);
|
|
68178
|
+
if (result.ok === false) {
|
|
68179
|
+
const failure = result.error ?? result.message;
|
|
68180
|
+
const message = settingsFailureReason(failure);
|
|
68181
|
+
return { ok: false, conflict: isConflictError(result) || isConflictError(failure), error: message };
|
|
68182
|
+
}
|
|
68183
|
+
return { ok: true };
|
|
68184
|
+
}
|
|
68185
|
+
var SETTINGS_NS_VALUE_FIELDS;
|
|
68186
|
+
var init_bridge_settings_route = __esm(() => {
|
|
68187
|
+
SETTINGS_NS_VALUE_FIELDS = {
|
|
68188
|
+
subagent: ["maxActiveSubagents", "maxDepth"],
|
|
68189
|
+
permission: ["defaultPreset", "presets"],
|
|
68190
|
+
"session-log-deepseek": ["enabled"]
|
|
68191
|
+
};
|
|
68192
|
+
});
|
|
68193
|
+
|
|
67725
68194
|
// src/client/bridge-session-seam.ts
|
|
67726
68195
|
import { existsSync as existsSync13, readFileSync as readFileSync14, readdirSync as readdirSync4 } from "fs";
|
|
67727
68196
|
import { join as join16 } from "path";
|
|
@@ -67738,7 +68207,7 @@ function optionalStringField(row, key) {
|
|
|
67738
68207
|
return typeof value === "string" && value !== "" ? value : undefined;
|
|
67739
68208
|
}
|
|
67740
68209
|
function parseAskRequest(value) {
|
|
67741
|
-
const row =
|
|
68210
|
+
const row = asRecord12(value);
|
|
67742
68211
|
const eventId = optionalStringField(row, "eventId");
|
|
67743
68212
|
const sessionId = optionalStringField(row, "sessionId");
|
|
67744
68213
|
const kind = row.kind;
|
|
@@ -67761,14 +68230,14 @@ function parseAskRequest(value) {
|
|
|
67761
68230
|
if (Array.isArray(row.questions)) {
|
|
67762
68231
|
const questions = [];
|
|
67763
68232
|
for (const raw of row.questions) {
|
|
67764
|
-
const q =
|
|
68233
|
+
const q = asRecord12(raw);
|
|
67765
68234
|
const id = optionalStringField(q, "id");
|
|
67766
68235
|
const prompt = optionalStringField(q, "prompt");
|
|
67767
68236
|
if (id === undefined || prompt === undefined || !Array.isArray(q.options))
|
|
67768
68237
|
continue;
|
|
67769
68238
|
const options = [];
|
|
67770
68239
|
for (const rawOpt of q.options) {
|
|
67771
|
-
const opt =
|
|
68240
|
+
const opt = asRecord12(rawOpt);
|
|
67772
68241
|
const label = optionalStringField(opt, "label");
|
|
67773
68242
|
if (label === undefined)
|
|
67774
68243
|
continue;
|
|
@@ -67839,11 +68308,11 @@ function answersFor(request, picks) {
|
|
|
67839
68308
|
function unavailableResponse(request) {
|
|
67840
68309
|
return request.kind === "questions" ? { eventId: request.eventId, kind: "questions", verdict: "unavailable", answers: answersFor(request, []) } : { eventId: request.eventId, kind: "approval", verdict: "unavailable" };
|
|
67841
68310
|
}
|
|
67842
|
-
function
|
|
68311
|
+
function asRecord12(value) {
|
|
67843
68312
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
67844
68313
|
}
|
|
67845
68314
|
function projectSeamAccountView(value) {
|
|
67846
|
-
const v =
|
|
68315
|
+
const v = asRecord12(value);
|
|
67847
68316
|
return {
|
|
67848
68317
|
status: typeof v.status === "string" && ACCOUNT_STATUSES.has(v.status) ? v.status : null,
|
|
67849
68318
|
attemptPhase: typeof v.attemptPhase === "string" && ACCOUNT_PHASES.has(v.attemptPhase) ? v.attemptPhase : null,
|
|
@@ -67865,14 +68334,14 @@ function projectBridgeSessionList(items, limit = 12) {
|
|
|
67865
68334
|
const rows = Array.isArray(items) ? items : [];
|
|
67866
68335
|
const out = [];
|
|
67867
68336
|
for (const item of rows) {
|
|
67868
|
-
const row =
|
|
68337
|
+
const row = asRecord12(item);
|
|
67869
68338
|
if (row.origin === "subagent")
|
|
67870
68339
|
continue;
|
|
67871
68340
|
const id = typeof row.sessionId === "string" ? row.sessionId : "";
|
|
67872
68341
|
if (!id)
|
|
67873
68342
|
continue;
|
|
67874
68343
|
const updatedAt = typeof row.updatedAt === "number" ? String(row.updatedAt) : "";
|
|
67875
|
-
const values =
|
|
68344
|
+
const values = asRecord12(asRecord12(row.projections).values);
|
|
67876
68345
|
const title = typeof values.title === "string" ? values.title : "";
|
|
67877
68346
|
out.push({
|
|
67878
68347
|
id,
|
|
@@ -67889,7 +68358,7 @@ function projectCurrentCwd(items, sessionId) {
|
|
|
67889
68358
|
if (sessionId === undefined || sessionId === "" || !Array.isArray(items))
|
|
67890
68359
|
return;
|
|
67891
68360
|
for (const item of items) {
|
|
67892
|
-
const row =
|
|
68361
|
+
const row = asRecord12(item);
|
|
67893
68362
|
if (row.sessionId !== sessionId)
|
|
67894
68363
|
continue;
|
|
67895
68364
|
return typeof row.cwd === "string" && row.cwd !== "" ? row.cwd : undefined;
|
|
@@ -67901,7 +68370,7 @@ function bridgeReplayRowsToSeamTranscript(rows, skip = 0) {
|
|
|
67901
68370
|
type: row.type,
|
|
67902
68371
|
seq: row.seq,
|
|
67903
68372
|
time: 0,
|
|
67904
|
-
data:
|
|
68373
|
+
data: asRecord12(row.payload)
|
|
67905
68374
|
}));
|
|
67906
68375
|
const durable = journalToTranscriptRows(entries, skip);
|
|
67907
68376
|
return durable.map((row) => {
|
|
@@ -67915,8 +68384,8 @@ function bridgeReplayRowsToSeamTranscript(rows, skip = 0) {
|
|
|
67915
68384
|
});
|
|
67916
68385
|
}
|
|
67917
68386
|
function seamReplayEventKey(event) {
|
|
67918
|
-
const details =
|
|
67919
|
-
return `${event.type}:${String(details.id ?? details.messageID ?? "")}:${String(
|
|
68387
|
+
const details = asRecord12(event.details);
|
|
68388
|
+
return `${event.type}:${String(details.id ?? details.messageID ?? "")}:${String(asRecord12(details.part).id ?? "")}`;
|
|
67920
68389
|
}
|
|
67921
68390
|
function bridgeReplayRowsToSeamEvents(rows, sessionId) {
|
|
67922
68391
|
const events = [];
|
|
@@ -67930,7 +68399,7 @@ function bridgeReplayRowsToSeamEvents(rows, sessionId) {
|
|
|
67930
68399
|
};
|
|
67931
68400
|
const toolCalls = new Map;
|
|
67932
68401
|
for (const row of rows) {
|
|
67933
|
-
const entry = { type: row.type, seq: row.seq, time: 0, data:
|
|
68402
|
+
const entry = { type: row.type, seq: row.seq, time: 0, data: asRecord12(row.payload) };
|
|
67934
68403
|
for (const event of projectJournalRecord(entry, sessionId))
|
|
67935
68404
|
push(event);
|
|
67936
68405
|
const data = entry.data;
|
|
@@ -67944,7 +68413,7 @@ function bridgeReplayRowsToSeamEvents(rows, sessionId) {
|
|
|
67944
68413
|
});
|
|
67945
68414
|
}
|
|
67946
68415
|
} else if (row.type === "tool/result") {
|
|
67947
|
-
const message =
|
|
68416
|
+
const message = asRecord12(data.message);
|
|
67948
68417
|
const callId = data.callId !== undefined ? String(data.callId) : message.toolCallId !== undefined ? String(message.toolCallId) : "";
|
|
67949
68418
|
const call = callId ? toolCalls.get(callId) : undefined;
|
|
67950
68419
|
if (call !== undefined) {
|
|
@@ -68000,7 +68469,7 @@ function bridgeSettleChild(existing, outcome, startedAt, now) {
|
|
|
68000
68469
|
function bridgeFoldAgentRecord(children, runSeq, liveStarts, type, data, now, live) {
|
|
68001
68470
|
const name = typeof data.name === "string" && data.name !== "" ? data.name : undefined;
|
|
68002
68471
|
if (type === "user/message") {
|
|
68003
|
-
const source =
|
|
68472
|
+
const source = asRecord12(data.source);
|
|
68004
68473
|
if (source.kind !== BRIDGE_SUBAGENT_SETTLED)
|
|
68005
68474
|
return false;
|
|
68006
68475
|
const childId = typeof source.senderSessionId === "string" ? source.senderSessionId : "";
|
|
@@ -68107,7 +68576,7 @@ function bridgeSweepSettledChildIds(rows, parentId, locallyRunning) {
|
|
|
68107
68576
|
return [];
|
|
68108
68577
|
const settled = [];
|
|
68109
68578
|
for (const raw of rows) {
|
|
68110
|
-
const row =
|
|
68579
|
+
const row = asRecord12(raw);
|
|
68111
68580
|
if (row.origin !== "subagent")
|
|
68112
68581
|
continue;
|
|
68113
68582
|
if (row.parentSessionId !== parentId)
|
|
@@ -68157,16 +68626,16 @@ function bridgeChildJournalMeta(rows) {
|
|
|
68157
68626
|
let contextModel;
|
|
68158
68627
|
let descriptorModel;
|
|
68159
68628
|
for (const row of rows) {
|
|
68160
|
-
const data =
|
|
68629
|
+
const data = asRecord12(row.payload);
|
|
68161
68630
|
if (row.type === "assistant/message") {
|
|
68162
68631
|
rounds += 1;
|
|
68163
|
-
const message =
|
|
68632
|
+
const message = asRecord12(data.message);
|
|
68164
68633
|
const tail = bridgeLastContentLine(bridgeBlocksText(message.content ?? data.content));
|
|
68165
68634
|
if (tail !== undefined)
|
|
68166
68635
|
lastLine = tail;
|
|
68167
68636
|
} else if (row.type === "tool/result") {
|
|
68168
68637
|
if (data.isError !== true) {
|
|
68169
|
-
const message =
|
|
68638
|
+
const message = asRecord12(data.message);
|
|
68170
68639
|
const tail = bridgeLastContentLine(bridgeBlocksText(message.content ?? data.content));
|
|
68171
68640
|
if (tail !== undefined)
|
|
68172
68641
|
lastLine = tail;
|
|
@@ -68204,7 +68673,7 @@ function bridgeChildStopReason(rows) {
|
|
|
68204
68673
|
const row = rows[i];
|
|
68205
68674
|
if (row.type !== "user/message")
|
|
68206
68675
|
continue;
|
|
68207
|
-
const source =
|
|
68676
|
+
const source = asRecord12(asRecord12(row.payload).source);
|
|
68208
68677
|
if (source.kind !== BRIDGE_SUBAGENT_SETTLED)
|
|
68209
68678
|
continue;
|
|
68210
68679
|
const reason = source.stopReason;
|
|
@@ -68215,7 +68684,7 @@ function bridgeChildStopReason(rows) {
|
|
|
68215
68684
|
const row = rows[i];
|
|
68216
68685
|
if (row.type !== "turn/end")
|
|
68217
68686
|
continue;
|
|
68218
|
-
const reason =
|
|
68687
|
+
const reason = asRecord12(asRecord12(row.payload).reason);
|
|
68219
68688
|
const kind = reason.kind;
|
|
68220
68689
|
if (typeof kind === "string" && kind !== "")
|
|
68221
68690
|
return kind;
|
|
@@ -68273,7 +68742,7 @@ function lastJournalTurnTerminal(rows, startOutsideWindow = false) {
|
|
|
68273
68742
|
return latest;
|
|
68274
68743
|
}
|
|
68275
68744
|
function journalTurnId(row) {
|
|
68276
|
-
const payload =
|
|
68745
|
+
const payload = asRecord12(row.payload);
|
|
68277
68746
|
if (typeof payload.turn === "number" && Number.isFinite(payload.turn))
|
|
68278
68747
|
return payload.turn;
|
|
68279
68748
|
if (typeof payload.turnId === "string" && payload.turnId !== "")
|
|
@@ -68281,7 +68750,7 @@ function journalTurnId(row) {
|
|
|
68281
68750
|
return;
|
|
68282
68751
|
}
|
|
68283
68752
|
function projectBridgeEvent(frame, sessionId) {
|
|
68284
|
-
const payload =
|
|
68753
|
+
const payload = asRecord12(frame.payload);
|
|
68285
68754
|
const turnId = typeof payload.turnId === "string" ? payload.turnId : "";
|
|
68286
68755
|
if (frame.type === "turn.start") {
|
|
68287
68756
|
return [{ type: "session.updated", details: { sessionID: sessionId, turnId, turn: "starting" } }];
|
|
@@ -68303,7 +68772,7 @@ function projectBridgeEvent(frame, sessionId) {
|
|
|
68303
68772
|
return [];
|
|
68304
68773
|
}
|
|
68305
68774
|
function parseUsage(value) {
|
|
68306
|
-
const u =
|
|
68775
|
+
const u = asRecord12(value);
|
|
68307
68776
|
const num = (...aliases) => {
|
|
68308
68777
|
let present = false;
|
|
68309
68778
|
let best = 0;
|
|
@@ -68332,7 +68801,7 @@ function parseUsage(value) {
|
|
|
68332
68801
|
return out;
|
|
68333
68802
|
}
|
|
68334
68803
|
function journalUsage(payload) {
|
|
68335
|
-
const usage =
|
|
68804
|
+
const usage = asRecord12(asRecord12(payload).usage);
|
|
68336
68805
|
const parsed = parseUsage(usage);
|
|
68337
68806
|
if (Object.keys(parsed).length === 0)
|
|
68338
68807
|
return;
|
|
@@ -68342,7 +68811,7 @@ function journalUsage(payload) {
|
|
|
68342
68811
|
return { ...parsed, total };
|
|
68343
68812
|
}
|
|
68344
68813
|
function asDeadCause(value) {
|
|
68345
|
-
const r =
|
|
68814
|
+
const r = asRecord12(value);
|
|
68346
68815
|
const stage = r.stage;
|
|
68347
68816
|
const stages = ["spawn", "handshake", "runtime", "closed"];
|
|
68348
68817
|
return {
|
|
@@ -68368,9 +68837,35 @@ class BridgeSessionSeam {
|
|
|
68368
68837
|
#pluginBundlesCache = [];
|
|
68369
68838
|
#pluginsManagerAvailable = undefined;
|
|
68370
68839
|
#goalsAvailable = undefined;
|
|
68840
|
+
#settingsSource = "local-file";
|
|
68841
|
+
#settingsSourceDetail = undefined;
|
|
68842
|
+
async#describeSettings() {
|
|
68843
|
+
try {
|
|
68844
|
+
const reply = await this.#transport.request("settings.describe");
|
|
68845
|
+
const document = projectHostSettingsDocument(reply);
|
|
68846
|
+
this.#settingsSource = "host";
|
|
68847
|
+
this.#settingsSourceDetail = undefined;
|
|
68848
|
+
return document;
|
|
68849
|
+
} catch (error) {
|
|
68850
|
+
const reason = settingsFailureReason(error);
|
|
68851
|
+
this.#settingsSource = "local-file";
|
|
68852
|
+
this.#settingsSourceDetail = { profile: this.#profile, reason };
|
|
68853
|
+
const local = this.#settingsStore.describe();
|
|
68854
|
+
return { ...local, source: "local-file", sourceDetail: this.#settingsSourceDetail };
|
|
68855
|
+
}
|
|
68856
|
+
}
|
|
68371
68857
|
settings = {
|
|
68372
|
-
describe: () =>
|
|
68373
|
-
mutate: (ns, ops, revision) =>
|
|
68858
|
+
describe: () => this.#describeSettings(),
|
|
68859
|
+
mutate: (ns, ops, revision) => {
|
|
68860
|
+
if (this.#settingsSource !== "host") {
|
|
68861
|
+
return Promise.resolve({
|
|
68862
|
+
ok: false,
|
|
68863
|
+
conflict: false,
|
|
68864
|
+
error: `host settings unavailable (local-file mode); the write was not applied${this.#settingsSourceDetail?.reason ? `: ${this.#settingsSourceDetail.reason}` : ""}`
|
|
68865
|
+
});
|
|
68866
|
+
}
|
|
68867
|
+
return this.#transport.request("settings.mutate", { ns, ops, expectedRevision: revision }).then(projectHostMutateResult, hostMutateError);
|
|
68868
|
+
},
|
|
68374
68869
|
identity: () => ({ profile: this.#profile, dshHome: this.#dshHome }),
|
|
68375
68870
|
permissionCatalog: () => this.#readPermissionCatalog()
|
|
68376
68871
|
};
|
|
@@ -68404,7 +68899,7 @@ class BridgeSessionSeam {
|
|
|
68404
68899
|
set: (name, field, value) => this.#localAgents.set(name, field, value),
|
|
68405
68900
|
body: (name) => this.#localAgents.body(name),
|
|
68406
68901
|
modelEfforts: (providerID, modelID) => this.#localAgents.modelEfforts(providerID, modelID),
|
|
68407
|
-
officialCaps: () => this.#
|
|
68902
|
+
officialCaps: async () => officialCapsFromDocument(await this.#describeSettings())
|
|
68408
68903
|
};
|
|
68409
68904
|
preset = {
|
|
68410
68905
|
list: () => Promise.resolve(this.#localPresets.list()),
|
|
@@ -68430,7 +68925,7 @@ class BridgeSessionSeam {
|
|
|
68430
68925
|
cancelSignIn: async (attemptId) => projectSeamAccountView(await this.#transport.request("account.cancelSignIn", { attemptId })),
|
|
68431
68926
|
signOut: async () => projectSeamAccountView(await this.#transport.request("account.signOut", { client: accountClientMeta() })),
|
|
68432
68927
|
hasRunningAccountTasks: async () => {
|
|
68433
|
-
const value =
|
|
68928
|
+
const value = asRecord12(await this.#transport.request("account.hasRunningAccountTasks"));
|
|
68434
68929
|
return value.running === true;
|
|
68435
68930
|
}
|
|
68436
68931
|
};
|
|
@@ -68493,7 +68988,7 @@ class BridgeSessionSeam {
|
|
|
68493
68988
|
}
|
|
68494
68989
|
}
|
|
68495
68990
|
async#permissionSwitch(preset) {
|
|
68496
|
-
const agentId = this.currentSessionId();
|
|
68991
|
+
const agentId = this.currentSessionId() ?? this.stagedSessionId();
|
|
68497
68992
|
if (agentId === undefined || agentId === "") {
|
|
68498
68993
|
throw new BridgeProtocolError("UNSUPPORTED", "permission.switch: no active session (agentId unavailable)");
|
|
68499
68994
|
}
|
|
@@ -68605,7 +69100,7 @@ class BridgeSessionSeam {
|
|
|
68605
69100
|
effortsFor: (providerID, modelID) => this.#catalogEfforts(providerID, modelID),
|
|
68606
69101
|
currentEffort: async () => {
|
|
68607
69102
|
const selection = await this.#transport.request("model.currentSelection");
|
|
68608
|
-
const value =
|
|
69103
|
+
const value = asRecord12(selection).reasoningEffort;
|
|
68609
69104
|
return typeof value === "string" && value !== "" ? value : undefined;
|
|
68610
69105
|
},
|
|
68611
69106
|
selectEffort: async (effort) => {
|
|
@@ -68641,7 +69136,7 @@ class BridgeSessionSeam {
|
|
|
68641
69136
|
return [];
|
|
68642
69137
|
const out = [];
|
|
68643
69138
|
for (const e of efforts) {
|
|
68644
|
-
const row =
|
|
69139
|
+
const row = asRecord12(e);
|
|
68645
69140
|
const id = typeof row.id === "string" ? row.id : "";
|
|
68646
69141
|
const name = typeof row.name === "string" ? row.name : "";
|
|
68647
69142
|
if (!id)
|
|
@@ -68661,6 +69156,7 @@ class BridgeSessionSeam {
|
|
|
68661
69156
|
#subagentRunSeq = new Map;
|
|
68662
69157
|
#subagentLiveStarts = new Set;
|
|
68663
69158
|
#subagentListeners = new Set;
|
|
69159
|
+
#subagentProgress = new Map;
|
|
68664
69160
|
#subagentSessionId;
|
|
68665
69161
|
#subagentJournalLoaded = new Set;
|
|
68666
69162
|
#subagentJournalMeta = new Map;
|
|
@@ -68738,7 +69234,7 @@ class BridgeSessionSeam {
|
|
|
68738
69234
|
}
|
|
68739
69235
|
async connect() {
|
|
68740
69236
|
try {
|
|
68741
|
-
const reply =
|
|
69237
|
+
const reply = asRecord12(await this.#transport.request("bridge.ping"));
|
|
68742
69238
|
this.#recordBridgeCapabilities(reply.capabilities);
|
|
68743
69239
|
this.#connection = "connected";
|
|
68744
69240
|
} catch (err) {
|
|
@@ -68825,7 +69321,7 @@ class BridgeSessionSeam {
|
|
|
68825
69321
|
this.#replayDrainPending = true;
|
|
68826
69322
|
let opened;
|
|
68827
69323
|
try {
|
|
68828
|
-
opened =
|
|
69324
|
+
opened = asRecord12(await this.#transport.request("session.open", { mode: "resume", id: sessionId }));
|
|
68829
69325
|
} catch (err) {
|
|
68830
69326
|
const code = err instanceof BridgeProtocolError ? err.code : "SESSION_OPEN_FAILED";
|
|
68831
69327
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -68835,7 +69331,7 @@ class BridgeSessionSeam {
|
|
|
68835
69331
|
this.#bufferedPendingSnapshot = undefined;
|
|
68836
69332
|
this.#replayDrainPending = false;
|
|
68837
69333
|
this.#settleSuspendedTurn();
|
|
68838
|
-
const errorDetail = err instanceof BridgeProtocolError ?
|
|
69334
|
+
const errorDetail = err instanceof BridgeProtocolError ? asRecord12(err.detail) : {};
|
|
68839
69335
|
const holder = typeof errorDetail.holder === "string" && errorDetail.holder.trim() !== "" ? errorDetail.holder : undefined;
|
|
68840
69336
|
const result = {
|
|
68841
69337
|
state: "locked",
|
|
@@ -68910,7 +69406,7 @@ class BridgeSessionSeam {
|
|
|
68910
69406
|
turnId: dead.turnId,
|
|
68911
69407
|
seq: terminal.seq,
|
|
68912
69408
|
terminalType: terminal.type,
|
|
68913
|
-
reason:
|
|
69409
|
+
reason: asRecord12(terminal.payload).reason,
|
|
68914
69410
|
payload: terminal.payload,
|
|
68915
69411
|
source: "journal"
|
|
68916
69412
|
}
|
|
@@ -68968,7 +69464,7 @@ class BridgeSessionSeam {
|
|
|
68968
69464
|
const seen = new Set;
|
|
68969
69465
|
const collected = [];
|
|
68970
69466
|
for (;; ) {
|
|
68971
|
-
const value =
|
|
69467
|
+
const value = asRecord12(await this.#transport.request("journal.replay", { sessionId, from }));
|
|
68972
69468
|
const rawRows = Array.isArray(value.rows) ? value.rows : [];
|
|
68973
69469
|
if (typeof value.cursor === "number" && Number.isFinite(value.cursor))
|
|
68974
69470
|
cursor = value.cursor;
|
|
@@ -68981,7 +69477,7 @@ class BridgeSessionSeam {
|
|
|
68981
69477
|
let added = 0;
|
|
68982
69478
|
let pageMax = from - 1;
|
|
68983
69479
|
for (const raw of rawRows) {
|
|
68984
|
-
const row =
|
|
69480
|
+
const row = asRecord12(raw);
|
|
68985
69481
|
const seq = row.seq;
|
|
68986
69482
|
if (typeof seq !== "number" || !Number.isFinite(seq) || seq < floor || seen.has(seq))
|
|
68987
69483
|
continue;
|
|
@@ -69030,7 +69526,7 @@ class BridgeSessionSeam {
|
|
|
69030
69526
|
};
|
|
69031
69527
|
const attempt = (remaining) => {
|
|
69032
69528
|
this.#transport.request("turn.abort", { turnId }).then((result) => {
|
|
69033
|
-
if (
|
|
69529
|
+
if (asRecord12(result).noop === true) {
|
|
69034
69530
|
fail(`turn.abort was a noop for turn ${turnId}; turn may still be running`, "TURN_ABORT_NOOP");
|
|
69035
69531
|
}
|
|
69036
69532
|
}).catch((err) => {
|
|
@@ -69166,7 +69662,7 @@ class BridgeSessionSeam {
|
|
|
69166
69662
|
stats.contextTokens = usage.total;
|
|
69167
69663
|
}
|
|
69168
69664
|
} else if (row.type === "request/context") {
|
|
69169
|
-
const data =
|
|
69665
|
+
const data = asRecord12(row.payload);
|
|
69170
69666
|
const window = data.contextWindow;
|
|
69171
69667
|
if (typeof window === "number" && Number.isFinite(window) && window > 0) {
|
|
69172
69668
|
const provider = typeof data.provider === "string" ? data.provider : "";
|
|
@@ -69300,7 +69796,7 @@ class BridgeSessionSeam {
|
|
|
69300
69796
|
this.#interruptInFlight.set(childId, generation);
|
|
69301
69797
|
let value;
|
|
69302
69798
|
try {
|
|
69303
|
-
value =
|
|
69799
|
+
value = asRecord12(await this.#transport.request("subagents.interrupt", { parentSessionId, childId }));
|
|
69304
69800
|
} catch (err) {
|
|
69305
69801
|
if (this.#interruptInFlight.get(childId) === generation)
|
|
69306
69802
|
this.#interruptInFlight.delete(childId);
|
|
@@ -69326,13 +69822,13 @@ class BridgeSessionSeam {
|
|
|
69326
69822
|
if (parentSessionId === undefined || parentSessionId === "") {
|
|
69327
69823
|
throw new BridgeProtocolError("NO_SESSION", "cannot stop children: no session is bound to this bridge connection");
|
|
69328
69824
|
}
|
|
69329
|
-
const value =
|
|
69825
|
+
const value = asRecord12(await this.#transport.request("subagents.stopChildren", { parentSessionId }));
|
|
69330
69826
|
const children = value.children;
|
|
69331
69827
|
if (!Array.isArray(children))
|
|
69332
69828
|
return [];
|
|
69333
69829
|
const sessionAtStart = this.#subagentSessionId;
|
|
69334
69830
|
const rows = children.map((row) => {
|
|
69335
|
-
const r =
|
|
69831
|
+
const r = asRecord12(row);
|
|
69336
69832
|
return {
|
|
69337
69833
|
childId: typeof r.childId === "string" ? r.childId : "",
|
|
69338
69834
|
disposition: typeof r.disposition === "string" ? r.disposition : "failed"
|
|
@@ -69358,10 +69854,10 @@ class BridgeSessionSeam {
|
|
|
69358
69854
|
return;
|
|
69359
69855
|
let stopped = false;
|
|
69360
69856
|
try {
|
|
69361
|
-
const items =
|
|
69857
|
+
const items = asRecord12(await this.#transport.request("session.list", { _request: {} })).items;
|
|
69362
69858
|
if (Array.isArray(items)) {
|
|
69363
69859
|
stopped = items.some((row) => {
|
|
69364
|
-
const item =
|
|
69860
|
+
const item = asRecord12(row);
|
|
69365
69861
|
return item.sessionId === childId && item.running === false;
|
|
69366
69862
|
});
|
|
69367
69863
|
}
|
|
@@ -69371,7 +69867,7 @@ class BridgeSessionSeam {
|
|
|
69371
69867
|
if (stopped) {
|
|
69372
69868
|
let reason = "aborted";
|
|
69373
69869
|
try {
|
|
69374
|
-
const rows =
|
|
69870
|
+
const rows = asRecord12(await this.#transport.request("journal.replay", { sessionId: childId })).rows;
|
|
69375
69871
|
if (Array.isArray(rows)) {
|
|
69376
69872
|
const clean = rows.filter((row) => row !== null && typeof row === "object" && !Array.isArray(row));
|
|
69377
69873
|
reason = bridgeChildStopReason(clean) ?? "aborted";
|
|
@@ -69430,7 +69926,7 @@ class BridgeSessionSeam {
|
|
|
69430
69926
|
} catch {
|
|
69431
69927
|
return;
|
|
69432
69928
|
}
|
|
69433
|
-
const items =
|
|
69929
|
+
const items = asRecord12(value).items;
|
|
69434
69930
|
if (!Array.isArray(items))
|
|
69435
69931
|
return;
|
|
69436
69932
|
const locallyRunning = new Set;
|
|
@@ -69475,7 +69971,7 @@ class BridgeSessionSeam {
|
|
|
69475
69971
|
this.#subagentJournalLoaded.add(key);
|
|
69476
69972
|
const sessionAtStart = this.#subagentSessionId;
|
|
69477
69973
|
try {
|
|
69478
|
-
const value =
|
|
69974
|
+
const value = asRecord12(await this.#transport.request("journal.replay", { sessionId: childId }));
|
|
69479
69975
|
const rows = value.rows;
|
|
69480
69976
|
if (!Array.isArray(rows))
|
|
69481
69977
|
return;
|
|
@@ -69527,18 +70023,23 @@ class BridgeSessionSeam {
|
|
|
69527
70023
|
const key = bridgeChildJournalKey(view);
|
|
69528
70024
|
const exactMeta = this.#subagentJournalMeta.get(key);
|
|
69529
70025
|
const meta = exactMeta ?? (key === `${view.id}@` ? this.#priorRunMeta(view.id) : undefined);
|
|
69530
|
-
|
|
70026
|
+
const progress = view.status === "running" ? this.#subagentProgress.get(view.id) : undefined;
|
|
70027
|
+
if (meta !== undefined || progress !== undefined) {
|
|
69531
70028
|
const restored = {
|
|
69532
70029
|
...view,
|
|
69533
|
-
rounds: meta.rounds,
|
|
69534
|
-
...
|
|
69535
|
-
...meta
|
|
70030
|
+
rounds: progress !== undefined ? Math.max(view.rounds, progress.rounds) : meta?.rounds ?? view.rounds,
|
|
70031
|
+
...progress?.lastLine !== undefined ? { lastLine: progress.lastLine } : meta?.lastLine !== undefined ? { lastLine: meta.lastLine } : {},
|
|
70032
|
+
...meta?.model !== undefined ? { model: meta.model } : {},
|
|
70033
|
+
...progress?.elapsedSec !== undefined ? { elapsedSec: progress.elapsedSec } : {}
|
|
69536
70034
|
};
|
|
69537
|
-
if (restored.rounds !== view.rounds || restored.lastLine !== view.lastLine || restored.model !== view.model) {
|
|
70035
|
+
if (restored.rounds !== view.rounds || restored.lastLine !== view.lastLine || restored.model !== view.model || restored.elapsedSec !== view.elapsedSec) {
|
|
69538
70036
|
this.#subagentViews.set(view.id, restored);
|
|
69539
70037
|
changed = true;
|
|
69540
70038
|
}
|
|
69541
70039
|
}
|
|
70040
|
+
if (view.status !== "running" && this.#subagentProgress.has(view.id)) {
|
|
70041
|
+
this.#subagentProgress.delete(view.id);
|
|
70042
|
+
}
|
|
69542
70043
|
if (exactMeta === undefined && !this.#subagentJournalLoaded.has(key)) {
|
|
69543
70044
|
this.#ensureChildJournal(view.id, view.startedAt);
|
|
69544
70045
|
}
|
|
@@ -69582,7 +70083,7 @@ class BridgeSessionSeam {
|
|
|
69582
70083
|
}
|
|
69583
70084
|
}
|
|
69584
70085
|
#foldAgentFrame(frame) {
|
|
69585
|
-
const payload =
|
|
70086
|
+
const payload = asRecord12(frame.payload);
|
|
69586
70087
|
const frameSession = typeof payload.sessionId === "string" ? payload.sessionId : "";
|
|
69587
70088
|
if (this.#subagentSessionId !== undefined && frameSession !== "" && frameSession !== this.#subagentSessionId)
|
|
69588
70089
|
return;
|
|
@@ -69600,12 +70101,36 @@ class BridgeSessionSeam {
|
|
|
69600
70101
|
this.#emitSubagentViews();
|
|
69601
70102
|
}
|
|
69602
70103
|
}
|
|
70104
|
+
#foldAgentProgress(frame) {
|
|
70105
|
+
const payload = asRecord12(frame.payload);
|
|
70106
|
+
const frameSession = typeof payload.sessionId === "string" ? payload.sessionId : "";
|
|
70107
|
+
if (this.#subagentSessionId !== undefined && frameSession !== "" && frameSession !== this.#subagentSessionId)
|
|
70108
|
+
return;
|
|
70109
|
+
const childId = typeof payload.childId === "string" ? payload.childId : "";
|
|
70110
|
+
const rounds = typeof payload.rounds === "number" && Number.isFinite(payload.rounds) ? Math.max(0, Math.floor(payload.rounds)) : undefined;
|
|
70111
|
+
if (childId === "" || rounds === undefined)
|
|
70112
|
+
return;
|
|
70113
|
+
const view = this.#subagentViews.get(childId);
|
|
70114
|
+
if (view === undefined || view.status !== "running")
|
|
70115
|
+
return;
|
|
70116
|
+
const lastLine = typeof payload.lastLine === "string" ? payload.lastLine : undefined;
|
|
70117
|
+
const elapsedSec = typeof payload.elapsedSec === "number" && Number.isFinite(payload.elapsedSec) ? payload.elapsedSec : undefined;
|
|
70118
|
+
const prev = this.#subagentProgress.get(childId);
|
|
70119
|
+
this.#subagentProgress.set(childId, {
|
|
70120
|
+
rounds: Math.max(prev?.rounds ?? 0, rounds),
|
|
70121
|
+
...lastLine !== undefined ? { lastLine } : prev?.lastLine !== undefined ? { lastLine: prev.lastLine } : {},
|
|
70122
|
+
...elapsedSec !== undefined ? { elapsedSec } : prev?.elapsedSec !== undefined ? { elapsedSec: prev.elapsedSec } : {}
|
|
70123
|
+
});
|
|
70124
|
+
this.#syncSubagentMeta(false);
|
|
70125
|
+
this.#emitSubagentViews();
|
|
70126
|
+
}
|
|
69603
70127
|
#foldAgentReplayRows(rows, sessionId) {
|
|
69604
70128
|
let rosterReset = false;
|
|
69605
70129
|
if (sessionId !== this.#subagentSessionId) {
|
|
69606
70130
|
this.#subagentViews.clear();
|
|
69607
70131
|
this.#subagentRunSeq.clear();
|
|
69608
70132
|
this.#subagentLiveStarts.clear();
|
|
70133
|
+
this.#subagentProgress.clear();
|
|
69609
70134
|
this.#subagentJournalLoaded.clear();
|
|
69610
70135
|
this.#subagentJournalMeta.clear();
|
|
69611
70136
|
this.#subagentTranscripts.clear();
|
|
@@ -69619,7 +70144,7 @@ class BridgeSessionSeam {
|
|
|
69619
70144
|
let changed = false;
|
|
69620
70145
|
const now = Date.now();
|
|
69621
70146
|
for (const row of rows) {
|
|
69622
|
-
if (this.#foldWithFrozenSettle(row.type,
|
|
70147
|
+
if (this.#foldWithFrozenSettle(row.type, asRecord12(row.payload), now, false))
|
|
69623
70148
|
changed = true;
|
|
69624
70149
|
}
|
|
69625
70150
|
if (rosterReset || changed) {
|
|
@@ -69653,34 +70178,34 @@ class BridgeSessionSeam {
|
|
|
69653
70178
|
}
|
|
69654
70179
|
async listSessions(limit) {
|
|
69655
70180
|
const value = await this.#transport.request("session.list");
|
|
69656
|
-
return projectBridgeSessionList(
|
|
70181
|
+
return projectBridgeSessionList(asRecord12(value).items, limit);
|
|
69657
70182
|
}
|
|
69658
70183
|
async cwd() {
|
|
69659
70184
|
const sessionId = this.currentSessionId();
|
|
69660
70185
|
if (sessionId === undefined || sessionId === "")
|
|
69661
70186
|
return;
|
|
69662
70187
|
const value = await this.#transport.request("session.list");
|
|
69663
|
-
return projectCurrentCwd(
|
|
70188
|
+
return projectCurrentCwd(asRecord12(value).items, sessionId);
|
|
69664
70189
|
}
|
|
69665
70190
|
async storedTranscript(id, skip = 0) {
|
|
69666
70191
|
const value = await this.#transport.request("journal.replay", { sessionId: id });
|
|
69667
|
-
const rows = Array.isArray(
|
|
70192
|
+
const rows = Array.isArray(asRecord12(value).rows) ? asRecord12(value).rows : [];
|
|
69668
70193
|
this.#foldAgentReplayRows(rows, id);
|
|
69669
70194
|
this.#sweepSubagents(id);
|
|
69670
70195
|
return bridgeReplayRowsToSeamTranscript(rows, skip);
|
|
69671
70196
|
}
|
|
69672
70197
|
async sessionJournal(id) {
|
|
69673
70198
|
const value = await this.#transport.request("journal.replay", { sessionId: id });
|
|
69674
|
-
const rows = Array.isArray(
|
|
70199
|
+
const rows = Array.isArray(asRecord12(value).rows) ? asRecord12(value).rows : [];
|
|
69675
70200
|
return rows.map((row) => ({
|
|
69676
70201
|
type: row.type,
|
|
69677
70202
|
seq: row.seq,
|
|
69678
70203
|
time: 0,
|
|
69679
|
-
data:
|
|
70204
|
+
data: asRecord12(row.payload)
|
|
69680
70205
|
}));
|
|
69681
70206
|
}
|
|
69682
70207
|
async forkSession(sessionId, seqEnd) {
|
|
69683
|
-
const value =
|
|
70208
|
+
const value = asRecord12(await this.#transport.request("session.fork", {
|
|
69684
70209
|
sessionId,
|
|
69685
70210
|
...seqEnd !== undefined ? { atSeq: seqEnd } : {}
|
|
69686
70211
|
}));
|
|
@@ -69694,7 +70219,7 @@ class BridgeSessionSeam {
|
|
|
69694
70219
|
const selection = await this.#transport.request("model.currentSelection");
|
|
69695
70220
|
if (selection === undefined || selection === null)
|
|
69696
70221
|
return;
|
|
69697
|
-
const s =
|
|
70222
|
+
const s = asRecord12(selection);
|
|
69698
70223
|
const providerID = typeof s.provider === "string" ? s.provider : "";
|
|
69699
70224
|
const modelID = typeof s.model === "string" ? s.model : "";
|
|
69700
70225
|
if (!providerID || !modelID)
|
|
@@ -69729,9 +70254,23 @@ class BridgeSessionSeam {
|
|
|
69729
70254
|
if (this.#pendingOpen !== undefined) {
|
|
69730
70255
|
const pending = this.#pendingOpen;
|
|
69731
70256
|
this.#pendingOpen = undefined;
|
|
69732
|
-
|
|
70257
|
+
if (pending.mode === "new" && this.#sessionAttached) {
|
|
70258
|
+
try {
|
|
70259
|
+
await this.#transport.request("session.close");
|
|
70260
|
+
} catch (err) {
|
|
70261
|
+
const code = err instanceof BridgeProtocolError ? err.code : err !== null && typeof err === "object" && typeof err.code === "string" ? err.code : undefined;
|
|
70262
|
+
if (code === "SESSION_NOT_OPEN") {} else {
|
|
70263
|
+
this.#pendingOpen = pending;
|
|
70264
|
+
throw err;
|
|
70265
|
+
}
|
|
70266
|
+
}
|
|
70267
|
+
this.#sessionAttached = false;
|
|
70268
|
+
if (this.#disposed)
|
|
70269
|
+
throw new BridgeProtocolError("DISPOSED", "bridge seam is disposed");
|
|
70270
|
+
}
|
|
70271
|
+
const params = pending.mode === "resume" ? { mode: "resume", id: pending.id, ...this.#sessionAttached ? { replace: true } : {} } : { mode: "new" };
|
|
69733
70272
|
try {
|
|
69734
|
-
const opened =
|
|
70273
|
+
const opened = asRecord12(await this.#transport.request("session.open", params));
|
|
69735
70274
|
if (typeof opened.sessionId === "string")
|
|
69736
70275
|
this.#currentSessionId = opened.sessionId;
|
|
69737
70276
|
if (this.#lastAppliedSessionId !== this.#currentSessionId) {
|
|
@@ -69748,7 +70287,7 @@ class BridgeSessionSeam {
|
|
|
69748
70287
|
const done = new Promise((resolve) => {
|
|
69749
70288
|
this.#turnDone = resolve;
|
|
69750
70289
|
});
|
|
69751
|
-
const sent =
|
|
70290
|
+
const sent = asRecord12(await this.#transport.request("session.send", { text: userText }));
|
|
69752
70291
|
if (typeof sent.turnId === "string") {
|
|
69753
70292
|
this.#inFlightTurnId = sent.turnId;
|
|
69754
70293
|
this.#emitEvent({
|
|
@@ -69784,6 +70323,7 @@ class BridgeSessionSeam {
|
|
|
69784
70323
|
this.#subagentViews.clear();
|
|
69785
70324
|
this.#subagentRunSeq.clear();
|
|
69786
70325
|
this.#subagentLiveStarts.clear();
|
|
70326
|
+
this.#subagentProgress.clear();
|
|
69787
70327
|
this.#subagentJournalLoaded.clear();
|
|
69788
70328
|
this.#subagentJournalMeta.clear();
|
|
69789
70329
|
this.#sweepSettledRuns.clear();
|
|
@@ -69841,10 +70381,10 @@ class BridgeSessionSeam {
|
|
|
69841
70381
|
}
|
|
69842
70382
|
}
|
|
69843
70383
|
async searchSessions(query) {
|
|
69844
|
-
const value =
|
|
70384
|
+
const value = asRecord12(await this.#transport.request("session.search", { query }));
|
|
69845
70385
|
const rows = Array.isArray(value.items) ? value.items : [];
|
|
69846
70386
|
return rows.map((row) => {
|
|
69847
|
-
const r =
|
|
70387
|
+
const r = asRecord12(row);
|
|
69848
70388
|
return {
|
|
69849
70389
|
id: typeof r.id === "string" ? r.id : "",
|
|
69850
70390
|
snippet: typeof r.snippet === "string" ? r.snippet : ""
|
|
@@ -70031,7 +70571,7 @@ class BridgeSessionSeam {
|
|
|
70031
70571
|
return { ...request, sessionId: parent };
|
|
70032
70572
|
}
|
|
70033
70573
|
#onAskEvent(frame) {
|
|
70034
|
-
const payload =
|
|
70574
|
+
const payload = asRecord12(frame.payload);
|
|
70035
70575
|
if (frame.type === "ask.request" || frame.type === "ask.pending")
|
|
70036
70576
|
this.#askFrameSeen = true;
|
|
70037
70577
|
switch (frame.type) {
|
|
@@ -70092,7 +70632,7 @@ class BridgeSessionSeam {
|
|
|
70092
70632
|
#onCapPushEvent(frame) {
|
|
70093
70633
|
if (frame.type !== "cap.event" && frame.type !== "cap.end")
|
|
70094
70634
|
return false;
|
|
70095
|
-
const payload =
|
|
70635
|
+
const payload = asRecord12(frame.payload);
|
|
70096
70636
|
const sessionId = optionalStringField(payload, "sessionId");
|
|
70097
70637
|
if (sessionId === undefined || sessionId === "")
|
|
70098
70638
|
return true;
|
|
@@ -70147,6 +70687,10 @@ class BridgeSessionSeam {
|
|
|
70147
70687
|
this.#foldAgentFrame(frame);
|
|
70148
70688
|
return;
|
|
70149
70689
|
}
|
|
70690
|
+
if (frame.type === "agent.progress") {
|
|
70691
|
+
this.#foldAgentProgress(frame);
|
|
70692
|
+
return;
|
|
70693
|
+
}
|
|
70150
70694
|
if (frame.type === "bridge.dead") {
|
|
70151
70695
|
const cause = asDeadCause(frame.payload);
|
|
70152
70696
|
if (this.#inFlightGeneration !== 0 && this.#inFlightTurnId !== undefined && this.#inFlightTurnId !== "") {
|
|
@@ -70166,7 +70710,7 @@ class BridgeSessionSeam {
|
|
|
70166
70710
|
}
|
|
70167
70711
|
return;
|
|
70168
70712
|
}
|
|
70169
|
-
const payload =
|
|
70713
|
+
const payload = asRecord12(frame.payload);
|
|
70170
70714
|
if (frame.type === "turn.start") {
|
|
70171
70715
|
this.#turn = "starting";
|
|
70172
70716
|
this.#decodeWindowStart = undefined;
|
|
@@ -70257,6 +70801,7 @@ var init_bridge_session_seam = __esm(() => {
|
|
|
70257
70801
|
init_remote_local_fs();
|
|
70258
70802
|
init_lifecycle();
|
|
70259
70803
|
init_bridge_goals();
|
|
70804
|
+
init_bridge_settings_route();
|
|
70260
70805
|
BridgeProtocolError = class BridgeProtocolError extends Error {
|
|
70261
70806
|
code;
|
|
70262
70807
|
detail;
|
|
@@ -70385,11 +70930,11 @@ function toBridgeBootstrapError(err, fallbackCode = "BRIDGE_HANDSHAKE_FAILED") {
|
|
|
70385
70930
|
const message = err instanceof Error ? err.message : String(err);
|
|
70386
70931
|
return new BridgeBootstrapError({ code: fallbackCode, diagnosis: `bridge handshake failed: ${message}` });
|
|
70387
70932
|
}
|
|
70388
|
-
function
|
|
70933
|
+
function asRecord13(value) {
|
|
70389
70934
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
70390
70935
|
}
|
|
70391
70936
|
function verifyBridgeFingerprint(hello, expectedProtocolVersion = BRIDGE_PROTOCOL_VERSION) {
|
|
70392
|
-
const h =
|
|
70937
|
+
const h = asRecord13(hello);
|
|
70393
70938
|
const protocolVersion = h.protocolVersion;
|
|
70394
70939
|
if (protocolVersion !== expectedProtocolVersion) {
|
|
70395
70940
|
throw new BridgeBootstrapError({
|
|
@@ -70817,6 +71362,7 @@ function V2SessionPageBody(props) {
|
|
|
70817
71362
|
}));
|
|
70818
71363
|
dialog.replace(() => createComponent2(DialogSelect, {
|
|
70819
71364
|
title,
|
|
71365
|
+
description: headerLine,
|
|
70820
71366
|
renderFilter: false,
|
|
70821
71367
|
get options() {
|
|
70822
71368
|
if (extras?.getOptions === undefined) {
|
|
@@ -70985,6 +71531,32 @@ function V2SessionPageBody(props) {
|
|
|
70985
71531
|
composerRef.focus();
|
|
70986
71532
|
}
|
|
70987
71533
|
});
|
|
71534
|
+
Keymap2.createLayer(() => ({
|
|
71535
|
+
priority: 2,
|
|
71536
|
+
target: () => composerRef?.node(),
|
|
71537
|
+
capture: "main",
|
|
71538
|
+
commands: [
|
|
71539
|
+
{
|
|
71540
|
+
id: "input.copy",
|
|
71541
|
+
title: "Copy selected input text",
|
|
71542
|
+
group: "Prompt",
|
|
71543
|
+
run: () => {
|
|
71544
|
+
const node = composerRef?.node();
|
|
71545
|
+
if (copyComposerSelection({
|
|
71546
|
+
hasSelection: () => node?.hasSelection() === true,
|
|
71547
|
+
getSelectedText: () => node?.getSelectedText() ?? ""
|
|
71548
|
+
}, clipboard, toast.error))
|
|
71549
|
+
return true;
|
|
71550
|
+
if (node !== undefined && !busy() && node.plainText !== "") {
|
|
71551
|
+
node.setText("");
|
|
71552
|
+
keyTrace?.composerSet("ctrl-c-clear", 0);
|
|
71553
|
+
return true;
|
|
71554
|
+
}
|
|
71555
|
+
return false;
|
|
71556
|
+
}
|
|
71557
|
+
}
|
|
71558
|
+
]
|
|
71559
|
+
}));
|
|
70988
71560
|
const root = createElement("box");
|
|
70989
71561
|
spread(root, {
|
|
70990
71562
|
flexDirection: "column",
|
|
@@ -71066,6 +71638,7 @@ function V2SessionPageBody(props) {
|
|
|
71066
71638
|
sessionId: () => seam.currentSessionId() ?? seam.stagedSessionId?.() ?? props.initialSessionId,
|
|
71067
71639
|
onRefill: (text) => {
|
|
71068
71640
|
composerRef?.node()?.setText(text);
|
|
71641
|
+
keyTrace?.composerSet("history-refill", text.length);
|
|
71069
71642
|
if (composerRef && !composerRef.focused())
|
|
71070
71643
|
composerRef.focus();
|
|
71071
71644
|
},
|
|
@@ -71474,7 +72047,7 @@ var init_v2_entry = __esm(() => {
|
|
|
71474
72047
|
init_hints_line();
|
|
71475
72048
|
init_widgets_dock();
|
|
71476
72049
|
init_ui_state();
|
|
71477
|
-
|
|
72050
|
+
init_src2();
|
|
71478
72051
|
init_i18n();
|
|
71479
72052
|
init_search_overlay();
|
|
71480
72053
|
init_transcript_scroll();
|
|
@@ -71503,6 +72076,7 @@ var init_v2_entry = __esm(() => {
|
|
|
71503
72076
|
init_toast();
|
|
71504
72077
|
init_clipboard();
|
|
71505
72078
|
init_clipboard2();
|
|
72079
|
+
init_key_trace();
|
|
71506
72080
|
init_keymap();
|
|
71507
72081
|
init_theme3();
|
|
71508
72082
|
init_panel_kit_host();
|
|
@@ -71534,7 +72108,7 @@ function recoveryCause(err, phase) {
|
|
|
71534
72108
|
};
|
|
71535
72109
|
}
|
|
71536
72110
|
if (err instanceof BridgeProtocolError && err.code === "BRIDGE_DEAD") {
|
|
71537
|
-
const detail =
|
|
72111
|
+
const detail = asRecord14(err.detail);
|
|
71538
72112
|
return {
|
|
71539
72113
|
stage: phase,
|
|
71540
72114
|
code: typeof detail.code === "number" ? detail.code : null,
|
|
@@ -71649,7 +72223,7 @@ class StdioBridgeTransport {
|
|
|
71649
72223
|
} catch {
|
|
71650
72224
|
return;
|
|
71651
72225
|
}
|
|
71652
|
-
const rec =
|
|
72226
|
+
const rec = asRecord14(frame);
|
|
71653
72227
|
if (typeof rec.id === "number") {
|
|
71654
72228
|
const pending = this.#pending.get(rec.id);
|
|
71655
72229
|
if (pending === undefined)
|
|
@@ -71661,7 +72235,7 @@ class StdioBridgeTransport {
|
|
|
71661
72235
|
this.#setState("ready");
|
|
71662
72236
|
pending.resolve(rec.result);
|
|
71663
72237
|
} else {
|
|
71664
|
-
const error =
|
|
72238
|
+
const error = asRecord14(rec.error);
|
|
71665
72239
|
pending.reject(new BridgeProtocolError(typeof error.code === "string" ? error.code : "BRIDGE_ERROR", typeof error.message === "string" ? error.message : "bridge request failed", error.detail));
|
|
71666
72240
|
}
|
|
71667
72241
|
return;
|
|
@@ -71793,7 +72367,7 @@ class StdioBridgeTransport {
|
|
|
71793
72367
|
} catch {}
|
|
71794
72368
|
}
|
|
71795
72369
|
}
|
|
71796
|
-
var
|
|
72370
|
+
var asRecord14 = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
71797
72371
|
var init_bridge_transport = __esm(() => {
|
|
71798
72372
|
init_bridge_session_seam();
|
|
71799
72373
|
init_seam_bootstrap();
|
|
@@ -71986,5 +72560,5 @@ export {
|
|
|
71986
72560
|
themeNameFromConfig
|
|
71987
72561
|
};
|
|
71988
72562
|
|
|
71989
|
-
//# debugId=
|
|
72563
|
+
//# debugId=8B06DA5F28BAE23464756E2164756E21
|
|
71990
72564
|
//# sourceMappingURL=index.js.map
|