sideby 0.41.2 → 0.42.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 +2 -0
- package/dist/src/cli/commands.js +263 -32
- package/dist/src/cli/json-schemas.js +85 -4
- package/dist/src/cli/main.js +49 -7
- package/dist/src/core/claude-memory.d.ts +236 -0
- package/dist/src/core/claude-memory.js +937 -0
- package/dist/src/core/cli-commands.js +16 -3
- package/dist/src/core/config.d.ts +17 -0
- package/dist/src/core/config.js +266 -43
- package/dist/src/core/history-project.d.ts +14 -0
- package/dist/src/core/history-project.js +42 -12
- package/dist/src/core/history.d.ts +4 -6
- package/dist/src/core/history.js +5 -15
- package/dist/src/core/local-build.d.ts +12 -0
- package/dist/src/core/local-build.js +32 -0
- package/dist/src/core/search-catalog.js +49 -0
- package/dist/src/core/session-hooks.d.ts +12 -2
- package/dist/src/core/session-hooks.js +12 -8
- package/dist/src/core/unattended-followup.d.ts +62 -0
- package/dist/src/core/unattended-followup.js +205 -0
- package/dist/src/core/unattended-pending.d.ts +11 -3
- package/dist/src/core/unattended-pending.js +34 -8
- package/dist/src/families/claude/history.js +9 -1
- package/dist/src/families/claude/layout.d.ts +7 -0
- package/dist/src/families/claude/layout.js +17 -0
- package/dist/src/families/claude/live-sessions.js +2 -1
- package/dist/src/families/history.d.ts +22 -2
- package/dist/src/families/history.js +55 -0
- package/dist/src/handoff/messages.js +1 -1
- package/dist/src/panel/handler.d.ts +22 -4
- package/dist/src/panel/handler.js +71 -25
- package/dist/src/panel/i18n.d.ts +35 -1
- package/dist/src/panel/i18n.js +72 -4
- package/dist/src/panel/page-logic.d.ts +53 -0
- package/dist/src/panel/page-logic.js +96 -0
- package/dist/src/panel/page-script.js +174 -36
- package/dist/src/panel/page-styles.js +18 -0
- package/dist/src/runtime.d.ts +30 -0
- package/dist/src/runtime.js +85 -1
- package/dist/src/unattended/hook.d.ts +10 -5
- package/dist/src/unattended/hook.js +17 -12
- package/package.json +1 -1
- package/schemas/config.json +5 -1
- package/schemas/memory-set.json +117 -0
- package/schemas/memory.json +210 -0
- package/schemas/unattended-pending.json +156 -56
- package/skills/sideby/SKILL.md +3 -1
- package/skills/sideby/references/diagnose.md +1 -0
- package/skills/sideby/references/handoff.md +1 -1
- package/skills/sideby/references/panel.md +1 -1
- package/skills/sideby/references/sharing.md +23 -1
- package/skills/sideby/references/unattended.md +16 -5
|
@@ -1799,6 +1799,42 @@ export function historyWhen(iso, now) {
|
|
|
1799
1799
|
const pad = (n) => String(n).padStart(2, '0');
|
|
1800
1800
|
return { key: 'time.on', date: d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()) };
|
|
1801
1801
|
}
|
|
1802
|
+
/**
|
|
1803
|
+
* When the words for `iso` (historyWhen, and the page's date, which shows the year only for another year) change
|
|
1804
|
+
* next, as a time after `now`: the next minute under an hour, the next hour under a day, the next day under a week
|
|
1805
|
+
* (the seventh is when they turn into a date), and after that the next New Year. Infinity for a time that is not a date.
|
|
1806
|
+
*/
|
|
1807
|
+
export function historyWhenNext(iso, now) {
|
|
1808
|
+
const ts = Date.parse(iso || '');
|
|
1809
|
+
if (!Number.isFinite(ts))
|
|
1810
|
+
return Number.POSITIVE_INFINITY;
|
|
1811
|
+
const ms = Math.max(0, now - ts);
|
|
1812
|
+
if (ms < 7 * 86_400_000) {
|
|
1813
|
+
const step = ms < 3_600_000 ? 60_000 : ms < 86_400_000 ? 3_600_000 : 86_400_000;
|
|
1814
|
+
return ts + (Math.floor(ms / step) + 1) * step;
|
|
1815
|
+
}
|
|
1816
|
+
return new Date(new Date(now).getFullYear() + 1, 0, 1).getTime();
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* A date formatter that keeps one Intl.DateTimeFormat per locale and options: `toLocaleDateString(locale, options)`
|
|
1820
|
+
* builds a new one on every call, which was most of the time a long list spent showing its dates.
|
|
1821
|
+
*/
|
|
1822
|
+
export function dateFormatter() {
|
|
1823
|
+
const made = new Map();
|
|
1824
|
+
return (date, locale, options) => {
|
|
1825
|
+
const key = `${locale} ${JSON.stringify(options)}`;
|
|
1826
|
+
let f = made.get(key);
|
|
1827
|
+
if (!f) {
|
|
1828
|
+
f = new Intl.DateTimeFormat(locale, options);
|
|
1829
|
+
made.set(key, f);
|
|
1830
|
+
}
|
|
1831
|
+
return f.format(date);
|
|
1832
|
+
};
|
|
1833
|
+
}
|
|
1834
|
+
/** Everything a History row shows and its buttons act on, so a row drawn from the same can be kept as it is. */
|
|
1835
|
+
export function historyRowSig(session, words, noProject, lang) {
|
|
1836
|
+
return JSON.stringify([lang, words, Boolean(noProject), session]);
|
|
1837
|
+
}
|
|
1802
1838
|
/** `text` cut into the parts that match one of `words` (any case) and the parts between, for highlighting. */
|
|
1803
1839
|
export function highlightParts(text, words) {
|
|
1804
1840
|
const low = text.toLowerCase();
|
|
@@ -2146,6 +2182,66 @@ export function uaGroupPending(list) {
|
|
|
2146
2182
|
.sort(([, a], [, b]) => newest(b) - newest(a))
|
|
2147
2183
|
.map(([key, items]) => ({ key, first: items[0], items }));
|
|
2148
2184
|
}
|
|
2185
|
+
/**
|
|
2186
|
+
* Where a new toast goes among the shown ones: `replaces`, a keyed one with the same key and other text (the theme's
|
|
2187
|
+
* toast, say); `merges`, one with the same text, and the same key when the new one has a key, so two marks that each
|
|
2188
|
+
* carry an Undo stay two toasts with their own Undo.
|
|
2189
|
+
*/
|
|
2190
|
+
export function toastMerge(shown, text, key) {
|
|
2191
|
+
return {
|
|
2192
|
+
replaces: key ? shown.find((x) => x.key === key && x.text !== text) : undefined,
|
|
2193
|
+
merges: shown.find((x) => x.text === text && (!key || x.key === key)),
|
|
2194
|
+
};
|
|
2195
|
+
}
|
|
2196
|
+
/**
|
|
2197
|
+
* Pending Decisions grouped by Project, then by the Session that left them, as the Unattended page and `sideby
|
|
2198
|
+
* unattended pending` show them (spec §3.37, ADR-0078). What nobody touched (`open`) comes first at every level: a
|
|
2199
|
+
* Project with an open one before the others, the newest open one first, then the rest by their newest one, and the
|
|
2200
|
+
* group without a Project (`project` '') last. Inside a Project a Session's open ones and its other ones are two
|
|
2201
|
+
* blocks, so every open block comes before every replied one, each set ordered the same way; inside a block the
|
|
2202
|
+
* replied ones before the done ones, each oldest first. Counts are per state.
|
|
2203
|
+
*/
|
|
2204
|
+
export function uaGroupByProject(list) {
|
|
2205
|
+
const rank = (d) => (d.state === 'replied' ? 1 : d.state === 'done' ? 2 : 0);
|
|
2206
|
+
const time = (d) => Date.parse(d.at);
|
|
2207
|
+
const order = (a, b) => rank(a) - rank(b) || time(a) - time(b) || a.id.localeCompare(b.id);
|
|
2208
|
+
// Those with an open one first, the newest open one first; then by the newest one.
|
|
2209
|
+
const lead = (items) => {
|
|
2210
|
+
const open = items.filter((d) => rank(d) === 0).map(time);
|
|
2211
|
+
return [open.length ? 0 : 1, -Math.max(...(open.length ? open : items.map(time)))];
|
|
2212
|
+
};
|
|
2213
|
+
const before = (a, b) => {
|
|
2214
|
+
const [x, y] = [lead(a), lead(b)];
|
|
2215
|
+
return x[0] - y[0] || x[1] - y[1];
|
|
2216
|
+
};
|
|
2217
|
+
const projects = new Map();
|
|
2218
|
+
for (const d of list)
|
|
2219
|
+
projects.set(d.project, [...(projects.get(d.project) ?? []), d]);
|
|
2220
|
+
return [...projects]
|
|
2221
|
+
.sort(([pa, a], [pb, b]) => Number(pa === '') - Number(pb === '') || before(a, b) || pa.localeCompare(pb))
|
|
2222
|
+
.map(([project, items]) => {
|
|
2223
|
+
const sessions = new Map();
|
|
2224
|
+
for (const d of items) {
|
|
2225
|
+
const key = `${project}|${d.sessionId ? `s:${d.sessionId}` : 'none'}|${rank(d) === 0 ? 'open' : 'rest'}`;
|
|
2226
|
+
sessions.set(key, [...(sessions.get(key) ?? []), d]);
|
|
2227
|
+
}
|
|
2228
|
+
const count = (r) => items.filter((d) => rank(d) === r).length;
|
|
2229
|
+
return {
|
|
2230
|
+
key: `p:${project}`,
|
|
2231
|
+
project,
|
|
2232
|
+
name: items[0].projectName,
|
|
2233
|
+
open: count(0),
|
|
2234
|
+
replied: count(1),
|
|
2235
|
+
done: count(2),
|
|
2236
|
+
sessions: [...sessions]
|
|
2237
|
+
.sort(([ka, a], [kb, b]) => before(a, b) || ka.localeCompare(kb))
|
|
2238
|
+
.map(([key, s]) => {
|
|
2239
|
+
const sorted = [...s].sort(order);
|
|
2240
|
+
return { key, first: sorted[0], items: sorted };
|
|
2241
|
+
}),
|
|
2242
|
+
};
|
|
2243
|
+
});
|
|
2244
|
+
}
|
|
2149
2245
|
/**
|
|
2150
2246
|
* A time typed into the Unattended page's 24-hour fields as `HH:MM`, or null when it is not one. Takes `7:30`,
|
|
2151
2247
|
* `07:30`, `730`, `0730`, `7` (07:00), and the full-width colon a Chinese input method types; the field's `pattern`
|
|
@@ -6,7 +6,7 @@ import { groupsToAccept } from '../core/inbound.js';
|
|
|
6
6
|
import { limitResetOffer, quotaAge, quotaIsStale, windowAge } from '../core/quota-levels.js';
|
|
7
7
|
import { remoteControlTodo } from '../core/remote-control.js';
|
|
8
8
|
import { catalogMatchLevel, catalogNorm, searchCatalog } from '../core/search-catalog.js';
|
|
9
|
-
import { accountTitle, advisorPick, advisorSummary, aiTaskAccounts, aliasArgsOf, aliasIssue, aliasPrefix, askBridge, askBridged, askCopy, askPermissionNote, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dotsKeepKeyboard, enableOutcome, expiredLogins, fileSize, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyWhen, hotkeyFromKey, hotkeyPressKind, inDisplayOrder, loginClusters, loginKey, longWindow, maskEmail, matchesQuery, mdBlocks, mdInline, menuPlacement, mergeDaily, mergeUsage, messageChip, messageNews, messageToCheck, networkTaskFacts, newAccountDir, nextReset, openBridge, openBridged, orderedAliases, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, portalRefresh, quotaAskable, quotaHighLevel, quotaPressure, radioStep, reloadForBuild, remoteControlSummary, reorder, resetWhen, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, sessionRowShape, shortCwd, shortSessionLabel, sortAccounts, sortMenu, sortSessions, startedFromView, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, uaDayRuns, uaGroupPending, uaOnChoices, uaParseClock, uaPickTime, uaSameSlot, uaShouldRead, uaSlotNight, uaStatusParts, uaStepClock, uaToggleDay, uaWaitingCount, uaWhen, updatedAge, vendorAlias, widthFollower, widthTier, windowState, withPinned, } from './page-logic.js';
|
|
9
|
+
import { accountTitle, advisorPick, advisorSummary, aiTaskAccounts, aliasArgsOf, aliasIssue, aliasPrefix, askBridge, askBridged, askCopy, askPermissionNote, attentionReasons, attentionWhy, autostartNote, bindingWindow, cacheHitRate, canLeaveLocal, categoryOrder, codeSwapOutcome, dateFormatter, dotsKeepKeyboard, enableOutcome, expiredLogins, fileSize, fixPrompt, foldSkips, foldToolCalls, formatDuration, handoffChangeOf, handoffHintAccount, handoffTaskFacts, hiddenIn, highlightParts, histFilters, historyEmpty, historyRowSig, historyWhen, historyWhenNext, hotkeyFromKey, hotkeyPressKind, inDisplayOrder, loginClusters, loginKey, longWindow, maskEmail, matchesQuery, mdBlocks, mdInline, menuPlacement, mergeDaily, mergeUsage, messageChip, messageNews, messageToCheck, networkTaskFacts, newAccountDir, nextReset, openBridge, openBridged, orderedAliases, panelFixes, panelHint, panelLang, panelMigration, panelPrefs, passedWindow, pinnedIn, portalRefresh, quotaAskable, quotaHighLevel, quotaPressure, radioStep, reloadForBuild, remoteControlSummary, reorder, resetWhen, rowBadge, runCodeSwap, saveHandoffChange, sendBlock, sendFileProblem, sendResultView, sessionAge, sessionLabelParts, sessionRowShape, shortCwd, shortSessionLabel, sortAccounts, sortMenu, sortSessions, startedFromView, steadyOrder, stripSecrets, suggestAlias, suggestName, switchFailure, tailInView, taskFindings, toastMerge, uaDayRuns, uaGroupByProject, uaGroupPending, uaOnChoices, uaParseClock, uaPickTime, uaSameSlot, uaShouldRead, uaSlotNight, uaStatusParts, uaStepClock, uaToggleDay, uaWaitingCount, uaWhen, updatedAge, vendorAlias, widthFollower, widthTier, windowState, withPinned, } from './page-logic.js';
|
|
10
10
|
// The component library's dropdown menu, copied by the brand repo's add script (--html into ui/); do not edit it.
|
|
11
11
|
import { CHECK, menuItem, menuScript } from './ui/dropdown-menu/dropdown-menu.html.js';
|
|
12
12
|
import { cn, esc } from './ui/lib/cn.js';
|
|
@@ -53,7 +53,9 @@ const LOGIC = [
|
|
|
53
53
|
foldToolCalls,
|
|
54
54
|
highlightParts,
|
|
55
55
|
historyEmpty,
|
|
56
|
+
historyRowSig,
|
|
56
57
|
historyWhen,
|
|
58
|
+
historyWhenNext,
|
|
57
59
|
handoffChangeOf,
|
|
58
60
|
handoffHintAccount,
|
|
59
61
|
handoffTaskFacts,
|
|
@@ -77,6 +79,7 @@ const LOGIC = [
|
|
|
77
79
|
nextReset,
|
|
78
80
|
canLeaveLocal,
|
|
79
81
|
codeSwapOutcome,
|
|
82
|
+
dateFormatter,
|
|
80
83
|
runCodeSwap,
|
|
81
84
|
switchFailure,
|
|
82
85
|
panelFixes,
|
|
@@ -115,6 +118,7 @@ const LOGIC = [
|
|
|
115
118
|
suggestAlias,
|
|
116
119
|
suggestName,
|
|
117
120
|
tailInView,
|
|
121
|
+
toastMerge,
|
|
118
122
|
updatedAge,
|
|
119
123
|
pinnedIn,
|
|
120
124
|
hiddenIn,
|
|
@@ -132,6 +136,7 @@ const LOGIC = [
|
|
|
132
136
|
uaToggleDay,
|
|
133
137
|
uaSameSlot,
|
|
134
138
|
uaGroupPending,
|
|
139
|
+
uaGroupByProject,
|
|
135
140
|
uaParseClock,
|
|
136
141
|
uaStepClock,
|
|
137
142
|
uaShouldRead,
|
|
@@ -262,6 +267,10 @@ const MAIN = String.raw `
|
|
|
262
267
|
return out.filter((x) => x !== '')
|
|
263
268
|
}
|
|
264
269
|
const locale = () => (lang === 'zh' ? 'zh-CN' : 'en-US')
|
|
270
|
+
// A date in the page's language, as toLocaleDateString(locale(), options) would write it (page-logic.ts, dateFormatter),
|
|
271
|
+
// which also says "Invalid Date" where a formatter would throw.
|
|
272
|
+
const formatDate = dateFormatter()
|
|
273
|
+
function dateIn(d, options) { return Number.isFinite(d.getTime()) ? formatDate(d, locale(), options) : 'Invalid Date' }
|
|
265
274
|
|
|
266
275
|
function h(tag, props, ...kids) {
|
|
267
276
|
const el = document.createElement(tag)
|
|
@@ -459,13 +468,33 @@ const MAIN = String.raw `
|
|
|
459
468
|
if (!o || used.has(o) || o.nodeType !== n.nodeType || o.nodeName !== n.nodeName) return n
|
|
460
469
|
if (n.nodeType === 3) { if (o.data !== n.data) o.data = n.data; used.add(o); return o }
|
|
461
470
|
if (n.nodeType !== 1) return n
|
|
462
|
-
if (
|
|
463
|
-
|
|
471
|
+
if (n._make) {
|
|
472
|
+
if (o._sig === n._sig) { used.add(o); return o }
|
|
473
|
+
n = made(n)
|
|
474
|
+
}
|
|
475
|
+
const both = o.hasAttribute('data-patch') && n.hasAttribute('data-patch')
|
|
476
|
+
// A container holding stand-ins never has the same markup: it goes child by child without being compared whole.
|
|
477
|
+
if (!(both && n.querySelector('[data-stand]')) && markup(o) === markup(n)) { used.add(o); return o }
|
|
478
|
+
if (both) { syncAttrs(o, n); patchKids(o, Array.from(n.childNodes)); used.add(o); return o }
|
|
464
479
|
return n
|
|
465
480
|
})
|
|
466
481
|
for (const o of old) if (!used.has(o)) o.remove()
|
|
467
482
|
result.forEach((n, i) => { if (box.childNodes[i] !== n) box.insertBefore(n, box.childNodes[i] || null) })
|
|
468
483
|
}
|
|
484
|
+
// A stand-in for an element of a long list that make() builds (a div with this data-key): patch keeps the element
|
|
485
|
+
// drawn before when it was made with the same sig, so a row that did not change is neither built nor compared, and
|
|
486
|
+
// never leaves the page (focus, hover and a text selection in it stay); make() runs only for a new or changed one.
|
|
487
|
+
function standIn(key, sig, make) {
|
|
488
|
+
const el = h('div', { 'data-key': key, 'data-stand': '' })
|
|
489
|
+
el._sig = sig
|
|
490
|
+
el._make = make
|
|
491
|
+
return el
|
|
492
|
+
}
|
|
493
|
+
function made(stand) {
|
|
494
|
+
const el = stand._make()
|
|
495
|
+
el._sig = stand._sig
|
|
496
|
+
return el
|
|
497
|
+
}
|
|
469
498
|
function pathOf(el, root) {
|
|
470
499
|
const p = []
|
|
471
500
|
while (el && el !== root) {
|
|
@@ -489,6 +518,8 @@ const MAIN = String.raw `
|
|
|
489
518
|
const path = anchor !== box || (active && box.contains(active) && active !== box) ? pathOf(active, anchor) : null
|
|
490
519
|
const chain = keys.map((el) => el.getAttribute('data-key'))
|
|
491
520
|
patchKids(box, kids)
|
|
521
|
+
// Stand-ins that came in with a new container (a first draw, a new group) are built in place.
|
|
522
|
+
for (const x of box.querySelectorAll('[data-stand]')) x.replaceWith(made(x))
|
|
492
523
|
if (path && !active.isConnected) {
|
|
493
524
|
let el = box
|
|
494
525
|
for (const k of chain) el = el && Array.from(el.querySelectorAll('[data-key]')).find((x) => x.getAttribute('data-key') === k)
|
|
@@ -686,10 +717,11 @@ const MAIN = String.raw `
|
|
|
686
717
|
opts = opts || {}
|
|
687
718
|
const kind = opts.kind || 'ok'
|
|
688
719
|
const ms = opts.duration || Math.max(2000, Math.min(8000, 1800 + text.length * 40 + (opts.action ? 4000 : 0) + (kind === 'fail' ? 2000 : 0)))
|
|
689
|
-
// A keyed toast (such as the theme) replaces the earlier one with that key
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
720
|
+
// A keyed toast (such as the theme) replaces the earlier one with that key; the same text merges into one toast,
|
|
721
|
+
// unless they carry different keys (two Undos stay two).
|
|
722
|
+
const where = toastMerge(toasts, text, opts.key)
|
|
723
|
+
if (where.replaces) dismiss(where.replaces)
|
|
724
|
+
let item = where.merges
|
|
693
725
|
if (item) {
|
|
694
726
|
clearTimeout(item.timer)
|
|
695
727
|
item.el.classList.remove('bump')
|
|
@@ -752,15 +784,15 @@ const MAIN = String.raw `
|
|
|
752
784
|
function clock(iso) {
|
|
753
785
|
const d = new Date(iso)
|
|
754
786
|
if (!Number.isFinite(d.getTime())) return '?'
|
|
755
|
-
const time = d
|
|
787
|
+
const time = dateIn(d, { hour: '2-digit', minute: '2-digit' })
|
|
756
788
|
const now = new Date()
|
|
757
789
|
if (d.toDateString() === now.toDateString()) return time
|
|
758
|
-
if (Math.abs(d - now) < 6 * 864e5) return d
|
|
759
|
-
return d
|
|
790
|
+
if (Math.abs(d - now) < 6 * 864e5) return dateIn(d, { weekday: 'short' }) + ' ' + time
|
|
791
|
+
return dateIn(d, { month: 'short', day: 'numeric' }) + ' ' + time
|
|
760
792
|
}
|
|
761
793
|
function day(iso) {
|
|
762
794
|
const d = new Date(iso)
|
|
763
|
-
return Number.isFinite(d.getTime()) ? d
|
|
795
|
+
return Number.isFinite(d.getTime()) ? dateIn(d, { month: 'short', day: 'numeric' }) : '?'
|
|
764
796
|
}
|
|
765
797
|
function countdown(iso, now) {
|
|
766
798
|
const at = Date.parse(iso)
|
|
@@ -1346,7 +1378,7 @@ const MAIN = String.raw `
|
|
|
1346
1378
|
daily.map((d, i) => {
|
|
1347
1379
|
const v = Number(d.totalTokens) || 0
|
|
1348
1380
|
const date = new Date(d.date + 'T12:00:00')
|
|
1349
|
-
const day = Number.isFinite(date.getTime()) ? date
|
|
1381
|
+
const day = Number.isFinite(date.getTime()) ? dateIn(date, { weekday: 'short', month: 'numeric', day: 'numeric' }) : d.date
|
|
1350
1382
|
// Every day keeps its slot; an empty day shows only a short stub on the baseline, so it reads as a gap in time.
|
|
1351
1383
|
return h('i', { class: (i === daily.length - 1 ? 'today' : '') + (v ? '' : ' zero') || null, title: day + colon() + tokens(v) },
|
|
1352
1384
|
h('b', { css: { height: v && max ? Math.max(10, Math.round((v / max) * 100)) + '%' : null } }))
|
|
@@ -4246,14 +4278,14 @@ const MAIN = String.raw `
|
|
|
4246
4278
|
function histFold(by) { return prefs.histFold[by] || (prefs.histFold[by] = {}) }
|
|
4247
4279
|
function fullWhen(iso) {
|
|
4248
4280
|
const d = new Date(iso)
|
|
4249
|
-
return Number.isFinite(d.getTime()) ? d
|
|
4281
|
+
return Number.isFinite(d.getTime()) ? dateIn(d, { dateStyle: 'medium', timeStyle: 'short' }) : ''
|
|
4250
4282
|
}
|
|
4251
4283
|
function whenText(iso) {
|
|
4252
4284
|
const w = historyWhen(iso, Date.now())
|
|
4253
4285
|
if (!w) return ''
|
|
4254
4286
|
if (w.key !== 'time.on') return t(w.key, { n: w.n })
|
|
4255
4287
|
const d = new Date(iso)
|
|
4256
|
-
const date = d
|
|
4288
|
+
const date = dateIn(d, d.getFullYear() === new Date().getFullYear() ? { month: 'short', day: 'numeric' } : { dateStyle: 'medium' })
|
|
4257
4289
|
return t(w.key, { date })
|
|
4258
4290
|
}
|
|
4259
4291
|
// A snippet that only repeats the title (ellipses and spacing aside) adds nothing under it.
|
|
@@ -4777,7 +4809,7 @@ const MAIN = String.raw `
|
|
|
4777
4809
|
})
|
|
4778
4810
|
return h('section', { class: 'hist-group' + (open ? '' : ' is-folded'), 'data-key': 'hg-' + by + '-' + g.key, 'aria-label': title, 'data-patch': '' },
|
|
4779
4811
|
h('div', { class: 'hist-ghead', 'data-key': 'hgh' }, btn),
|
|
4780
|
-
open && list.length ? h('div', { class: 'group-list hist-rows', role: 'list', id: bodyId, 'data-key': 'hgr', 'data-patch': '' }, list.map((s) =>
|
|
4812
|
+
open && list.length ? h('div', { class: 'group-list hist-rows', role: 'list', id: bodyId, 'data-key': 'hgr', 'data-patch': '' }, list.map((s) => listedHistoryRow(s, words, by === 'project' || Boolean(hs.project)))) : null)
|
|
4781
4813
|
})
|
|
4782
4814
|
}
|
|
4783
4815
|
// Folding eases the group's rows away and drops them from the list at once; the list is then asked again quietly,
|
|
@@ -4900,6 +4932,12 @@ const MAIN = String.raw `
|
|
|
4900
4932
|
})
|
|
4901
4933
|
return withMenu(row, (a) => historyMenu(a, s, more))
|
|
4902
4934
|
}
|
|
4935
|
+
// A row of the list itself (patchIf): a stand-in that keeps the row already drawn from the same session, words and
|
|
4936
|
+
// language, so folding a group or loading more builds only the rows that are new. The buttons of a kept row act on
|
|
4937
|
+
// the session it was drawn from, which the same sig means has not changed.
|
|
4938
|
+
function listedHistoryRow(s, words, noProject) {
|
|
4939
|
+
return standIn('hr-' + s.account + '-' + s.sessionId, historyRowSig(s, words, noProject, lang), () => historyRow(s, words, noProject))
|
|
4940
|
+
}
|
|
4903
4941
|
// Each item carries its own leading dot; the dots of items that start a line fall outside the box and are clipped.
|
|
4904
4942
|
function metaItems(parts) {
|
|
4905
4943
|
return parts.filter((p) => p !== null && p !== undefined && p !== false && p !== '').map((p) => h('span', { class: 'hist-mi' }, p))
|
|
@@ -4945,7 +4983,7 @@ const MAIN = String.raw `
|
|
|
4945
4983
|
empty.widen ? h('button', { class: 'btn btn-sm', type: 'button', onclick: () => { hs.since = 'all'; e.since.value = 'all'; historyChanged(true) } }, t('hist.widen')) : null,
|
|
4946
4984
|
empty.tools ? h('button', { class: 'btn btn-sm', type: 'button', onclick: () => { hs.tools = true; e.tools.checked = true; startToolScan() } }, t('hist.tools')) : null) : null)
|
|
4947
4985
|
if (d.groups && d.groups.length) return historyGroups(d, words)
|
|
4948
|
-
return h('div', { class: 'group-list hist-rows', role: 'list', 'data-key': 'hrows', 'data-patch': '' }, d.sessions.map((s) =>
|
|
4986
|
+
return h('div', { class: 'group-list hist-rows', role: 'list', 'data-key': 'hrows', 'data-patch': '' }, d.sessions.map((s) => listedHistoryRow(s, words, Boolean(hs.project))))
|
|
4949
4987
|
})
|
|
4950
4988
|
if (hs.swap && !hs.loading) {
|
|
4951
4989
|
hs.swap = false
|
|
@@ -5007,9 +5045,15 @@ const MAIN = String.raw `
|
|
|
5007
5045
|
function historyTick() {
|
|
5008
5046
|
const e = hs.els
|
|
5009
5047
|
if (!e || !e.root.isConnected) return
|
|
5048
|
+
// Each age is worked out again only once its words change (historyWhenNext), or when the clock was set back.
|
|
5049
|
+
const now = Date.now()
|
|
5010
5050
|
for (const el of e.root.querySelectorAll('[data-hage]')) {
|
|
5011
|
-
const
|
|
5051
|
+
const due = el._hage
|
|
5052
|
+
if (due && now < due.at && now >= due.from) continue
|
|
5053
|
+
const iso = el.getAttribute('data-hage')
|
|
5054
|
+
const text = whenText(iso)
|
|
5012
5055
|
if (el.textContent !== text) el.textContent = text
|
|
5056
|
+
el._hage = { at: historyWhenNext(iso, now), from: now }
|
|
5013
5057
|
}
|
|
5014
5058
|
if (hs.pending) renderHistoryParts()
|
|
5015
5059
|
const d = hs.data
|
|
@@ -6274,7 +6318,7 @@ const MAIN = String.raw `
|
|
|
6274
6318
|
const UA_MS = 15000
|
|
6275
6319
|
const UA_DAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
|
|
6276
6320
|
const UA_PRESET = { name: 'Weeknights', days: ['mon', 'tue', 'wed', 'thu', 'fri'], start: '23:00', end: '08:00' }
|
|
6277
|
-
const ua = { data: null, error: null, loading: null, at: 0, nextAt: 0, inflight: new Map(), opening: false, choosing: false, choice: null, time: '08:00', timeInit: '08:00', busy: false, local: null, saves: 0, rows: [], seq: 0, gone: {}, open: {}, firstUse: false, focus: null, wait: undefined, waitSaves: 0 }
|
|
6321
|
+
const ua = { data: null, error: null, loading: null, at: 0, nextAt: 0, inflight: new Map(), opening: false, choosing: false, choice: null, time: '08:00', timeInit: '08:00', busy: false, local: null, saves: 0, rows: [], seq: 0, gone: {}, open: {}, batch: 0, showReplied: {}, showDone: false, firstUse: false, focus: null, wait: undefined, waitSaves: 0 }
|
|
6278
6322
|
let uaSaving = Promise.resolve()
|
|
6279
6323
|
function uaStatusNow() { return (S.state && S.state.unattended) || null }
|
|
6280
6324
|
// The latest status's count, less the ones being marked done right now (the page shows them gone already).
|
|
@@ -6322,7 +6366,7 @@ const MAIN = String.raw `
|
|
|
6322
6366
|
const w = uaWhen(ms, now)
|
|
6323
6367
|
if (w.day === 'today') return ''
|
|
6324
6368
|
if (w.day === 'tomorrow') return t('ua.tomorrow')
|
|
6325
|
-
return new Date(ms)
|
|
6369
|
+
return dateIn(new Date(ms), w.day === 'week' ? { weekday: 'short' } : { month: 'short', day: 'numeric' })
|
|
6326
6370
|
}
|
|
6327
6371
|
// kind: until ("until 08:00"), back ("back on at 08:00") or next ("next: Mon 23:00"; today is said too).
|
|
6328
6372
|
function uaAt(kind, ms) {
|
|
@@ -6342,7 +6386,7 @@ const MAIN = String.raw `
|
|
|
6342
6386
|
}
|
|
6343
6387
|
function uaDayNames(style) {
|
|
6344
6388
|
// 2024-01-01 was a Monday.
|
|
6345
|
-
return UA_DAYS.map((d, i) => new Date(2024, 0, 1 + i)
|
|
6389
|
+
return UA_DAYS.map((d, i) => dateIn(new Date(2024, 0, 1 + i), { weekday: style }))
|
|
6346
6390
|
}
|
|
6347
6391
|
// The status sentence, its parts joined by dots: "On · Slot “Weeknights” · until 08:00".
|
|
6348
6392
|
function uaSentence(st) {
|
|
@@ -6656,14 +6700,14 @@ const MAIN = String.raw `
|
|
|
6656
6700
|
const ms = Date.parse(iso)
|
|
6657
6701
|
const now = Date.now()
|
|
6658
6702
|
const w = uaWhen(ms, now)
|
|
6659
|
-
return w.day === 'today' ? w.hhmm : new Date(ms)
|
|
6703
|
+
return w.day === 'today' ? w.hhmm : dateIn(new Date(ms), { month: 'short', day: 'numeric' }) + ' ' + w.hhmm
|
|
6660
6704
|
}
|
|
6661
6705
|
async function uaDone(ids, all) {
|
|
6662
6706
|
const before = uaStatusNow()
|
|
6663
6707
|
for (const id of ids) { ua.gone[id] = true; ua.inflight.set(id, before) }
|
|
6664
6708
|
uaRedraw()
|
|
6665
6709
|
try {
|
|
6666
|
-
const r = await api('/api/unattended/pending', all ? { all: true } : { id: ids[0] })
|
|
6710
|
+
const r = await api('/api/unattended/pending', all ? { all: true } : ids.length > 1 ? { ids } : { id: ids[0] })
|
|
6667
6711
|
const done = r.ids
|
|
6668
6712
|
// A status read meanwhile already counts without them; only the one from before is lowered.
|
|
6669
6713
|
if (before && uaStatusNow() === before) {
|
|
@@ -6671,21 +6715,28 @@ const MAIN = String.raw `
|
|
|
6671
6715
|
if (Array.isArray(before.pendingIds)) before.pendingIds = before.pendingIds.filter((id) => !done.includes(id))
|
|
6672
6716
|
}
|
|
6673
6717
|
for (const id of ids) ua.inflight.delete(id)
|
|
6674
|
-
|
|
6718
|
+
// Each mark has its own toast and Undo: a second mark does not take the first one's away.
|
|
6719
|
+
// Done elsewhere meanwhile (another tab, the CLI): nothing was marked here, so there is nothing to undo.
|
|
6720
|
+
if (!done.length) toast(t('ua.doneAlready'))
|
|
6721
|
+
else toast(done.length > 1 ? tn('ua.doneMany', done.length) : t('ua.doneOne'), { key: 'ua-done-' + (++ua.batch), duration: 10000, action: BOOT.readOnly ? undefined : { label: t('toast.undo'), run: () => uaReopen(done) } })
|
|
6675
6722
|
} catch (e) {
|
|
6676
6723
|
for (const id of ids) { delete ua.gone[id]; ua.inflight.delete(id) }
|
|
6677
6724
|
toast(e.message, { kind: 'fail' })
|
|
6678
6725
|
}
|
|
6679
6726
|
uaRedraw()
|
|
6680
6727
|
}
|
|
6681
|
-
|
|
6728
|
+
// Undo after "Done", and "Reopen" in the done list (said: what the toast says then).
|
|
6729
|
+
async function uaReopen(ids, said) {
|
|
6682
6730
|
try {
|
|
6683
|
-
|
|
6731
|
+
await api('/api/unattended/pending', { ids, done: false })
|
|
6684
6732
|
for (const id of ids) delete ua.gone[id]
|
|
6685
|
-
toast(t('ua.undone')
|
|
6733
|
+
toast(said || t('ua.undone'))
|
|
6686
6734
|
} catch (e) { toast(e.message, { kind: 'fail' }) }
|
|
6687
6735
|
await load({ silent: true })
|
|
6688
6736
|
await loadUa()
|
|
6737
|
+
// The done list hid them while they were reopened; it shows what the answer says now.
|
|
6738
|
+
for (const id of ids) delete ua.gone['re:' + id]
|
|
6739
|
+
uaRedraw()
|
|
6689
6740
|
}
|
|
6690
6741
|
// "Back to the session": a running one is on the Sessions page; an ended one resumes with the copied command.
|
|
6691
6742
|
function uaBack(d) {
|
|
@@ -6718,9 +6769,27 @@ const MAIN = String.raw `
|
|
|
6718
6769
|
// Until the folder is fixed nothing is read; "nothing waits" would not be true.
|
|
6719
6770
|
if (st.problem) return [head, h('p', { class: 'note', 'data-key': 'ua-blocked' }, t('ua.pendingBlocked'))]
|
|
6720
6771
|
const list = ua.data.pending.filter((d) => !ua.gone[d.id])
|
|
6721
|
-
|
|
6722
|
-
const
|
|
6723
|
-
const
|
|
6772
|
+
// Marked done in the last 30 days, folded at the end: one marked by mistake is reopened there.
|
|
6773
|
+
const doneList = (ua.data.done || []).filter((d) => !ua.gone['re:' + d.id])
|
|
6774
|
+
const doneFold = doneList.length
|
|
6775
|
+
? h('div', { class: 'ua-fold ua-done-fold', 'data-key': 'ua-df', 'data-ua': 'df', 'data-find': 'ua-done', 'data-patch': '' },
|
|
6776
|
+
h('button', { class: 'group-toggle ua-fold-btn', type: 'button', 'data-key': 'ua-df-btn', 'aria-expanded': String(ua.showDone), 'aria-controls': 'ua-df-body', onclick: () => { ua.showDone = !ua.showDone; renderUaPage() } },
|
|
6777
|
+
icon('chevron', 'chev'), h('span', null, tn('ua.doneShow', doneList.length))),
|
|
6778
|
+
ua.showDone
|
|
6779
|
+
? h('div', { class: 'ua-fold-body', id: 'ua-df-body', 'data-key': 'ua-df-body', 'data-patch': '' },
|
|
6780
|
+
h('p', { class: 'muted small ua-fold-note' }, t('ua.doneListNote')),
|
|
6781
|
+
h('ul', { class: 'ua-items ua-done-list', 'data-patch': '' }, doneList.map((x) => h('li', { class: 'ua-item', 'data-key': 'ua-d-' + x.id, 'data-ua': 'd-' + x.id, 'data-patch': '' },
|
|
6782
|
+
h('div', { class: 'ua-item-meta' },
|
|
6783
|
+
h('span', { class: 'chip chip-sm' }, x.project ? x.projectName : t('ua.projOther')),
|
|
6784
|
+
h('span', { class: 'muted small' }, t('ua.doneWhen', { when: uaWhenShort(x.doneAt) }))),
|
|
6785
|
+
h('p', { class: 'ua-text is-clamped' }, x.text),
|
|
6786
|
+
h('div', { class: 'ua-item-actions' },
|
|
6787
|
+
h('button', { class: 'btn btn-sm', type: 'button', 'data-key': 'ua-reopen-' + x.id, disabled: BOOT.readOnly, onclick: () => { ua.gone['re:' + x.id] = true; uaRedraw(); uaReopen([x.id], t('ua.reopenedOne')) } }, icon('refresh'), t('ua.reopen')))))))
|
|
6788
|
+
: null)
|
|
6789
|
+
: null
|
|
6790
|
+
if (!list.length) return [head, h('p', { class: 'note ua-empty', 'data-key': 'ua-none', 'data-ua': 'none' }, icon('check'), t('ua.pendingEmpty')), doneFold]
|
|
6791
|
+
// By Project (ADR-0078), then by the session that left them; what nobody touched first at every level.
|
|
6792
|
+
const session = (g) => {
|
|
6724
6793
|
const d = g.first
|
|
6725
6794
|
// Kept outside a session (a defer typed in a terminal): no account or tool to name.
|
|
6726
6795
|
const known = d.account || (d.family && d.family !== 'unknown')
|
|
@@ -6737,22 +6806,53 @@ const MAIN = String.raw `
|
|
|
6737
6806
|
h('ul', { class: 'ua-items', 'data-patch': '' }, g.items.map((x) => {
|
|
6738
6807
|
const long = x.text.length > 280 || x.text.split('\n').length > 5
|
|
6739
6808
|
const open = Boolean(ua.open[x.id])
|
|
6740
|
-
|
|
6809
|
+
const replied = x.state === 'replied' && x.repliedAt
|
|
6810
|
+
return h('li', { class: 'ua-item' + (replied ? ' is-replied' : ''), 'data-key': 'ua-i-' + x.id, 'data-ua': 'i-' + x.id, 'data-patch': '' },
|
|
6741
6811
|
h('div', { class: 'ua-item-meta' },
|
|
6742
6812
|
h('span', { class: 'chip chip-sm' + (x.kind === 'question' ? ' chip-accent' : x.kind === 'permission' ? ' chip-warn' : '') }, t('ua.kind.' + x.kind)),
|
|
6743
6813
|
h('time', { class: 'muted small', datetime: x.at }, uaWhenShort(x.at)),
|
|
6744
6814
|
x.waited ? h('span', { class: 'muted small' }, t('ua.waited', { n: x.waited })) : null,
|
|
6745
|
-
x.agentType ? h('span', { class: 'muted small' }, t('ua.agent', { type: x.agentType })) : null
|
|
6815
|
+
x.agentType ? h('span', { class: 'muted small' }, t('ua.agent', { type: x.agentType })) : null,
|
|
6816
|
+
replied ? h('span', { class: 'chip chip-sm ua-replied', 'data-tip': t('ua.repliedTip', { when: uaWhenShort(x.repliedAt) }) }, t('ua.replied', { ago: ago(x.repliedAt) })) : null,
|
|
6817
|
+
x.replyCheck === 'no-record' ? h('span', { class: 'muted small' }, t('ua.noRecord')) : null),
|
|
6746
6818
|
h('p', { class: 'ua-text' + (long && !open ? ' is-clamped' : '') }, x.text),
|
|
6747
6819
|
h('div', { class: 'ua-item-actions' },
|
|
6748
6820
|
long ? h('button', { class: 'link-btn small', type: 'button', 'data-key': 'ua-more-' + x.id, 'aria-expanded': String(open), onclick: () => { ua.open[x.id] = !open; renderUaPage() } }, t(open ? 'ua.less' : 'ua.more')) : null,
|
|
6749
6821
|
h('button', { class: 'btn btn-sm', type: 'button', 'data-key': 'ua-done-' + x.id, disabled: off, onclick: () => uaDone([x.id]) }, icon('check'), t('ua.done'))))
|
|
6750
6822
|
})))
|
|
6823
|
+
}
|
|
6824
|
+
// In each Project the untouched ones show; the ones written in afterwards fold under them (writing there does not
|
|
6825
|
+
// mean it was finished), each with its own Done, and a counted mark for all of them with a caution.
|
|
6826
|
+
const box = h('div', { class: 'ua-groups', 'data-key': 'ua-groups', 'data-ua': 'groups', 'data-patch': '' }, uaGroupByProject(list).map((p, i) => {
|
|
6827
|
+
const counts = [p.open ? tn('ua.projOpen', p.open) : null, p.replied ? tn('ua.projReplied', p.replied) : null].filter(Boolean).join(' · ')
|
|
6828
|
+
const openBlocks = p.sessions.filter((g) => g.first.state !== 'replied')
|
|
6829
|
+
const repliedBlocks = p.sessions.filter((g) => g.first.state === 'replied')
|
|
6830
|
+
const repliedIds = repliedBlocks.flatMap((g) => g.items).map((x) => x.id)
|
|
6831
|
+
const shown = Boolean(ua.showReplied[p.key])
|
|
6832
|
+
const name = p.project ? p.name : t('ua.projOther')
|
|
6833
|
+
return h('section', { class: 'ua-proj', 'data-key': 'ua-p-' + p.key, 'data-ua': 'p-' + p.key, 'data-patch': '', 'aria-label': name },
|
|
6834
|
+
h('div', { class: 'ua-proj-head', 'data-patch': '' },
|
|
6835
|
+
h('div', { class: 'ua-proj-who' },
|
|
6836
|
+
h('h4', { class: 'ua-proj-name', 'data-tip': p.project || null }, icon('folder'), h('span', null, name)),
|
|
6837
|
+
h('span', { class: 'muted small' }, counts))),
|
|
6838
|
+
openBlocks.length ? h('div', { class: 'ua-proj-sessions', 'data-key': 'ua-po-' + p.key, 'data-patch': '' }, openBlocks.map(session)) : null,
|
|
6839
|
+
repliedIds.length
|
|
6840
|
+
? h('div', { class: 'ua-fold', 'data-key': 'ua-rf-' + p.key, 'data-ua': 'rf-' + p.key, 'data-patch': '' },
|
|
6841
|
+
h('button', { class: 'group-toggle ua-fold-btn', type: 'button', 'data-key': 'ua-rf-btn-' + p.key, 'aria-expanded': String(shown), 'aria-controls': 'ua-rf-' + i, onclick: () => { ua.showReplied[p.key] = !shown; renderUaPage() } },
|
|
6842
|
+
icon('chevron', 'chev'), h('span', null, tn('ua.repliedShow', repliedIds.length))),
|
|
6843
|
+
shown
|
|
6844
|
+
? h('div', { class: 'ua-fold-body', id: 'ua-rf-' + i, 'data-key': 'ua-rb-' + p.key, 'data-patch': '' },
|
|
6845
|
+
h('div', { class: 'ua-fold-note', 'data-patch': '' },
|
|
6846
|
+
h('p', { class: 'muted small' }, t('ua.repliedCaution')),
|
|
6847
|
+
h('button', { class: 'btn btn-sm', type: 'button', 'data-key': 'ua-rdone-' + p.key, disabled: off, onclick: () => uaDone(repliedIds) }, icon('check'), tn('ua.repliedBatch', repliedIds.length))),
|
|
6848
|
+
h('div', { class: 'ua-proj-sessions', 'data-patch': '' }, repliedBlocks.map(session)))
|
|
6849
|
+
: null)
|
|
6850
|
+
: null)
|
|
6751
6851
|
}))
|
|
6752
|
-
const all = list.length > 1 ? h('button', { class: 'link-btn small', type: 'button', 'data-key': 'ua-all', disabled: off, onclick: () => uaDone(list.map((x) => x.id), true) },
|
|
6753
|
-
return [h('div', { class: 'page-sec-head ua-pending-head' },
|
|
6852
|
+
const all = list.length > 1 ? h('button', { class: 'link-btn small', type: 'button', 'data-key': 'ua-all', disabled: off, onclick: () => uaDone(list.map((x) => x.id), true) }, tn('ua.allDoneN', list.length)) : null
|
|
6853
|
+
return [h('div', { class: 'page-sec-head ua-pending-head', 'data-find': 'ua-pending' },
|
|
6754
6854
|
h('div', { class: 'ua-sec-row' }, h('h3', { class: 'page-sec' }, t('ua.pending'), ' ', h('span', { class: 'tab-count' }, String(list.length))), all),
|
|
6755
|
-
h('p', { class: 'muted small' }, t('ua.pendingNote'))), box]
|
|
6855
|
+
h('p', { class: 'muted small' }, t('ua.pendingNote'))), box, doneFold]
|
|
6756
6856
|
}
|
|
6757
6857
|
|
|
6758
6858
|
// ---------- Answer Wait (ADR-0077) ----------
|
|
@@ -6858,6 +6958,7 @@ const MAIN = String.raw `
|
|
|
6858
6958
|
}
|
|
6859
6959
|
// The Search Catalog's actions: to the page, then the chooser open, or the "Add a Slot" button shown.
|
|
6860
6960
|
function uaGo(what) {
|
|
6961
|
+
if (what === 'done' && !ua.showDone) { ua.showDone = true; renderUaPage() }
|
|
6861
6962
|
setPage('unattended')
|
|
6862
6963
|
let tries = 0
|
|
6863
6964
|
const look = () => {
|
|
@@ -6865,7 +6966,8 @@ const MAIN = String.raw `
|
|
|
6865
6966
|
if (box.hidden || (!ua.data && !ua.error)) { if (++tries < 40) setTimeout(look, 100); return }
|
|
6866
6967
|
const st = uaStatusNow()
|
|
6867
6968
|
if (what === 'on' && st && uaStatusParts(st).state !== 'on' && !BOOT.readOnly && !st.problem) { if (!ua.choosing) uaOpenChooser(); return }
|
|
6868
|
-
const el = box.querySelector(what === 'on' ? '[data-key="ua-main"]' : what === 'wait' ? '[data-find="ua-wait"]' : '[data-find="ua-add"]')
|
|
6969
|
+
const el = box.querySelector(what === 'on' ? '[data-key="ua-main"]' : what === 'wait' ? '[data-find="ua-wait"]' : what === 'pending' ? '.ua-pending-head' : what === 'done' ? '[data-find="ua-done"]' : '[data-find="ua-add"]') ||
|
|
6970
|
+
(what === 'done' ? box.querySelector('.ua-pending-head') : null)
|
|
6869
6971
|
if (!el) return
|
|
6870
6972
|
el.scrollIntoView({ behavior: REDUCED ? 'auto' : 'smooth', block: 'center' })
|
|
6871
6973
|
palFlash(el)
|
|
@@ -7135,6 +7237,38 @@ const MAIN = String.raw `
|
|
|
7135
7237
|
out.push(h('p', { class: 'small' }, h('button', { class: 'link-btn small', type: 'button', 'data-key': 'tr-ask', onclick: () => openAsk({ text: t('ai.ask.trust') }) }, t('adv.ask'))))
|
|
7136
7238
|
return out
|
|
7137
7239
|
}
|
|
7240
|
+
// Shared Project Memory (spec §3.44, ADR-0081): the switch writes config claude.shareMemory at once (the words beside
|
|
7241
|
+
// it say what it does and what Fix all moves) and the toast offers the way back. Its state reads no account folder.
|
|
7242
|
+
async function setMemory(on) {
|
|
7243
|
+
const mm = S.state && S.state.memory
|
|
7244
|
+
if (!mm) return
|
|
7245
|
+
const was = mm.on
|
|
7246
|
+
S.state.memory = Object.assign({}, mm, { on })
|
|
7247
|
+
refreshSettings()
|
|
7248
|
+
try {
|
|
7249
|
+
await api('/api/memory/settings', { on, confirm: true })
|
|
7250
|
+
toast(t(on ? 'mm.onToast' : 'mm.offToast'), { kind: 'ok', action: { label: t('toast.undo'), run: () => setMemory(was) }, duration: 8000 })
|
|
7251
|
+
} catch (e) {
|
|
7252
|
+
S.state.memory = Object.assign({}, S.state.memory, { on: was })
|
|
7253
|
+
refreshSettings()
|
|
7254
|
+
toast(t('mm.failed', { msg: e.message }), { kind: 'fail' })
|
|
7255
|
+
}
|
|
7256
|
+
load({ silent: true })
|
|
7257
|
+
}
|
|
7258
|
+
function memoryItems() {
|
|
7259
|
+
const mm = S.state.memory
|
|
7260
|
+
const label = t('mm.switch')
|
|
7261
|
+
const out = [fm('memory', h('div', { class: 'set-row', 'data-patch': '' },
|
|
7262
|
+
h('span', { class: 'set-label' }, label),
|
|
7263
|
+
BOOT.readOnly ? h('span', { class: 'chip chip-sm' + (mm.on ? ' chip-ok' : '') }, mm.on ? t('ah.on') : t('ah.off'))
|
|
7264
|
+
: h('div', { class: 'seg', role: 'group', 'aria-label': label, 'data-patch': '' }, [[true, t('ah.on')], [false, t('ah.off')]].map(([v, text]) =>
|
|
7265
|
+
h('button', { class: 'seg-btn', type: 'button', 'aria-pressed': String(v === mm.on), onclick: () => { if (v !== mm.on) setMemory(v) } }, text)))))]
|
|
7266
|
+
out.push(h('ul', { class: 'pr-notes' }, h('li', null, t('mm.what')), h('li', null, t('mm.doctor')), h('li', null, t('mm.offKeeps'))))
|
|
7267
|
+
if (mm.folded) out.push(h('p', { class: 'small muted mm-folded' }, tn('mm.folded', mm.folded)))
|
|
7268
|
+
if (!BOOT.readOnly && !askBridged(BOOT, window))
|
|
7269
|
+
out.push(h('p', { class: 'small' }, h('button', { class: 'link-btn small', type: 'button', 'data-key': 'mm-ask', onclick: () => openAsk({ text: t('ai.ask.memory') }) }, t('adv.ask'))))
|
|
7270
|
+
return out
|
|
7271
|
+
}
|
|
7138
7272
|
function famTitleOf(fam) { const f = S.state && S.state.families.find((x) => x.id === fam); return f ? f.title : fam }
|
|
7139
7273
|
// ---------- settings ----------
|
|
7140
7274
|
// One header button holds what is set once and rarely changed: language, theme, Remote Control and Auto Handoff.
|
|
@@ -7153,6 +7287,7 @@ const MAIN = String.raw `
|
|
|
7153
7287
|
if (S.state && S.state.network) out.push('net')
|
|
7154
7288
|
if (S.state && S.state.progress) out.push('progress')
|
|
7155
7289
|
if (S.state && S.state.trust) out.push('trust')
|
|
7290
|
+
if (S.state && S.state.memory) out.push('memory')
|
|
7156
7291
|
return out
|
|
7157
7292
|
}
|
|
7158
7293
|
function renderSettingsButton() {
|
|
@@ -7268,6 +7403,7 @@ const MAIN = String.raw `
|
|
|
7268
7403
|
{ id: 'handoff', title: t('ah.button'), items: [ahLink(leave)].filter(Boolean), foot: t('set.ahHint') },
|
|
7269
7404
|
{ id: 'progress', title: t('pr.title'), items: secs.includes('progress') ? progressItems() : [], foot: t('pr.hint') },
|
|
7270
7405
|
{ id: 'trust', title: t('tr.title'), items: secs.includes('trust') ? trustItems() : [], foot: t('tr.hint') },
|
|
7406
|
+
{ id: 'memory', title: t('mm.title'), items: secs.includes('memory') ? memoryItems() : [], foot: t('mm.hint') },
|
|
7271
7407
|
{ id: 'network', title: t('net.title'), items: netItems, foot: t('net.hint') },
|
|
7272
7408
|
{ id: 'ai', title: t('set.g.ai'), items: ai, foot: t('set.aiHint') },
|
|
7273
7409
|
].filter((g) => g.items.length)
|
|
@@ -7346,6 +7482,8 @@ const MAIN = String.raw `
|
|
|
7346
7482
|
'unattended-on': { run: () => uaGo('on'), ok: () => Boolean(uaStatusNow()), nav: true },
|
|
7347
7483
|
'unattended-add-slot': { run: () => uaGo('add'), ok: () => Boolean(uaStatusNow()), nav: true },
|
|
7348
7484
|
'unattended-wait': { run: () => uaGo('wait'), ok: () => Boolean(uaStatusNow()), nav: true },
|
|
7485
|
+
'unattended-pending': { run: () => uaGo('pending'), ok: () => Boolean(uaStatusNow()), nav: true },
|
|
7486
|
+
'unattended-pending-done': { run: () => uaGo('done'), ok: () => Boolean(uaStatusNow()), nav: true },
|
|
7349
7487
|
'limit-reset': { run: openResetPick, ok: () => resetCandidates().length > 0 },
|
|
7350
7488
|
}
|
|
7351
7489
|
function palHealth() {
|
|
@@ -7969,7 +8107,7 @@ const MAIN = String.raw `
|
|
|
7969
8107
|
return Boolean(u && u.skillUpdate && u.skillUpdate.installed && u.skillUpdate.installed.length)
|
|
7970
8108
|
}
|
|
7971
8109
|
// Example phrases: a click puts one in the Let AI do it box (spec §3.28).
|
|
7972
|
-
const AI_ASKS = ['ai.ask.quota', 'ai.ask.reset', 'ai.ask.pick', 'ai.ask.new', 'ai.ask.api', 'ai.ask.pin', 'ai.ask.hide', 'ai.ask.relogin', 'ai.ask.expired', 'ai.ask.fix', 'ai.ask.handoff', 'ai.ask.handoffRules', 'ai.ask.session', 'ai.ask.history', 'ai.ask.send', 'ai.ask.inbound', 'ai.ask.menubar', 'ai.ask.rc', 'ai.ask.advisor', 'ai.ask.trust', 'ai.ask.network', 'ai.ask.unattended', 'ai.ask.progress', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.commands', 'ai.ask.tool']
|
|
8110
|
+
const AI_ASKS = ['ai.ask.quota', 'ai.ask.reset', 'ai.ask.pick', 'ai.ask.new', 'ai.ask.api', 'ai.ask.pin', 'ai.ask.hide', 'ai.ask.relogin', 'ai.ask.expired', 'ai.ask.fix', 'ai.ask.handoff', 'ai.ask.handoffRules', 'ai.ask.session', 'ai.ask.history', 'ai.ask.send', 'ai.ask.inbound', 'ai.ask.menubar', 'ai.ask.rc', 'ai.ask.advisor', 'ai.ask.trust', 'ai.ask.memory', 'ai.ask.network', 'ai.ask.unattended', 'ai.ask.pending', 'ai.ask.progress', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.commands', 'ai.ask.tool']
|
|
7973
8111
|
// Network Guard (spec §3.35): one dialog with the switch, the allowed countries and the newest result per address.
|
|
7974
8112
|
// Countries are never ticked for the user, the current one included: a wrong network would allow itself.
|
|
7975
8113
|
const NET_COMMON = ['US', 'JP', 'SG', 'GB', 'DE', 'FR', 'NL', 'CA', 'AU', 'KR', 'TW', 'HK']
|
|
@@ -982,6 +982,7 @@ ${UI_CSS}
|
|
|
982
982
|
.set-group > .reveal[data-key=pr-every] { margin-top: -8px; }
|
|
983
983
|
.reveal[data-key=pr-every] > .reveal-in > .pr-every { padding-top: 8px; }
|
|
984
984
|
.pr-notes { margin: 4px 0 0; padding-left: 16px; display: grid; gap: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
|
|
985
|
+
.mm-folded { margin: 12px 0 0; }
|
|
985
986
|
.pr-every .seg-btn { white-space: nowrap; }
|
|
986
987
|
:where(:root[data-width=phone]) .pr-every { flex-direction: column; align-items: flex-start; gap: 8px; }
|
|
987
988
|
:where(:root[data-width=phone]) .pr-every .seg { max-width: 100%; }
|
|
@@ -1451,6 +1452,23 @@ input.ua-time::placeholder { color: var(--faint); }
|
|
|
1451
1452
|
.ua-sec-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
|
1452
1453
|
.ua-sec-row .tab-count { margin-left: 4px; vertical-align: 1px; }
|
|
1453
1454
|
.ua-groups { display: flex; flex-direction: column; }
|
|
1455
|
+
.ua-proj { margin-bottom: 20px; }
|
|
1456
|
+
.ua-proj-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 8px; }
|
|
1457
|
+
.ua-proj-who { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
|
|
1458
|
+
.ua-proj-name { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
|
|
1459
|
+
.ua-proj-name .ic { width: 15px; height: 15px; flex: none; color: var(--muted); }
|
|
1460
|
+
.ua-proj-sessions > .ua-group:last-child { margin-bottom: 0; }
|
|
1461
|
+
/* What was written in afterwards, and the done list: folded under a toggle (ADR-0078). */
|
|
1462
|
+
.ua-fold { margin-top: 8px; }
|
|
1463
|
+
.ua-fold-btn { margin-left: -4px; font-size: 13px; color: var(--muted); }
|
|
1464
|
+
.ua-fold-btn:hover { color: var(--text); }
|
|
1465
|
+
.ua-fold-btn .chev { width: 12px; height: 12px; }
|
|
1466
|
+
.ua-fold-body { margin-top: 8px; }
|
|
1467
|
+
.ua-fold-note { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 8px; }
|
|
1468
|
+
.ua-fold-note p { margin: 0; }
|
|
1469
|
+
.ua-done-fold { margin-top: 0; }
|
|
1470
|
+
.ua-done-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
|
|
1471
|
+
.ua-item-meta { flex-wrap: wrap; }
|
|
1454
1472
|
.ua-group { margin-bottom: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
|
|
1455
1473
|
.ua-group-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
|
|
1456
1474
|
.ua-group-who { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; min-width: 0; }
|