@crossworks/client-types 0.500.30 → 0.500.35
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/package.json +1 -1
- package/src/agent-ui.ts +78 -0
- package/src/dto/auth.ts +52 -0
- package/src/dto/rows.ts +9 -0
- package/src/dto/turns.ts +17 -2
- package/src/dto/update-notice.ts +23 -0
- package/src/index.ts +1 -0
- package/src/update-notice.test.ts +89 -0
- package/src/update-notice.ts +58 -0
package/package.json
CHANGED
package/src/agent-ui.ts
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The agent UI channel: an in-app agent drives the window the person chats
|
|
3
|
+
* from (docs/agent-ui.md). The wire constants both halves read, in one leaf
|
|
4
|
+
* module: browser-safe and dependency-free, as profile-flags.ts is.
|
|
5
|
+
*
|
|
6
|
+
* The turn names its window (`windowId` on POST /api/assistant/turn); a ui_*
|
|
7
|
+
* tool call reaches that window as a `ui-call` turn event (TurnUiCallData,
|
|
8
|
+
* dto/turns.ts); the window answers POST
|
|
9
|
+
* /api/assistant/turn/:turnId/ui/:callId with `{ windowId, result }`.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** A window id: fresh per page load, kept in memory by the client. */
|
|
13
|
+
export const AGENT_UI_WINDOW_ID_RE = /^[A-Za-z0-9_-]{8,64}$/;
|
|
14
|
+
|
|
15
|
+
/** Whether `v` is a window id the brain takes. */
|
|
16
|
+
export function isAgentUiWindowId(v: unknown): v is string {
|
|
17
|
+
return typeof v === 'string' && AGENT_UI_WINDOW_ID_RE.test(v);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** How long the window has to answer one call, ms (the row's expires_at). */
|
|
21
|
+
export const AGENT_UI_CALL_TTL_MS = 15_000;
|
|
22
|
+
|
|
23
|
+
/** The largest result the window may answer with: its JSON, in bytes. */
|
|
24
|
+
export const AGENT_UI_RESULT_MAX_BYTES = 64 * 1024;
|
|
25
|
+
|
|
26
|
+
/** The actions a ui tool asks of the window (the tool is `ui_<action>`). */
|
|
27
|
+
export const AGENT_UI_ACTIONS = [
|
|
28
|
+
'screen',
|
|
29
|
+
'navigate',
|
|
30
|
+
'click',
|
|
31
|
+
'type',
|
|
32
|
+
'select',
|
|
33
|
+
'point',
|
|
34
|
+
'wait',
|
|
35
|
+
] as const;
|
|
36
|
+
export type AgentUiAction = (typeof AGENT_UI_ACTIONS)[number];
|
|
37
|
+
|
|
38
|
+
/** Whether a tool slug is one of the agent UI tools (`ui_<action>`). They
|
|
39
|
+
* stay in-app: a per-turn affordance, never in a tool group or an agent's
|
|
40
|
+
* stored tools, never handed to a delegated agent. */
|
|
41
|
+
export function isAgentUiToolSlug(slug: string): boolean {
|
|
42
|
+
return slug.startsWith('ui_') && (AGENT_UI_ACTIONS as readonly string[]).includes(slug.slice(3));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** What a failed action says, the window's or the brain's own
|
|
46
|
+
* (`window_gone`: no answer before the call expired; `stopped`: the person
|
|
47
|
+
* stopped the turn). */
|
|
48
|
+
export const AGENT_UI_ERRORS = [
|
|
49
|
+
'no_session',
|
|
50
|
+
'stopped',
|
|
51
|
+
'user_took_over',
|
|
52
|
+
'not_found',
|
|
53
|
+
'ambiguous',
|
|
54
|
+
'stale_ref',
|
|
55
|
+
'needs_user',
|
|
56
|
+
'secret_field',
|
|
57
|
+
'host_control',
|
|
58
|
+
'bad_route',
|
|
59
|
+
// A link that leaves the app's origin, or whose path the window's route
|
|
60
|
+
// check refuses (the window's link click).
|
|
61
|
+
'unsafe_route',
|
|
62
|
+
'unsupported',
|
|
63
|
+
'timeout',
|
|
64
|
+
'needs_consent',
|
|
65
|
+
'window_gone',
|
|
66
|
+
] as const;
|
|
67
|
+
export type AgentUiError = (typeof AGENT_UI_ERRORS)[number];
|
|
68
|
+
|
|
69
|
+
/** An element the agent names: by its id, by its role and accessible name,
|
|
70
|
+
* or by a ref from the last `ui_screen`. */
|
|
71
|
+
export type AgentUiTarget = { id: string } | { role: string; name: string } | { ref: string };
|
|
72
|
+
|
|
73
|
+
/** What the window answers for one call. */
|
|
74
|
+
export type AgentUiResult =
|
|
75
|
+
({ ok: true } & Record<string, unknown>) | { ok: false; error: AgentUiError; message: string };
|
|
76
|
+
|
|
77
|
+
/** The per-login setting (GET/PUT /api/profile/agent-ui). */
|
|
78
|
+
export type AgentUiSetting = { enabled: boolean };
|
package/src/dto/auth.ts
CHANGED
|
@@ -47,6 +47,58 @@ export type OidcMode = 'off' | 'optional' | 'required';
|
|
|
47
47
|
* cookie. */
|
|
48
48
|
export type OidcConfigDTO = { mode: 'off' } | { mode: 'optional' | 'required'; label: string };
|
|
49
49
|
|
|
50
|
+
/** Who stored a value on the setup screen and when. `by`: the login's email,
|
|
51
|
+
* or null when that login is gone. */
|
|
52
|
+
export type SsoSetupSetter = { by: string | null; at: string };
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* GET /api/users/sso-setup (the users area): the company sign-in and SCIM
|
|
56
|
+
* setup screen (docs/oidc-sign-in.md). The mode word is the live one: a plain
|
|
57
|
+
* restart keeps the old value. Off: `{ mode: 'off' }` only. Never a value of
|
|
58
|
+
* the secret, the hash or the token. `setup` is the only mode that may write.
|
|
59
|
+
*/
|
|
60
|
+
export type SsoSetupStatusDTO =
|
|
61
|
+
| { mode: 'off' }
|
|
62
|
+
| {
|
|
63
|
+
mode: 'setup' | 'optional' | 'required';
|
|
64
|
+
issuer: string;
|
|
65
|
+
clientId: string;
|
|
66
|
+
/** The redirect URI to register with the provider; '' with no usable
|
|
67
|
+
* MANTLE_PUBLIC_URL. */
|
|
68
|
+
redirectUri: string;
|
|
69
|
+
/** The SCIM URL to give the provider; '' with no MANTLE_PUBLIC_URL. */
|
|
70
|
+
scimUrl: string;
|
|
71
|
+
/** The names of the box .env lines that are missing. */
|
|
72
|
+
envMissing: string[];
|
|
73
|
+
/** Where the client secret comes from. */
|
|
74
|
+
secret: 'env' | 'row' | 'none';
|
|
75
|
+
/** Where the SCIM token's hash comes from. `env-off`: the .env holds a
|
|
76
|
+
* value that turns SCIM off. */
|
|
77
|
+
scim: 'env' | 'env-off' | 'row' | 'none';
|
|
78
|
+
secretSet: SsoSetupSetter | null;
|
|
79
|
+
scimSet: SsoSetupSetter | null;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/** POST /api/users/sso-setup/test: one fixed code, never provider text. */
|
|
83
|
+
export type SsoSetupTestOutcome =
|
|
84
|
+
| 'ok'
|
|
85
|
+
| 'secret-refused'
|
|
86
|
+
| 'unclear'
|
|
87
|
+
| 'unreachable'
|
|
88
|
+
| 'issuer-mismatch'
|
|
89
|
+
| 'env-missing'
|
|
90
|
+
| 'no-secret'
|
|
91
|
+
| 'secret-unreadable';
|
|
92
|
+
|
|
93
|
+
/** A refusal of the setup screen's writes. `setup-closed` 403: the mode word
|
|
94
|
+
* is not `setup`. `env-wins` 409: the box .env holds this value. `password`
|
|
95
|
+
* 403: the password step failed. A write may also answer the password hold's
|
|
96
|
+
* 403 (`password_change_required`, its words in `message`) and the one 429. */
|
|
97
|
+
export type SsoSetupRefusal = { error: string; code: 'setup-closed' | 'env-wins' | 'password' };
|
|
98
|
+
|
|
99
|
+
/** POST /api/users/sso-setup/scim-token: this answer alone holds the token. */
|
|
100
|
+
export type SsoSetupScimToken = { token: string };
|
|
101
|
+
|
|
50
102
|
/** GET /api/auth/oidc/status (the signed-in login; 401 without one). Off:
|
|
51
103
|
* `{ mode: 'off' }` only. */
|
|
52
104
|
export type OidcStatusDTO =
|
package/src/dto/rows.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import type { AppNav, AppOpenStat, AppTint } from '../app-nav';
|
|
14
14
|
import type { HistoryActor } from '../role-names';
|
|
15
15
|
import type { ListChips, ListWorkspace } from './grants';
|
|
16
|
+
import type { StoredUpdateNotice } from './update-notice';
|
|
16
17
|
|
|
17
18
|
// ── Row/DTO shapes moved from the server packages (jackdaw split P0) ─────────
|
|
18
19
|
// Sources: @mantle/content, @mantle/email, @mantle/microsoft, @mantle/runtime/agent
|
|
@@ -603,6 +604,10 @@ export type ProfilePreferences = {
|
|
|
603
604
|
/** The email account client sign-in codes are sent from (client logins
|
|
604
605
|
* C2b). A BRAIN key: one sender for the brain. Unset = codes are off. */
|
|
605
606
|
clientSigninSenderId?: string;
|
|
607
|
+
/** The update notice switched on by hand or by an agent (dto/update-notice.ts):
|
|
608
|
+
* a BRAIN key. Read via projectUpdateNotice, never raw; a write of `null`
|
|
609
|
+
* switches it off. Whether it still counts is updateNoticeOn's to say. */
|
|
610
|
+
updateNotice?: StoredUpdateNotice | null;
|
|
606
611
|
/** Tags the owner curates as Dashboard sections on the /team overview: each
|
|
607
612
|
* tag renders a section of up to 5 team-visible shared pages carrying it
|
|
608
613
|
* (newest-updated first, title + summary + /s link). Order here = section
|
|
@@ -624,6 +629,10 @@ export type ProfilePreferences = {
|
|
|
624
629
|
* first changes it (the client's default applies). Written by
|
|
625
630
|
* PUT /api/profile/sounds; read via projectSounds, never raw. */
|
|
626
631
|
sounds?: SoundPreference;
|
|
632
|
+
/** Per-login: an in-app agent may drive this login's window (the agent UI
|
|
633
|
+
* channel, docs/agent-ui.md). Off until the login turns it on. Written
|
|
634
|
+
* by PUT /api/profile/agent-ui; read as `=== true`, never raw. */
|
|
635
|
+
agentUi?: boolean;
|
|
627
636
|
/** Per-login: open count + last-opened instant per app id, feeding the
|
|
628
637
|
* "Most used" and "Recent" filters. Written by recordAppOpen. */
|
|
629
638
|
appOpens?: Record<string, AppOpenStat>;
|
package/src/dto/turns.ts
CHANGED
|
@@ -32,7 +32,8 @@ export type TurnEventType =
|
|
|
32
32
|
| 'reasoning-delta'
|
|
33
33
|
| 'text-delta'
|
|
34
34
|
| 'done'
|
|
35
|
-
| 'error'
|
|
35
|
+
| 'error'
|
|
36
|
+
| 'ui-call';
|
|
36
37
|
|
|
37
38
|
/** A pending outbound message now exists; the client can bind UI to `turnId`. */
|
|
38
39
|
export interface TurnStartData {
|
|
@@ -106,6 +107,19 @@ export interface TurnErrorData {
|
|
|
106
107
|
message: string;
|
|
107
108
|
}
|
|
108
109
|
|
|
110
|
+
/** A ui_* tool asks the turn's window to act (the agent UI channel,
|
|
111
|
+
* docs/agent-ui.md). Only the window the turn named (`windowId` on the turn
|
|
112
|
+
* POST) acts on it; it answers POST /api/assistant/turn/:turnId/ui/:callId
|
|
113
|
+
* with `{ windowId, result }` before `expiresAt` (ISO-8601). `action` is one
|
|
114
|
+
* of AGENT_UI_ACTIONS (@mantle/client-types/agent-ui); `args` the tool's
|
|
115
|
+
* arguments as the model gave them (validated by the tool schema). */
|
|
116
|
+
export interface TurnUiCallData {
|
|
117
|
+
callId: string;
|
|
118
|
+
action: string;
|
|
119
|
+
args: Record<string, unknown>;
|
|
120
|
+
expiresAt: string;
|
|
121
|
+
}
|
|
122
|
+
|
|
109
123
|
/** Fields every turn event carries. */
|
|
110
124
|
export interface TurnEventBase {
|
|
111
125
|
/** Schema version (`TURN_EVENT_SCHEMA_VERSION` at emit time). */
|
|
@@ -127,7 +141,8 @@ export type TurnEvent =
|
|
|
127
141
|
| (TurnEventBase & { type: 'reasoning-delta'; data: TurnReasoningDeltaData })
|
|
128
142
|
| (TurnEventBase & { type: 'text-delta'; data: TurnTextDeltaData })
|
|
129
143
|
| (TurnEventBase & { type: 'done'; data: TurnDoneData })
|
|
130
|
-
| (TurnEventBase & { type: 'error'; data: TurnErrorData })
|
|
144
|
+
| (TurnEventBase & { type: 'error'; data: TurnErrorData })
|
|
145
|
+
| (TurnEventBase & { type: 'ui-call'; data: TurnUiCallData });
|
|
131
146
|
|
|
132
147
|
// ── ask_human questionnaire (runner queues) ───────────────────────────────────
|
|
133
148
|
// THE single source of truth for the questionnaire contract. The plan parser
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The update notice: the "Update In Progress" screen every signed-in login on
|
|
3
|
+
* a box sees while an update runs. An admin (or an agent, over MCP too)
|
|
4
|
+
* switches it on and off with update_notice_on / update_notice_off; the box
|
|
5
|
+
* also counts as updating while its own updater pulls or rolls a release.
|
|
6
|
+
* The rule that decides it is updateNoticeOn (../update-notice.ts).
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** What an "on" stores, a brain preference (`updateNotice`): when, and on
|
|
10
|
+
* which version. `null` is the write that switches it off. */
|
|
11
|
+
export type StoredUpdateNotice = {
|
|
12
|
+
/** When it was switched on (ISO). */
|
|
13
|
+
setAt: string;
|
|
14
|
+
/** The APP_VERSION the box ran then: on another version it counts as off. */
|
|
15
|
+
version: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** GET /api/update-notice: public, so the sign-in page shows it too. One
|
|
19
|
+
* boolean and the build version, which /api/version already tells anyone. */
|
|
20
|
+
export type UpdateNoticeView = {
|
|
21
|
+
on: boolean;
|
|
22
|
+
version: string;
|
|
23
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -36,6 +36,7 @@ export * from './dto/recall';
|
|
|
36
36
|
export * from './dto/contact-shares';
|
|
37
37
|
export * from './dto/services';
|
|
38
38
|
export * from './dto/box-status';
|
|
39
|
+
export * from './dto/update-notice';
|
|
39
40
|
export * from './dto/present-checks';
|
|
40
41
|
// Types only; ACCESS_LEVELS (runtime) is the `@mantle/client-types/dto/access` subpath.
|
|
41
42
|
export type {
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The update notice's rule (update-notice.ts): a manual "on" counts only on
|
|
3
|
+
* the version it was set on and for an hour at most; the updater counts
|
|
4
|
+
* while it pulls or rolls, for an hour at most; anything malformed is off.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, expect, it } from 'vitest';
|
|
7
|
+
import {
|
|
8
|
+
UPDATE_NOTICE_MAX_MS,
|
|
9
|
+
manualNoticeUntil,
|
|
10
|
+
projectUpdateNotice,
|
|
11
|
+
updateNoticeOn,
|
|
12
|
+
updaterBusy,
|
|
13
|
+
} from './update-notice';
|
|
14
|
+
|
|
15
|
+
const T0 = Date.parse('2026-11-06T10:00:00.000Z');
|
|
16
|
+
const SET = { setAt: '2026-11-06T10:00:00.000Z', version: '0.500.31' };
|
|
17
|
+
|
|
18
|
+
describe('projectUpdateNotice', () => {
|
|
19
|
+
it('keeps a well-formed value', () => {
|
|
20
|
+
expect(projectUpdateNotice(SET)).toEqual(SET);
|
|
21
|
+
});
|
|
22
|
+
it.each([null, undefined, 'on', true, {}, { setAt: 'soon', version: '1' }, { setAt: SET.setAt }])(
|
|
23
|
+
'drops %j',
|
|
24
|
+
(v) => {
|
|
25
|
+
expect(projectUpdateNotice(v)).toBeUndefined();
|
|
26
|
+
},
|
|
27
|
+
);
|
|
28
|
+
it('drops extra keys', () => {
|
|
29
|
+
expect(projectUpdateNotice({ ...SET, by: 'someone' })).toEqual(SET);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe('manualNoticeUntil', () => {
|
|
34
|
+
it('counts for an hour on the same version', () => {
|
|
35
|
+
expect(manualNoticeUntil(SET, '0.500.31', T0 + 1000)).toBe(T0 + UPDATE_NOTICE_MAX_MS);
|
|
36
|
+
});
|
|
37
|
+
it('stops at the hour', () => {
|
|
38
|
+
expect(manualNoticeUntil(SET, '0.500.31', T0 + UPDATE_NOTICE_MAX_MS)).toBeNull();
|
|
39
|
+
});
|
|
40
|
+
it('stops on another version (the box rolled)', () => {
|
|
41
|
+
expect(manualNoticeUntil(SET, '0.500.32', T0 + 1000)).toBeNull();
|
|
42
|
+
});
|
|
43
|
+
it('is off with nothing stored', () => {
|
|
44
|
+
expect(manualNoticeUntil(undefined, '0.500.31', T0)).toBeNull();
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('updaterBusy', () => {
|
|
49
|
+
const started = '2026-11-06T10:00:00.000Z';
|
|
50
|
+
it.each(['pulling', 'rolling'])('counts %s', (phase) => {
|
|
51
|
+
expect(updaterBusy({ phase, startedAt: started }, T0 + 1000)).toBe(true);
|
|
52
|
+
});
|
|
53
|
+
it.each(['idle', 'requested', 'done', 'error', 'unconfigured'])('not %s', (phase) => {
|
|
54
|
+
expect(updaterBusy({ phase, startedAt: started }, T0 + 1000)).toBe(false);
|
|
55
|
+
});
|
|
56
|
+
it('not a run that started over an hour ago (an updater that died)', () => {
|
|
57
|
+
expect(updaterBusy({ phase: 'rolling', startedAt: started }, T0 + UPDATE_NOTICE_MAX_MS)).toBe(
|
|
58
|
+
false,
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
it('not without a start, nor without a status', () => {
|
|
62
|
+
expect(updaterBusy({ phase: 'rolling', startedAt: null }, T0)).toBe(false);
|
|
63
|
+
expect(updaterBusy(null, T0)).toBe(false);
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
describe('updateNoticeOn', () => {
|
|
68
|
+
it('is on by hand, or while the updater runs', () => {
|
|
69
|
+
expect(updateNoticeOn({ notice: SET, version: '0.500.31', updater: null, now: T0 })).toBe(true);
|
|
70
|
+
expect(
|
|
71
|
+
updateNoticeOn({
|
|
72
|
+
notice: undefined,
|
|
73
|
+
version: '0.500.31',
|
|
74
|
+
updater: { phase: 'pulling', startedAt: SET.setAt },
|
|
75
|
+
now: T0,
|
|
76
|
+
}),
|
|
77
|
+
).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
it('is off once the box runs the new version and the updater is done', () => {
|
|
80
|
+
expect(
|
|
81
|
+
updateNoticeOn({
|
|
82
|
+
notice: SET,
|
|
83
|
+
version: '0.500.32',
|
|
84
|
+
updater: { phase: 'done', startedAt: SET.setAt },
|
|
85
|
+
now: T0 + 60_000,
|
|
86
|
+
}),
|
|
87
|
+
).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the update notice is on (dto/update-notice.ts), worked out at read
|
|
3
|
+
* time from what is stored and what the updater says. Nothing clears the
|
|
4
|
+
* stored value: a forgotten "off" stops counting by itself, so no reaper or
|
|
5
|
+
* boot step can fail to run and leave a box's logins locked out.
|
|
6
|
+
*/
|
|
7
|
+
import type { StoredUpdateNotice } from './dto/update-notice';
|
|
8
|
+
|
|
9
|
+
/** The longest a notice counts: a manual "on", or an updater run. */
|
|
10
|
+
export const UPDATE_NOTICE_MAX_MS = 60 * 60 * 1000;
|
|
11
|
+
|
|
12
|
+
/** The updater phases that count as an update in progress (its status.json). */
|
|
13
|
+
const UPDATER_BUSY = new Set(['pulling', 'rolling']);
|
|
14
|
+
|
|
15
|
+
/** The stored value, or undefined for anything else (pure). */
|
|
16
|
+
export function projectUpdateNotice(v: unknown): StoredUpdateNotice | undefined {
|
|
17
|
+
if (!v || typeof v !== 'object') return undefined;
|
|
18
|
+
const { setAt, version } = v as Record<string, unknown>;
|
|
19
|
+
if (typeof setAt !== 'string' || typeof version !== 'string' || !version) return undefined;
|
|
20
|
+
if (!Number.isFinite(Date.parse(setAt))) return undefined;
|
|
21
|
+
return { setAt, version };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** When a manual "on" stops counting (ms), or null when it counts not at
|
|
25
|
+
* all: set on another version, or already past its hour (pure). */
|
|
26
|
+
export function manualNoticeUntil(
|
|
27
|
+
notice: StoredUpdateNotice | undefined,
|
|
28
|
+
version: string,
|
|
29
|
+
now: number,
|
|
30
|
+
): number | null {
|
|
31
|
+
if (!notice || notice.version !== version) return null;
|
|
32
|
+
const until = Date.parse(notice.setAt) + UPDATE_NOTICE_MAX_MS;
|
|
33
|
+
return until > now ? until : null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The updater is pulling or rolling, and started within the hour (an
|
|
37
|
+
* updater that died mid-run leaves its status behind) (pure). */
|
|
38
|
+
export function updaterBusy(
|
|
39
|
+
updater: { phase: string; startedAt: string | null } | null | undefined,
|
|
40
|
+
now: number,
|
|
41
|
+
): boolean {
|
|
42
|
+
if (!updater || !UPDATER_BUSY.has(updater.phase) || !updater.startedAt) return false;
|
|
43
|
+
const started = Date.parse(updater.startedAt);
|
|
44
|
+
return Number.isFinite(started) && now - started < UPDATE_NOTICE_MAX_MS;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Whether every login sees the notice (pure). */
|
|
48
|
+
export function updateNoticeOn(input: {
|
|
49
|
+
notice: StoredUpdateNotice | undefined;
|
|
50
|
+
version: string;
|
|
51
|
+
updater: { phase: string; startedAt: string | null } | null | undefined;
|
|
52
|
+
now: number;
|
|
53
|
+
}): boolean {
|
|
54
|
+
return (
|
|
55
|
+
manualNoticeUntil(input.notice, input.version, input.now) !== null ||
|
|
56
|
+
updaterBusy(input.updater, input.now)
|
|
57
|
+
);
|
|
58
|
+
}
|