sideby 0.42.2 → 0.43.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/ai-tasks.json +10 -0
- package/dist/build.json +1 -1
- package/dist/src/cli/commands.js +54 -13
- package/dist/src/cli/json-schemas.js +58 -1
- package/dist/src/cli/main.js +11 -4
- package/dist/src/core/ask.d.ts +8 -14
- package/dist/src/core/ask.js +66 -30
- package/dist/src/core/egress.d.ts +5 -0
- package/dist/src/core/egress.js +32 -2
- package/dist/src/core/handoff-run.js +41 -8
- package/dist/src/core/handoff-select.d.ts +5 -0
- package/dist/src/core/handoff-select.js +1 -1
- package/dist/src/core/handoff.d.ts +69 -1
- package/dist/src/core/handoff.js +90 -9
- package/dist/src/core/history-index.d.ts +4 -0
- package/dist/src/core/history-index.js +1 -1
- package/dist/src/core/live-sessions.d.ts +5 -0
- package/dist/src/core/live-sessions.js +12 -1
- package/dist/src/core/network.d.ts +37 -0
- package/dist/src/core/network.js +65 -1
- package/dist/src/core/pick-commands.d.ts +7 -1
- package/dist/src/core/pick-commands.js +15 -3
- package/dist/src/core/pick-records.d.ts +26 -0
- package/dist/src/core/pick-records.js +81 -0
- package/dist/src/families/agy/history.d.ts +2 -0
- package/dist/src/families/agy/history.js +118 -0
- package/dist/src/families/agy/index.js +5 -0
- package/dist/src/families/agy/quota.d.ts +5 -1
- package/dist/src/families/agy/quota.js +111 -10
- package/dist/src/families/history.js +2 -1
- package/dist/src/network/hook.js +4 -4
- package/dist/src/network/page-script.d.ts +40 -0
- package/dist/src/network/page-script.js +270 -0
- package/dist/src/network/page.d.ts +11 -0
- package/dist/src/network/page.js +189 -0
- package/dist/src/network/panel.d.ts +5 -0
- package/dist/src/network/panel.js +7 -0
- package/dist/src/panel/handler.d.ts +21 -1
- package/dist/src/panel/handler.js +174 -37
- package/dist/src/panel/i18n.d.ts +26 -0
- package/dist/src/panel/i18n.js +54 -2
- package/dist/src/panel/page-logic.d.ts +26 -3
- package/dist/src/panel/page-logic.js +95 -12
- package/dist/src/panel/page-script.js +86 -17
- package/dist/src/panel/page-styles.js +1 -0
- package/dist/src/runtime.d.ts +44 -5
- package/dist/src/runtime.js +102 -12
- package/dist/src/types.d.ts +3 -2
- package/package.json +1 -1
- package/schemas/network-diagnose.json +196 -0
- package/schemas/next.json +42 -2
- package/skills/sideby/SKILL.md +2 -1
- package/skills/sideby/references/accounts.md +1 -1
- package/skills/sideby/references/ai-tasks.md +1 -1
- package/skills/sideby/references/handoff.md +4 -2
- package/skills/sideby/references/network.md +6 -1
- package/skills/sideby/references/quota.md +1 -1
- package/skills/sideby/references/sessions.md +1 -1
|
@@ -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,
|
|
7
|
+
import { openLoginInTerminal, 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';
|
|
@@ -25,6 +25,7 @@ import { listMessages, sendMessage } from '../core/messages.js';
|
|
|
25
25
|
import { accountModel, setAccountModel } from '../core/model-choice.js';
|
|
26
26
|
import { GUARDED_FAMILIES, setNetwork } from '../core/network.js';
|
|
27
27
|
import { tildify } from '../core/paths.js';
|
|
28
|
+
import { readPickRecords } from '../core/pick-records.js';
|
|
28
29
|
import { PROGRESS_FAMILIES } from '../core/progress.js';
|
|
29
30
|
import { validEvery } from '../core/progress-state.js';
|
|
30
31
|
import { quotaAsking } from '../core/quota-fetch.js';
|
|
@@ -48,6 +49,7 @@ import { HOOK_FAMILIES } from '../handoff/hook.js';
|
|
|
48
49
|
import { MENUBAR_AGENT } from '../menubar/agent.js';
|
|
49
50
|
import { hotkeyView, iconView, openMenuBarSettings, readMenubarState, setMenubarHotkey, } from '../menubar/hotkey.js';
|
|
50
51
|
import { MENUBAR_SCRIPT } from '../menubar/script.js';
|
|
52
|
+
import { renderNetworkPage } from '../network/page.js';
|
|
51
53
|
import { orcaTabs, switchOrcaTab, systemOrca } from './orca.js';
|
|
52
54
|
import { renderPage } from './page.js';
|
|
53
55
|
import { AI_TASK_KINDS } from './page-logic.js';
|
|
@@ -64,6 +66,11 @@ export const MAX_QUEUED_WRITES = 4;
|
|
|
64
66
|
* does not export it); it may change without notice.
|
|
65
67
|
*/
|
|
66
68
|
export const LIVE_SESSIONS_SOURCE = Symbol('sideby.panel.liveSessions');
|
|
69
|
+
/**
|
|
70
|
+
* Internal: a property under this key of the handler options serves only the Network view (`src/network/panel.ts`).
|
|
71
|
+
* Not part of the Portal contract (`src/index.ts` does not export it); it may change without notice.
|
|
72
|
+
*/
|
|
73
|
+
export const PANEL_VIEW = Symbol('sideby.panel.view');
|
|
67
74
|
/** The longest text "Send to it" takes; the page's text box has the same limit. */
|
|
68
75
|
export const MAX_MESSAGE_TEXT = 8000;
|
|
69
76
|
/** The `ask` and `open` options: `{ bridge: 'postMessage' }` or left out; anything else is a TypeError. */
|
|
@@ -258,7 +265,14 @@ async function localSwitchState(rt, method) {
|
|
|
258
265
|
}
|
|
259
266
|
}
|
|
260
267
|
/** The `handoff` map of the Panel state, from the statuses and Quota already read for the page. */
|
|
261
|
-
export function handoffByFamily(rt, accounts, now) {
|
|
268
|
+
export function handoffByFamily(rt, accounts, now, load) {
|
|
269
|
+
const out = {};
|
|
270
|
+
for (const [id, plan] of Object.entries(handoffPlans(rt, accounts, now, load)))
|
|
271
|
+
out[id] = plan.pick;
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
274
|
+
/** The plan behind each pick of `handoffByFamily`, spread by Room per Session when `load` is given (ADR-0083). */
|
|
275
|
+
export function handoffPlans(rt, accounts, now, load) {
|
|
262
276
|
const out = {};
|
|
263
277
|
for (const [id, f] of rt.families) {
|
|
264
278
|
// An Account still being read has no Quota yet; it is neither a pick nor an alternative until it has.
|
|
@@ -276,11 +290,18 @@ export function handoffByFamily(rt, accounts, now) {
|
|
|
276
290
|
login: a.login ?? 'unknown',
|
|
277
291
|
...(a.loginProblem ? { loginProblem: a.loginProblem } : {}),
|
|
278
292
|
quota: a.quota ?? { status: 'unavailable', reason: 'unrecognized' },
|
|
293
|
+
...(a.sameLogin ? { sameLogin: a.sameLogin } : {}),
|
|
294
|
+
...(load ? { liveSessions: load.live.get(a.ref) ?? 0 } : {}),
|
|
279
295
|
})), now,
|
|
280
296
|
// The same plan as `sideby next`: the same Takeover Limits, and past them the least used Account (a Last Resort).
|
|
281
|
-
{
|
|
297
|
+
{
|
|
298
|
+
limits: takeoverLimits(rt.handoffSettings().threshold),
|
|
299
|
+
lastResort: true,
|
|
300
|
+
// Counted over every Account, also one still being read, so a Same Login partner's sessions count.
|
|
301
|
+
...(load ? { picks: load.picks, live: load.live } : {}),
|
|
302
|
+
});
|
|
282
303
|
if (plan.pick && plan.hasQuota)
|
|
283
|
-
out[id] = plan
|
|
304
|
+
out[id] = plan;
|
|
284
305
|
}
|
|
285
306
|
return out;
|
|
286
307
|
}
|
|
@@ -585,6 +606,8 @@ async function timedAccountState(rt, account, families, mine) {
|
|
|
585
606
|
return placeholder({ pending: true });
|
|
586
607
|
}
|
|
587
608
|
async function buildState(rt, opts) {
|
|
609
|
+
// Read alongside the Accounts, so waiting for it adds little.
|
|
610
|
+
const liveNow = opts.live?.() ?? Promise.resolve(new Set());
|
|
588
611
|
const ctx = rt.readContext();
|
|
589
612
|
const [families, accounts, history, quotaSetups, remoteControl, advisor, upd] = await Promise.all([
|
|
590
613
|
rt.familyInfo(),
|
|
@@ -630,7 +653,26 @@ async function buildState(rt, opts) {
|
|
|
630
653
|
...(withArgs.length ? { aliasArgs: Object.fromEntries(withArgs) } : {}),
|
|
631
654
|
};
|
|
632
655
|
});
|
|
633
|
-
|
|
656
|
+
// The Next pick counts Live Sessions and Pick Records as `sideby next` does; it only reads them (ADR-0083).
|
|
657
|
+
const keys = await liveNow;
|
|
658
|
+
const live = new Map();
|
|
659
|
+
for (const key of keys ?? []) {
|
|
660
|
+
const ref = key.slice(0, key.indexOf('\0'));
|
|
661
|
+
live.set(ref, (live.get(ref) ?? 0) + 1);
|
|
662
|
+
}
|
|
663
|
+
const plans = keys
|
|
664
|
+
? handoffPlans(rt, list, ctx.now, { live, picks: await readPickRecords(rt.paths.stateDir, ctx.now) })
|
|
665
|
+
: {};
|
|
666
|
+
const handoff = Object.fromEntries(Object.entries(plans).map(([f, p]) => [f, p.pick]));
|
|
667
|
+
const handoffRunning = Object.fromEntries(Object.entries(plans).flatMap(([f, p]) => {
|
|
668
|
+
const n = p.accounts.find((e) => e.ref === p.pick)?.liveSessions ?? 0;
|
|
669
|
+
return n ? [[f, n]] : [];
|
|
670
|
+
}));
|
|
671
|
+
const handoffReason = Object.fromEntries(Object.entries(plans).flatMap(([f, p]) => {
|
|
672
|
+
const why = p.reason ??
|
|
673
|
+
(p.tight ? 'tight' : p.accounts.find((e) => e.ref === p.pick)?.state === 'unknown' ? 'unknown' : null);
|
|
674
|
+
return why ? [[f, why]] : [];
|
|
675
|
+
}));
|
|
634
676
|
const pickOffers = {};
|
|
635
677
|
for (const f of families) {
|
|
636
678
|
const offer = await rt.pickSuggestion(f.id, accounts).catch(() => null);
|
|
@@ -678,6 +720,8 @@ async function buildState(rt, opts) {
|
|
|
678
720
|
...(Object.keys(pickOffers).length ? { pickOffers } : {}),
|
|
679
721
|
shellSetup: { ...shellSt, rc: tildify(shellSt.rc, ctx.home), block: setupBlock(shellSt.shell) },
|
|
680
722
|
...(Object.keys(handoff).length ? { handoff } : {}),
|
|
723
|
+
...(Object.keys(handoffRunning).length ? { handoffRunning } : {}),
|
|
724
|
+
...(Object.keys(handoffReason).length ? { handoffReason } : {}),
|
|
681
725
|
...(remoteControl.length ? { remoteControl: rcView(remoteControl, ctx.home) } : {}),
|
|
682
726
|
...(advisor.groups.length ? { advisor: advisorView(advisor, ctx.home) } : {}),
|
|
683
727
|
...(appProfiles.length
|
|
@@ -1051,6 +1095,9 @@ function layerTheme(colors, portal) {
|
|
|
1051
1095
|
}
|
|
1052
1096
|
export function createPanelHandler(opts) {
|
|
1053
1097
|
const basePath = normalizeBase(opts.basePath);
|
|
1098
|
+
const view = opts[PANEL_VIEW] ?? 'accounts';
|
|
1099
|
+
if (view !== 'accounts' && view !== 'network')
|
|
1100
|
+
throw new TypeError('panel view must be "accounts" or "network"');
|
|
1054
1101
|
const allowed = new Set(opts.allowedHosts.map((h) => h.toLowerCase()));
|
|
1055
1102
|
const readOnly = Boolean(opts.readOnly);
|
|
1056
1103
|
const version = opts.version ?? PANEL_VERSION;
|
|
@@ -1082,14 +1129,19 @@ export function createPanelHandler(opts) {
|
|
|
1082
1129
|
const history = () => (historyMod ??= import('../core/history.js'));
|
|
1083
1130
|
// Which Sessions run now, for the "running" mark of History rows: read at most every 5 s, given 3 s.
|
|
1084
1131
|
const LIVE_FIRST_MS = 300;
|
|
1132
|
+
// How long the page state waits for the first list of running sessions before it leaves the Next pick out.
|
|
1133
|
+
const LIVE_STATE_MS = 3_000;
|
|
1085
1134
|
let liveMark;
|
|
1086
1135
|
// Which past Sessions run now. A search never waits for that list once one is known: it answers with the last
|
|
1087
1136
|
// one while a fresh one is read, and waits at most LIVE_FIRST_MS for the very first.
|
|
1088
|
-
const
|
|
1137
|
+
const liveRead = (rt) => {
|
|
1089
1138
|
if (!liveMark || Date.now() - liveMark.at > 5_000) {
|
|
1090
1139
|
const ids = (sessionsSource?.list ? sessionsSource.list(rt) : listLiveSessions(rt, { deadlineMs: 3_000 }))
|
|
1091
|
-
.then((r) =>
|
|
1092
|
-
.
|
|
1140
|
+
.then((r) => ({
|
|
1141
|
+
ids: new Set(r.sessions.map((x) => liveKey(x.account, x.sessionId))),
|
|
1142
|
+
complete: !r.partial,
|
|
1143
|
+
}))
|
|
1144
|
+
.catch(() => ({ ids: new Set(), complete: false }));
|
|
1093
1145
|
const last = liveMark?.last;
|
|
1094
1146
|
liveMark = { at: Date.now(), ids, ...(last ? { last } : {}) };
|
|
1095
1147
|
const mark = liveMark;
|
|
@@ -1097,19 +1149,26 @@ export function createPanelHandler(opts) {
|
|
|
1097
1149
|
mark.last = v;
|
|
1098
1150
|
});
|
|
1099
1151
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1152
|
+
return liveMark;
|
|
1153
|
+
};
|
|
1154
|
+
// The last complete list known, else the one being read, given `waitMs`; past that the last list, even an
|
|
1155
|
+
// incomplete one, or `late` when there is none.
|
|
1156
|
+
const liveWithin = async (rt, waitMs, late) => {
|
|
1157
|
+
const mark = liveRead(rt);
|
|
1158
|
+
if (mark.last?.complete)
|
|
1159
|
+
return mark.last;
|
|
1102
1160
|
let timer;
|
|
1103
|
-
const
|
|
1104
|
-
timer = setTimeout(() => r(
|
|
1161
|
+
const gave = new Promise((r) => {
|
|
1162
|
+
timer = setTimeout(() => r(mark.last ?? late), waitMs);
|
|
1105
1163
|
});
|
|
1106
1164
|
try {
|
|
1107
|
-
return await Promise.race([
|
|
1165
|
+
return await Promise.race([mark.ids, gave]);
|
|
1108
1166
|
}
|
|
1109
1167
|
finally {
|
|
1110
1168
|
clearTimeout(timer);
|
|
1111
1169
|
}
|
|
1112
1170
|
};
|
|
1171
|
+
const liveIds = async (rt) => (await liveWithin(rt, LIVE_FIRST_MS, null))?.ids ?? new Set();
|
|
1113
1172
|
const toolScans = new Map();
|
|
1114
1173
|
const dropIdleScans = () => {
|
|
1115
1174
|
for (const [id, scan] of toolScans)
|
|
@@ -1188,6 +1247,21 @@ export function createPanelHandler(opts) {
|
|
|
1188
1247
|
};
|
|
1189
1248
|
},
|
|
1190
1249
|
});
|
|
1250
|
+
const checkNetworkAsk = (body) => {
|
|
1251
|
+
if (view !== 'network')
|
|
1252
|
+
return;
|
|
1253
|
+
if (body.task !== 'network-diagnose')
|
|
1254
|
+
throw new HttpError(400, 'the Network Panel only runs its fixed diagnosis task');
|
|
1255
|
+
if (Object.keys(body).some((k) => !['task', 'lang', 'context'].includes(k)))
|
|
1256
|
+
throw new HttpError(400, 'the fixed network diagnosis accepts only task, lang and diagnostic context');
|
|
1257
|
+
const context = body.context;
|
|
1258
|
+
if (!context || typeof context !== 'object' || Array.isArray(context))
|
|
1259
|
+
throw new HttpError(400, 'the fixed network diagnosis requires its diagnostic context');
|
|
1260
|
+
if (Object.keys(context).some((k) => !['networkDiagnose', 'version'].includes(k)))
|
|
1261
|
+
throw new HttpError(400, 'the fixed network diagnosis accepts only networkDiagnose and version facts');
|
|
1262
|
+
if (!Array.isArray(context.networkDiagnose))
|
|
1263
|
+
throw new HttpError(400, 'the fixed network diagnosis requires networkDiagnose facts');
|
|
1264
|
+
};
|
|
1191
1265
|
const routes = {
|
|
1192
1266
|
// AI Tasks (spec §3.28, ADR-0027). The prompt and the account it would use, read only: for the confirm area,
|
|
1193
1267
|
// the copy fallback and the read-only Panel.
|
|
@@ -1205,6 +1279,7 @@ export function createPanelHandler(opts) {
|
|
|
1205
1279
|
writes: () => false,
|
|
1206
1280
|
queued: false,
|
|
1207
1281
|
async run(body) {
|
|
1282
|
+
checkNetworkAsk(body);
|
|
1208
1283
|
const input = askInput(body);
|
|
1209
1284
|
const rt = await getRuntime();
|
|
1210
1285
|
const { prompt, removedSecrets } = promptForTask(rt, input, await previewAttachments(rt, input));
|
|
@@ -1212,17 +1287,28 @@ export function createPanelHandler(opts) {
|
|
|
1212
1287
|
return {
|
|
1213
1288
|
prompt,
|
|
1214
1289
|
removedSecrets,
|
|
1215
|
-
|
|
1216
|
-
|
|
1290
|
+
...(view === 'network'
|
|
1291
|
+
? {}
|
|
1292
|
+
: {
|
|
1293
|
+
account: 'account' in pick ? pick.account.ref : null,
|
|
1294
|
+
...('reason' in pick ? { reason: pick.reason } : {}),
|
|
1295
|
+
}),
|
|
1217
1296
|
};
|
|
1218
1297
|
},
|
|
1219
1298
|
},
|
|
1220
1299
|
// Writes the task file and opens the terminal. An account the person picked, API ones too, is kept as `ask.account`.
|
|
1221
1300
|
'/api/ask': {
|
|
1222
1301
|
async run(body) {
|
|
1302
|
+
checkNetworkAsk(body);
|
|
1223
1303
|
const input = askInput(body);
|
|
1224
1304
|
const rt = await getRuntime();
|
|
1225
|
-
|
|
1305
|
+
const result = opened(await startAiTask(rt, view === 'network'
|
|
1306
|
+
? { ...input, terminal: 'orca', remember: false }
|
|
1307
|
+
: { ...input, remember: Boolean(input.account || input.terminal) }));
|
|
1308
|
+
if (view !== 'network')
|
|
1309
|
+
return result;
|
|
1310
|
+
const { account: _account, ...withoutAccount } = result;
|
|
1311
|
+
return withoutAccount;
|
|
1226
1312
|
},
|
|
1227
1313
|
},
|
|
1228
1314
|
// Runs `sideby login <ref>` in the person's terminal; no AI is involved (spec §3.28 "登录").
|
|
@@ -1375,13 +1461,27 @@ export function createPanelHandler(opts) {
|
|
|
1375
1461
|
if (!name)
|
|
1376
1462
|
throw new HttpError(400, '"name" is required');
|
|
1377
1463
|
const rt = await getRuntime();
|
|
1378
|
-
|
|
1464
|
+
// This start counts for the next pick, so its record is written now (ADR-0083).
|
|
1465
|
+
let rec;
|
|
1466
|
+
const { family, choice } = await rt.pickChoice(name, {
|
|
1467
|
+
record: true,
|
|
1468
|
+
recorded: (r) => {
|
|
1469
|
+
rec = r;
|
|
1470
|
+
},
|
|
1471
|
+
});
|
|
1379
1472
|
if (choice.ref === null)
|
|
1380
1473
|
throw new UserError(choice.earliestReset
|
|
1381
1474
|
? `Every signed-in ${family} account has used up its quota; ${choice.earliestReset.ref} is back first.`
|
|
1382
1475
|
: `No ${family} account can be used now; sign one in first.`, { code: 'none-usable' });
|
|
1383
|
-
// The terminal
|
|
1384
|
-
|
|
1476
|
+
// The terminal starts exactly the Account picked here, the one the answer names; picking again there could
|
|
1477
|
+
// start another. A terminal that did not open starts nothing, so the record is taken back.
|
|
1478
|
+
const r = opened(await openRunInTerminal(rt, choice.ref).catch(async (err) => {
|
|
1479
|
+
if (rec)
|
|
1480
|
+
await rt.cancelPick(rec);
|
|
1481
|
+
throw err;
|
|
1482
|
+
}));
|
|
1483
|
+
if (!r.opened && rec)
|
|
1484
|
+
await rt.cancelPick(rec);
|
|
1385
1485
|
return {
|
|
1386
1486
|
...r,
|
|
1387
1487
|
name,
|
|
@@ -1389,6 +1489,8 @@ export function createPanelHandler(opts) {
|
|
|
1389
1489
|
picked: choice.ref,
|
|
1390
1490
|
reason: choice.reason,
|
|
1391
1491
|
...('pressure' in choice ? { pressure: choice.pressure, window: choice.window } : {}),
|
|
1492
|
+
...('expiring' in choice && choice.expiring ? { expiring: true } : {}),
|
|
1493
|
+
...('running' in choice && choice.running ? { running: choice.running } : {}),
|
|
1392
1494
|
...('limit' in choice ? { limit: choice.limit, longLimit: choice.longLimit } : {}),
|
|
1393
1495
|
};
|
|
1394
1496
|
},
|
|
@@ -2142,6 +2244,13 @@ export function createPanelHandler(opts) {
|
|
|
2142
2244
|
return (await getRuntime()).networkStatus({ check: true });
|
|
2143
2245
|
},
|
|
2144
2246
|
},
|
|
2247
|
+
// Manual offline diagnosis: cached Guard state and a local TCP probe, never an online trace.
|
|
2248
|
+
'/api/network/diagnose': {
|
|
2249
|
+
writes: () => false,
|
|
2250
|
+
async run() {
|
|
2251
|
+
return (await getRuntime()).networkDiagnose();
|
|
2252
|
+
},
|
|
2253
|
+
},
|
|
2145
2254
|
// Network Guard's switch and countries (spec §3.35): config `network`, shown first like every config change.
|
|
2146
2255
|
'/api/network/settings': {
|
|
2147
2256
|
writes: (body) => body.confirm === true,
|
|
@@ -2568,18 +2677,28 @@ export function createPanelHandler(opts) {
|
|
|
2568
2677
|
if (!allowed.has(host))
|
|
2569
2678
|
throw new HttpError(403, 'host not allowed');
|
|
2570
2679
|
const method = req.method ?? 'GET';
|
|
2680
|
+
const networkGetRoutes = new Set([
|
|
2681
|
+
'/',
|
|
2682
|
+
'/index.html',
|
|
2683
|
+
'/favicon.svg',
|
|
2684
|
+
'/icon.svg',
|
|
2685
|
+
'/api/health',
|
|
2686
|
+
'/api/session',
|
|
2687
|
+
]);
|
|
2688
|
+
if (view === 'network' && (method === 'GET' || method === 'HEAD') && !networkGetRoutes.has(sub))
|
|
2689
|
+
throw new HttpError(404, 'not found');
|
|
2571
2690
|
if (method === 'GET' || method === 'HEAD') {
|
|
2572
2691
|
if (sub === '/' || sub === '/index.html') {
|
|
2573
2692
|
const nonce = randomBytes(16).toString('base64');
|
|
2574
2693
|
// The theme and language in config (spec §3.29), so the first paint has them; a config that cannot be
|
|
2575
2694
|
// read leaves the defaults, and /api/state reports the problem.
|
|
2576
|
-
const panel = method === 'HEAD'
|
|
2695
|
+
const panel = method === 'HEAD' || view === 'network'
|
|
2577
2696
|
? undefined
|
|
2578
2697
|
: await getRuntime().then((rt) => rt.config.panel, () => undefined);
|
|
2579
2698
|
// The user's Theme under the Portal's colors (spec §3.34): `?theme=preview` shows the Theme `sideby theme
|
|
2580
2699
|
// preview` set, for this load only. A Theme that cannot be read leaves the default and Settings says why.
|
|
2581
2700
|
const preview = new URL(req.url ?? '/', 'http://x').searchParams.get('theme') === 'preview';
|
|
2582
|
-
const colors = method === 'HEAD'
|
|
2701
|
+
const colors = method === 'HEAD' || view === 'network'
|
|
2583
2702
|
? undefined
|
|
2584
2703
|
: await getRuntime().then(async (rt) => (preview ? await previewColors(rt.paths) : undefined) ??
|
|
2585
2704
|
(rt.config.panel?.colorTheme && rt.config.panel.colorTheme !== NO_THEME
|
|
@@ -2606,21 +2725,23 @@ export function createPanelHandler(opts) {
|
|
|
2606
2725
|
});
|
|
2607
2726
|
res.end(method === 'HEAD'
|
|
2608
2727
|
? undefined
|
|
2609
|
-
:
|
|
2610
|
-
basePath,
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2728
|
+
: view === 'network'
|
|
2729
|
+
? renderNetworkPage({ basePath, token, nonce, version, theme, lang })
|
|
2730
|
+
: renderPage({
|
|
2731
|
+
basePath,
|
|
2732
|
+
token,
|
|
2733
|
+
nonce,
|
|
2734
|
+
version,
|
|
2735
|
+
build,
|
|
2736
|
+
local,
|
|
2737
|
+
readOnly,
|
|
2738
|
+
theme: pageTheme,
|
|
2739
|
+
lang,
|
|
2740
|
+
updates,
|
|
2741
|
+
...(ask ? { ask } : {}),
|
|
2742
|
+
...(openBridge ? { open: openBridge } : {}),
|
|
2743
|
+
...(panel ? { panel } : {}),
|
|
2744
|
+
}));
|
|
2624
2745
|
return true;
|
|
2625
2746
|
}
|
|
2626
2747
|
// The mark, for a Portal's tab and for this page's favicon (ADR-0006 amendment).
|
|
@@ -2661,7 +2782,20 @@ export function createPanelHandler(opts) {
|
|
|
2661
2782
|
return true;
|
|
2662
2783
|
}
|
|
2663
2784
|
if (sub === '/api/state') {
|
|
2664
|
-
send(res, 200, await buildState(await getRuntime(), {
|
|
2785
|
+
send(res, 200, await buildState(await getRuntime(), {
|
|
2786
|
+
version,
|
|
2787
|
+
build,
|
|
2788
|
+
readOnly,
|
|
2789
|
+
updates,
|
|
2790
|
+
readings,
|
|
2791
|
+
// The Next pick waits for the running sessions, so it never shows a pick that moves once they are known.
|
|
2792
|
+
// A scan that could not list the running programs or left Accounts out counts as not known, like one
|
|
2793
|
+
// that came too late.
|
|
2794
|
+
live: async () => {
|
|
2795
|
+
const scan = await liveWithin(await getRuntime(), LIVE_STATE_MS, null);
|
|
2796
|
+
return scan?.complete ? scan.ids : null;
|
|
2797
|
+
},
|
|
2798
|
+
}));
|
|
2665
2799
|
return true;
|
|
2666
2800
|
}
|
|
2667
2801
|
if (Object.hasOwn(routes, sub) || Object.hasOwn(uploads, sub))
|
|
@@ -2670,6 +2804,9 @@ export function createPanelHandler(opts) {
|
|
|
2670
2804
|
}
|
|
2671
2805
|
if (method !== 'POST')
|
|
2672
2806
|
throw new HttpError(405, 'method not allowed');
|
|
2807
|
+
const networkPostRoutes = new Set(['/api/network/diagnose', '/api/ask/prompt', '/api/ask']);
|
|
2808
|
+
if (view === 'network' && !networkPostRoutes.has(sub))
|
|
2809
|
+
throw new HttpError(404, 'not found');
|
|
2673
2810
|
const route = Object.hasOwn(routes, sub) ? routes[sub] : undefined;
|
|
2674
2811
|
const upload = Object.hasOwn(uploads, sub) ? uploads[sub] : undefined;
|
|
2675
2812
|
if (!route && !upload)
|
package/dist/src/panel/i18n.d.ts
CHANGED
|
@@ -292,6 +292,12 @@ declare const en: {
|
|
|
292
292
|
'acct.next': string;
|
|
293
293
|
'acct.nextWhy': string;
|
|
294
294
|
'acct.nextCopy': string;
|
|
295
|
+
'acct.nextWhyRoom': string;
|
|
296
|
+
'acct.nextWhyExpiring': string;
|
|
297
|
+
'acct.nextWhyTight': string;
|
|
298
|
+
'acct.nextWhyUnknown': string;
|
|
299
|
+
'acct.nextRunning.one': string;
|
|
300
|
+
'acct.nextRunning.other': string;
|
|
295
301
|
'stat.needWho': string;
|
|
296
302
|
'stat.needWhoMore': string;
|
|
297
303
|
'acct.sameLogin': string;
|
|
@@ -655,6 +661,8 @@ declare const en: {
|
|
|
655
661
|
'ask.copyPrompt': string;
|
|
656
662
|
'ask.promptShown': string;
|
|
657
663
|
'ask.showPrompt': string;
|
|
664
|
+
'ask.actualPrompt': string;
|
|
665
|
+
'ask.promptChanged': string;
|
|
658
666
|
'ask.readOnly': string;
|
|
659
667
|
'ask.opened': string;
|
|
660
668
|
'ask.failed': string;
|
|
@@ -718,6 +726,8 @@ declare const en: {
|
|
|
718
726
|
'pk.namePh': string;
|
|
719
727
|
'pk.started': string;
|
|
720
728
|
'pk.why.room': string;
|
|
729
|
+
'pk.why.roomRunning': string;
|
|
730
|
+
'pk.why.expiring': string;
|
|
721
731
|
'pk.why.tight': string;
|
|
722
732
|
'pk.why.noData': string;
|
|
723
733
|
'login.opened': string;
|
|
@@ -784,6 +794,9 @@ declare const en: {
|
|
|
784
794
|
'ask.ex.network.1': string;
|
|
785
795
|
'ask.ex.network.2': string;
|
|
786
796
|
'ask.ex.network.3': string;
|
|
797
|
+
'ask.title.network-diagnose': string;
|
|
798
|
+
'ask.task.network-diagnose': string;
|
|
799
|
+
'ask.ph.network-diagnose': string;
|
|
787
800
|
'ask.ph.theme': string;
|
|
788
801
|
'ask.ex.theme.1': string;
|
|
789
802
|
'ask.ex.theme.2': string;
|
|
@@ -1462,6 +1475,19 @@ declare const en: {
|
|
|
1462
1475
|
'net.pickFirst': string;
|
|
1463
1476
|
'net.now': string;
|
|
1464
1477
|
'net.recheck': string;
|
|
1478
|
+
'net.diagnose': string;
|
|
1479
|
+
'net.diagnoseRefresh': string;
|
|
1480
|
+
'net.diagnosing': string;
|
|
1481
|
+
'net.diagnoseOffline': string;
|
|
1482
|
+
'net.diagnoseRoute': string;
|
|
1483
|
+
'net.diagnoseDirect': string;
|
|
1484
|
+
'net.diagnoseNoLocalProbe': string;
|
|
1485
|
+
'net.diagnoseListenerUp': string;
|
|
1486
|
+
'net.diagnoseListenerDown': string;
|
|
1487
|
+
'net.diagnoseTcpLimit': string;
|
|
1488
|
+
'net.diagnoseUnsupported': string;
|
|
1489
|
+
'net.diagnoseInvalid': string;
|
|
1490
|
+
'net.diagnoseChecked': string;
|
|
1465
1491
|
'net.ok': string;
|
|
1466
1492
|
'net.blocked': string;
|
|
1467
1493
|
'net.unknown': string;
|
package/dist/src/panel/i18n.js
CHANGED
|
@@ -294,6 +294,12 @@ const en = {
|
|
|
294
294
|
'acct.next': 'Suggested',
|
|
295
295
|
'acct.nextWhy': 'Of the {title} accounts, this one has the most quota left, so it is the one to use next. sideby never switches by itself.',
|
|
296
296
|
'acct.nextCopy': 'Copy the command that starts it',
|
|
297
|
+
'acct.nextWhyRoom': 'Of the {title} accounts, this one leaves the most quota for each session already running on it, so new work spreads instead of piling onto one account. sideby never switches by itself.',
|
|
298
|
+
'acct.nextWhyExpiring': "Of the {title} accounts, this one's weekly or monthly quota resets within a day, and what is left would be lost then, so use it first. sideby never switches by itself.",
|
|
299
|
+
'acct.nextWhyTight': 'Every {title} account is past its limit; this one has the most left, so it is the one to use next. It may run out soon. sideby never switches by itself.',
|
|
300
|
+
'acct.nextWhyUnknown': 'The {title} accounts with quota data are full; this one has no quota data yet, so it is the one to try next. sideby never switches by itself.',
|
|
301
|
+
'acct.nextRunning.one': '1 session running on it',
|
|
302
|
+
'acct.nextRunning.other': '{n} sessions running on it',
|
|
297
303
|
'stat.needWho': '{names}',
|
|
298
304
|
'stat.needWhoMore': '{names} and {n} more',
|
|
299
305
|
'acct.sameLogin': 'Same login as {names}',
|
|
@@ -657,6 +663,8 @@ const en = {
|
|
|
657
663
|
'ask.copyPrompt': 'Copy prompt',
|
|
658
664
|
'ask.promptShown': 'the prompt',
|
|
659
665
|
'ask.showPrompt': 'See the prompt',
|
|
666
|
+
'ask.actualPrompt': 'Exact prompt to send',
|
|
667
|
+
'ask.promptChanged': 'The prompt changed. Review the new prompt and confirm again; nothing was opened.',
|
|
660
668
|
'ask.readOnly': 'This panel is read-only, so it cannot open a terminal. Copy the prompt and paste it into any AI.',
|
|
661
669
|
'ask.opened': 'Opened {terminal} with {ref}. Carry on there.',
|
|
662
670
|
'ask.failed': '{terminal} did not open.',
|
|
@@ -719,7 +727,9 @@ const en = {
|
|
|
719
727
|
'pk.offerNoNameShort': 'Add short command',
|
|
720
728
|
'pk.namePh': 'e.g. cc',
|
|
721
729
|
'pk.started': 'Opened {ref} in {terminal} ({why}).',
|
|
722
|
-
'pk.why.room': '{w}{n}% used, most quota left',
|
|
730
|
+
'pk.why.room': '{w}{n}% used, most quota left for each running session',
|
|
731
|
+
'pk.why.roomRunning': '{w}{n}% used, {running} running, most quota left for each session',
|
|
732
|
+
'pk.why.expiring': '{w}{n}% used; its weekly or monthly quota resets within a day, so it goes first',
|
|
723
733
|
'pk.why.tight': 'every account is past its limit ({limit}% of a 5-hour window, {longLimit}% of a weekly one); this one has the most left, {w}{n}% used',
|
|
724
734
|
'pk.why.noData': 'no quota data yet',
|
|
725
735
|
'login.opened': 'Opened {terminal}: sign in to {ref} there.',
|
|
@@ -786,6 +796,9 @@ const en = {
|
|
|
786
796
|
'ask.ex.network.1': 'I am in the US; stop everything when the proxy drops',
|
|
787
797
|
'ask.ex.network.2': 'Allow only my Japan and Singapore nodes',
|
|
788
798
|
'ask.ex.network.3': 'A message was blocked; help me check the proxy',
|
|
799
|
+
'ask.title.network-diagnose': 'Let AI diagnose',
|
|
800
|
+
'ask.task.network-diagnose': 'AI explains the offline route, listener and cached Guard facts. It is read-only and changes nothing.',
|
|
801
|
+
'ask.ph.network-diagnose': 'No added text; the current diagnosis is included automatically',
|
|
789
802
|
'ask.ph.theme': 'What feel do you want? A website or a color works too.',
|
|
790
803
|
'ask.ex.theme.1': 'Quiet and gray, like Notion',
|
|
791
804
|
'ask.ex.theme.2': 'Green, like my company site',
|
|
@@ -1464,6 +1477,19 @@ const en = {
|
|
|
1464
1477
|
'net.pickFirst': 'Choose at least one country to turn it on. sideby never chooses for you, not even the current one.',
|
|
1465
1478
|
'net.now': 'Where your requests leave from',
|
|
1466
1479
|
'net.recheck': 'Check again',
|
|
1480
|
+
'net.diagnose': 'Diagnose connection',
|
|
1481
|
+
'net.diagnoseRefresh': 'Refresh diagnosis',
|
|
1482
|
+
'net.diagnosing': 'Diagnosing…',
|
|
1483
|
+
'net.diagnoseOffline': 'Offline only: reads the Guard cache and tests a selected local proxy TCP listener. It sends no online trace and never connects to a remote proxy.',
|
|
1484
|
+
'net.diagnoseRoute': 'Selected route: {proxy}',
|
|
1485
|
+
'net.diagnoseDirect': 'Direct connection; no proxy listener to test.',
|
|
1486
|
+
'net.diagnoseNoLocalProbe': 'No local TCP listener probe: the proxy is remote, invalid, or has no explicit port for its scheme.',
|
|
1487
|
+
'net.diagnoseListenerUp': 'TCP listener reachable at {host}:{port}.',
|
|
1488
|
+
'net.diagnoseListenerDown': 'TCP listener not reachable at {host}:{port} ({error}).',
|
|
1489
|
+
'net.diagnoseTcpLimit': 'TCP reachability does not prove that HTTP CONNECT, SOCKS or the upstream proxy works.',
|
|
1490
|
+
'net.diagnoseUnsupported': 'This proxy scheme is not supported by Network Guard, which supports HTTP CONNECT only. Configure an HTTP proxy or direct connection, then check again.',
|
|
1491
|
+
'net.diagnoseInvalid': 'The proxy address is invalid. Correct it in the environment and start a new session.',
|
|
1492
|
+
'net.diagnoseChecked': 'Diagnosed {when}',
|
|
1467
1493
|
'net.ok': 'allowed',
|
|
1468
1494
|
'net.blocked': 'not allowed',
|
|
1469
1495
|
'net.unknown': 'cannot tell',
|
|
@@ -2141,6 +2167,12 @@ const zh = {
|
|
|
2141
2167
|
'acct.next': '建议使用',
|
|
2142
2168
|
'acct.nextWhy': '{title} 的账号里,这个剩余额度最多,接下来用它最合适。sideby 不会自己切换。',
|
|
2143
2169
|
'acct.nextCopy': '复制启动它的命令',
|
|
2170
|
+
'acct.nextWhyRoom': '{title} 的账号里,按已在跑的会话分摊后,这个每个会话分到的额度最多,新任务会分散开,不挤在一个账号上。sideby 不会自己切换。',
|
|
2171
|
+
'acct.nextWhyExpiring': '{title} 的账号里,这个的周额度或月额度一天内就重置,剩下的到时会作废,所以先用它。sideby 不会自己切换。',
|
|
2172
|
+
'acct.nextWhyTight': '{title} 的账号都已到上限,这个剩得最多,接下来用它,可能很快用完。sideby 不会自己切换。',
|
|
2173
|
+
'acct.nextWhyUnknown': '{title} 里有额度数据的账号都满了,这个还没有额度数据,接下来先试它。sideby 不会自己切换。',
|
|
2174
|
+
'acct.nextRunning.one': '它上面有 1 个会话在跑',
|
|
2175
|
+
'acct.nextRunning.other': '它上面有 {n} 个会话在跑',
|
|
2144
2176
|
'stat.needWho': '{names}',
|
|
2145
2177
|
'stat.needWhoMore': '{names} 等 {n} 个',
|
|
2146
2178
|
'acct.sameLogin': '与 {names} 同一登录',
|
|
@@ -2504,6 +2536,8 @@ const zh = {
|
|
|
2504
2536
|
'ask.copyPrompt': '复制提示词',
|
|
2505
2537
|
'ask.promptShown': '提示词',
|
|
2506
2538
|
'ask.showPrompt': '查看提示词',
|
|
2539
|
+
'ask.actualPrompt': '将发送的完整提示词',
|
|
2540
|
+
'ask.promptChanged': '提示词有变化。请查看新提示词后再次确认;这次没有打开终端。',
|
|
2507
2541
|
'ask.readOnly': '这个面板是只读的,不能打开终端。复制提示词,贴给任何 AI 就行。',
|
|
2508
2542
|
'ask.opened': '已用 {ref} 打开 {terminal},请到那边继续。',
|
|
2509
2543
|
'ask.failed': '{terminal} 没有打开。',
|
|
@@ -2566,7 +2600,9 @@ const zh = {
|
|
|
2566
2600
|
'pk.offerNoNameShort': '添加短命令',
|
|
2567
2601
|
'pk.namePh': '例如 cc',
|
|
2568
2602
|
'pk.started': '已在 {terminal} 启动 {ref}({why})。',
|
|
2569
|
-
'pk.why.room': '{w}已用 {n}
|
|
2603
|
+
'pk.why.room': '{w}已用 {n}%,按在跑的会话分摊后额度最多',
|
|
2604
|
+
'pk.why.roomRunning': '{w}已用 {n}%,有 {running} 个会话在跑,每个会话分到的额度最多',
|
|
2605
|
+
'pk.why.expiring': '{w}已用 {n}%;它的周额度或月额度一天内重置,所以先用它',
|
|
2570
2606
|
'pk.why.tight': '所有账号都已到上限(5 小时窗口 {limit}%,每周窗口 {longLimit}%);这个剩得最多,{w}已用 {n}%',
|
|
2571
2607
|
'pk.why.noData': '还没有额度数据',
|
|
2572
2608
|
'login.opened': '已打开 {terminal},请在那里登录 {ref}。',
|
|
@@ -2633,6 +2669,9 @@ const zh = {
|
|
|
2633
2669
|
'ask.ex.network.1': '我在美国,代理一断就全部拦住',
|
|
2634
2670
|
'ask.ex.network.2': '只允许日本和新加坡节点',
|
|
2635
2671
|
'ask.ex.network.3': '消息被拦了,帮我查查代理',
|
|
2672
|
+
'ask.title.network-diagnose': '让 AI 诊断',
|
|
2673
|
+
'ask.task.network-diagnose': 'AI 只读解释离线路由、listener 和缓存检查结果,不修改任何设置或文件。',
|
|
2674
|
+
'ask.ph.network-diagnose': '无需补充;会自动带上当前诊断',
|
|
2636
2675
|
'ask.ph.theme': '想要什么感觉?给个网址或颜色也行。',
|
|
2637
2676
|
'ask.ex.theme.1': '素净的灰色,像 Notion',
|
|
2638
2677
|
'ask.ex.theme.2': '绿色,和我们公司官网一样',
|
|
@@ -3311,6 +3350,19 @@ const zh = {
|
|
|
3311
3350
|
'net.pickFirst': '至少选一个地区才能打开。sideby 不替你选,当前所在的地区也不会自动选上。',
|
|
3312
3351
|
'net.now': '现在的请求从哪里发出',
|
|
3313
3352
|
'net.recheck': '重新检查',
|
|
3353
|
+
'net.diagnose': '诊断连接',
|
|
3354
|
+
'net.diagnoseRefresh': '刷新诊断',
|
|
3355
|
+
'net.diagnosing': '正在诊断…',
|
|
3356
|
+
'net.diagnoseOffline': '只读离线诊断:读取缓存并测试本地代理的 TCP listener,不发在线 trace,也不连接远程代理。',
|
|
3357
|
+
'net.diagnoseRoute': '本次选择的路由:{proxy}',
|
|
3358
|
+
'net.diagnoseDirect': '直连,没有代理 listener 要测试。',
|
|
3359
|
+
'net.diagnoseNoLocalProbe': '未探测本地 TCP listener:代理在远程、地址无效,或该协议没有明确端口。',
|
|
3360
|
+
'net.diagnoseListenerUp': 'TCP listener 可连接:{host}:{port}。',
|
|
3361
|
+
'net.diagnoseListenerDown': 'TCP listener 连不上:{host}:{port}({error})。',
|
|
3362
|
+
'net.diagnoseTcpLimit': 'TCP 能连接不代表 HTTP CONNECT、SOCKS 或上游代理协议可用。',
|
|
3363
|
+
'net.diagnoseUnsupported': 'Network Guard 只支持 HTTP CONNECT,不支持这个代理协议。请配置 HTTP 代理或直连后再检查。',
|
|
3364
|
+
'net.diagnoseInvalid': '代理地址无效。请修正环境变量,再新开会话。',
|
|
3365
|
+
'net.diagnoseChecked': '{when}诊断过',
|
|
3314
3366
|
'net.ok': '允许',
|
|
3315
3367
|
'net.blocked': '不允许',
|
|
3316
3368
|
'net.unknown': '查不出',
|
|
@@ -684,8 +684,9 @@ export declare function loginKey(refs: readonly string[]): string;
|
|
|
684
684
|
* 16 capitals or digits), and a JWT (three base64url parts joined by dots, the first starting `eyJ`). Then any run of
|
|
685
685
|
* 32 or more letters, digits, `_`, `-` or `+` that mixes letters and digits, unless the whitespace-free word it sits
|
|
686
686
|
* in is a URL or a file path (it has a `/`); a 40-character git SHA is such a run. Everything else, whitespace and
|
|
687
|
-
* newlines included, stays as it was
|
|
688
|
-
* user to the
|
|
687
|
+
* newlines included, stays as it was, except a URL with userinfo is reduced to scheme and host (credentials, path,
|
|
688
|
+
* query and fragment removed). `removed` says whether anything was taken out, so the caller can point the user to the
|
|
689
|
+
* key box.
|
|
689
690
|
*/
|
|
690
691
|
export declare function stripSecrets(text: string): {
|
|
691
692
|
text: string;
|
|
@@ -711,8 +712,28 @@ export declare function networkTaskFacts(n: {
|
|
|
711
712
|
skip?: string;
|
|
712
713
|
}[];
|
|
713
714
|
}): string[];
|
|
715
|
+
export declare function networkDiagnoseTaskFacts(d: {
|
|
716
|
+
checkedAt: string;
|
|
717
|
+
targets: readonly {
|
|
718
|
+
url: string;
|
|
719
|
+
proxy: string;
|
|
720
|
+
guardSupport: string;
|
|
721
|
+
listener: null | {
|
|
722
|
+
host: string;
|
|
723
|
+
port: number;
|
|
724
|
+
reachable: boolean;
|
|
725
|
+
error?: string;
|
|
726
|
+
};
|
|
727
|
+
guard: {
|
|
728
|
+
status: string;
|
|
729
|
+
loc?: string;
|
|
730
|
+
checkedAt?: string;
|
|
731
|
+
error?: string;
|
|
732
|
+
};
|
|
733
|
+
}[];
|
|
734
|
+
}): string[];
|
|
714
735
|
/** The kinds of AI Task (spec §3.28); anything else is refused. */
|
|
715
|
-
export declare const AI_TASK_KINDS: readonly ['free', 'fix', 'quota', 'account', 'host', 'plugin', 'terminal', 'theme', 'handoff', 'menubar', 'hotkey', 'network', 'update'];
|
|
736
|
+
export declare const AI_TASK_KINDS: readonly ['free', 'fix', 'quota', 'account', 'host', 'plugin', 'terminal', 'theme', 'handoff', 'menubar', 'hotkey', 'network', 'network-diagnose', 'update'];
|
|
716
737
|
export type AiTaskKind = (typeof AI_TASK_KINDS)[number];
|
|
717
738
|
/**
|
|
718
739
|
* The message keys of the AI dialog for `task` (spec §3.28 "每个入口的提示"): its title, the text box placeholder and
|
|
@@ -858,6 +879,8 @@ export declare function taskPrompt(input: {
|
|
|
858
879
|
handoff?: readonly string[];
|
|
859
880
|
/** Network Guard facts, one per line, as `networkTaskFacts` gives them (`network` task, spec §3.35). */
|
|
860
881
|
network?: readonly string[];
|
|
882
|
+
/** Offline route/listener/cache facts for the fixed read-only `network-diagnose` task. */
|
|
883
|
+
networkDiagnose?: readonly string[];
|
|
861
884
|
/** The error the last Update Check or Update showed (`update` task, spec §3.23). */
|
|
862
885
|
updateError?: string;
|
|
863
886
|
};
|