sideby 0.38.1 → 0.40.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 +6 -0
- package/dist/src/cli/commands.js +120 -1
- package/dist/src/cli/json-schemas.js +44 -2
- package/dist/src/cli/main.js +37 -0
- package/dist/src/core/cli-commands.js +26 -2
- package/dist/src/core/config.d.ts +14 -0
- package/dist/src/core/config.js +21 -0
- package/dist/src/core/launch.d.ts +5 -0
- package/dist/src/core/launch.js +11 -1
- package/dist/src/core/progress-state.d.ts +94 -0
- package/dist/src/core/progress-state.js +240 -0
- package/dist/src/core/progress.d.ts +36 -0
- package/dist/src/core/progress.js +77 -0
- package/dist/src/core/prompt-origin.d.ts +40 -0
- package/dist/src/core/prompt-origin.js +98 -0
- package/dist/src/core/search-catalog.js +43 -0
- package/dist/src/core/unattended-attended.d.ts +109 -0
- package/dist/src/core/unattended-attended.js +337 -0
- package/dist/src/core/unattended-pending.d.ts +14 -2
- package/dist/src/core/unattended-pending.js +27 -3
- package/dist/src/core/unattended-state.d.ts +19 -1
- package/dist/src/core/unattended-state.js +31 -5
- package/dist/src/core/unattended-wait.d.ts +86 -0
- package/dist/src/core/unattended-wait.js +125 -0
- package/dist/src/core/unattended.d.ts +29 -2
- package/dist/src/core/unattended.js +48 -6
- package/dist/src/handoff/hook.js +19 -4
- package/dist/src/network/hook.js +4 -8
- package/dist/src/panel/handler.d.ts +3 -0
- package/dist/src/panel/handler.js +31 -1
- package/dist/src/panel/i18n.d.ts +27 -0
- package/dist/src/panel/i18n.js +56 -2
- package/dist/src/panel/page-script.js +118 -4
- package/dist/src/panel/page-styles.js +21 -0
- package/dist/src/progress/hook.d.ts +57 -0
- package/dist/src/progress/hook.js +258 -0
- package/dist/src/runtime.d.ts +9 -0
- package/dist/src/runtime.js +45 -2
- package/dist/src/types.d.ts +5 -0
- package/dist/src/unattended/hook.d.ts +26 -6
- package/dist/src/unattended/hook.js +361 -25
- package/package.json +1 -1
- package/schemas/config.json +27 -0
- package/schemas/progress.json +137 -0
- package/schemas/unattended-defer.json +5 -0
- package/schemas/unattended-pending.json +5 -0
- package/schemas/unattended.json +54 -2
- package/skills/sideby/SKILL.md +4 -1
- package/skills/sideby/references/progress.md +25 -0
- package/skills/sideby/references/unattended.md +25 -3
|
@@ -6274,7 +6274,7 @@ const MAIN = String.raw `
|
|
|
6274
6274
|
const UA_MS = 15000
|
|
6275
6275
|
const UA_DAYS = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun']
|
|
6276
6276
|
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 }
|
|
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 }
|
|
6278
6278
|
let uaSaving = Promise.resolve()
|
|
6279
6279
|
function uaStatusNow() { return (S.state && S.state.unattended) || null }
|
|
6280
6280
|
// The latest status's count, less the ones being marked done right now (the page shows them gone already).
|
|
@@ -6741,6 +6741,7 @@ const MAIN = String.raw `
|
|
|
6741
6741
|
h('div', { class: 'ua-item-meta' },
|
|
6742
6742
|
h('span', { class: 'chip chip-sm' + (x.kind === 'question' ? ' chip-accent' : x.kind === 'permission' ? ' chip-warn' : '') }, t('ua.kind.' + x.kind)),
|
|
6743
6743
|
h('time', { class: 'muted small', datetime: x.at }, uaWhenShort(x.at)),
|
|
6744
|
+
x.waited ? h('span', { class: 'muted small' }, t('ua.waited', { n: x.waited })) : null,
|
|
6744
6745
|
x.agentType ? h('span', { class: 'muted small' }, t('ua.agent', { type: x.agentType })) : null),
|
|
6745
6746
|
h('p', { class: 'ua-text' + (long && !open ? ' is-clamped' : '') }, x.text),
|
|
6746
6747
|
h('div', { class: 'ua-item-actions' },
|
|
@@ -6754,6 +6755,74 @@ const MAIN = String.raw `
|
|
|
6754
6755
|
h('p', { class: 'muted small' }, t('ua.pendingNote'))), box]
|
|
6755
6756
|
}
|
|
6756
6757
|
|
|
6758
|
+
// ---------- Answer Wait (ADR-0077) ----------
|
|
6759
|
+
// How long a question shown in a session waits for you before, with the mode on, the session goes on. One row of
|
|
6760
|
+
// choices that writes at once (the toast carries the undo); the choice moves before the answer comes back, stays on
|
|
6761
|
+
// the latest click while earlier ones are still being written, and a failure puts it back. A wait set elsewhere (the CLI takes any 1 to 120) shows as one more choice.
|
|
6762
|
+
const UA_WAITS = [5, 10, 15, 30, 60]
|
|
6763
|
+
function uaWaitNow(st) {
|
|
6764
|
+
return ua.wait !== undefined ? ua.wait : st.answerWait === undefined ? 10 : st.answerWait
|
|
6765
|
+
}
|
|
6766
|
+
async function uaSetWait(minutes, opts) {
|
|
6767
|
+
opts = opts || {}
|
|
6768
|
+
const st = uaStatusNow()
|
|
6769
|
+
if (!st) return
|
|
6770
|
+
const was = uaWaitNow(st)
|
|
6771
|
+
if (minutes === was) return
|
|
6772
|
+
ua.wait = minutes
|
|
6773
|
+
ua.waitSaves++
|
|
6774
|
+
if (!st.configured) ua.firstUse = true
|
|
6775
|
+
renderUaPage()
|
|
6776
|
+
uaSaving = uaSaving.then(async () => {
|
|
6777
|
+
try {
|
|
6778
|
+
const r = await api('/api/unattended/wait', { minutes })
|
|
6779
|
+
uaKeepStatus(r.status)
|
|
6780
|
+
if (r.changed) {
|
|
6781
|
+
const text = opts.undone ? t('ua.undone') : minutes === null ? t('ua.waitNeverToast') : t('ua.waitToast', { n: minutes })
|
|
6782
|
+
toast(text, opts.undone ? { key: 'ua-wait' } : { key: 'ua-wait', action: { label: t('toast.undo'), run: () => uaSetWait(r.before, { undone: true }) }, duration: 10000 })
|
|
6783
|
+
}
|
|
6784
|
+
} catch (e) { toast(t('ua.waitFailed', { msg: e.message }), { kind: 'fail' }) }
|
|
6785
|
+
// The latest choice stays shown until every change is written; then the page shows what the config holds.
|
|
6786
|
+
if (!--ua.waitSaves) ua.wait = undefined
|
|
6787
|
+
uaRedraw()
|
|
6788
|
+
})
|
|
6789
|
+
}
|
|
6790
|
+
function uaWaitBlock(st) {
|
|
6791
|
+
const cur = uaWaitNow(st)
|
|
6792
|
+
const opts = UA_WAITS.slice()
|
|
6793
|
+
if (cur !== null && !opts.includes(cur)) { opts.push(cur); opts.sort((a, b) => a - b) }
|
|
6794
|
+
const label = t('ua.waitLabel')
|
|
6795
|
+
const choices = [...opts.map((n) => [n, t('ua.waitMin', { n })]), [null, t('ua.waitNever')]]
|
|
6796
|
+
const control = BOOT.readOnly || st.problem
|
|
6797
|
+
? h('span', { class: 'chip chip-sm' }, cur === null ? t('ua.waitNever') : t('ua.waitMin', { n: cur }))
|
|
6798
|
+
: h('div', { class: 'seg ua-wait-seg', role: 'group', 'aria-label': label, 'data-patch': '' }, choices.map(([v, text]) =>
|
|
6799
|
+
h('button', { class: 'seg-btn', type: 'button', 'data-key': 'ua-wait-' + (v === null ? 'never' : v), 'aria-pressed': String(v === cur), onclick: () => uaSetWait(v) }, text)))
|
|
6800
|
+
return [h('div', { class: 'page-sec-head', 'data-key': 'ua-wait-head' }, h('h3', { class: 'page-sec' }, t('ua.wait')), h('p', { class: 'muted small' }, t('ua.waitNote'))),
|
|
6801
|
+
fm('ua-wait', h('div', { class: 'set-row ua-wait', 'data-key': 'ua-wait', 'data-patch': '' }, h('span', { class: 'set-label' }, label), control))]
|
|
6802
|
+
}
|
|
6803
|
+
|
|
6804
|
+
// ---------- Attended Sessions (ADR-0075) ----------
|
|
6805
|
+
// While it is on: the sessions someone typed into within the last 30 minutes, which ask as usual, each with until
|
|
6806
|
+
// when; with none, one line that says typing in a session is all it takes. Only shown: nothing here sets it.
|
|
6807
|
+
function uaHereBlock(st, p) {
|
|
6808
|
+
if (p.state !== 'on' || st.problem) return []
|
|
6809
|
+
const now = Date.now()
|
|
6810
|
+
const list = (st.attended || []).filter((x) => Date.parse(x.until) > now)
|
|
6811
|
+
if (!list.length) return [h('p', { class: 'note ua-here-hint', 'data-key': 'ua-here-hint', 'data-ua': 'here-hint' }, icon('messages'), t('ua.hereHint'))]
|
|
6812
|
+
return [h('div', { class: 'ua-here', 'data-key': 'ua-here', 'data-ua': 'here', 'data-patch': '' },
|
|
6813
|
+
h('div', { class: 'page-sec-head' },
|
|
6814
|
+
h('h3', { class: 'page-sec' }, t('ua.here'), ' ', h('span', { class: 'tab-count' }, String(list.length))),
|
|
6815
|
+
h('p', { class: 'muted small' }, t('ua.hereNote'))),
|
|
6816
|
+
h('ul', { class: 'ua-here-list', 'data-patch': '' }, list.map((x) => {
|
|
6817
|
+
const folder = x.cwd ? x.cwd.split(/[\\/]/).filter(Boolean).pop() : null
|
|
6818
|
+
return h('li', { class: 'ua-here-row', 'data-key': 'ua-here-' + x.sessionId, 'data-ua': 'here-' + x.sessionId, 'data-patch': '', 'data-tip': t('ua.hereSession', { id: x.sessionId.slice(0, 8) }) },
|
|
6819
|
+
badge(x.family, 'sm'),
|
|
6820
|
+
h('b', null, x.account ? accountLabel(x.account) : family(x.family).title),
|
|
6821
|
+
folder ? h('code', { class: 'ua-cwd' }, folder) : null,
|
|
6822
|
+
h('span', { class: 'ua-when muted' }, uaAt('until', Date.parse(x.until))))
|
|
6823
|
+
})))]
|
|
6824
|
+
}
|
|
6825
|
+
|
|
6757
6826
|
// ---------- the page ----------
|
|
6758
6827
|
function uaCoverage(st) {
|
|
6759
6828
|
const have = new Set(S.state.accounts.map((a) => a.family))
|
|
@@ -6796,7 +6865,7 @@ const MAIN = String.raw `
|
|
|
6796
6865
|
if (box.hidden || (!ua.data && !ua.error)) { if (++tries < 40) setTimeout(look, 100); return }
|
|
6797
6866
|
const st = uaStatusNow()
|
|
6798
6867
|
if (what === 'on' && st && uaStatusParts(st).state !== 'on' && !BOOT.readOnly && !st.problem) { if (!ua.choosing) uaOpenChooser(); return }
|
|
6799
|
-
const el = box.querySelector(what === 'on' ? '[data-key="ua-main"]' : '[data-find="ua-add"]')
|
|
6868
|
+
const el = box.querySelector(what === 'on' ? '[data-key="ua-main"]' : what === 'wait' ? '[data-find="ua-wait"]' : '[data-find="ua-add"]')
|
|
6800
6869
|
if (!el) return
|
|
6801
6870
|
el.scrollIntoView({ behavior: REDUCED ? 'auto' : 'smooth', block: 'center' })
|
|
6802
6871
|
palFlash(el)
|
|
@@ -6836,7 +6905,9 @@ const MAIN = String.raw `
|
|
|
6836
6905
|
main))
|
|
6837
6906
|
if (ua.choosing && p.state !== 'on') kids.push(uaChooser(st))
|
|
6838
6907
|
if (!st.configured || ua.firstUse) kids.push(h('p', { class: 'note ua-first', 'data-key': 'ua-first', 'data-ua': 'first' }, icon('clock'), t('ua.firstUse')))
|
|
6908
|
+
kids.push(...uaHereBlock(st, p))
|
|
6839
6909
|
kids.push(...uaScheduleBlock())
|
|
6910
|
+
kids.push(...uaWaitBlock(st))
|
|
6840
6911
|
kids.push(...uaPendingBlock(st))
|
|
6841
6912
|
kids.push(...uaCoverage(st))
|
|
6842
6913
|
uaPatch(box, kids)
|
|
@@ -6949,6 +7020,45 @@ const MAIN = String.raw `
|
|
|
6949
7020
|
} catch (e) { toast(t('quota.checkFailed', { msg: e.message }), { kind: 'fail' }) }
|
|
6950
7021
|
load({ silent: true })
|
|
6951
7022
|
}
|
|
7023
|
+
// Progress Reminders (spec §3.42): on with every minutes, or off with null. The switch moves at once (the state
|
|
7024
|
+
// here first), so the interval row grows in or folds away without waiting for the server; a failure puts it back.
|
|
7025
|
+
async function setProgressEvery(every) {
|
|
7026
|
+
const p = S.state && S.state.progress
|
|
7027
|
+
if (!p) return
|
|
7028
|
+
const was = { on: p.on, every: p.every }
|
|
7029
|
+
S.state.progress = Object.assign({}, p, every === null ? { on: false, every: undefined } : { on: true, every })
|
|
7030
|
+
refreshSettings()
|
|
7031
|
+
try {
|
|
7032
|
+
await api('/api/progress', { every })
|
|
7033
|
+
toast(every === null ? t('pr.offToast') : was.on ? t('pr.everyToast', { n: every }) : t('pr.onToast', { n: every }))
|
|
7034
|
+
} catch (e) {
|
|
7035
|
+
S.state.progress = Object.assign({}, S.state.progress, was)
|
|
7036
|
+
refreshSettings()
|
|
7037
|
+
toast(t('pr.failed', { msg: e.message }), { kind: 'fail' })
|
|
7038
|
+
}
|
|
7039
|
+
load({ silent: true })
|
|
7040
|
+
}
|
|
7041
|
+
// The section's rows: the switch, the interval (it grows in under the switch while on), and three short notes.
|
|
7042
|
+
function progressItems() {
|
|
7043
|
+
const p = S.state.progress
|
|
7044
|
+
const every = p.every || p.defaultEvery
|
|
7045
|
+
const label = t('pr.switch')
|
|
7046
|
+
const seg = (name, opts, cur, pick) => h('div', { class: 'seg', role: 'group', 'aria-label': name, 'data-patch': '' }, opts.map(([v, text]) =>
|
|
7047
|
+
h('button', { class: 'seg-btn', type: 'button', 'aria-pressed': String(v === cur), onclick: () => { if (v !== cur) pick(v) } }, text)))
|
|
7048
|
+
const out = [fm('progress', h('div', { class: 'set-row', 'data-patch': '' },
|
|
7049
|
+
h('span', { class: 'set-label' }, label),
|
|
7050
|
+
BOOT.readOnly ? h('span', { class: 'chip chip-sm' + (p.on ? ' chip-ok' : '') }, p.on ? t('pr.everyLong', { n: every }) : t('ah.off'))
|
|
7051
|
+
: seg(label, [[true, t('ah.on')], [false, t('ah.off')]], p.on, (v) => setProgressEvery(v ? every : null))))]
|
|
7052
|
+
if (!BOOT.readOnly)
|
|
7053
|
+
out.push(h('div', { class: 'reveal' + (p.on ? ' is-open' : ''), 'data-patch': '', 'data-key': 'pr-every', inert: p.on ? undefined : true },
|
|
7054
|
+
h('div', { class: 'reveal-in', 'data-patch': '' }, h('div', { class: 'set-row pr-every', 'data-patch': '' },
|
|
7055
|
+
h('span', { class: 'set-label' }, t('pr.every')),
|
|
7056
|
+
seg(t('pr.every'), p.choices.map((n) => [n, t('pr.minutes', { n })]), p.on ? every : null, (n) => setProgressEvery(n))))))
|
|
7057
|
+
out.push(h('ul', { class: 'pr-notes' }, h('li', null, t('pr.cost')), h('li', null, t('pr.scope')), h('li', null, t('pr.codex'))))
|
|
7058
|
+
if (!BOOT.readOnly && !askBridged(BOOT, window))
|
|
7059
|
+
out.push(h('p', { class: 'small' }, h('button', { class: 'link-btn small', type: 'button', 'data-key': 'pr-ask', onclick: () => openAsk({ text: t('ai.ask.progress') }) }, t('adv.ask'))))
|
|
7060
|
+
return out
|
|
7061
|
+
}
|
|
6952
7062
|
function famTitleOf(fam) { const f = S.state && S.state.families.find((x) => x.id === fam); return f ? f.title : fam }
|
|
6953
7063
|
// ---------- settings ----------
|
|
6954
7064
|
// One header button holds what is set once and rarely changed: language, theme, Remote Control and Auto Handoff.
|
|
@@ -6965,6 +7075,7 @@ const MAIN = String.raw `
|
|
|
6965
7075
|
if (S.state && ahState()) out.push('ah')
|
|
6966
7076
|
if (S.state && (S.state.quotaChecks || []).length) out.push('checks')
|
|
6967
7077
|
if (S.state && S.state.network) out.push('net')
|
|
7078
|
+
if (S.state && S.state.progress) out.push('progress')
|
|
6968
7079
|
return out
|
|
6969
7080
|
}
|
|
6970
7081
|
function renderSettingsButton() {
|
|
@@ -7012,7 +7123,8 @@ const MAIN = String.raw `
|
|
|
7012
7123
|
function aiLink(leave) {
|
|
7013
7124
|
return setLink(leave, t('ai.title'), t(skillInstalled() ? 'ai.installed' : 'ai.notInstalled'), skillInstalled() ? 'chip-ok' : '', () => openAsk(), true)
|
|
7014
7125
|
}
|
|
7015
|
-
// The dialog's sections, in order: General, Menu bar, Accounts, Quota checks, Auto Handoff,
|
|
7126
|
+
// The dialog's sections, in order: General, Menu bar, Accounts, Quota checks, Auto Handoff, Progress updates,
|
|
7127
|
+
// Network check, Let AI help. Each is
|
|
7016
7128
|
// { id, title, items, foot }: foot is the one line that explains the whole section.
|
|
7017
7129
|
function settingsGroups(leave) {
|
|
7018
7130
|
const secs = settingsSections()
|
|
@@ -7077,6 +7189,7 @@ const MAIN = String.raw `
|
|
|
7077
7189
|
{ id: 'accounts', title: t('set.g.accounts'), items: acct },
|
|
7078
7190
|
{ id: 'quota', title: t('set.g.quota'), items: checks, foot: t('set.quotaChecksHint', { n: every }) },
|
|
7079
7191
|
{ id: 'handoff', title: t('ah.button'), items: [ahLink(leave)].filter(Boolean), foot: t('set.ahHint') },
|
|
7192
|
+
{ id: 'progress', title: t('pr.title'), items: secs.includes('progress') ? progressItems() : [], foot: t('pr.hint') },
|
|
7080
7193
|
{ id: 'network', title: t('net.title'), items: netItems, foot: t('net.hint') },
|
|
7081
7194
|
{ id: 'ai', title: t('set.g.ai'), items: ai, foot: t('set.aiHint') },
|
|
7082
7195
|
].filter((g) => g.items.length)
|
|
@@ -7154,6 +7267,7 @@ const MAIN = String.raw `
|
|
|
7154
7267
|
inbound: { run: openInbound, ok: () => Boolean(S.state) },
|
|
7155
7268
|
'unattended-on': { run: () => uaGo('on'), ok: () => Boolean(uaStatusNow()), nav: true },
|
|
7156
7269
|
'unattended-add-slot': { run: () => uaGo('add'), ok: () => Boolean(uaStatusNow()), nav: true },
|
|
7270
|
+
'unattended-wait': { run: () => uaGo('wait'), ok: () => Boolean(uaStatusNow()), nav: true },
|
|
7157
7271
|
'limit-reset': { run: openResetPick, ok: () => resetCandidates().length > 0 },
|
|
7158
7272
|
}
|
|
7159
7273
|
function palHealth() {
|
|
@@ -7777,7 +7891,7 @@ const MAIN = String.raw `
|
|
|
7777
7891
|
return Boolean(u && u.skillUpdate && u.skillUpdate.installed && u.skillUpdate.installed.length)
|
|
7778
7892
|
}
|
|
7779
7893
|
// Example phrases: a click puts one in the Let AI do it box (spec §3.28).
|
|
7780
|
-
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.network', 'ai.ask.unattended', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.commands', 'ai.ask.tool']
|
|
7894
|
+
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.network', 'ai.ask.unattended', 'ai.ask.progress', 'ai.ask.theme', 'ai.ask.find', 'ai.ask.commands', 'ai.ask.tool']
|
|
7781
7895
|
// Network Guard (spec §3.35): one dialog with the switch, the allowed countries and the newest result per address.
|
|
7782
7896
|
// Countries are never ticked for the user, the current one included: a wrong network would allow itself.
|
|
7783
7897
|
const NET_COMMON = ['US', 'JP', 'SG', 'GB', 'DE', 'FR', 'NL', 'CA', 'AU', 'KR', 'TW', 'HK']
|
|
@@ -977,6 +977,15 @@ ${UI_CSS}
|
|
|
977
977
|
.set-foot { margin: -8px 0 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
|
|
978
978
|
.set-dialog .set-hint { max-width: none; }
|
|
979
979
|
.set-dialog .set-link { margin: 0 -12px; width: calc(100% + 20px); }
|
|
980
|
+
/* Progress updates (spec §3.42): the interval grows in under the switch while it is on. Folded, it takes no room: the
|
|
981
|
+
group's gap above it is taken back and given inside instead. */
|
|
982
|
+
.set-group > .reveal[data-key=pr-every] { margin-top: -8px; }
|
|
983
|
+
.reveal[data-key=pr-every] > .reveal-in > .pr-every { padding-top: 8px; }
|
|
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
|
+
.pr-every .seg-btn { white-space: nowrap; }
|
|
986
|
+
:where(:root[data-width=phone]) .pr-every { flex-direction: column; align-items: flex-start; gap: 8px; }
|
|
987
|
+
:where(:root[data-width=phone]) .pr-every .seg { max-width: 100%; }
|
|
988
|
+
:where(:root[data-width=phone]) .pr-every .seg-btn { padding: 0 8px; }
|
|
980
989
|
:where(:root[data-width=narrow], :root[data-width=phone]) {
|
|
981
990
|
.set-dialog { grid-template-columns: minmax(0, 1fr); gap: 16px; min-height: 0; }
|
|
982
991
|
.set-nav { flex-direction: row; overflow-x: auto; padding: 0 0 8px; border-right: 0; border-bottom: 1px solid var(--border); }
|
|
@@ -1454,6 +1463,18 @@ input.ua-time::placeholder { color: var(--faint); }
|
|
|
1454
1463
|
.ua-item-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; align-items: flex-start; gap: 12px; }
|
|
1455
1464
|
.ua-cover { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
|
|
1456
1465
|
.ua-cover li::before { content: "·"; margin-right: 8px; color: var(--faint); }
|
|
1466
|
+
.ua-here-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
|
|
1467
|
+
.ua-here-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
|
|
1468
|
+
.ua-here-row:first-child { border-top: 0; }
|
|
1469
|
+
.ua-here-hint { gap: 8px; margin-top: 12px; }
|
|
1470
|
+
/* Answer Wait (ADR-0077): the label, then a row of choices that wraps under it on a narrow page; on a phone the
|
|
1471
|
+
choices make a grid of three, so "Never" is never hidden behind a sideways scroll. */
|
|
1472
|
+
.ua-wait { justify-content: flex-start; flex-wrap: wrap; gap: 8px 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
|
|
1473
|
+
.ua-wait .seg { max-width: 100%; }
|
|
1474
|
+
.ua-wait .seg-btn { white-space: nowrap; }
|
|
1475
|
+
:where(:root[data-width=phone]) .ua-wait .seg { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: auto; }
|
|
1476
|
+
:where(:root[data-width=phone]) .ua-wait .seg-btn { justify-content: center; height: calc(var(--ctl-h-sm) - 4px); padding: 0 8px; }
|
|
1477
|
+
.ua-here-hint .ic { width: 15px; height: 15px; flex: none; }
|
|
1457
1478
|
:where(:root[data-width=narrow], :root[data-width=phone]) .ua-item { grid-template-columns: minmax(0, 1fr); }
|
|
1458
1479
|
:where(:root[data-width=narrow], :root[data-width=phone]) .ua-item-actions { grid-column: 1; grid-row: auto; }
|
|
1459
1480
|
:where(:root[data-width=phone]) .ua-del { margin-left: 0; }
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
type Env = Record<string, string | undefined>;
|
|
2
|
+
/** How often a watch looks whether it is still wanted. */
|
|
3
|
+
export declare const CHECK_EVERY_MS = 60000;
|
|
4
|
+
/** A watch ends by itself after this long, under the five-hour `timeout` Claude Code gives the hook. */
|
|
5
|
+
export declare const WATCH_FOR_MS: number;
|
|
6
|
+
export interface ProgressHookDeps {
|
|
7
|
+
now?: () => Date;
|
|
8
|
+
sleep?: (ms: number) => Promise<void>;
|
|
9
|
+
/** Whether the Host that started the hook is gone; by default, whether this process's parent changed. */
|
|
10
|
+
parentGone?: () => boolean;
|
|
11
|
+
/** This watch's id; random by default. */
|
|
12
|
+
id?: string;
|
|
13
|
+
/**
|
|
14
|
+
* When the hook began, before it read its input: the order of the session's `Stop`s, kept as the watch's `at`.
|
|
15
|
+
* `runProgressHook` sets it; by default when the watch starts.
|
|
16
|
+
*/
|
|
17
|
+
entered?: Date;
|
|
18
|
+
checkEveryMs?: number;
|
|
19
|
+
/** How long a write waits for the session's lock (for tests). */
|
|
20
|
+
lockWait?: {
|
|
21
|
+
timeoutMs: number;
|
|
22
|
+
pollMs: number;
|
|
23
|
+
};
|
|
24
|
+
/** Runs between the last check of the watch record and marking it woken, inside the lock (for tests). */
|
|
25
|
+
beforeWake?: () => Promise<void>;
|
|
26
|
+
/** Runs after the loop's last checks, before taking the session's lock to mark the watch woken (for tests). */
|
|
27
|
+
beforeLock?: () => Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
type Input = AsyncIterable<string | Uint8Array> | string;
|
|
30
|
+
/** The background tasks as the reminder names them: kind and description, never the command. */
|
|
31
|
+
export declare function taskList(tasks: readonly unknown[]): string;
|
|
32
|
+
/**
|
|
33
|
+
* What the model is woken with. It starts with `PROGRESS_MARK`, names the clock time the wait began (so a reminder
|
|
34
|
+
* Network Guard held and delivered late still makes sense), and asks for one or two sentences and the end of the turn.
|
|
35
|
+
*/
|
|
36
|
+
export declare function reminderMessage(o: {
|
|
37
|
+
tasks: readonly unknown[];
|
|
38
|
+
since: string;
|
|
39
|
+
now: Date;
|
|
40
|
+
every: number;
|
|
41
|
+
}): string;
|
|
42
|
+
/**
|
|
43
|
+
* The `Stop` watch (spec §3.42). Replaces the session's earlier watch first, then, while background work runs and the
|
|
44
|
+
* setting is on, wakes the session every `progress.every` minutes with a reminder (exit 2). Ends with exit 0 when a
|
|
45
|
+
* later `Stop` took over, the session's latest prompt is not the one this `Stop` ended, the parent is gone, the
|
|
46
|
+
* setting is off, Auto Handoff is handing over, or time runs out. While the session is unattended a reminder is skipped and the wait starts again.
|
|
47
|
+
*/
|
|
48
|
+
export declare function watchWhileWaiting(input: Record<string, unknown>, env: Env, deps?: ProgressHookDeps): Promise<{
|
|
49
|
+
exit: 0 | 2;
|
|
50
|
+
message?: string;
|
|
51
|
+
}>;
|
|
52
|
+
export declare function runProgressHook(argv: readonly string[], env: Env, input: Input, io: {
|
|
53
|
+
err: {
|
|
54
|
+
write(s: string): unknown;
|
|
55
|
+
};
|
|
56
|
+
}, deps?: ProgressHookDeps): Promise<number>;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// Entry for `sideby progress-hook claude <event>` (spec §3.42, ADR-0076): Progress Reminders. Claude Code runs it in
|
|
2
|
+
// the background after every turn (`Stop`, `asyncRewake`) and on every prompt (`UserPromptSubmit`, `async`) in a
|
|
3
|
+
// session sideby started while config `progress.every` is set. It imports only Node built-ins and leaf modules: never
|
|
4
|
+
// the Runtime, a Family index or core/accounts.ts. It never fails the Host: any problem means no output and exit 0.
|
|
5
|
+
//
|
|
6
|
+
// `UserPromptSubmit` keeps when the session's latest prompt came, a hash of its id, and whether it was a reminder's
|
|
7
|
+
// wake-up. `Stop` watches while the session waits on background work: every `every` minutes it wakes the session with
|
|
8
|
+
// exit 2 and asks the model to tell the user what it waits for, then end its turn. It ends without a word when a later
|
|
9
|
+
// `Stop` took over, a new turn began (told by the prompt's id), the Host is gone, the setting was turned off or Auto
|
|
10
|
+
// Handoff is handing over, and it stays quiet while the session is unattended (ADR-0075). A reminder Network Guard
|
|
11
|
+
// held and delivered later still counts as a reminder.
|
|
12
|
+
import { randomBytes } from 'node:crypto';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
import { FILES, HANDOFF_ENV, readJsonFile } from '../core/handoff-chain.js';
|
|
15
|
+
import { resolvePaths } from '../core/paths.js';
|
|
16
|
+
import { hashOf, markWatchWoken, newerPrompt, progressReminderTurn, readProgressEvery, readPromptRecord, readWatch, writePromptRecord, writeWatch, } from '../core/progress-state.js';
|
|
17
|
+
import { PROGRESS_MARK, progressWakeUp } from '../core/prompt-origin.js';
|
|
18
|
+
import { sessionUnattended } from '../core/unattended-attended.js';
|
|
19
|
+
import { UNATTENDED_ENV } from '../core/unattended-state.js';
|
|
20
|
+
/** How often a watch looks whether it is still wanted. */
|
|
21
|
+
export const CHECK_EVERY_MS = 60_000;
|
|
22
|
+
/** A watch ends by itself after this long, under the five-hour `timeout` Claude Code gives the hook. */
|
|
23
|
+
export const WATCH_FOR_MS = (4 * 60 + 55) * 60_000;
|
|
24
|
+
const STDIN_MAX = 8 * 1024 * 1024;
|
|
25
|
+
/** Input that has not ended after this long is not waited for: the hook then does nothing. */
|
|
26
|
+
const STDIN_WAIT_MS = 5000;
|
|
27
|
+
/** Background tasks named in a reminder, and the most of each description. */
|
|
28
|
+
const TASKS_NAMED = 5;
|
|
29
|
+
const DESCRIPTION_MAX = 80;
|
|
30
|
+
async function readInput(input) {
|
|
31
|
+
if (typeof input === 'string')
|
|
32
|
+
return input;
|
|
33
|
+
const read = (async () => {
|
|
34
|
+
const chunks = [];
|
|
35
|
+
let size = 0;
|
|
36
|
+
for await (const chunk of input) {
|
|
37
|
+
const b = Buffer.from(chunk);
|
|
38
|
+
size += b.length;
|
|
39
|
+
if (size > STDIN_MAX)
|
|
40
|
+
return '';
|
|
41
|
+
chunks.push(b);
|
|
42
|
+
}
|
|
43
|
+
return Buffer.concat(chunks).toString('utf8');
|
|
44
|
+
})();
|
|
45
|
+
read.catch(() => { });
|
|
46
|
+
// A Host that never ends the input must not keep the hook waiting.
|
|
47
|
+
let timer;
|
|
48
|
+
const late = new Promise((resolve) => {
|
|
49
|
+
timer = setTimeout(() => {
|
|
50
|
+
;
|
|
51
|
+
input.destroy?.();
|
|
52
|
+
resolve('');
|
|
53
|
+
}, STDIN_WAIT_MS);
|
|
54
|
+
});
|
|
55
|
+
try {
|
|
56
|
+
return await Promise.race([read, late]);
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
clearTimeout(timer);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function parseInput(input) {
|
|
63
|
+
try {
|
|
64
|
+
const v = JSON.parse(await readInput(input));
|
|
65
|
+
return v && typeof v === 'object' && !Array.isArray(v) ? v : undefined;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const str = (v) => (typeof v === 'string' && v ? v : undefined);
|
|
72
|
+
const iso = (ms) => new Date(ms).toISOString();
|
|
73
|
+
/** Notes the session's latest prompt: when, a hash of its id, and whether it is a reminder's wake-up. */
|
|
74
|
+
async function notePrompt(env, input, now) {
|
|
75
|
+
const v = await parseInput(input);
|
|
76
|
+
if (!v || v.agent_id !== undefined)
|
|
77
|
+
return;
|
|
78
|
+
const sessionId = str(v.session_id);
|
|
79
|
+
const promptId = str(v.prompt_id);
|
|
80
|
+
if (!sessionId || !promptId)
|
|
81
|
+
return;
|
|
82
|
+
const paths = resolvePaths(env);
|
|
83
|
+
if ((await readProgressEvery(paths.configFile, env)) === undefined)
|
|
84
|
+
return;
|
|
85
|
+
const prompt = typeof v.prompt === 'string' ? v.prompt : '';
|
|
86
|
+
await writePromptRecord(paths.stateDir, sessionId, { at: now.toISOString(), prompt: hashOf(promptId), reminder: progressWakeUp(prompt) }, now);
|
|
87
|
+
}
|
|
88
|
+
/** One line of text from the Host: no control characters or quotes, runs of space as one, at most `max` characters. */
|
|
89
|
+
function clean(s, max) {
|
|
90
|
+
const one = [...s]
|
|
91
|
+
.map((ch) => (ch < ' ' || ch === '\u007f' || ch === '"' || ch === '`' ? ' ' : ch))
|
|
92
|
+
.join('')
|
|
93
|
+
.replace(/\s+/g, ' ')
|
|
94
|
+
.trim();
|
|
95
|
+
return one.length > max ? `${one.slice(0, max - 1)}…` : one;
|
|
96
|
+
}
|
|
97
|
+
/** The background tasks as the reminder names them: kind and description, never the command. */
|
|
98
|
+
export function taskList(tasks) {
|
|
99
|
+
const named = tasks.slice(0, TASKS_NAMED).map((t) => {
|
|
100
|
+
const r = (t && typeof t === 'object' ? t : {});
|
|
101
|
+
const kind = r.type === 'shell'
|
|
102
|
+
? 'command'
|
|
103
|
+
: r.type === 'subagent'
|
|
104
|
+
? 'subagent'
|
|
105
|
+
: typeof r.type === 'string' && r.type
|
|
106
|
+
? clean(r.type, 20)
|
|
107
|
+
: 'task';
|
|
108
|
+
const what = typeof r.description === 'string' ? clean(r.description, DESCRIPTION_MAX) : '';
|
|
109
|
+
return what ? `${kind} "${what}"` : kind;
|
|
110
|
+
});
|
|
111
|
+
const more = tasks.length > TASKS_NAMED ? `; and ${tasks.length - TASKS_NAMED} more` : '';
|
|
112
|
+
return `${tasks.length} ${tasks.length === 1 ? 'task' : 'tasks'}: ${named.join('; ')}${more}`;
|
|
113
|
+
}
|
|
114
|
+
const hhmm = (ms) => {
|
|
115
|
+
const d = new Date(ms);
|
|
116
|
+
return `${String(d.getHours()).padStart(2, '0')}:${String(d.getMinutes()).padStart(2, '0')}`;
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* What the model is woken with. It starts with `PROGRESS_MARK`, names the clock time the wait began (so a reminder
|
|
120
|
+
* Network Guard held and delivered late still makes sense), and asks for one or two sentences and the end of the turn.
|
|
121
|
+
*/
|
|
122
|
+
export function reminderMessage(o) {
|
|
123
|
+
const since = Date.parse(o.since);
|
|
124
|
+
const minutes = Math.max(1, Math.round((o.now.getTime() - since) / 60_000));
|
|
125
|
+
return [
|
|
126
|
+
`${PROGRESS_MARK} you are waiting on background work (${taskList(o.tasks)}), since ${hhmm(since)}, ${minutes} ${minutes === 1 ? 'minute' : 'minutes'} as of this reminder.`,
|
|
127
|
+
'Tell the user in one or two sentences what you are waiting for, how long it has been, and whether there is new output (look only if that is quick), then end your turn.',
|
|
128
|
+
'Do not start new work or stop the tasks.',
|
|
129
|
+
`sideby sends this every ${o.every} ${o.every === 1 ? 'minute' : 'minutes'} while background work runs; if the user asks how to stop it, the command is \`sideby progress off\`.`,
|
|
130
|
+
].join(' ');
|
|
131
|
+
}
|
|
132
|
+
/** Whether Auto Handoff of this session's run is handing over: the threshold was sent or the run is ready. */
|
|
133
|
+
async function handingOver(env) {
|
|
134
|
+
const runId = env[HANDOFF_ENV.run];
|
|
135
|
+
const dir = env[HANDOFF_ENV.dir];
|
|
136
|
+
if (!runId || !dir)
|
|
137
|
+
return false;
|
|
138
|
+
if (await readJsonFile(join(dir, FILES.ready)))
|
|
139
|
+
return true;
|
|
140
|
+
return Boolean((await readJsonFile(join(dir, FILES.run(runId))))?.thresholdSentAt);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The `Stop` watch (spec §3.42). Replaces the session's earlier watch first, then, while background work runs and the
|
|
144
|
+
* setting is on, wakes the session every `progress.every` minutes with a reminder (exit 2). Ends with exit 0 when a
|
|
145
|
+
* later `Stop` took over, the session's latest prompt is not the one this `Stop` ended, the parent is gone, the
|
|
146
|
+
* setting is off, Auto Handoff is handing over, or time runs out. While the session is unattended a reminder is skipped and the wait starts again.
|
|
147
|
+
*/
|
|
148
|
+
export async function watchWhileWaiting(input, env, deps = {}) {
|
|
149
|
+
const clock = deps.now ?? (() => new Date());
|
|
150
|
+
const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
151
|
+
const startPpid = process.ppid;
|
|
152
|
+
const parentGone = deps.parentGone ?? (() => process.ppid !== startPpid || process.ppid === 1);
|
|
153
|
+
const checkEvery = deps.checkEveryMs ?? CHECK_EVERY_MS;
|
|
154
|
+
const sessionId = str(input.session_id);
|
|
155
|
+
if (!sessionId)
|
|
156
|
+
return { exit: 0 };
|
|
157
|
+
const promptId = str(input.prompt_id);
|
|
158
|
+
const paths = resolvePaths(env);
|
|
159
|
+
const start = clock().getTime();
|
|
160
|
+
const stopAt = deps.entered ? deps.entered.getTime() : start;
|
|
161
|
+
// The wait goes on across the turns reminders start; any other turn starts a new one.
|
|
162
|
+
const prev = await readWatch(paths.stateDir, sessionId);
|
|
163
|
+
const afterReminder = await progressReminderTurn(paths.stateDir, sessionId, promptId);
|
|
164
|
+
const since = afterReminder && prev ? prev.since : iso(start);
|
|
165
|
+
const id = deps.id ?? randomBytes(8).toString('hex');
|
|
166
|
+
// Written first, so a watch left by an earlier Stop ends even when this one has nothing to watch. When the session's
|
|
167
|
+
// lock stays held nothing is written, and this Stop does not watch: an earlier watch may still hold the record. Nor
|
|
168
|
+
// does it when the record is a later Stop's watch (its hook began after this one's): that turn's wait goes on.
|
|
169
|
+
if (!(await writeWatch(paths.stateDir, sessionId, { id, since, at: iso(stopAt) }, deps)))
|
|
170
|
+
return { exit: 0 };
|
|
171
|
+
const tasks = input.background_tasks;
|
|
172
|
+
if (!Array.isArray(tasks) || tasks.length === 0)
|
|
173
|
+
return { exit: 0 };
|
|
174
|
+
let every = await readProgressEvery(paths.configFile, env);
|
|
175
|
+
if (every === undefined)
|
|
176
|
+
return { exit: 0 };
|
|
177
|
+
const ownPrompt = promptId ? hashOf(promptId) : undefined;
|
|
178
|
+
let base = start;
|
|
179
|
+
for (;;) {
|
|
180
|
+
const wait = Math.min(checkEvery, Math.max(1000, base + every * 60_000 - clock().getTime()));
|
|
181
|
+
await sleep(wait);
|
|
182
|
+
const now = clock();
|
|
183
|
+
const t = now.getTime();
|
|
184
|
+
if (t - start >= WATCH_FOR_MS || parentGone())
|
|
185
|
+
return { exit: 0 };
|
|
186
|
+
if ((await readWatch(paths.stateDir, sessionId))?.id !== id)
|
|
187
|
+
return { exit: 0 };
|
|
188
|
+
// The latest prompt is another one: a turn began after this Stop's, and its own Stop decides again.
|
|
189
|
+
if (newerPrompt(await readPromptRecord(paths.stateDir, sessionId), ownPrompt, stopAt))
|
|
190
|
+
return { exit: 0 };
|
|
191
|
+
// Read every time: turning it off, or another interval, reaches a running session.
|
|
192
|
+
every = await readProgressEvery(paths.configFile, env);
|
|
193
|
+
if (every === undefined)
|
|
194
|
+
return { exit: 0 };
|
|
195
|
+
if (await handingOver(env))
|
|
196
|
+
return { exit: 0 };
|
|
197
|
+
if (t - base < every * 60_000)
|
|
198
|
+
continue;
|
|
199
|
+
let quiet = true;
|
|
200
|
+
try {
|
|
201
|
+
quiet = (await sessionUnattended({
|
|
202
|
+
stateDir: paths.stateDir,
|
|
203
|
+
configFile: paths.configFile,
|
|
204
|
+
session: env[UNATTENDED_ENV] === '1',
|
|
205
|
+
sessionId,
|
|
206
|
+
now,
|
|
207
|
+
})).on;
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// cannot tell: no reminder
|
|
211
|
+
}
|
|
212
|
+
if (quiet) {
|
|
213
|
+
base = t;
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
// Checked and marked under the session's lock just before waking, so a Stop that came meanwhile is never
|
|
217
|
+
// answered by this watch, and never has its record put back to this one; a prompt noted meanwhile drops the
|
|
218
|
+
// reminder, which would only queue behind that turn. A prompt whose own (background) hook has not noted it yet,
|
|
219
|
+
// or that comes between this check and the Host reading the exit code, still gets the reminder after its turn.
|
|
220
|
+
const hook = {
|
|
221
|
+
turn: { ...(ownPrompt ? { prompt: ownPrompt } : {}), stopAt },
|
|
222
|
+
...(deps.beforeWake ? { beforeWrite: deps.beforeWake } : {}),
|
|
223
|
+
};
|
|
224
|
+
await deps.beforeLock?.();
|
|
225
|
+
if (!(await markWatchWoken(paths.stateDir, sessionId, id, now, hook)))
|
|
226
|
+
return { exit: 0 };
|
|
227
|
+
return { exit: 2, message: reminderMessage({ tasks, since, now, every }) };
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
export async function runProgressHook(argv, env, input, io, deps = {}) {
|
|
231
|
+
const [family, event] = argv;
|
|
232
|
+
if (family !== 'claude')
|
|
233
|
+
return 0;
|
|
234
|
+
try {
|
|
235
|
+
if (event === 'UserPromptSubmit') {
|
|
236
|
+
// In the background: its output and exit code change nothing, and it never holds a prompt back.
|
|
237
|
+
await notePrompt(env, input, deps.now ? deps.now() : new Date());
|
|
238
|
+
return 0;
|
|
239
|
+
}
|
|
240
|
+
if (event !== 'Stop')
|
|
241
|
+
return 0;
|
|
242
|
+
// Taken before the input is read, which may wait: it orders this Stop among the session's others.
|
|
243
|
+
const entered = deps.entered ?? (deps.now ? deps.now() : new Date());
|
|
244
|
+
const v = await parseInput(input);
|
|
245
|
+
if (!v)
|
|
246
|
+
return 0;
|
|
247
|
+
const w = await watchWhileWaiting(v, env, { ...deps, entered });
|
|
248
|
+
// Exit 2 wakes the session (asyncRewake), which hands stderr to the model.
|
|
249
|
+
if (w.exit === 2 && w.message) {
|
|
250
|
+
io.err.write(`${w.message}\n`);
|
|
251
|
+
return 2;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
// never fail the Host
|
|
256
|
+
}
|
|
257
|
+
return 0;
|
|
258
|
+
}
|
package/dist/src/runtime.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { type LimitResetPlan, type LimitResetResult } from './core/limit-reset.t
|
|
|
14
14
|
import { type NetworkOverview } from './core/network.ts';
|
|
15
15
|
import { type Paths } from './core/paths.ts';
|
|
16
16
|
import { type PickChoice } from './core/pick-commands.ts';
|
|
17
|
+
import { type ProgressView } from './core/progress.ts';
|
|
17
18
|
import { type ProjectCategories } from './core/project-categories.ts';
|
|
18
19
|
import { type QuotaFetchMode } from './core/quota-fetch.ts';
|
|
19
20
|
import { type RemoteControlChange, type RemoteControlGroup } from './core/remote-control.ts';
|
|
@@ -376,6 +377,14 @@ export interface Runtime {
|
|
|
376
377
|
setQuotaCheck(family: string, on: boolean): Promise<{
|
|
377
378
|
changed: boolean;
|
|
378
379
|
}>;
|
|
380
|
+
/** Progress Reminders (spec §3.42): whether they are on, how often, and for which Families. */
|
|
381
|
+
progressView(): ProgressView;
|
|
382
|
+
/** Turns Progress Reminders on with `every` minutes, or off (undefined); writes only config `progress`. */
|
|
383
|
+
setProgress(every: number | undefined): Promise<{
|
|
384
|
+
changed: boolean;
|
|
385
|
+
before?: number;
|
|
386
|
+
after?: number;
|
|
387
|
+
}>;
|
|
379
388
|
/** The config `display` (spec §3.25), or an empty object. */
|
|
380
389
|
displayOrder(): DisplayConfig;
|
|
381
390
|
/** Replaces the config `display`; undefined or empty removes it. Returns what the file now holds. */
|