sideby 0.44.0 → 0.45.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/dist/build.json +1 -1
- package/dist/src/cli/commands.d.ts +4 -0
- package/dist/src/cli/commands.js +9 -8
- package/dist/src/cli/json-schemas.js +51 -0
- package/dist/src/core/cli-commands.js +0 -10
- package/dist/src/core/egress.d.ts +1 -7
- package/dist/src/core/egress.js +7 -36
- package/dist/src/core/history.d.ts +1 -1
- package/dist/src/core/history.js +2 -2
- package/dist/src/core/network.d.ts +5 -35
- package/dist/src/core/network.js +18 -54
- package/dist/src/core/themes.js +0 -7
- package/dist/src/core/update.d.ts +1 -1
- package/dist/src/core/update.js +4 -12
- package/dist/src/families/claude/quota-fetch.js +2 -2
- package/dist/src/families/claude/tuning.d.ts +0 -1
- package/dist/src/families/claude/tuning.js +1 -1
- package/dist/src/network/hook.js +1 -1
- package/dist/src/network/page.d.ts +1 -1
- package/dist/src/network/page.js +15 -181
- package/dist/src/panel/handler.js +57 -25
- package/dist/src/panel/page-logic.d.ts +11 -29
- package/dist/src/panel/page-logic.js +11 -33
- package/dist/src/panel/page-script.js +5 -34
- package/dist/src/panel/page-styles.js +9 -18
- package/dist/src/quota/claude-statusline.js +1 -1
- package/dist/src/runtime.d.ts +2 -1
- package/dist/src/runtime.js +9 -6
- package/dist/src/types.d.ts +2 -2
- package/dist/src/unattended/hook.js +0 -1
- package/dist/testing/index.js +1 -1
- package/package.json +2 -1
- package/schemas/network-diagnose.json +239 -0
- package/skills/sideby/SKILL.md +1 -1
- package/skills/sideby/references/network.md +5 -3
- package/dist/src/network/page-script.d.ts +0 -40
- package/dist/src/network/page-script.js +0 -270
package/dist/src/core/update.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
// Update Check, Update Notice, Install Method, Update and Auto Update (spec §3.23, ADR-0021). The Update Check is
|
|
2
|
-
//
|
|
1
|
+
// Update Check, Update Notice, Install Method, Update and Auto Update (spec §3.23, ADR-0021). The Update Check is one
|
|
2
|
+
// of the two network requests sideby makes on its own (the other is Network Guard, ADR-0053): one GET for the
|
|
3
|
+
// `latest` dist-tag, carrying nothing about the user.
|
|
3
4
|
// Everything it learns goes to one state file shared by the CLI and every Panel.
|
|
4
5
|
import { spawn } from 'node:child_process';
|
|
5
6
|
import { access, constants, mkdir, readdir, readFile, realpath, rm } from 'node:fs/promises';
|
|
@@ -22,7 +23,6 @@ export const RETRY_INTERVAL_MS = 60 * 60 * 1000;
|
|
|
22
23
|
export const AUTO_RETRY_MS = 24 * 60 * 60 * 1000;
|
|
23
24
|
const FETCH_TIMEOUT_MS = 5000;
|
|
24
25
|
export const RELEASE_NOTES = (v) => `${REPO_URL}/releases/tag/v${v}`;
|
|
25
|
-
/** Swapped in tests through `bindUpdateDeps`; the real machine otherwise. */
|
|
26
26
|
/**
|
|
27
27
|
* Whether `sideby autostart --refresh --json` rewrote the login item: it exits 0 also when nothing changed or the
|
|
28
28
|
* rewrite was refused, so only its `changed: true` counts.
|
|
@@ -180,7 +180,6 @@ export const runProgram = (file, args, opts) => deps().exec(file, args, opts);
|
|
|
180
180
|
export const updateMachine = () => deps();
|
|
181
181
|
/** The lock every install shares (`update-install.lock`), so a Local Build switch never races an Update. */
|
|
182
182
|
export const takeInstallLock = (paths) => takeLock(paths, 'update-install.lock').catch(() => null);
|
|
183
|
-
// ---- versions
|
|
184
183
|
/** `latest` is newer than `current`. */
|
|
185
184
|
export const isNewer = (latest, current) => latest !== undefined && compareVersions(latest, current) === 1;
|
|
186
185
|
/**
|
|
@@ -192,7 +191,6 @@ export function sameLine(from, to) {
|
|
|
192
191
|
const b = parseVersion(to)?.core;
|
|
193
192
|
return Boolean(a && b && a[0] === b[0]);
|
|
194
193
|
}
|
|
195
|
-
// ---- switches
|
|
196
194
|
const set = (v) => v !== undefined && v !== '' && v !== '0' && v.toLowerCase() !== 'false';
|
|
197
195
|
// `inCi` lives in core/egress.ts, a leaf module `network-hook` may import.
|
|
198
196
|
export { inCi };
|
|
@@ -215,7 +213,6 @@ export function checksOffWhy(env, config, local = localBuild() !== null) {
|
|
|
215
213
|
export function checksOff(env, config, local = localBuild() !== null) {
|
|
216
214
|
return checksOffWhy(env, config, local)?.text ?? null;
|
|
217
215
|
}
|
|
218
|
-
// ---- registry
|
|
219
216
|
/** The registry checks and installs use: `SIDEBY_UPDATE_REGISTRY` (http or https only), else npm's. */
|
|
220
217
|
function registryOf(env) {
|
|
221
218
|
const base = (env.SIDEBY_UPDATE_REGISTRY || DEFAULT_REGISTRY).replace(/\/+$/, '');
|
|
@@ -235,7 +232,6 @@ function shownRegistry(base) {
|
|
|
235
232
|
return 'the registry in SIDEBY_UPDATE_REGISTRY';
|
|
236
233
|
}
|
|
237
234
|
}
|
|
238
|
-
// ---- cache
|
|
239
235
|
const cacheFile = (p) => join(p.stateDir, 'update.json');
|
|
240
236
|
const str = (v) => typeof v === 'string';
|
|
241
237
|
export async function readUpdateCache(paths) {
|
|
@@ -316,7 +312,6 @@ export function autoPending(cache, current, config, now) {
|
|
|
316
312
|
return true;
|
|
317
313
|
return !a.ok && !(age(a.at, now) < AUTO_RETRY_MS);
|
|
318
314
|
}
|
|
319
|
-
// ---- the check
|
|
320
315
|
/** Asks the registry for the `latest` dist-tag. Throws with a message that names the registry and what to do. */
|
|
321
316
|
export async function fetchLatest(env) {
|
|
322
317
|
const base = registryOf(env);
|
|
@@ -355,7 +350,7 @@ export async function refreshUpdateCheck(paths, env) {
|
|
|
355
350
|
const LOCK_MAX_MS = 60 * 60 * 1000;
|
|
356
351
|
/** A lock file another process has just created and not yet written to. */
|
|
357
352
|
const LOCK_WRITE_GRACE_MS = 60 * 1000;
|
|
358
|
-
/** How often a holder touches its lock
|
|
353
|
+
/** How often a holder touches its lock; one nobody touched for `LOCK_STALE_MS` is free. */
|
|
359
354
|
const LOCK_BEAT_MS = 15 * 1000;
|
|
360
355
|
const LOCK_STALE_MS = 2 * 60 * 1000;
|
|
361
356
|
/**
|
|
@@ -378,7 +373,6 @@ async function takeLock(paths, name) {
|
|
|
378
373
|
writeGraceMs: LOCK_WRITE_GRACE_MS,
|
|
379
374
|
}).catch(() => null);
|
|
380
375
|
}
|
|
381
|
-
// ---- the notice
|
|
382
376
|
/**
|
|
383
377
|
* The Update Notice line the CLI may print now, or null. Once per new version per day; `current` is the running
|
|
384
378
|
* version.
|
|
@@ -504,7 +498,6 @@ export function afterCommandPlan(cache, current, config, env, now, skill = null)
|
|
|
504
498
|
skillAutoPending(cache, current, config, skill, now),
|
|
505
499
|
};
|
|
506
500
|
}
|
|
507
|
-
// ---- Install Method
|
|
508
501
|
/** Where the running copy comes from (spec §3.23 table); reads only paths. */
|
|
509
502
|
export async function installMethod(env) {
|
|
510
503
|
const d = deps();
|
|
@@ -600,7 +593,6 @@ export function updateCommand(method, version, env = {}) {
|
|
|
600
593
|
return { text: 'pnpm local --off' };
|
|
601
594
|
}
|
|
602
595
|
}
|
|
603
|
-
// ---- running sessions
|
|
604
596
|
const runningDir = (p) => join(p.stateDir, 'running');
|
|
605
597
|
/**
|
|
606
598
|
* Records that this process runs a Host (`run`, `login`, `next`, `resume`) so an Auto Update waits for it; returns the
|
|
@@ -161,11 +161,11 @@ export function claudeUsageAnswer(answer, account, now) {
|
|
|
161
161
|
const windows = local ? usageQuota(text, now) : null;
|
|
162
162
|
if (windows)
|
|
163
163
|
return { status: 'ok', windows, observedAt: new Date(now).toISOString(), source: QUOTA_FETCH_SOURCE };
|
|
164
|
-
// Only an answer with a known expiry phrase is an Expired Login (ADR-0071, Q10); a `/login` hint, "Not logged in" or
|
|
165
|
-
// an API key problem alone is not.
|
|
166
164
|
// A model turn is never read for sign-in words: its text may merely quote them (it is not a local /usage either).
|
|
167
165
|
if (typeof a.num_turns === 'number' && a.num_turns > 0)
|
|
168
166
|
return failed('this Claude Code version cannot report quota through /usage; update Claude Code, then refresh');
|
|
167
|
+
// Only an answer with a known expiry phrase is an Expired Login (ADR-0071, Q10); a `/login` hint, "Not logged in" or
|
|
168
|
+
// an API key problem alone is not.
|
|
169
169
|
// Only Claude Code's own error result counts as an expiry.
|
|
170
170
|
if (a.is_error === true && saysLoginExpired(text) && !/invalid api key/i.test(text))
|
|
171
171
|
return {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FileMemo } from '../../core/file-memo.ts';
|
|
2
2
|
import type { Account, ReadContext, TuningResult } from '../../types.ts';
|
|
3
|
-
/** Context window of a model, from the table or the records: a context that grew past 200K is a 1M window. */
|
|
4
3
|
export declare const isKnownClaudeModel: (id: string) => boolean;
|
|
5
4
|
/** `[key, ts, session, model, ctx, out, write5m, write1h]` */
|
|
6
5
|
type TurnRow = [string, number, string, string, number, number, number, number];
|
|
@@ -11,8 +11,8 @@ import { getOrCreate, IDLE_OBSERVED_MS, tuningResult, } from '../../core/tuning.
|
|
|
11
11
|
import { listJsonl } from './usage.js';
|
|
12
12
|
const DAY_MS = 86_400_000;
|
|
13
13
|
const SETTINGS_MAX_BYTES = 1_000_000;
|
|
14
|
-
/** Context window of a model, from the table or the records: a context that grew past 200K is a 1M window. */
|
|
15
14
|
export const isKnownClaudeModel = (id) => id.startsWith('claude-');
|
|
15
|
+
/** Context window of a model, from the table or the records: a context that grew past 200K is a 1M window. */
|
|
16
16
|
const windowOf = (maxCtx) => (maxCtx > 200_000 ? 1_000_000 : 200_000);
|
|
17
17
|
/**
|
|
18
18
|
* Models with a native 1M window, which compact at about 967K when nothing is set: the Fable models, Sonnet 5 and
|
package/dist/src/network/hook.js
CHANGED
|
@@ -86,7 +86,7 @@ async function hostMadePrompt(input) {
|
|
|
86
86
|
const decisionName = (id) => sha256(id).slice(0, 32);
|
|
87
87
|
/**
|
|
88
88
|
* Keeps the decision for a prompt the Host made (`ok` or `blocked`, nothing of the prompt) where `Held` finds it, and
|
|
89
|
-
* removes decisions nobody read. A failure changes nothing: `Held` then
|
|
89
|
+
* removes decisions nobody read. A failure changes nothing: `Held` then finds no decision and hands nothing over.
|
|
90
90
|
*/
|
|
91
91
|
async function keepDecision(dir, id, decision, now) {
|
|
92
92
|
try {
|
|
@@ -7,5 +7,5 @@ export interface NetworkPageOptions {
|
|
|
7
7
|
theme?: ResolvedTheme;
|
|
8
8
|
lang?: 'auto' | 'en' | 'zh';
|
|
9
9
|
}
|
|
10
|
-
/** The
|
|
10
|
+
/** The generic page owns diagnosis and interaction; sideby owns only its theme, icon, token header and footer. */
|
|
11
11
|
export declare function renderNetworkPage(opts: NetworkPageOptions): string;
|
package/dist/src/network/page.js
CHANGED
|
@@ -1,189 +1,23 @@
|
|
|
1
|
-
//
|
|
2
|
-
import {
|
|
3
|
-
import { FAVICON_VERSION
|
|
1
|
+
// sideby chrome around the reusable Network document. Runtime data still comes only from the Panel's own routes.
|
|
2
|
+
import { renderNetworkPage as renderPortalNetworkPage } from 'network-portal';
|
|
3
|
+
import { FAVICON_VERSION } from '../panel/page.js';
|
|
4
4
|
import { pageStyles } from '../panel/page-styles.js';
|
|
5
5
|
import { resolveTheme } from '../panel/theme.js';
|
|
6
|
-
|
|
7
|
-
const MESSAGES = {
|
|
8
|
-
en: {
|
|
9
|
-
title: 'Network connection',
|
|
10
|
-
tagline: 'Routes and local listeners visible to this Panel.',
|
|
11
|
-
intro: 'See the selected direct or redacted proxy route, its loopback TCP listener, and the cached Network Guard result for each target.',
|
|
12
|
-
scope: 'These facts come from this Panel process environment. Older sessions keep their own environment; run the sideby CLI in that terminal to diagnose them.',
|
|
13
|
-
notCovered: 'This Panel does not read or change WARP, DNS, macOS system proxy, or any other network setting.',
|
|
14
|
-
diagnose: 'Diagnose connection',
|
|
15
|
-
diagnoseAgain: 'Diagnose again',
|
|
16
|
-
diagnosing: 'Diagnosing…',
|
|
17
|
-
loading: 'Running an offline diagnosis. No online trace is sent; a slow local TCP probe may take a moment.',
|
|
18
|
-
diagnoseFailed: 'Diagnosis failed: {message}',
|
|
19
|
-
checkedAt: 'Offline diagnosis at {when}. Cached Guard results have their own timestamps below.',
|
|
20
|
-
empty: 'No guarded targets were found. Add or sign in to an account before diagnosing its route.',
|
|
21
|
-
route: 'Selected route',
|
|
22
|
-
direct: 'Direct connection; there is no proxy listener to test.',
|
|
23
|
-
noListener: 'No loopback TCP probe: the proxy is remote, invalid, or has no explicit port for this protocol.',
|
|
24
|
-
listenerUp: 'Loopback TCP listener reachable at {host}:{port}.',
|
|
25
|
-
listenerDown: 'Loopback TCP listener not reachable at {host}:{port} ({error}).',
|
|
26
|
-
failed: 'failed',
|
|
27
|
-
tcpLimit: 'A reachable TCP listener does not prove that HTTP CONNECT, SOCKS, TLS, or upstream connectivity works.',
|
|
28
|
-
'support.direct': 'Direct',
|
|
29
|
-
'support.http-connect': 'HTTP CONNECT',
|
|
30
|
-
'support.unsupported': 'Unsupported proxy',
|
|
31
|
-
'support.invalid': 'Invalid proxy',
|
|
32
|
-
unsupported: 'Network Guard does not support this SOCKS or non-HTTP proxy route. Use HTTP CONNECT or direct before an online Guard check.',
|
|
33
|
-
invalid: 'The proxy address is invalid. Correct the environment and start a new session.',
|
|
34
|
-
'guard.ok': 'Cached Guard: allowed',
|
|
35
|
-
'guard.blocked': 'Cached Guard: blocked',
|
|
36
|
-
'guard.unknown': 'Cached Guard: unknown',
|
|
37
|
-
'guard.not-checked': 'Cached Guard: not checked',
|
|
38
|
-
guardChecked: 'Guard checked {when}',
|
|
39
|
-
guardNever: 'Guard has no cached check',
|
|
40
|
-
ask: 'Let AI diagnose',
|
|
41
|
-
fixedOnly: 'This fixed task contains only the current diagnostic facts above. No free text, attachments, account details, or other context is included.',
|
|
42
|
-
actualPrompt: 'Exact prompt to send',
|
|
43
|
-
promptLoading: 'Preparing the actual prompt…',
|
|
44
|
-
promptChanged: 'The prompt changed. Review the new prompt and confirm again; nothing was opened.',
|
|
45
|
-
confirm: 'Open in Orca',
|
|
46
|
-
checkingPrompt: 'Checking prompt again…',
|
|
47
|
-
cancel: 'Cancel',
|
|
48
|
-
close: 'Close',
|
|
49
|
-
opened: 'Orca was asked to open the diagnosis.',
|
|
50
|
-
copyFallback: 'Orca could not be opened. Copy this command and run it in a terminal.',
|
|
51
|
-
copy: 'Copy command',
|
|
52
|
-
command: 'AI diagnosis command',
|
|
53
|
-
requestFailed: 'Request failed ({status})',
|
|
54
|
-
},
|
|
55
|
-
zh: {
|
|
56
|
-
title: '网络连接',
|
|
57
|
-
tagline: '查看此 Panel 能读取的路由和本地 listener。',
|
|
58
|
-
intro: '逐个 target 查看直连或脱敏代理路由、loopback TCP listener,以及缓存的 Network Guard 结果。',
|
|
59
|
-
scope: '这些信息来自当前 Panel 进程的环境。旧会话保留自己的环境;请在对应终端运行 sideby CLI 诊断。',
|
|
60
|
-
notCovered: '此 Panel 不读取或修改 WARP、DNS、macOS 系统代理及任何其他网络设置。',
|
|
61
|
-
diagnose: '诊断连接',
|
|
62
|
-
diagnoseAgain: '重新诊断',
|
|
63
|
-
diagnosing: '正在诊断…',
|
|
64
|
-
loading: '正在离线诊断,不会发送在线 trace。本地 TCP 探测较慢时需要稍等。',
|
|
65
|
-
diagnoseFailed: '诊断失败:{message}',
|
|
66
|
-
checkedAt: '离线诊断时间:{when}。缓存的 Guard 结果在下方单独标注时间。',
|
|
67
|
-
empty: '没有找到受 Guard 管理的 target。请先添加或登录账号,再诊断它的路由。',
|
|
68
|
-
route: '本次选择的路由',
|
|
69
|
-
direct: '直连,没有代理 listener 要测试。',
|
|
70
|
-
noListener: '未探测 loopback TCP:代理在远程、地址无效,或该协议没有明确端口。',
|
|
71
|
-
listenerUp: 'loopback TCP listener 可连接:{host}:{port}。',
|
|
72
|
-
listenerDown: 'loopback TCP listener 连不上:{host}:{port}({error})。',
|
|
73
|
-
failed: '失败',
|
|
74
|
-
tcpLimit: 'TCP 能连接不代表 HTTP CONNECT、SOCKS、TLS 或上游网络可用。',
|
|
75
|
-
'support.direct': '直连',
|
|
76
|
-
'support.http-connect': 'HTTP CONNECT',
|
|
77
|
-
'support.unsupported': '不支持的代理',
|
|
78
|
-
'support.invalid': '代理地址无效',
|
|
79
|
-
unsupported: 'Network Guard 不支持此 SOCKS 或非 HTTP 代理路由。在线 Guard 检查前,请改用 HTTP CONNECT 或直连。',
|
|
80
|
-
invalid: '代理地址无效。请修正环境变量,再新开会话。',
|
|
81
|
-
'guard.ok': '缓存 Guard:允许',
|
|
82
|
-
'guard.blocked': '缓存 Guard:阻止',
|
|
83
|
-
'guard.unknown': '缓存 Guard:未知',
|
|
84
|
-
'guard.not-checked': '缓存 Guard:未检查',
|
|
85
|
-
guardChecked: 'Guard 检查于 {when}',
|
|
86
|
-
guardNever: 'Guard 没有缓存检查',
|
|
87
|
-
ask: '让 AI 诊断',
|
|
88
|
-
fixedOnly: '固定任务只包含上方当前诊断 facts,不含自由文本、附件、账号详情或其他 context。',
|
|
89
|
-
actualPrompt: '将发送的完整提示词',
|
|
90
|
-
promptLoading: '正在生成实际提示词…',
|
|
91
|
-
promptChanged: '提示词有变化。请查看新提示词后再次确认;这次没有打开终端。',
|
|
92
|
-
confirm: '在 Orca 中打开',
|
|
93
|
-
checkingPrompt: '正在再次核对提示词…',
|
|
94
|
-
cancel: '取消',
|
|
95
|
-
close: '关闭',
|
|
96
|
-
opened: '已请求 Orca 打开诊断任务。',
|
|
97
|
-
copyFallback: '无法打开 Orca。请复制此命令到终端运行。',
|
|
98
|
-
copy: '复制命令',
|
|
99
|
-
command: 'AI 诊断命令',
|
|
100
|
-
requestFailed: '请求失败({status})',
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
const CSS = `
|
|
104
|
-
.network-main { min-width: 0; }
|
|
105
|
-
.network-hero { margin-bottom: 20px; }
|
|
106
|
-
.network-hero h2 { font-size: var(--title-size); font-weight: var(--title-weight); margin-bottom: 8px; }
|
|
107
|
-
.network-hero p { max-width: 760px; color: var(--muted); overflow-wrap: anywhere; }
|
|
108
|
-
.network-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 12px; }
|
|
109
|
-
.network-notes { display: grid; gap: 8px; margin: 16px 0 20px; }
|
|
110
|
-
.network-notes p { overflow-wrap: anywhere; }
|
|
111
|
-
#targets { display: grid; gap: 12px; min-width: 0; }
|
|
112
|
-
.net-target { min-width: 0; display: grid; gap: 10px; overflow: hidden; }
|
|
113
|
-
.net-target-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
|
|
114
|
-
.net-target h3 { min-width: 0; font-size: var(--heading-size); overflow-wrap: anywhere; }
|
|
115
|
-
.net-target .chip { flex: none; max-width: 100%; white-space: normal; text-align: center; }
|
|
116
|
-
.net-route { min-width: 0; overflow-wrap: anywhere; }
|
|
117
|
-
.net-route code { overflow-wrap: anywhere; }
|
|
118
|
-
.net-ok { color: var(--ok); }
|
|
119
|
-
.net-target .note { display: block; overflow-wrap: anywhere; }
|
|
120
|
-
.net-placeholder { min-height: 120px; }
|
|
121
|
-
.net-empty { color: var(--muted); }
|
|
122
|
-
.net-prompt { white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; max-width: 100%; max-height: 320px; overflow: auto; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2); font: 12px/1.55 var(--mono); }
|
|
123
|
-
.net-command { width: 100%; min-height: 64px; resize: vertical; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-md); font: 12px var(--mono); }
|
|
124
|
-
@media (max-width: 520px) {
|
|
125
|
-
:root { --gutter: 16px; }
|
|
126
|
-
.network-top .top-in { padding-top: 20px; }
|
|
127
|
-
.network-top .tagline { font-size: var(--small); }
|
|
128
|
-
.net-target { padding: 16px; }
|
|
129
|
-
.net-target-head { flex-direction: column; gap: 8px; }
|
|
130
|
-
.network-actions .btn { flex: 1 1 auto; white-space: normal; min-height: var(--ctl-h); height: auto; padding-top: 8px; padding-bottom: 8px; }
|
|
131
|
-
.dlg-head, .dlg-body { padding-left: 16px; padding-right: 16px; }
|
|
132
|
-
.dlg-foot { padding-left: 16px; padding-right: 16px; flex-wrap: wrap; }
|
|
133
|
-
}
|
|
134
|
-
`;
|
|
135
|
-
/** The network view never embeds account state; the browser obtains only its token and fixed UI metadata. */
|
|
6
|
+
/** The generic page owns diagnosis and interaction; sideby owns only its theme, icon, token header and footer. */
|
|
136
7
|
export function renderNetworkPage(opts) {
|
|
137
|
-
const nonce = opts.nonce
|
|
138
|
-
? ` nonce="${opts.nonce.replace(/&/g, '&').replace(/"/g, '"').replace(/</g, '<')}"`
|
|
139
|
-
: '';
|
|
140
8
|
const theme = opts.theme ?? resolveTheme(undefined);
|
|
141
|
-
|
|
142
|
-
const
|
|
143
|
-
|
|
9
|
+
// A Portal serves this page under /panel/; only the Host root favicon carries the current surface's Network icon.
|
|
10
|
+
const favicon = `/favicon.svg?v=${FAVICON_VERSION}`;
|
|
11
|
+
return renderPortalNetworkPage({
|
|
144
12
|
basePath: opts.basePath,
|
|
145
13
|
token: opts.token,
|
|
146
|
-
|
|
147
|
-
|
|
14
|
+
...(opts.nonce ? { nonce: opts.nonce } : {}),
|
|
15
|
+
...(opts.version ? { version: opts.version } : {}),
|
|
16
|
+
...(opts.lang ? { lang: opts.lang } : {}),
|
|
17
|
+
hostStyles: pageStyles(theme),
|
|
18
|
+
favicon,
|
|
19
|
+
tokenHeader: 'x-sideby-token',
|
|
20
|
+
footer: 'sideby',
|
|
21
|
+
chrome: { title: 'Network', header: theme.header },
|
|
148
22
|
});
|
|
149
|
-
return `<!doctype html>
|
|
150
|
-
<html lang="${lang === 'zh' ? 'zh-CN' : 'en'}">
|
|
151
|
-
<head>
|
|
152
|
-
<meta charset="utf-8">
|
|
153
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
154
|
-
<meta name="color-scheme" content="${scheme}">
|
|
155
|
-
<meta name="referrer" content="no-referrer">
|
|
156
|
-
<title>Network connection</title>
|
|
157
|
-
<link rel="icon" type="image/svg+xml" href="${opts.basePath}/favicon.svg?v=${FAVICON_VERSION}">
|
|
158
|
-
<style${nonce}>${pageStyles(theme)}${CSS}</style>
|
|
159
|
-
</head>
|
|
160
|
-
<body${theme.header === 'bar' ? ' class="header-bar"' : ''}>
|
|
161
|
-
<header class="top network-top">
|
|
162
|
-
<div class="top-in">
|
|
163
|
-
<div class="brand"><span class="logo" aria-hidden="true">${MARK_IMG}</span><div><h1>sideby</h1><p id="tagline" class="tagline">Routes and local listeners visible to this Panel.</p></div></div>
|
|
164
|
-
<div class="top-actions"><button id="language" class="btn" type="button"${lang === 'auto' ? '' : ' hidden'}>中文</button></div>
|
|
165
|
-
</div>
|
|
166
|
-
</header>
|
|
167
|
-
<main class="wrap network-main">
|
|
168
|
-
<section class="network-hero" aria-labelledby="title">
|
|
169
|
-
<h2 id="title">Network connection</h2>
|
|
170
|
-
<p id="intro">See the selected direct or redacted proxy route, its loopback TCP listener, and the cached Network Guard result for each target.</p>
|
|
171
|
-
<div class="network-actions"><button id="diagnose" class="btn btn-primary" type="button" aria-busy="true">Diagnosing…</button><button id="ask-open" class="btn" type="button" aria-haspopup="dialog" hidden>Let AI diagnose</button></div>
|
|
172
|
-
<div id="status"><p class="note" role="status">Running an offline diagnosis. No online trace is sent.</p></div>
|
|
173
|
-
</section>
|
|
174
|
-
<section class="network-notes" aria-label="Scope"><p id="scope" class="note"></p><p id="not-covered" class="small muted"></p></section>
|
|
175
|
-
<div id="targets" aria-live="polite" aria-busy="true"><div class="panel net-placeholder"><span class="sk sk-line w70"></span><span class="sk sk-line w50"></span></div></div>
|
|
176
|
-
<p id="tcp-limit" class="small muted network-notes"></p>
|
|
177
|
-
<footer class="foot muted small">sideby</footer>
|
|
178
|
-
</main>
|
|
179
|
-
<dialog id="ask-dialog" class="dialog dialog-wide" aria-labelledby="ask-title">
|
|
180
|
-
<div class="dlg-head"><h2 id="ask-title">Let AI diagnose</h2></div>
|
|
181
|
-
<div id="ask-body" class="dlg-body"></div>
|
|
182
|
-
<div class="dlg-foot"><button id="ask-cancel" class="btn" type="button">Cancel</button><button id="ask-confirm" class="btn btn-primary" type="button" disabled>Open in Orca</button></div>
|
|
183
|
-
</dialog>
|
|
184
|
-
<script type="application/json" id="sideby-boot"${nonce}>${boot}</script>
|
|
185
|
-
<script type="application/json" id="network-i18n"${nonce}>${jsonForScript(MESSAGES)}</script>
|
|
186
|
-
<script${nonce}>const BOOT = JSON.parse(document.getElementById('sideby-boot').textContent); const MESSAGES = JSON.parse(document.getElementById('network-i18n').textContent);${NETWORK_PAGE_SCRIPT}</script>
|
|
187
|
-
</body>
|
|
188
|
-
</html>`;
|
|
189
23
|
}
|
|
@@ -4,7 +4,7 @@ import { realpath } from 'node:fs/promises';
|
|
|
4
4
|
import { aliasesByAccount, startArgsOf } from '../core/accounts.js';
|
|
5
5
|
import { advisorPlan, advisorScope, checkAdvisorAccount, isAdvisorChoice, } from '../core/advisor.js';
|
|
6
6
|
import { listAppProfiles, openAppProfile, removeAppProfile, } from '../core/app-profiles.js';
|
|
7
|
-
import { openLoginInTerminal, openRunInTerminal, pickTaskAccount, previewAttachments, promptForTask, setCustomTerminal, setPreferredTerminal, startAiTask, taskContext, terminals, tryAccount, } from '../core/ask.js';
|
|
7
|
+
import { newTaskId, openLoginInTerminal, openPromptTask, openRunInTerminal, pickTaskAccount, previewAttachments, promptForTask, setCustomTerminal, setPreferredTerminal, startAiTask, taskContext, terminals, tryAccount, } from '../core/ask.js';
|
|
8
8
|
import { ATTACHMENT_LIMITS, MAX_ATTACHMENTS, MAX_UPLOAD_BYTES, removeStaged, stagedAttachments, stageUpload, } from '../core/attachments.js';
|
|
9
9
|
import { applyAutostart, autostartStatus, PANEL_AGENT, planAutostart, } from '../core/autostart.js';
|
|
10
10
|
import { FAVICON_SVG, ICON_SVG } from '../core/brand-mark.js';
|
|
@@ -35,7 +35,7 @@ import { openRunBoard, withRuns } from '../core/run-link.js';
|
|
|
35
35
|
import { SECRET_VAR_NAME, secretVarFor, setSecret } from '../core/secret-file.js';
|
|
36
36
|
import { readHandoffChains, withHandoffs } from '../core/session-handoffs.js';
|
|
37
37
|
import { SKILL_INSTALL } from '../core/skill-check.js';
|
|
38
|
-
import {
|
|
38
|
+
import { TERMINALS } from '../core/terminal.js';
|
|
39
39
|
import { checkThemeData, listThemes, NO_THEME, previewColors, removeThemeFile, resolveColors, saveThemeFile, undoTheme, useTheme, } from '../core/themes.js';
|
|
40
40
|
import { MIN_CALLS } from '../core/tuning.js';
|
|
41
41
|
import { onUntil, setAnswerWait, setUnattendedSchedule, turnUnattendedOff, turnUnattendedOn, unattendedStatus, } from '../core/unattended.js';
|
|
@@ -54,7 +54,7 @@ import { renderNetworkPage } from '../network/page.js';
|
|
|
54
54
|
import { createChangeFeed, stateQuotaDir } from './changes.js';
|
|
55
55
|
import { orcaTabs, switchOrcaTab, systemOrca } from './orca.js';
|
|
56
56
|
import { renderPage } from './page.js';
|
|
57
|
-
import { AI_TASK_KINDS } from './page-logic.js';
|
|
57
|
+
import { AI_TASK_KINDS, networkDiagnoseTaskFacts } from './page-logic.js';
|
|
58
58
|
import { tokenStyles } from './page-styles.js';
|
|
59
59
|
import { resolveTheme } from './theme.js';
|
|
60
60
|
import { BUILTIN_THEMES, DEFAULT_THEME_ID } from './themes.js';
|
|
@@ -1227,6 +1227,28 @@ export function createPanelHandler(opts) {
|
|
|
1227
1227
|
const serial = writeQueue();
|
|
1228
1228
|
const readings = { going: new Map(), last: new Map() };
|
|
1229
1229
|
const getRuntime = typeof opts.runtime === 'function' ? opts.runtime : async () => opts.runtime;
|
|
1230
|
+
// Recent facts this server actually returned, keyed by their complete redacted serialization. Client-supplied
|
|
1231
|
+
// diagnosis text is only a lookup key: arbitrary instructions never become a fixed AI Task prompt.
|
|
1232
|
+
const networkFacts = new Map();
|
|
1233
|
+
const rememberNetworkFacts = (diagnosis) => {
|
|
1234
|
+
const facts = networkDiagnoseTaskFacts(diagnosis);
|
|
1235
|
+
const key = JSON.stringify(facts);
|
|
1236
|
+
networkFacts.delete(key);
|
|
1237
|
+
networkFacts.set(key, facts);
|
|
1238
|
+
while (networkFacts.size > 8)
|
|
1239
|
+
networkFacts.delete(networkFacts.keys().next().value);
|
|
1240
|
+
return diagnosis;
|
|
1241
|
+
};
|
|
1242
|
+
const actualAskPrompt = async (rt, input) => {
|
|
1243
|
+
if (view === 'network') {
|
|
1244
|
+
const supplied = input.context?.networkDiagnose;
|
|
1245
|
+
const facts = supplied && networkFacts.get(JSON.stringify(supplied));
|
|
1246
|
+
if (!facts)
|
|
1247
|
+
throw new HttpError(400, 'Run the Network diagnosis again and use its current redacted facts; nothing was opened.', 'network-facts-mismatch');
|
|
1248
|
+
input = { ...input, context: { ...input.context, networkDiagnose: facts } };
|
|
1249
|
+
}
|
|
1250
|
+
return promptForTask(rt, input, await previewAttachments(rt, input));
|
|
1251
|
+
};
|
|
1230
1252
|
// Quota files watched while a page asks (spec §3.45, ADR-0084).
|
|
1231
1253
|
const changes = createChangeFeed({
|
|
1232
1254
|
dirs: async () => {
|
|
@@ -1250,13 +1272,13 @@ export function createPanelHandler(opts) {
|
|
|
1250
1272
|
// Session History loads node:sqlite only when the page first asks for it.
|
|
1251
1273
|
let historyMod;
|
|
1252
1274
|
const history = () => (historyMod ??= import('../core/history.js'));
|
|
1253
|
-
// Which Sessions run now, for the "running" mark of History rows: read at most every 5 s, given 3 s.
|
|
1254
1275
|
const LIVE_FIRST_MS = 300;
|
|
1255
1276
|
// How long the page state waits for the first list of running sessions before it leaves the Next pick out.
|
|
1256
1277
|
const LIVE_STATE_MS = 3_000;
|
|
1257
1278
|
let liveMark;
|
|
1258
|
-
// Which
|
|
1259
|
-
// one while a fresh one is read, and waits
|
|
1279
|
+
// Which Sessions run now, for the "running" mark of History rows: read at most every 5 s, given 3 s. A search
|
|
1280
|
+
// never waits for that list once one is known: it answers with the last one while a fresh one is read, and waits
|
|
1281
|
+
// at most LIVE_FIRST_MS for the very first.
|
|
1260
1282
|
const liveRead = (rt) => {
|
|
1261
1283
|
if (!liveMark || Date.now() - liveMark.at > 5_000) {
|
|
1262
1284
|
const ids = (sessionsSource?.list ? sessionsSource.list(rt) : listLiveSessions(rt, { deadlineMs: 3_000 }))
|
|
@@ -1370,13 +1392,18 @@ export function createPanelHandler(opts) {
|
|
|
1370
1392
|
};
|
|
1371
1393
|
},
|
|
1372
1394
|
});
|
|
1373
|
-
const checkNetworkAsk = (body) => {
|
|
1395
|
+
const checkNetworkAsk = (body, confirmed = false) => {
|
|
1374
1396
|
if (view !== 'network')
|
|
1375
1397
|
return;
|
|
1376
1398
|
if (body.task !== 'network-diagnose')
|
|
1377
1399
|
throw new HttpError(400, 'the Network Panel only runs its fixed diagnosis task');
|
|
1378
|
-
|
|
1379
|
-
|
|
1400
|
+
const allowed = ['task', 'lang', 'context', ...(confirmed ? ['confirmedPrompt'] : [])];
|
|
1401
|
+
if (Object.keys(body).some((k) => !allowed.includes(k)))
|
|
1402
|
+
throw new HttpError(400, confirmed
|
|
1403
|
+
? 'the fixed network diagnosis accepts only task, lang, diagnostic context and confirmedPrompt'
|
|
1404
|
+
: 'the fixed network diagnosis accepts only task, lang and diagnostic context');
|
|
1405
|
+
if (confirmed && (typeof body.confirmedPrompt !== 'string' || !body.confirmedPrompt.trim()))
|
|
1406
|
+
throw new HttpError(400, 'Preview again and send the exact prompt as confirmedPrompt; nothing was opened.', 'network-prompt-required');
|
|
1380
1407
|
const context = body.context;
|
|
1381
1408
|
if (!context || typeof context !== 'object' || Array.isArray(context))
|
|
1382
1409
|
throw new HttpError(400, 'the fixed network diagnosis requires its diagnostic context');
|
|
@@ -1386,8 +1413,7 @@ export function createPanelHandler(opts) {
|
|
|
1386
1413
|
throw new HttpError(400, 'the fixed network diagnosis requires networkDiagnose facts');
|
|
1387
1414
|
};
|
|
1388
1415
|
const routes = {
|
|
1389
|
-
// AI Tasks (spec §3.28, ADR-0027).
|
|
1390
|
-
// the copy fallback and the read-only Panel.
|
|
1416
|
+
// AI Tasks (spec §3.28, ADR-0027).
|
|
1391
1417
|
// Frees a staged upload the person removed from the dialog, so it stops counting toward the staging limit.
|
|
1392
1418
|
'/api/ask/attach/remove': {
|
|
1393
1419
|
async run(body) {
|
|
@@ -1398,6 +1424,8 @@ export function createPanelHandler(opts) {
|
|
|
1398
1424
|
return { removed: await removeStaged(rt.paths, ids) };
|
|
1399
1425
|
},
|
|
1400
1426
|
},
|
|
1427
|
+
// The prompt and the account it would use, read only: for the confirm area, the copy fallback and the read-only
|
|
1428
|
+
// Panel.
|
|
1401
1429
|
'/api/ask/prompt': {
|
|
1402
1430
|
writes: () => false,
|
|
1403
1431
|
queued: false,
|
|
@@ -1405,7 +1433,7 @@ export function createPanelHandler(opts) {
|
|
|
1405
1433
|
checkNetworkAsk(body);
|
|
1406
1434
|
const input = askInput(body);
|
|
1407
1435
|
const rt = await getRuntime();
|
|
1408
|
-
const { prompt, removedSecrets } =
|
|
1436
|
+
const { prompt, removedSecrets } = await actualAskPrompt(rt, input);
|
|
1409
1437
|
const pick = await pickTaskAccount(rt, input);
|
|
1410
1438
|
return {
|
|
1411
1439
|
prompt,
|
|
@@ -1422,16 +1450,19 @@ export function createPanelHandler(opts) {
|
|
|
1422
1450
|
// Writes the task file and opens the terminal. An account the person picked, API ones too, is kept as `ask.account`.
|
|
1423
1451
|
'/api/ask': {
|
|
1424
1452
|
async run(body) {
|
|
1425
|
-
checkNetworkAsk(body);
|
|
1453
|
+
checkNetworkAsk(body, true);
|
|
1426
1454
|
const input = askInput(body);
|
|
1427
1455
|
const rt = await getRuntime();
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1456
|
+
if (view === 'network') {
|
|
1457
|
+
const actual = await actualAskPrompt(rt, input);
|
|
1458
|
+
if (actual.prompt !== body.confirmedPrompt)
|
|
1459
|
+
throw new HttpError(400, 'The network diagnosis prompt changed. Preview again and confirm the exact new prompt; nothing was opened.', 'network-prompt-mismatch');
|
|
1460
|
+
// Write the exact server-generated prompt that was compared above; do not generate it again after an await.
|
|
1461
|
+
const result = opened(await openPromptTask(rt, { ...input, terminal: 'orca', remember: false }, { taskId: newTaskId(), ...actual, attachments: [] }));
|
|
1462
|
+
const { account: _account, ...withoutAccount } = result;
|
|
1463
|
+
return withoutAccount;
|
|
1464
|
+
}
|
|
1465
|
+
return opened(await startAiTask(rt, { ...input, remember: Boolean(input.account || input.terminal) }));
|
|
1435
1466
|
},
|
|
1436
1467
|
},
|
|
1437
1468
|
// Runs `sideby login <ref>` in the person's terminal; no AI is involved (spec §3.28 "登录").
|
|
@@ -2057,10 +2088,6 @@ export function createPanelHandler(opts) {
|
|
|
2057
2088
|
return { switched: true };
|
|
2058
2089
|
},
|
|
2059
2090
|
},
|
|
2060
|
-
// "Send to it" (spec §3.32 step 2): text and the screenshots staged through SEND_ATTACH_ROUTE go to one Live
|
|
2061
|
-
// Session through sendMessage, which keeps the Message as a file before any delivery. The page sends only the
|
|
2062
|
-
// Session id. It writes files, so a read-only Panel refuses it (writes defaults to true); it runs beside the
|
|
2063
|
-
// write queue because a delivery may wait on the Host.
|
|
2064
2091
|
// Opens the Run Board of a Session (spec §3.32 step 2b, ADR-0041). The page sends only the Session id: the board
|
|
2065
2092
|
// file is found again here, from the Session Index, and checked again. It starts a program, so a read-only Panel
|
|
2066
2093
|
// refuses it (writes defaults to true).
|
|
@@ -2075,6 +2102,10 @@ export function createPanelHandler(opts) {
|
|
|
2075
2102
|
return { opened: true, board: tildify(r.board, rt.paths.home) };
|
|
2076
2103
|
},
|
|
2077
2104
|
},
|
|
2105
|
+
// "Send to it" (spec §3.32 step 2): text and the screenshots staged through SEND_ATTACH_ROUTE go to one Live
|
|
2106
|
+
// Session through sendMessage, which keeps the Message as a file before any delivery. The page sends only the
|
|
2107
|
+
// Session id. It writes files, so a read-only Panel refuses it (writes defaults to true); it runs beside the
|
|
2108
|
+
// write queue because a delivery may wait on the Host.
|
|
2078
2109
|
'/api/sessions/send': {
|
|
2079
2110
|
queued: false,
|
|
2080
2111
|
async run(body) {
|
|
@@ -2376,7 +2407,8 @@ export function createPanelHandler(opts) {
|
|
|
2376
2407
|
'/api/network/diagnose': {
|
|
2377
2408
|
writes: () => false,
|
|
2378
2409
|
async run() {
|
|
2379
|
-
|
|
2410
|
+
const diagnosis = await (await getRuntime()).networkDiagnose();
|
|
2411
|
+
return view === 'network' ? rememberNetworkFacts(diagnosis) : diagnosis;
|
|
2380
2412
|
},
|
|
2381
2413
|
},
|
|
2382
2414
|
// Network Guard's switch and countries (spec §3.35): config `network`, shown first like every config change.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { networkDiagnoseTaskFacts } from 'network-portal';
|
|
1
2
|
import type { HandoffSettings } from '../core/config.ts';
|
|
3
|
+
export { networkDiagnoseTaskFacts };
|
|
2
4
|
/** The parts of a PanelAccount the helpers read. */
|
|
3
5
|
export interface LogicAccount {
|
|
4
6
|
family: string;
|
|
@@ -282,10 +284,6 @@ export declare function suggestName(names: string[]): string;
|
|
|
282
284
|
* that are not fixable, and `--fix --force`, keep the command: Fix all would not do them.
|
|
283
285
|
*/
|
|
284
286
|
export declare function panelHint(hint: string, fixable: boolean, action: string): string;
|
|
285
|
-
/**
|
|
286
|
-
* Whether the Panel fixes Finding `f` with a button of its own: a sideby skill behind this version while the
|
|
287
|
-
* Update plan says sideby may update it (`skillUpdatable`). Such Findings stay out of the prompt for an AI agent.
|
|
288
|
-
*/
|
|
289
287
|
/**
|
|
290
288
|
* A Local Build the Panel can leave for npm itself (ADR-0024): the global `sideby` still runs it and the Panel may
|
|
291
289
|
* write. Then switching to the release is the update, offered as a button instead of the `pnpm local --off` command.
|
|
@@ -365,6 +363,10 @@ export declare function findingSentence(f: {
|
|
|
365
363
|
item?: string;
|
|
366
364
|
params?: Record<string, string | number>;
|
|
367
365
|
}, table: Record<string, string>, en: Record<string, string>, prefix?: string): string;
|
|
366
|
+
/**
|
|
367
|
+
* Whether the Panel fixes Finding `f` with a button of its own: a sideby skill behind this version while the
|
|
368
|
+
* Update plan says sideby may update it (`skillUpdatable`). Such Findings stay out of the prompt for an AI agent.
|
|
369
|
+
*/
|
|
368
370
|
export declare function panelFixes(f: {
|
|
369
371
|
code?: string;
|
|
370
372
|
}, skillUpdatable: boolean): boolean;
|
|
@@ -723,26 +725,6 @@ export declare function networkTaskFacts(n: {
|
|
|
723
725
|
skip?: string;
|
|
724
726
|
}[];
|
|
725
727
|
}): string[];
|
|
726
|
-
export declare function networkDiagnoseTaskFacts(d: {
|
|
727
|
-
checkedAt: string;
|
|
728
|
-
targets: readonly {
|
|
729
|
-
url: string;
|
|
730
|
-
proxy: string;
|
|
731
|
-
guardSupport: string;
|
|
732
|
-
listener: null | {
|
|
733
|
-
host: string;
|
|
734
|
-
port: number;
|
|
735
|
-
reachable: boolean;
|
|
736
|
-
error?: string;
|
|
737
|
-
};
|
|
738
|
-
guard: {
|
|
739
|
-
status: string;
|
|
740
|
-
loc?: string;
|
|
741
|
-
checkedAt?: string;
|
|
742
|
-
error?: string;
|
|
743
|
-
};
|
|
744
|
-
}[];
|
|
745
|
-
}): string[];
|
|
746
728
|
/** The kinds of AI Task (spec §3.28); anything else is refused. */
|
|
747
729
|
export declare const AI_TASK_KINDS: readonly ['free', 'fix', 'quota', 'account', 'host', 'plugin', 'terminal', 'theme', 'handoff', 'menubar', 'hotkey', 'network', 'network-diagnose', 'update'];
|
|
748
730
|
export type AiTaskKind = (typeof AI_TASK_KINDS)[number];
|
|
@@ -964,10 +946,6 @@ export declare function panelMigration(config: {
|
|
|
964
946
|
theme?: string;
|
|
965
947
|
language?: string;
|
|
966
948
|
} | null;
|
|
967
|
-
/**
|
|
968
|
-
* The line under the start-at-login switch (spec §3.29) as a message key, whether it is on, whether the switch can
|
|
969
|
-
* be moved, and the action beside it: `fix` turns it on again so it starts this sideby. Read-only: no switch, no action.
|
|
970
|
-
*/
|
|
971
949
|
/**
|
|
972
950
|
* A key press in the Panel's shortcut recorder as config `menubar.hotkey` writes it (`ctrl+opt+s`), or null while only
|
|
973
951
|
* modifiers are held or the key is not a letter or digit. Reads `code`, not `key`: on a Mac ⌥S types "ß".
|
|
@@ -985,6 +963,10 @@ export declare function hotkeyFromKey(e: {
|
|
|
985
963
|
* so at once instead of looking stuck. A letter or digit is neither (see `hotkeyFromKey`).
|
|
986
964
|
*/
|
|
987
965
|
export declare function hotkeyPressKind(code: string): 'key' | 'wait' | 'unsupported';
|
|
966
|
+
/**
|
|
967
|
+
* The line under the start-at-login switch (spec §3.29) as a message key, whether it is on, whether the switch can
|
|
968
|
+
* be moved, and the action beside it: `fix` turns it on again so it starts this sideby. Read-only: no switch, no action.
|
|
969
|
+
*/
|
|
988
970
|
export declare function autostartNote(s: {
|
|
989
971
|
supported: boolean;
|
|
990
972
|
state: string;
|
|
@@ -1043,12 +1025,12 @@ export declare function widthFollower<T>(shown: T, tierOf: (width: number) => T,
|
|
|
1043
1025
|
set: (fn: () => void, ms: number) => unknown;
|
|
1044
1026
|
clear: (id: unknown) => void;
|
|
1045
1027
|
}): (width: number) => void;
|
|
1046
|
-
/** When a History row was last active: "x min ago" within a week, then its date (key `time.on`). */
|
|
1047
1028
|
/**
|
|
1048
1029
|
* Whether the end of a list is close enough to load its next page: within `margin` px of the bottom of what can be
|
|
1049
1030
|
* seen, which is the viewport where the list's box grows with its rows (the page scrolls, not the box).
|
|
1050
1031
|
*/
|
|
1051
1032
|
export declare function tailInView(tailTop: number, boxBottom: number, viewHeight: number, margin?: number): boolean;
|
|
1033
|
+
/** When a History row was last active: "x min ago" within a week, then its date (key `time.on`). */
|
|
1052
1034
|
export declare function historyWhen(iso: string | undefined, now: number): {
|
|
1053
1035
|
key: string;
|
|
1054
1036
|
n?: number;
|