@1agh/maude 2.1.0 → 2.1.1
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/apps/studio/access/request.ts +1 -0
- package/apps/studio/actions/agents.ts +27 -0
- package/apps/studio/actions/defs/app.ts +28 -1
- package/apps/studio/actions/defs/sync.ts +4 -0
- package/apps/studio/actions.manifest.json +60 -2
- package/apps/studio/actions.parity.json +13 -1
- package/apps/studio/bin/_curl-local.mjs +7 -4
- package/apps/studio/client/app.jsx +16 -4
- package/apps/studio/client/home/HomeAccountsRow.jsx +221 -0
- package/apps/studio/client/home/HomeConnection.jsx +111 -0
- package/apps/studio/client/home/home-accounts-model.js +110 -1
- package/apps/studio/client/home/home-api.js +6 -2
- package/apps/studio/client/home/home-app.jsx +74 -12
- package/apps/studio/client/home/home-model.js +40 -1
- package/apps/studio/client/home/home-where-model.js +105 -0
- package/apps/studio/client/home/home.css +233 -1
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +3 -1
- package/apps/studio/client/hooks/use-tabs.jsx +11 -4
- package/apps/studio/client/panels/TeamProjects.jsx +137 -134
- package/apps/studio/client/share-link.js +12 -0
- package/apps/studio/client/styles/_index.css +4 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
- package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +94 -3
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +187 -4
- package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
- package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
- package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
- package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
- package/apps/studio/client/v2/link-server/link-server.css +109 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
- package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
- package/apps/studio/client/v2/search/search-keywords.js +3 -2
- package/apps/studio/client/v2/settings/account.jsx +4 -2
- package/apps/studio/client/v2/settings/advanced-section.jsx +245 -148
- package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
- package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
- package/apps/studio/client/v2/settings/general-section.jsx +138 -43
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
- package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
- package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
- package/apps/studio/client/v2/settings/settings-cards.js +220 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
- package/apps/studio/client/v2/settings/settings-model.js +91 -31
- package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
- package/apps/studio/client/v2/settings/settings.css +374 -64
- package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
- package/apps/studio/client/v2/settings/this-project-model.js +172 -0
- package/apps/studio/client/v2/settings/use-connections.js +3 -2
- package/apps/studio/client/v2/settings/use-open-card.js +37 -0
- package/apps/studio/client/v2/shell/connection-state.js +197 -0
- package/apps/studio/client/v2/shell/menu-runner.js +7 -2
- package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
- package/apps/studio/client/v2/shell/project-account-model.js +272 -149
- package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
- package/apps/studio/client/v2/shell/project-account.css +237 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
- package/apps/studio/client/v2/shell/shell-parity.js +3 -2
- package/apps/studio/client/v2/shell/shell-parity.json +40 -26
- package/apps/studio/client/v2/shell/use-account.js +2 -0
- package/apps/studio/client/v2/signin/use-signin.js +1 -1
- package/apps/studio/cloud/endpoints.ts +29 -4
- package/apps/studio/dist/client.bundle.js +834 -834
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/home/accounts.ts +30 -11
- package/apps/studio/home/cloud.ts +6 -1
- package/apps/studio/home/hub-health.ts +76 -0
- package/apps/studio/home/routes.ts +9 -3
- package/apps/studio/http.ts +8 -0
- package/apps/studio/migrate/hub.ts +8 -1
- package/apps/studio/routes/hub-link-folder.ts +334 -0
- package/apps/studio/routes/hub-signin.ts +78 -1
- package/apps/studio/routes/index.ts +4 -0
- package/apps/studio/routes/sync.ts +22 -4
- package/apps/studio/shell/api-key.ts +11 -0
- package/apps/studio/sync/accepted-cold-start.ts +144 -8
- package/apps/studio/sync/action-stage.ts +18 -1
- package/apps/studio/sync/ctl-heal.ts +58 -0
- package/apps/studio/sync/file-ledger.ts +38 -4
- package/apps/studio/sync/file-plane.ts +226 -19
- package/apps/studio/sync/held-deletes.ts +86 -5
- package/apps/studio/sync/hub-link.ts +8 -0
- package/apps/studio/sync/index.ts +68 -4
- package/apps/studio/sync/link-consent.ts +22 -75
- package/apps/studio/sync/link-survey.ts +252 -0
- package/apps/studio/sync/local-kernel.ts +16 -1
- package/apps/studio/sync/seed-progress.ts +12 -0
- package/apps/studio/sync/source-recovery.ts +18 -2
- package/apps/studio/sync/status.ts +11 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/whats-new.json +18 -0
- package/cli/lib/bash-guard.mjs +19 -0
- package/cli/lib/design-help.gen.mjs +1 -1
- package/package.json +9 -8
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
- package/apps/studio/client/v2/shell/account-card-model.js +0 -114
- package/apps/studio/client/v2/shell/account-card.jsx +0 -189
|
@@ -123,6 +123,9 @@ export interface SyncNotice {
|
|
|
123
123
|
* which config key opts out. */
|
|
124
124
|
text: string;
|
|
125
125
|
severity: 'info' | 'warn';
|
|
126
|
+
/** 2.1.1 T14 — `set-aside-<slug>`: which of this Mac's lanes (`meta` · `annotations` · `comments`)
|
|
127
|
+
* the project's version replaced, so Sync details can name them without parsing `text`. */
|
|
128
|
+
lanes?: string[];
|
|
126
129
|
at: number;
|
|
127
130
|
}
|
|
128
131
|
|
|
@@ -131,7 +134,7 @@ export interface FilePlaneStatus {
|
|
|
131
134
|
synced: number;
|
|
132
135
|
/** Cumulative files landed this boot. */
|
|
133
136
|
pulled: number;
|
|
134
|
-
/** Cumulative conflicts this boot
|
|
137
|
+
/** Cumulative conflicts this boot: the project's version is the file, this Mac's is parked beside it. */
|
|
135
138
|
conflicts: number;
|
|
136
139
|
/** Sync v2 — cumulative files sent UP this boot. The v1 lane had no push
|
|
137
140
|
* half of its own, so this is absent on a journal-less hub. */
|
|
@@ -176,6 +179,8 @@ export interface FilePlaneStatus {
|
|
|
176
179
|
paths: string[];
|
|
177
180
|
/** Issue #207 (7b) — `delete-out`: the folders the held deletes sit in, largest first. */
|
|
178
181
|
folders?: { folder: string; count: number }[];
|
|
182
|
+
/** 2.1.1 T8 — `delete-in`: a fingerprint of every held path; the answer carries it back. */
|
|
183
|
+
digest?: string;
|
|
179
184
|
/** `code-held`: the version of each listed file on the hub (an older hub names none) — the row
|
|
180
185
|
* shows it and "Adopt as code" sends the sha, so the hub adopts exactly what was shown. */
|
|
181
186
|
files?: { path: string; sha256: string; size: number }[];
|
|
@@ -253,6 +258,11 @@ export interface FilePlaneStatus {
|
|
|
253
258
|
* emits. Same bounding shape `items`/`itemsTruncated` already uses.
|
|
254
259
|
*/
|
|
255
260
|
deliveryTruncated?: number;
|
|
261
|
+
/**
|
|
262
|
+
* 2.1.1 T14 — files in `conflict` whose copy of this Mac's version sits beside them:
|
|
263
|
+
* `{ "<file>": "<copy>" }`, both relative to the design root. Sync details names the copy.
|
|
264
|
+
*/
|
|
265
|
+
conflictCopies?: Record<string, string>;
|
|
256
266
|
/**
|
|
257
267
|
* THE DENOMINATOR (feature-large-project-seed).
|
|
258
268
|
*
|
|
@@ -532,6 +532,9 @@ export const WRITER_REGISTRY: Record<string, WriterEntry> = {
|
|
|
532
532
|
'/_api/generate/keys': { class: 'local' },
|
|
533
533
|
'/_api/generate/whisper-model': { class: 'local' },
|
|
534
534
|
'/_api/hub/link': { class: 'local' },
|
|
535
|
+
// 2.1.1 routes/hub-link-folder.ts: links THIS folder to the person's team server (the attach lane);
|
|
536
|
+
// the seed-up is the sync runtime's, never this route's
|
|
537
|
+
'/_api/hub/link-folder': { class: 'local' },
|
|
535
538
|
'/_api/report': { class: 'local' },
|
|
536
539
|
'/_api/report-fallback': { class: 'local' },
|
|
537
540
|
'/_api/shell-shot': { class: 'local' },
|
|
@@ -567,6 +570,8 @@ export const WRITER_REGISTRY: Record<string, WriterEntry> = {
|
|
|
567
570
|
'/_api/hub-signin/poll': { class: 'local' },
|
|
568
571
|
'/_api/hub-signin/cancel': { class: 'local' },
|
|
569
572
|
'/_api/hub-signin/return': { class: 'local' },
|
|
573
|
+
// 2.1.1 T5 — "Link your server": a tokenless /health check of a typed address (writes nothing)
|
|
574
|
+
'/_api/hub-signin/check': { class: 'read' },
|
|
570
575
|
// --- the V2-2.5 table (routes/*.ts) — classified by the lead (decision v2-2.5 classification)
|
|
571
576
|
'/_api/outbox': { class: 'read' }, // routes/outbox.ts: the queue's view
|
|
572
577
|
'/_api/outbox/:id': { class: 'read' },
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "./whats-new.schema.json",
|
|
3
3
|
"entries": [
|
|
4
|
+
{
|
|
5
|
+
"id": "accounts-and-where-projects-live",
|
|
6
|
+
"version": "2.1.1",
|
|
7
|
+
"date": "2026-11-09",
|
|
8
|
+
"kind": "feature",
|
|
9
|
+
"title": "See where each project lives",
|
|
10
|
+
"summary": "The account button now shows which account a project uses, where it lives and whether it connects, with Sign in again one click away when a sign-in stops working. Link your server sends a folder to your own server and asks first when that server already holds work, and Settings opens with This project.",
|
|
11
|
+
"surface": "design-ui"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"id": "own-server-sync-fixes-2-1-1",
|
|
15
|
+
"version": "2.1.1",
|
|
16
|
+
"date": "2026-11-09",
|
|
17
|
+
"kind": "fix",
|
|
18
|
+
"title": "Signing in to your own server works again",
|
|
19
|
+
"summary": "Sign-in to your team's own server finishes again after the browser hands back. Files the owner removed for good stay removed, and a first link keeps your comments, sticky notes and layout.",
|
|
20
|
+
"surface": "design-ui"
|
|
21
|
+
},
|
|
4
22
|
{
|
|
5
23
|
"id": "generation-spend-limits",
|
|
6
24
|
"version": "2.1.0",
|
package/cli/lib/bash-guard.mjs
CHANGED
|
@@ -597,6 +597,25 @@ const HUMAN_ONLY_ROUTES = [
|
|
|
597
597
|
what: 'Move to cloud',
|
|
598
598
|
why: 'it uploads the project to their billed cloud account',
|
|
599
599
|
},
|
|
600
|
+
// 2.1.1 — Link your server: THIS folder joins the person's team server; the studio answers a
|
|
601
|
+
// write without the window's own fetch 403 window-only (routes/hub-link-folder.ts).
|
|
602
|
+
{
|
|
603
|
+
re: /\/_api\/hub\/link-folder(?![\w-])/i,
|
|
604
|
+
what: 'Link your server',
|
|
605
|
+
why: "it uploads the project to their team server with this Mac's sign-in",
|
|
606
|
+
},
|
|
607
|
+
// 2.1.1 T8 — a team-server sign-in and saving a team-server credential are the person's acts; the
|
|
608
|
+
// studio answers them 403 person-only to a key holder (shell/api-key.ts PERSON_ONLY).
|
|
609
|
+
{
|
|
610
|
+
re: /\/_api\/hub-signin\/(?:start|check)(?![\w-])/i,
|
|
611
|
+
what: 'Sign in to your server',
|
|
612
|
+
why: 'it signs this Mac in to a team server and stores that sign-in',
|
|
613
|
+
},
|
|
614
|
+
{
|
|
615
|
+
re: /\/_api\/hub\/link(?![\w-])/i,
|
|
616
|
+
what: 'Save a server sign-in',
|
|
617
|
+
why: "it stores a team server's credential on this Mac",
|
|
618
|
+
},
|
|
600
619
|
// V2-8.9 defender M1 (decision maude/v2-8.9-sync-link-confirm-needs-fetch-metadata).
|
|
601
620
|
{
|
|
602
621
|
re: /\/_api\/sync\/link\/confirm(?![\w-])/i,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// GENERATED by scripts/gen-actions.mjs from apps/studio/actions/verbs.ts — DO NOT EDIT BY HAND.
|
|
2
2
|
// What `maude design help` prints under the static usage (contract V2-1.11 §5.7 rule 6).
|
|
3
|
-
// manifest
|
|
3
|
+
// manifest cc9b94549577
|
|
4
4
|
|
|
5
5
|
export const DESIGN_VERB_TIERS_HELP =
|
|
6
6
|
"Verbs by permission tier (generated from actions.manifest.json, contract V2-1.11 §5.3):\n auto No prompt in the Maude chat (effect none/project):\n prep · bootstrap-check · slug · server-up · runtime-health · screenshot · smoke\n visual-sanity · perf · canvas-rects · canvas-errors · canvas-source\n read-annotations · svg-optimize · asset-sweep · draw-proof · probe-footage\n smart-frames · agent-browser-safe · chat-open · serve · status · index · assets\n help · check · place · layout-check · open · history list · history show\n history diff · history object · trash list · comments list · exports list\n exports again · runs list · runs stop · logs · sync status · annotate · canvas-edit\n handoff · import-asset · import-tokens · ingest-footage · photo-adjust\n transcribe-local · beats · captions list · captions add · captions export · captions\n cut-words · cut-to-beat · reel-place · ds-check · ds-upgrade analyse\n ds-upgrade plan · ds-upgrade validate · ds-upgrade status · ds-upgrade stage\n ds-upgrade prove · ds-upgrade discard · ds-upgrade cancel · trash move\n trash restore · ds status · ds usage · ds check-system · ds revisions\n prompt Shows the permission card:\n hook · video-proxy · export · curl-local · draw-build · to-lottie · generate\n audio-search · fetch-asset · ensure-browser · transcribe · import-figma\n import-brand · photo-bg-remove · describe · init · ds-upgrade · bulk-deletes\n history restore · trash · history undo · history name · exports · sync resync · sync\n runs · ds · comments reply · comments resolve · comments reopen · comments add\n comments · history\n human For people in a terminal. Never in the AI allow list:\n trash clear · link · adopt · unlink · detach\n Every studio capability's file or verb: the design plugin's studio-actions skill.\n";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@1agh/maude",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Marketplace of Claude Code plugins by Michal Dovrtěl: `design` (canvas-first design iteration) + `flow` (generic agentic workflow loop with .ai second brain). Ships the `maude` CLI (with `mdcc` legacy alias) to scaffold workspace, run the design dev server, and manage configs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"test:e2e:desktop:parity": "pnpm --filter @maude/desktop-e2e e2e:parity",
|
|
61
61
|
"test:e2e:desktop:sidecar-respawn": "pnpm --filter @maude/desktop-e2e e2e:sidecar-respawn",
|
|
62
62
|
"test:e2e:desktop:exports": "pnpm --filter @maude/desktop-e2e e2e:exports",
|
|
63
|
+
"test:e2e:desktop:accounts": "pnpm --filter @maude/desktop-e2e e2e:accounts",
|
|
63
64
|
"test:e2e:desktop:team-project": "pnpm --filter @maude/desktop-e2e e2e:team-project",
|
|
64
65
|
"test:e2e:desktop:ai-runs": "pnpm --filter @maude/desktop-e2e e2e:ai-runs",
|
|
65
66
|
"test:e2e:desktop:team-cell": "pnpm --filter @maude/desktop-e2e e2e:team-cell",
|
|
@@ -71,13 +72,13 @@
|
|
|
71
72
|
"test:e2e:desktop:parity:cloud": "pnpm --filter @maude/desktop-e2e e2e:parity:cloud"
|
|
72
73
|
},
|
|
73
74
|
"optionalDependencies": {
|
|
74
|
-
"@1agh/maude-darwin-arm64": "2.1.
|
|
75
|
-
"@1agh/maude-darwin-x64": "2.1.
|
|
76
|
-
"@1agh/maude-linux-arm64": "2.1.
|
|
77
|
-
"@1agh/maude-linux-arm64-musl": "2.1.
|
|
78
|
-
"@1agh/maude-linux-x64": "2.1.
|
|
79
|
-
"@1agh/maude-linux-x64-musl": "2.1.
|
|
80
|
-
"@1agh/maude-win32-x64": "2.1.
|
|
75
|
+
"@1agh/maude-darwin-arm64": "2.1.1",
|
|
76
|
+
"@1agh/maude-darwin-x64": "2.1.1",
|
|
77
|
+
"@1agh/maude-linux-arm64": "2.1.1",
|
|
78
|
+
"@1agh/maude-linux-arm64-musl": "2.1.1",
|
|
79
|
+
"@1agh/maude-linux-x64": "2.1.1",
|
|
80
|
+
"@1agh/maude-linux-x64-musl": "2.1.1",
|
|
81
|
+
"@1agh/maude-win32-x64": "2.1.1"
|
|
81
82
|
},
|
|
82
83
|
"files": [
|
|
83
84
|
"cli",
|
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
// client/v2/onboarding/HubSheet.jsx — "Connect to your own hub" (02 ob-adv-sheets, S6.9). The sheet S11.14's
|
|
2
|
-
// Settings › Connections mounts as "Add a team server…" (G0-D/D12), so it is a view: it owns its fields and
|
|
3
|
-
// calls back; what Test connection and Sign in DO is the caller's (Home: `/_home/hub/{test,signin/*,prepare}`).
|
|
4
|
-
//
|
|
5
|
-
// <HubSheet onTest={(url) => {ok, version?, error?}}
|
|
6
|
-
// onSignIn={({url, invite, onWaiting}) => {ok, error?, cancelled?}}
|
|
7
|
-
// onAbortSignIn={() => void} onCancel />
|
|
8
|
-
//
|
|
9
|
-
// Issue #204 (decision maude/v2-michal-team-server-signin-via-hub-page): the app owns NO login method for a
|
|
10
|
-
// team server. There is no email or password field here: Sign in opens the hub's OWN sign-in page in the
|
|
11
|
-
// browser (with an invite, the hub's own invite page), the sheet waits (`onWaiting` → "Finish signing in in
|
|
12
|
-
// your browser.", Cancel = `onAbortSignIn`) and the caller opens the project once the browser came back.
|
|
13
|
-
// The invite key is a bearer secret: a masked field, read once on Sign in and emptied at once; an error
|
|
14
|
-
// line is the server's own words, never an echo.
|
|
15
|
-
|
|
16
|
-
import { useEffect, useRef, useState } from 'react';
|
|
17
|
-
|
|
18
|
-
import { AdvModal, AdvSheet, Sw } from './AdvSheet.jsx';
|
|
19
|
-
import { HUB_WORDS as W } from './onboarding-model.js';
|
|
20
|
-
|
|
21
|
-
/** `https://hub.example/join/inv_…` → `https://hub.example` (the hub's own invite link); else null. */
|
|
22
|
-
export function hubOfInviteLink(raw) {
|
|
23
|
-
try {
|
|
24
|
-
const u = new URL(String(raw ?? '').trim());
|
|
25
|
-
if (u.protocol !== 'https:' && u.protocol !== 'http:') return null;
|
|
26
|
-
const m = /^(.*)\/join\/[^/]+$/.exec(u.pathname);
|
|
27
|
-
return m ? `${u.origin}${m[1]}` : null;
|
|
28
|
-
} catch {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @param {{ onTest: (url: string) => Promise<{ok: boolean, version?: string|null, error?: string}>,
|
|
35
|
-
* onSignIn: (v: {url: string, invite: string, onWaiting: () => void}) =>
|
|
36
|
-
* Promise<{ok: boolean, error?: string, cancelled?: boolean}>,
|
|
37
|
-
* onAbortSignIn?: () => void,
|
|
38
|
-
* onCancel: () => void, initialUrl?: string }} props
|
|
39
|
-
*/
|
|
40
|
-
export function HubSheet({ onTest, onSignIn, onAbortSignIn, onCancel, initialUrl = '' }) {
|
|
41
|
-
const [url, setUrl] = useState(initialUrl);
|
|
42
|
-
const [invite, setInvite] = useState('');
|
|
43
|
-
const [test, setTest] = useState({ phase: 'idle', version: null, error: null });
|
|
44
|
-
const [busy, setBusy] = useState(false);
|
|
45
|
-
const [waiting, setWaiting] = useState(false);
|
|
46
|
-
const [error, setError] = useState(null);
|
|
47
|
-
const alive = useRef(true);
|
|
48
|
-
const seq = useRef(0); // an answer for an address that has since changed is dropped
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
alive.current = true;
|
|
51
|
-
return () => {
|
|
52
|
-
alive.current = false;
|
|
53
|
-
};
|
|
54
|
-
}, []);
|
|
55
|
-
|
|
56
|
-
const runTest = async () => {
|
|
57
|
-
const id = ++seq.current;
|
|
58
|
-
setTest({ phase: 'busy', version: null, error: null });
|
|
59
|
-
let r;
|
|
60
|
-
try {
|
|
61
|
-
r = await onTest(url.trim());
|
|
62
|
-
} catch {
|
|
63
|
-
r = { ok: false, error: W.unreachable };
|
|
64
|
-
}
|
|
65
|
-
if (!alive.current || id !== seq.current) return;
|
|
66
|
-
setTest(
|
|
67
|
-
r?.ok
|
|
68
|
-
? { phase: 'ok', version: r.version ?? null, error: null }
|
|
69
|
-
: { phase: 'bad', version: null, error: r?.error || W.unreachable }
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const signIn = async () => {
|
|
74
|
-
// read once, empty the field now — an invite key never outlives this call in the page
|
|
75
|
-
const key = invite.trim();
|
|
76
|
-
setInvite('');
|
|
77
|
-
setError(null);
|
|
78
|
-
setBusy(true);
|
|
79
|
-
let r;
|
|
80
|
-
try {
|
|
81
|
-
r = await onSignIn({
|
|
82
|
-
url: url.trim(),
|
|
83
|
-
invite: key,
|
|
84
|
-
onWaiting: () => {
|
|
85
|
-
if (alive.current) setWaiting(true);
|
|
86
|
-
},
|
|
87
|
-
});
|
|
88
|
-
} catch {
|
|
89
|
-
r = { ok: false, error: W.unreachable };
|
|
90
|
-
}
|
|
91
|
-
if (!alive.current) return;
|
|
92
|
-
setBusy(false);
|
|
93
|
-
setWaiting(false);
|
|
94
|
-
if (!r?.ok && !r?.cancelled) setError(r?.error || W.unreachable);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const abort = () => {
|
|
98
|
-
setWaiting(false);
|
|
99
|
-
onAbortSignIn?.();
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
return (
|
|
103
|
-
<AdvModal onCancel={waiting ? abort : onCancel}>
|
|
104
|
-
<AdvSheet
|
|
105
|
-
id="hub"
|
|
106
|
-
title={W.title}
|
|
107
|
-
verb={W.verb}
|
|
108
|
-
busyVerb={W.busy}
|
|
109
|
-
busy={busy}
|
|
110
|
-
canSubmit={!!url.trim() && !busy}
|
|
111
|
-
onSubmit={signIn}
|
|
112
|
-
onCancel={waiting ? abort : onCancel}
|
|
113
|
-
>
|
|
114
|
-
<span className="ob-field">
|
|
115
|
-
<label className="ob-field-label" htmlFor="onb-hub-url">
|
|
116
|
-
{W.addressLabel}
|
|
117
|
-
</label>
|
|
118
|
-
<span className="ob-row2">
|
|
119
|
-
<input
|
|
120
|
-
id="onb-hub-url"
|
|
121
|
-
className="ob-input ob-mono"
|
|
122
|
-
data-testid="onb-hub-url"
|
|
123
|
-
type="text"
|
|
124
|
-
inputMode="url"
|
|
125
|
-
autoComplete="off"
|
|
126
|
-
spellCheck={false}
|
|
127
|
-
placeholder="https://"
|
|
128
|
-
// biome-ignore lint/a11y/noAutofocus: the sheet opens for this one field
|
|
129
|
-
autoFocus
|
|
130
|
-
disabled={busy}
|
|
131
|
-
value={url}
|
|
132
|
-
onChange={(e) => {
|
|
133
|
-
seq.current += 1;
|
|
134
|
-
setUrl(e.target.value);
|
|
135
|
-
setTest({ phase: 'idle', version: null, error: null });
|
|
136
|
-
}}
|
|
137
|
-
/>
|
|
138
|
-
<button
|
|
139
|
-
type="button"
|
|
140
|
-
className="btn btn--sm"
|
|
141
|
-
data-testid="onb-hub-test"
|
|
142
|
-
disabled={!url.trim() || test.phase === 'busy' || busy}
|
|
143
|
-
onClick={runTest}
|
|
144
|
-
>
|
|
145
|
-
{W.test}
|
|
146
|
-
</button>
|
|
147
|
-
</span>
|
|
148
|
-
{test.phase === 'busy' ? (
|
|
149
|
-
<span className="ob-ok" role="status">
|
|
150
|
-
<Sw state="busy" testid="onb-hub-testing">
|
|
151
|
-
{W.testing}
|
|
152
|
-
</Sw>
|
|
153
|
-
</span>
|
|
154
|
-
) : null}
|
|
155
|
-
{test.phase === 'ok' ? (
|
|
156
|
-
<span className="ob-ok" role="status">
|
|
157
|
-
<Sw state="ok" testid="onb-hub-reachable">
|
|
158
|
-
{W.reachable(test.version)}
|
|
159
|
-
</Sw>
|
|
160
|
-
</span>
|
|
161
|
-
) : null}
|
|
162
|
-
{test.phase === 'bad' ? (
|
|
163
|
-
<span className="ob-err" role="alert" data-testid="onb-hub-test-error">
|
|
164
|
-
{test.error}
|
|
165
|
-
</span>
|
|
166
|
-
) : null}
|
|
167
|
-
</span>
|
|
168
|
-
|
|
169
|
-
<span className="ob-field">
|
|
170
|
-
<label className="ob-field-label" htmlFor="onb-hub-invite">
|
|
171
|
-
{W.inviteLabel}
|
|
172
|
-
</label>
|
|
173
|
-
<input
|
|
174
|
-
id="onb-hub-invite"
|
|
175
|
-
className="ob-input"
|
|
176
|
-
data-testid="onb-hub-invite"
|
|
177
|
-
// a bearer secret: masked, never drawn back
|
|
178
|
-
type="password"
|
|
179
|
-
autoComplete="off"
|
|
180
|
-
spellCheck={false}
|
|
181
|
-
placeholder={W.invitePlaceholder}
|
|
182
|
-
disabled={busy}
|
|
183
|
-
value={invite}
|
|
184
|
-
onChange={(e) => {
|
|
185
|
-
const v = e.target.value;
|
|
186
|
-
setInvite(v);
|
|
187
|
-
// a pasted hub link names its hub: fill an empty address (the address is not secret)
|
|
188
|
-
const at = url.trim() ? null : hubOfInviteLink(v);
|
|
189
|
-
if (at) {
|
|
190
|
-
seq.current += 1;
|
|
191
|
-
setUrl(at);
|
|
192
|
-
setTest({ phase: 'idle', version: null, error: null });
|
|
193
|
-
}
|
|
194
|
-
}}
|
|
195
|
-
/>
|
|
196
|
-
</span>
|
|
197
|
-
|
|
198
|
-
{waiting ? (
|
|
199
|
-
<p className="ob-ok" role="status" data-testid="onb-hub-waiting">
|
|
200
|
-
<Sw state="busy">{W.waiting}</Sw>
|
|
201
|
-
</p>
|
|
202
|
-
) : null}
|
|
203
|
-
{error ? (
|
|
204
|
-
<p className="ai-conn-err" role="alert" data-testid="onb-hub-error">
|
|
205
|
-
{error}
|
|
206
|
-
</p>
|
|
207
|
-
) : null}
|
|
208
|
-
<p className="ob-fine">{W.fine}</p>
|
|
209
|
-
</AdvSheet>
|
|
210
|
-
</AdvModal>
|
|
211
|
-
);
|
|
212
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// client/v2/shell/account-card-model.js — S1.22a: the account chip beside the faces and its card
|
|
2
|
-
// (canvas 11 · pn-accounts, CONTRACT §6 "Accounts": each project tab is bound to one account).
|
|
3
|
-
//
|
|
4
|
-
// PURE: what the chip and the card SAY. The binding itself is the shell's (V2-3.1 / V2-3.8: a project
|
|
5
|
-
// carries a profile, `/_config.profile` is `{ id, label? }`); this module only words it.
|
|
6
|
-
//
|
|
7
|
-
// Two inputs the page has and one it may have:
|
|
8
|
-
// profile `/_config.profile` — which account THIS tab runs as (always known on the desktop)
|
|
9
|
-
// email `/_api/cloud/status` — the signed-in address of that profile (absent when signed out)
|
|
10
|
-
// accounts OPTIONAL — every account on this Mac, `[{ id, label, email, projects }]`: `projects` is
|
|
11
|
-
// the project names for the caller's own account and a count (a number) for every other
|
|
12
|
-
// one (S1.22b `accounts_list`, option B). A project page cannot read the shell's profile registry (the page
|
|
13
|
-
// capability deliberately omits it), so this arrives only from a shell command that returns
|
|
14
|
-
// it for the caller (patch request S1.22a-1). Without it the card still says everything that
|
|
15
|
-
// is known and leaves out the lines that would need it — never an invented list.
|
|
16
|
-
//
|
|
17
|
-
// The canvas draws the chip "only when this Mac has two or more accounts". A tab on a profile other than
|
|
18
|
-
// `default` proves a second account exists (the default profile always does); a tab on `default` needs the
|
|
19
|
-
// list to say so.
|
|
20
|
-
|
|
21
|
-
import { ACTIONS_BY_ID } from '../../../actions/index.ts';
|
|
22
|
-
import { accountTone } from '../../shell/account-tone.js';
|
|
23
|
-
|
|
24
|
-
const DEFAULT_ID = 'default';
|
|
25
|
-
|
|
26
|
-
const labelOf = (p) => String(p?.label || p?.id || '').trim();
|
|
27
|
-
const initialOf = (label) => (label ? Array.from(label)[0].toUpperCase() : '·');
|
|
28
|
-
const plural = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
|
29
|
-
|
|
30
|
-
/** "A" · "A and B" · "A, B and C" · "A, B and 4 more" — the canvas's project lists. */
|
|
31
|
-
export function projectsPhrase(names) {
|
|
32
|
-
const list = (names ?? []).filter((n) => typeof n === 'string' && n.trim());
|
|
33
|
-
if (list.length === 0) return '';
|
|
34
|
-
if (list.length === 1) return list[0];
|
|
35
|
-
if (list.length <= 3) return `${list.slice(0, -1).join(', ')} and ${list[list.length - 1]}`;
|
|
36
|
-
return `${list[0]}, ${list[1]} and ${list.length - 2} more`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/** The account's tone: the one function every surface asks (shell/account-tone.js) — Work sky,
|
|
40
|
-
* Personal yellow, anything else a stable object-palette tone. */
|
|
41
|
-
const toneOf = (id, label) => accountTone(id, label);
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* The chip in the Share cluster, or null when there is nothing to show.
|
|
45
|
-
* @param native the desktop app (a browser tab / cloud tab has no Mac accounts)
|
|
46
|
-
* @param connected this profile holds a cloud sign-in (an account is what a sign-in IS)
|
|
47
|
-
* @param cloud a cloud tab (its account is the hub's, not the Mac's)
|
|
48
|
-
*/
|
|
49
|
-
export function accountChip({ native, connected, cloud = false, profile, email, accounts = null }) {
|
|
50
|
-
if (!native || cloud || !connected) return null;
|
|
51
|
-
const id = profile?.id || DEFAULT_ID;
|
|
52
|
-
const twoOrMore = Array.isArray(accounts) ? accounts.length >= 2 : id !== DEFAULT_ID;
|
|
53
|
-
if (!twoOrMore) return null;
|
|
54
|
-
const label = labelOf(profile) || id;
|
|
55
|
-
return {
|
|
56
|
-
id,
|
|
57
|
-
label,
|
|
58
|
-
initial: initialOf(label),
|
|
59
|
-
tone: toneOf(id, label),
|
|
60
|
-
title: email ? `${label} · ${email}` : label,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Everything the open card says. */
|
|
65
|
-
export function accountCard({ project, profile, email, accounts = null }) {
|
|
66
|
-
const id = profile?.id || DEFAULT_ID;
|
|
67
|
-
const label = labelOf(profile) || id;
|
|
68
|
-
const list = Array.isArray(accounts) ? accounts : null;
|
|
69
|
-
const mine = list?.find((a) => a?.id === id) ?? null;
|
|
70
|
-
const here = (Array.isArray(mine?.projects) ? mine.projects : []).filter(
|
|
71
|
-
(n) => typeof n === 'string'
|
|
72
|
-
);
|
|
73
|
-
const who = email || label;
|
|
74
|
-
const effect = 'Signs out every project on it';
|
|
75
|
-
const named = projectsPhrase(here);
|
|
76
|
-
return {
|
|
77
|
-
current: {
|
|
78
|
-
initial: initialOf(label),
|
|
79
|
-
tone: toneOf(id, label),
|
|
80
|
-
title: email ? `${label} · ${email}` : label,
|
|
81
|
-
sub: project ? `${project} uses this account` : 'This project uses this account',
|
|
82
|
-
},
|
|
83
|
-
others: (list ?? [])
|
|
84
|
-
.filter((a) => a && a.id !== id)
|
|
85
|
-
.map((a) => {
|
|
86
|
-
const l = labelOf(a) || a.id;
|
|
87
|
-
return {
|
|
88
|
-
id: a.id,
|
|
89
|
-
initial: initialOf(l),
|
|
90
|
-
tone: toneOf(a.id, l),
|
|
91
|
-
title: a.email ? `${l} · ${a.email}` : l,
|
|
92
|
-
// S1.22b `accounts_list` (option B): another account carries a COUNT, not names.
|
|
93
|
-
sub: Array.isArray(a.projects)
|
|
94
|
-
? projectsPhrase(a.projects) || plural(a.projects.length, 'project', 'projects')
|
|
95
|
-
: plural(Number(a.projects) || 0, 'project', 'projects'),
|
|
96
|
-
};
|
|
97
|
-
}),
|
|
98
|
-
// The registry's own label — one label on every surface (CONTRACT §3).
|
|
99
|
-
switchLabel: ACTIONS_BY_ID.get('account.switch')?.label ?? 'Sign in as another account…',
|
|
100
|
-
signOut: {
|
|
101
|
-
label: `Sign out of ${who}…`,
|
|
102
|
-
sub: named ? `${effect}: ${named}.` : `${effect}.`,
|
|
103
|
-
confirm: {
|
|
104
|
-
title: `Sign out of ${who}?`,
|
|
105
|
-
body: 'Every project on it is signed out. Your work stays on this Mac.',
|
|
106
|
-
primary: 'Sign out',
|
|
107
|
-
cancel: 'Cancel',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
foot: project
|
|
111
|
-
? `Kept on this Mac — ${project} opens as ${label} next time.`
|
|
112
|
-
: `Kept on this Mac — this project opens as ${label} next time.`,
|
|
113
|
-
};
|
|
114
|
-
}
|