create-pmos 0.470.0 → 0.471.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.470.0",
3
+ "version": "0.471.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -32,6 +32,19 @@
32
32
  "audit"
33
33
  ],
34
34
  "pmosChanges": [
35
+ {
36
+ "v": "0.471.0",
37
+ "at": "2026-10-31T13:21:46.914Z",
38
+ "f": 3,
39
+ "prs": [
40
+ {
41
+ "n": 1124,
42
+ "t": "The Shared tab on the Board — join a team, read its boards, open one (board-publish slice 4)",
43
+ "s": "The Shared tab on the Board — join a team, read its boards, open one (board-publish slice 4)",
44
+ "k": "new"
45
+ }
46
+ ]
47
+ },
35
48
  {
36
49
  "v": "0.470.0",
37
50
  "at": "2026-10-31T12:11:04.375Z",
@@ -284,19 +297,6 @@
284
297
  "k": "new"
285
298
  }
286
299
  ]
287
- },
288
- {
289
- "v": "0.451.0",
290
- "at": "2026-10-29T08:45:28.582Z",
291
- "f": 3,
292
- "prs": [
293
- {
294
- "n": 1097,
295
- "t": "Catch up to Claude Code 2.1.312",
296
- "s": "Catch up to Claude Code 2.1.312",
297
- "k": "x"
298
- }
299
- ]
300
300
  }
301
301
  ]
302
302
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@a86e5a73
1
+ kernel-source: pmos@d7c341c8
2
2
  assembled: 2026-10-31
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-10-31T12:11:00Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-31T13:21:43Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-10-31T12:11:00Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-31T13:21:43Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-10-31T12:11:00Z"}
5
+ generated: {by: process:create-pmos, at: "2026-10-31T13:21:43Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -0,0 +1,155 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /* board-shared-ui — the Shared tab of the Board (initiative board-publish, slice 4; planning/prd/board-publish-prd.md T1 to T6; design
4
+ * prototype/board-publish/shared-view-design.html). Serves the real page from the real server. The workspace's /api/board-publish answers are served by
5
+ * the test (the server side is tested in board-publish-teams.test.js against the real host), so each press is checked on what the page SENDS and draws.
6
+ * A the tab and its number · B join · C the list · D a team that cannot be read · E leave · F reads happen on open and on Refresh only · G a phone */
7
+ const path = require('path');
8
+ const { spawn } = require('child_process');
9
+ const { findBrowser } = require('./lib/find-browser');
10
+ const T = require('./test-run').configure({ name: 'board-shared-ui' });
11
+ const BP = require('./lib/board-premium.js');
12
+ const F = require('./fixtures/board-premium-facts.js');
13
+ const Pack = require('./lib/board-pack.js');
14
+
15
+ let n = 0; let bad = 0;
16
+ const ok = (name, cond, extra = '') => { n++; if (!cond) bad++; console.log(`${cond ? ' ✓' : ' ✗'} ${name}${!cond && extra !== '' ? ' — ' + String(extra).slice(0, 300) : ''}`); };
17
+ const iso = (ms) => new Date(Date.now() + ms).toISOString();
18
+
19
+ (async () => {
20
+ const { chromium } = require('playwright-core');
21
+ const srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
22
+ const finish = async (browser, code) => { try { if (browser) await browser.close(); } catch { /* gone */ } try { srv.kill('SIGKILL'); } catch { /* gone */ } T.killTmux(); console.log(`\n${n - bad}/${n} board-shared-ui assertions passed`); process.exit(code !== undefined ? code : (bad ? 1 : 0)); };
23
+ process.on('unhandledRejection', (e) => { console.error(e); finish(null, 1); });
24
+ await T.waitForServer(T.BASE);
25
+ const browser = await chromium.launch({ executablePath: findBrowser() });
26
+ const model = BP.build(F.programFacts('idpf'));
27
+ const BOARD = '/api/board-premium?ws=idpf&board=idpf';
28
+
29
+ const MINE = [{ id: 'mine0000000000000001', url: 'https://boards.test/b/mine0000000000000001', team: 'Product', name: 'IDPF', kind: 'product', by: 'Wawan', made: iso(-86400000), ends: iso(6 * 86400000), views: 3 },
30
+ { id: 'mine0000000000000002', url: 'https://boards.test/b/mine0000000000000002', team: 'Product', name: 'Project Ascent', kind: 'program', by: 'Wawan', made: iso(-2 * 86400000), ends: iso(20 * 3600000), views: 11 }];
31
+ const TEAM_OK = { team: 'Product', host: 'boards.test', ok: true, links: [
32
+ { id: 'team0000000000000001', name: 'Descope feature parity', kind: 'initiative', by: 'Dimas', made: iso(-3 * 86400000), ends: iso(20 * 3600000), views: 7 },
33
+ { id: 'team0000000000000002', name: 'Payments redesign', kind: 'program', by: 'Anya', made: iso(-4 * 86400000), ends: iso(5 * 86400000), views: 4 },
34
+ { id: 'team0000000000000003', name: 'Legacy IdP sunset', kind: 'initiative', by: 'Mei', made: iso(-12 * 86400000), ends: iso(-86400000), views: 9 },
35
+ Object.assign({}, { id: 'mine0000000000000001', name: 'IDPF', kind: 'product', by: 'Wawan', made: iso(-86400000), ends: iso(6 * 86400000), views: 3 })] };
36
+ const W = { yours: [], teams: [], names: [], posts: [], reads: 0, joinAnswer: null, popup: null };
37
+ const open = async (w, h, url, init) => {
38
+ const ctx = await browser.newContext({ viewport: { width: w, height: h } });
39
+ await ctx.route((u) => /\/api\/board-premium/.test(u.toString()), (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model, as_of: 1 }) }));
40
+ await ctx.route((u) => new URL(u).pathname === '/api/programs', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, programs: F.programs() }) }));
41
+ await ctx.route((u) => new URL(u).pathname === '/api/board-publish', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, host: 'boards.test', days: [1, 7, 30], password: 'x', links: W.yours, teams: W.names, choices: null }) }));
42
+ await ctx.route((u) => new URL(u).pathname === '/api/board-publish/shared', (r) => { W.reads++; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, readAt: new Date().toISOString(), yours: W.yours, teams: W.teams }) }); });
43
+ await ctx.route((u) => /\/api\/board-publish\/(join|leave|open|republish|off)$/.test(new URL(u).pathname), (r) => {
44
+ const p = new URL(r.request().url()).pathname; const body = JSON.parse(r.request().postData() || '{}'); W.posts.push({ p, body });
45
+ if (p.endsWith('/join')) { const a = W.joinAnswer; if (a) return r.fulfill({ contentType: 'application/json', status: a.status || 400, body: JSON.stringify(a.body) }); W.names = ['Product']; W.teams = [JSON.parse(JSON.stringify(TEAM_OK))]; return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, team: 'Product' }) }); }
46
+ if (p.endsWith('/open')) return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, url: 'https://boards.test/b/' + body.id + '?t=ONETIME' }) });
47
+ if (p.endsWith('/leave')) { W.names = []; W.teams = []; }
48
+ if (p.endsWith('/off')) { W.yours = W.yours.filter((l) => l.id !== body.id); W.teams.forEach((t) => { if (t.links) t.links = t.links.filter((l) => l.id !== body.id); }); }
49
+ return r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true }) });
50
+ });
51
+ await ctx.route('https://boards.test/**', (r) => r.fulfill({ contentType: 'text/html', body: '<title>host</title><p>the board</p>' }));
52
+ const errs = []; const p = await ctx.newPage(); p.on('pageerror', (e) => errs.push(e.message));
53
+ const reqs = []; ctx.on('request', (r) => reqs.push(new URL(r.url()).pathname));
54
+ await p.addInitScript(() => { try { localStorage.setItem('pmos.board.view', 'list'); localStorage.setItem('pmos.board.grouping', 'program'); } catch (e) { /* none */ } });
55
+ await p.goto(T.BASE + url); await p.waitForSelector('#tabShared', { timeout: 15000 }).catch(() => {}); await p.waitForTimeout(700);
56
+ return { ctx, p, errs, reqs };
57
+ };
58
+ const reset = (o = {}) => { Object.assign(W, { yours: [], teams: [], names: [], posts: [], reads: 0, joinAnswer: null }, o); };
59
+
60
+ console.log('A the tab and its number');
61
+ reset();
62
+ let s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf');
63
+ ok('A1 Shared is a tab beside Initiatives and Documents, and has no number when there is nothing', await s.p.locator('#tabShared').isVisible() && /^Shared\s*$/.test((await s.p.locator('#tabShared').textContent()).trim()));
64
+ ok('A2 opening the tab with nothing joined asks nothing of any host beyond the read, and shows one sentence and the invite field', await (async () => { await s.p.click('#tabShared'); await s.p.waitForSelector('#shInvite'); return /Join a team to see its boards/.test(await s.p.locator('#cShared').textContent()) && (await s.p.locator('#cShared .bd-dt').count()) === 0; })());
65
+ ok('A3 the other tabs are hidden while it is open, and Initiatives comes back', await s.p.locator('#cIni').isHidden() && await s.p.locator('#cDocs').isHidden() && (await (async () => { await s.p.click('#tabIni'); return s.p.locator('#cShared').isHidden(); })()));
66
+ await s.ctx.close();
67
+ reset({ yours: MINE, names: ['Product'] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf');
68
+ ok('A4 at load the number is your own open links, from this computer only (no host was asked)', (await s.p.locator('#nShared').textContent()) === '2' && W.reads === 0, await s.p.locator('#nShared').textContent());
69
+ await s.ctx.close();
70
+ {
71
+ const pack = Pack.buildPack({ ws: 'idpf', board: 'idpf', selection: [{ kind: 'product', id: 'idpf' }], meta: { by: 'W', at: 'x', ends: 'y', viewer: 'test' }, answers: { [BOARD]: { ok: true, state: 'ready', model, as_of: 1 }, '/api/programs': { ok: true, programs: F.programs() } } });
72
+ const ctx = await browser.newContext({ viewport: { width: 1440, height: 900 } }); const reqs = []; ctx.on('request', (r) => reqs.push(new URL(r.url()).pathname));
73
+ await ctx.route((u) => new URL(u).pathname === '/__pack/p.json', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(pack) }));
74
+ const p = await ctx.newPage(); await p.goto(T.BASE + '/premium-board.html?ws=idpf&board=idpf&pack=/__pack/p.json'); await p.waitForSelector('.tg-n.ini2', { timeout: 15000 }).catch(() => {}); await p.waitForTimeout(600);
75
+ ok('A5 the read-only Board does not draw the tab and asks nothing of /api/board-publish', (await p.locator('#tabShared').isHidden()) && !reqs.some((u) => /board-publish/.test(u)));
76
+ await ctx.close();
77
+ }
78
+
79
+ console.log('B join');
80
+ reset(); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#tabShared'); await s.p.waitForSelector('#shInvite');
81
+ W.joinAnswer = { status: 400, body: { ok: false, error: 'This is not an invite link. It looks like https://boards.example.com/join#Team.password.' } };
82
+ await s.p.fill('#shInvite', 'hello'); await s.p.click('[data-sh="join"]'); await s.p.waitForSelector('[role="alert"]');
83
+ ok('B1 a refused invite shows the sentence under the field and keeps what was pasted', /not an invite link/.test(await s.p.locator('#cShared [role="alert"]').textContent()) && (await s.p.inputValue('#shInvite')) === 'hello' && W.posts[0].body.invite === 'hello');
84
+ await s.p.click('[data-sh="typed"]'); await s.p.waitForSelector('#shHost');
85
+ W.joinAnswer = { status: 429, body: { ok: false, kind: 'locked', error: 'Too many wrong tries. Try again in 12 minutes.' } };
86
+ await s.p.fill('#shHost', 'https://boards.pm-os.app'); await s.p.fill('#shTeam', 'Product'); await s.p.fill('#shPass', 'harbor-lime-47'); await s.p.click('[data-sh="join"]'); await s.p.waitForFunction(() => /12 minutes/.test((document.querySelector('#cShared [role="alert"]') || {}).textContent || ''));
87
+ const last = W.posts[W.posts.length - 1].body;
88
+ ok('B2 the typed way sends the host, team and password, and a lockout is shown with its minutes', last.host === 'https://boards.pm-os.app' && last.team === 'Product' && last.password === 'harbor-lime-47');
89
+ W.joinAnswer = null; await s.p.click('[data-sh="paste"]'); await s.p.fill('#shInvite', 'https://boards.test/join#Product.harbor-lime-47'); await s.p.click('[data-sh="join"]'); await s.p.waitForSelector('.bdsh-table');
90
+ ok('B3 a join that works reads the team and shows its list; the tab gets its number', (await s.p.locator('#nShared').textContent()) === '3' && /Joined Product/.test(await s.p.locator('#cShared').textContent()), await s.p.locator('#nShared').textContent());
91
+ await s.ctx.close();
92
+
93
+ console.log('C the list');
94
+ reset({ yours: MINE, names: ['Product'], teams: [JSON.parse(JSON.stringify(TEAM_OK))] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#tabShared'); await s.p.waitForSelector('.bdsh-table');
95
+ const chips = await s.p.locator('#cShared .bd-dchips .bd-chip').allTextContents();
96
+ ok('C1 the chips are All, Yours and one per team; counts leave out an ended copy, and your own link published to a team is one copy, not two', JSON.stringify(chips.map((x) => x.trim())) === JSON.stringify(['All 4', 'Yours 2', 'Product 4']), JSON.stringify(chips));
97
+ const names = await s.p.locator('#cShared .bdsh-table .bd-dlink').allTextContents();
98
+ ok('C2 your own links come first, then the team\'s, and an ended copy last; your link in the team list is not drawn twice', JSON.stringify(names) === JSON.stringify(['IDPF', 'Project Ascent', 'Descope feature parity', 'Payments redesign', 'Legacy IdP sunset']), JSON.stringify(names));
99
+ ok('C3 an ended copy is dimmed and is not a button; a copy that ends within a day and a half shows the Board\'s warning dot', (await s.p.locator('#cShared .bdsh-table .bdsh-gone').count()) === 1 && (await s.p.locator('#cShared .bdsh-table .bdsh-gone button.bd-dlink').count()) === 0 && (await s.p.locator('#cShared .bdsh-table .s-risk').count()) === 2);
100
+ ok('C4 the line under the table says where and when it was read', /Read from boards\.test just now/.test(await s.p.locator('#cShared .bdsh-fine').last().textContent()), await s.p.locator('#cShared .bdsh-fine').last().textContent());
101
+ const popup = s.p.waitForEvent('popup'); await s.p.locator('#cShared .bdsh-table [data-sh-open="team0000000000000001"]').click(); const pg = await popup; await pg.waitForURL(/ONETIME/, { timeout: 8000 }).catch(() => {});
102
+ const o = W.posts.find((x) => x.p.endsWith('/open'));
103
+ ok('C5 a press on a team\'s board asks for a one-time address and opens it in a new tab', o && o.body.team === 'Product' && o.body.id === 'team0000000000000001' && /boards\.test\/b\/team0000000000000001\?t=ONETIME/.test(pg.url()), pg.url());
104
+ await pg.close();
105
+ await s.p.locator('#cShared .bdsh-table [data-sh-re]').first().click(); await s.p.waitForTimeout(500);
106
+ ok('C6 Republish sends the link\'s id and the list is read again', W.posts.some((x) => x.p.endsWith('/republish') && x.body.id === MINE[0].id) && /Republished/.test(await s.p.locator('#cShared').textContent()));
107
+ await s.p.locator('#cShared .bdsh-table [data-sh-off]').first().click();
108
+ ok('C7 the first Turn off press asks "Sure?" and sends nothing', /Sure\? Turn off/.test(await s.p.locator('#cShared [data-sh-off]').first().textContent()) && !W.posts.some((x) => x.p.endsWith('/off')));
109
+ await s.p.locator('#cShared .bdsh-table [data-sh-off]').first().click(); await s.p.waitForTimeout(500);
110
+ ok('C8 the second press turns it off and the row goes', W.posts.some((x) => x.p.endsWith('/off') && x.body.id === MINE[0].id) && !(await s.p.locator('#cShared .bdsh-table').textContent()).includes('IDPF'));
111
+ await s.p.click('[data-sh-sel="mine"]');
112
+ ok('C9 the Yours chip shows only your own links', (await s.p.locator('#cShared .bdsh-table .bd-dlink').count()) === 1);
113
+ await s.ctx.close();
114
+
115
+ console.log('D a team that cannot be read');
116
+ const BAD = { team: 'Growth', host: 'boards.test', ok: false, kind: 'password', error: 'The team password no longer works. Ask for a new invite link.' };
117
+ reset({ yours: [], names: ['Product', 'Growth'], teams: [JSON.parse(JSON.stringify(TEAM_OK)), BAD] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#tabShared'); await s.p.waitForSelector('.bdsh-ban');
118
+ ok('D1 the failing team shows one line that says why and what to do, no old rows, and the other team still draws', /Growth: The team password no longer works/.test(await s.p.locator('.bdsh-ban').textContent()) && (await s.p.locator('#cShared .bdsh-table .bd-dlink').count()) === 4 && /Paste a new invite link/.test(await s.p.locator('.bdsh-ban .bd-btn').textContent()));
119
+ ok('D2 its chip has no count', (await s.p.locator('[data-sh-sel="Growth"]').textContent()).trim() === 'Growth');
120
+ await s.p.click('.bdsh-ban .bd-btn'); await s.p.waitForSelector('#shInvite');
121
+ ok('D3 Paste a new invite link opens the invite field', await s.p.locator('#shInvite').isVisible());
122
+ W.teams = [JSON.parse(JSON.stringify(TEAM_OK)), { team: 'Growth', host: 'boards.test', ok: false, kind: 'locked', error: 'Too many wrong tries. Try again in 9 minutes.' }];
123
+ await s.p.click('[data-sh="closejoin"]'); await s.p.click('[data-sh="refresh"] >> nth=0').catch(() => {}); await s.p.waitForTimeout(400);
124
+ ok('D4 a locked team says the minutes and offers Refresh', /9 minutes/.test(await s.p.locator('.bdsh-ban').textContent()) && /Refresh/.test(await s.p.locator('.bdsh-ban .bd-btn').textContent()));
125
+ await s.ctx.close();
126
+
127
+ console.log('E leave');
128
+ reset({ yours: [], names: ['Product'], teams: [JSON.parse(JSON.stringify(TEAM_OK))] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf'); await s.p.click('#tabShared'); await s.p.waitForSelector('.bdsh-table'); await s.p.click('[data-sh-sel="Product"]');
129
+ ok('E1 a team\'s chip adds Refresh, Paste a new invite link and Leave team', (await s.p.locator('.bdsh-tl .bd-btn').allTextContents()).map((x) => x.trim()).join('|') === 'Refresh|Paste a new invite link|Leave team');
130
+ await s.p.click('[data-sh-leave="Product"]');
131
+ ok('E2 the first press asks "Sure?", says what leaving does, and sends nothing', /Sure\? Leave Product/.test(await s.p.locator('[data-sh-leave]').textContent()) && /only forgets the team's password on this computer/.test(await s.p.locator('#cShared').textContent()) && !W.posts.some((x) => x.p.endsWith('/leave')));
132
+ await s.p.click('[data-sh-leave="Product"]'); await s.p.waitForSelector('#shInvite');
133
+ ok('E3 the second press leaves: the team is gone and the tab asks to join again', W.posts.some((x) => x.p.endsWith('/leave') && x.body.team === 'Product') && await s.p.locator('#shInvite').isVisible());
134
+ await s.ctx.close();
135
+
136
+ console.log('F reads');
137
+ reset({ yours: [], names: ['Product'], teams: [JSON.parse(JSON.stringify(TEAM_OK))] }); s = await open(1440, 900, '/premium-board.html?ws=idpf&board=idpf');
138
+ ok('F1 nothing is read from a host at load', W.reads === 0);
139
+ await s.p.click('#tabShared'); await s.p.waitForSelector('.bdsh-table'); const first = W.reads; await s.p.waitForTimeout(1500);
140
+ ok('F2 opening the tab reads once and nothing polls', first === 1 && W.reads === 1, W.reads);
141
+ await s.p.locator('#cShared .bdsh-lk').click(); await s.p.waitForTimeout(500);
142
+ ok('F3 Refresh reads again', W.reads === 2, W.reads);
143
+ await s.ctx.close();
144
+
145
+ console.log('G a phone');
146
+ reset({ yours: MINE, names: ['Product'], teams: [JSON.parse(JSON.stringify(TEAM_OK))] }); s = await open(390, 844, '/premium-board.html?ws=idpf&board=idpf');
147
+ ok('G1 on a phone Shared is a chip after Docs, and it opens the tab', await (async () => { await s.p.waitForSelector('#chShared'); const after = await s.p.evaluate(() => document.getElementById('chShared').previousElementSibling && document.getElementById('chShared').previousElementSibling.id); await s.p.click('#chShared'); await s.p.waitForSelector('.bdsh-cards .bdsh-card'); return after === 'chDocs'; })());
148
+ const g = await s.p.evaluate(() => ({ side: document.documentElement.scrollWidth > innerWidth + 1, table: getComputedStyle(document.querySelector('.bdsh-table')).display, cards: document.querySelectorAll('.bdsh-card').length }));
149
+ ok('G2 a row is a card: the table is not drawn, there is no sideways scroll', g.table === 'none' && g.cards === 5 && !g.side, JSON.stringify(g));
150
+ const small = await s.p.locator('#cShared button:visible').evaluateAll((els) => els.filter((e) => e.getBoundingClientRect().height < 34).map((e) => e.className + ':' + Math.round(e.getBoundingClientRect().height)));
151
+ ok('G3 every control on the phone is at least 34 px high', small.length === 0, small.join(' '));
152
+ ok('G4 no page error in any section', s.errs.length === 0, s.errs.join(' | '));
153
+ await s.ctx.close();
154
+ await finish(browser);
155
+ })();
@@ -435,7 +435,7 @@ const IVREAD = () => {
435
435
  const R = await open({ w: 390, h: 844, theme, model: BP.build(FJ.facts()) }), q = R.page;
436
436
  const m = await q.evaluate(() => { const small = [...document.querySelectorAll('#ibTabs button, #ibBody .bt-nm, #bdChipset .bd-chip, .bd-tab, #newIni, #bdFind, #bdView')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height > 0 && b.getBoundingClientRect().height < 44).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().height)); const fab = document.querySelector('#czFab').getBoundingClientRect(); return { over: document.documentElement.scrollWidth > innerWidth + 1, small, fabRight: Math.round(innerWidth - fab.right), top: Math.round(document.querySelector('.bd-hd').getBoundingClientRect().height), chips: [...document.querySelectorAll('#bdChipset .bd-chip')].map((b) => b.textContent.replace(/\s+/g, ' ').trim()), title: getComputedStyle(document.querySelector('.bd-title')).display }; });
437
437
  ok(`B13 at 390 px (${theme}) the page has no sideways scroll, the top bar is one line with "Board", the menu sits bottom right, and every control is 44 px`, !m.over && m.small.length === 0 && m.fabRight < 40 && m.top <= 56 && m.title !== 'none', JSON.stringify(m));
438
- ok(`B13 at 390 px (${theme}) the chips lead with This sprint, then the Jira read time and the new asks, and end with the documents`, m.chips[0] === 'Sprint 24 only' && /^Jira \d+ days$/.test(m.chips[1]) && m.chips[2] === '1 new ask' && m.chips[m.chips.length - 1] === 'Docs 6', JSON.stringify(m.chips));
438
+ ok(`B13 at 390 px (${theme}) the chips lead with This sprint, then the Jira read time and the new asks, and end with the documents and Shared`, m.chips[0] === 'Sprint 24 only' && /^Jira \d+ days$/.test(m.chips[1]) && m.chips[2] === '1 new ask' && m.chips[m.chips.length - 2] === 'Docs 6' && m.chips[m.chips.length - 1] === 'Shared', JSON.stringify(m.chips));
439
439
  const pl = await q.evaluate(() => ({ groups: [...document.querySelectorAll('#ibBody .bd-ghd')].map((g) => g.textContent.replace(/\s+/g, ' ').trim()), seg: [...document.querySelectorAll('#ibBody [data-pv]')].map((b) => b.textContent + (b.getAttribute('aria-pressed') === 'true' ? '*' : '')).join(), note: /Timeline needs a wider screen/.test(document.querySelector('#ibBody').textContent), small: [...document.querySelectorAll('#ibBody [data-pv], #ibBody .bd-lrow')].filter((b) => b.getBoundingClientRect().height < 44).length }));
440
440
  ok(`B13 at 390 px (${theme}) the phone opens on the List, grouped your turn first, with List, By stage, Track and Timeline (BdPhone, TsCPhone)`, pl.groups.join('|') === 'At risk or late4|On track3' && pl.seg === 'List*,By stage,Track,Timeline' && !pl.note && pl.small === 0, JSON.stringify(pl));
441
441
  await q.click('#bdView'); const s2 = await q.evaluate(() => document.documentElement.scrollWidth <= innerWidth + 1 && document.querySelectorAll('#ibBody .bd-scols.ph .bd-scol').length + (((document.querySelector('#ibBody .bd-sempty') || {}).textContent || '').replace(/^Nothing on screen in /, '').match(/[A-Z][a-z]+/g) || []).length === 8);
@@ -1,4 +1,17 @@
1
1
  [
2
+ {
3
+ "v": "0.471.0",
4
+ "at": "2026-10-31T13:21:46.914Z",
5
+ "f": 3,
6
+ "prs": [
7
+ {
8
+ "n": 1124,
9
+ "t": "The Shared tab on the Board — join a team, read its boards, open one (board-publish slice 4)",
10
+ "s": "The Shared tab on the Board — join a team, read its boards, open one (board-publish slice 4)",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
2
15
  {
3
16
  "v": "0.470.0",
4
17
  "at": "2026-10-31T12:11:04.375Z",
@@ -9,7 +9,7 @@ timestamp: 2026-10-31
9
9
 
10
10
  A **published board** is a copy of the Board that a teammate can read. It shows the Timeline of the products, programs or initiatives that you pick. It is a snapshot. It does not change after it is taken.
11
11
 
12
- This version has the **Publish** button on the Board, the read-only Board and the **data pack** that feeds it. The shared host must be set up first. Teams and the Shared view come in a later version.
12
+ This version has the **Publish** button on the Board, the **Shared** tab, the read-only Board and the **data pack** that feeds it. The shared host must be set up first.
13
13
 
14
14
  ## Publish a board
15
15
 
@@ -35,6 +35,30 @@ Under the form, **Open links** lists each link that has not ended. It shows the
35
35
 
36
36
  Only you can publish, republish or turn off a link, with a press on the page. An agent session cannot.
37
37
 
38
+ ## The Shared tab
39
+
40
+ **Shared** is a tab of the Board, beside **Initiatives** and **Documents**. It lists the boards that people published to your teams, and your own links. On a phone it is a chip after **Docs**. The tab shows a number when there are open copies. Before you read a team, the number is your own open links.
41
+
42
+ **Join a team.** The person who makes a team gets an invite link and sends it to you. It looks like `https://boards.example.com/join#Team.password`. Open **Shared**, paste the link in the field and press **Join**. PMOS asks the host first. It keeps the team only if the password works. You do not need to set the host address first: the invite link has it.
43
+
44
+ To join without the link, press **Type the team name and password instead**. Write the host address, the team name and the team password.
45
+
46
+ PMOS keeps the team and its password on this computer only. It does not show the password again.
47
+
48
+ **Read the list.** PMOS reads each team from its host when you open the tab and when you press **Refresh**. It does not read in between. The line under the table says which host and when.
49
+
50
+ The chips are **All**, **Yours** and one for each team. **Yours** shows only when you have open links. A chip shows how many open copies the team has.
51
+
52
+ - **A board.** Press the name of a board to open its copy in a new browser tab. You do not type the password of the link. A copy that has ended is dimmed and does not open.
53
+ - **Yours.** Your own links have **Republish** and **Turn off**, the same as in the Publish popover. **Turn off** asks you to press a second time.
54
+ - **A date in red.** The copy ends within a day and a half.
55
+
56
+ **A team that cannot be read.** One line shows in its place. It says if the team password was changed, if the host locked the team after too many wrong tries, or if the host did not answer. Press **Paste a new invite link** or **Refresh**. The other teams still show. PMOS shows no old rows for a team it cannot read.
57
+
58
+ **Leave a team.** Press the chip of the team. Then press **Leave team**, and press it a second time. PMOS forgets the team and its password on this computer. The copies that you published stay on the host. Join again with the invite link.
59
+
60
+ The tab is not in the read-only Board. A reader sees no Shared tab.
61
+
38
62
  ## What a reader sees
39
63
 
40
64
  - The Timeline, as you see it in the workspace. It opens on today.
@@ -11,6 +11,9 @@
11
11
  * and sent only to the host as the bearer. It is never returned to the browser, never logged, never written to a record (D08).
12
12
  * The host holds the key's hash; a key can publish and remove its own links only.
13
13
  *
14
+ * THE TEAMS this workspace joined (lib/boards-teams.js) are kept in state.json too: { name, host, password }. The team password is a secret on this computer
15
+ * like the publish key: mode 0600, never returned to the browser, never logged (D08).
16
+ *
14
17
  * THE LINKS. state.json also keeps, for each open link: { id, url, team, name, kind, selection, ws, board, by, made, ends, views }. The link's
15
18
  * password is NOT kept: it is shown once at publish. Republish keeps the same link and password (the host owns it).
16
19
  *
@@ -46,8 +49,8 @@ function hostOrigin(env = process.env) {
46
49
  }
47
50
 
48
51
  function readState(dir) {
49
- try { const s = JSON.parse(fs.readFileSync(fileOf(dir), 'utf8')); return { key: typeof s.key === 'string' ? s.key : null, host: typeof s.host === 'string' ? s.host : '', links: Array.isArray(s.links) ? s.links : [] }; }
50
- catch { return { key: null, host: '', links: [] }; }
52
+ try { const s = JSON.parse(fs.readFileSync(fileOf(dir), 'utf8')); return { key: typeof s.key === 'string' ? s.key : null, host: typeof s.host === 'string' ? s.host : '', teams: Array.isArray(s.teams) ? s.teams : [], links: Array.isArray(s.links) ? s.links : [] }; }
53
+ catch { return { key: null, host: '', teams: [], links: [] }; }
51
54
  }
52
55
  /** The address the PM saved on the Publish popover ('' when none). The environment variable PMOS_BOARDS_HOST wins over it (see addressOf). */
53
56
  function savedHost(dir) { return readState(dir).host || ''; }
@@ -147,4 +150,4 @@ async function turnOff(dir, id, opts = {}) {
147
150
  return { ok: true };
148
151
  }
149
152
 
150
- module.exports = { DAYS, TEAM_RX, MAX_PACK, hostOrigin, savedHost, setHost, addressOf, readState, links, publish, republish, turnOff };
153
+ module.exports = { DAYS, TEAM_RX, MAX_PACK, hostOrigin, savedHost, setHost, addressOf, readState, writeState, links, publish, republish, turnOff };
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+ /* boards-teams.js — the teams this workspace joined, and the Shared view's reads (initiative board-publish, slice 4; PRD T1 to T6; D103).
3
+ *
4
+ * A TEAM is { name, host, password }, kept in <runtime state>/board-publish/state.json (lib/boards-host.js): the host it lives on, and the team password.
5
+ * The password is a secret on this computer: mode 0600, never returned to the browser, never logged (D08). Every function here takes the state folder.
6
+ *
7
+ * THE CONTRACT with the host (board-host/src/core.js):
8
+ * GET <host>/api/teams/<team>/links X-Team-Password -> { ok, links: [{ id, name, kind, by, made, ends, views, url }] }
9
+ * POST <host>/api/teams/<team>/open/<id> X-Team-Password -> { ok, url } one-time, 5 minutes
10
+ * A refusal is { ok: false, error } with a plain sentence. 403 is a wrong password, 429 a lockout (the sentence names the minutes), 404 an unknown team.
11
+ *
12
+ * parseInvite(text) -> { host, team, password } | { error } "<host>/join#<team>.<password>", each part percent-encoded
13
+ * join(dir, { invite | host, team, password }, { fetch }) -> { ok, team } | { ok: false, error } verifies with the host before it keeps anything
14
+ * leave(dir, team) -> { ok } forgets the password here; the host is not told
15
+ * names(dir) -> [string]
16
+ * readAll(dir, { fetch }) -> [{ team, host, ok: true, links } | { team, host, ok: false, kind, error }] all teams at once; one failing never hides another
17
+ * open(dir, team, id, { fetch }) -> { ok, url } | { ok: false, error }
18
+ * kind of a failure: 'password' | 'locked' | 'missing' | 'unreachable' | 'other'. Nothing from a read is kept: an unreadable team has no old rows. */
19
+ const Host = require('./boards-host.js');
20
+
21
+ const TIMEOUT_MS = 15000;
22
+ const MAX_TEAMS = 20;
23
+
24
+ function parseInvite(text) {
25
+ let u; try { u = new URL(String(text || '').trim()); } catch { return { error: 'This is not an invite link. It looks like https://boards.example.com/join#Team.password.' }; }
26
+ const host = u.username || u.password ? null : Host.hostOrigin({ PMOS_BOARDS_HOST: u.origin });
27
+ const m = /^#([^.]+)\.(.+)$/.exec(u.hash || '');
28
+ if (!host || u.pathname !== '/join' || !m) return { error: 'This is not an invite link. It looks like https://boards.example.com/join#Team.password.' };
29
+ let team; let password; try { team = decodeURIComponent(m[1]); password = decodeURIComponent(m[2]); } catch { return { error: 'This is not an invite link. It looks like https://boards.example.com/join#Team.password.' }; }
30
+ if (!Host.TEAM_RX.test(team)) return { error: 'The team name in this link is not valid.' };
31
+ if (password.length < 8 || password.length > 100) return { error: 'The password in this link is not valid.' };
32
+ return { host, team, password };
33
+ }
34
+
35
+ /** One call to a host with the team password. Never throws. { ok, status, body } | { ok: false, kind, error } */
36
+ async function call(host, method, p, password, fetchFn) {
37
+ const f = fetchFn || (typeof fetch === 'function' ? fetch : null);
38
+ if (!f) return { ok: false, kind: 'unreachable', error: 'This computer cannot reach the host (no network client).' };
39
+ const ctl = typeof AbortController === 'function' ? new AbortController() : null; const timer = ctl ? setTimeout(() => ctl.abort(), TIMEOUT_MS) : null;
40
+ try {
41
+ const res = await f(host + p, { method, redirect: 'error', signal: ctl ? ctl.signal : undefined, headers: { 'X-Team-Password': password, Accept: 'application/json' } });
42
+ let j = null; try { j = await res.json(); } catch { /* not JSON */ }
43
+ if (res.ok && j && j.ok !== false) return { ok: true, status: res.status, body: j };
44
+ const say = (j && typeof j.error === 'string' && j.error.slice(0, 240)) || '';
45
+ if (res.status === 403) return { ok: false, kind: 'password', error: 'The team password does not work. Ask for a new invite link.' };
46
+ if (res.status === 429) return { ok: false, kind: 'locked', error: say || 'Too many wrong tries. Try again in a few minutes.' };
47
+ if (res.status === 404) return { ok: false, kind: 'missing', error: say || 'There is no such team on that host.' };
48
+ return { ok: false, kind: 'other', error: say || 'The host refused the request (' + res.status + ').' };
49
+ } catch (e) {
50
+ return { ok: false, kind: 'unreachable', error: e && e.name === 'AbortError' ? 'The host did not answer in time. Try again.' : 'The host could not be reached. Check the connection.' };
51
+ } finally { if (timer) clearTimeout(timer); }
52
+ }
53
+ const teamPath = (team) => '/api/teams/' + encodeURIComponent(team);
54
+
55
+ async function join(dir, o, opts = {}) {
56
+ let host; let team; let password;
57
+ if (o.invite != null && String(o.invite).trim() !== '') {
58
+ const p = parseInvite(o.invite); if (p.error) return { ok: false, error: p.error };
59
+ ({ host, team, password } = p);
60
+ } else {
61
+ host = Host.hostOrigin({ PMOS_BOARDS_HOST: String(o.host || '').trim() }); team = String(o.team || '').trim(); password = String(o.password || '');
62
+ if (!host) return { ok: false, error: 'Use an https address for the host, such as https://boards.example.com.' };
63
+ if (!Host.TEAM_RX.test(team)) return { ok: false, error: 'A team name is letters, numbers, spaces, dots, dashes and underscores, up to 40.' };
64
+ if (password.length < 8 || password.length > 100) return { ok: false, error: 'A team password is 8 to 100 characters.' };
65
+ }
66
+ const st = Host.readState(dir);
67
+ if (!st.teams.some((t) => t.name === team && t.host === host) && st.teams.length >= MAX_TEAMS) return { ok: false, error: 'This computer has joined 20 teams. Leave one first.' };
68
+ const r = await call(host, 'GET', teamPath(team) + '/links', password, opts.fetch);
69
+ if (!r.ok) return { ok: false, error: r.error, kind: r.kind };
70
+ const cur = Host.readState(dir);
71
+ cur.teams = cur.teams.filter((t) => !(t.name === team && t.host === host)).concat([{ name: team, host, password }]);
72
+ Host.writeState(dir, cur);
73
+ return { ok: true, team };
74
+ }
75
+
76
+ function leave(dir, team) { const st = Host.readState(dir); const had = st.teams.some((t) => t.name === team); st.teams = st.teams.filter((t) => t.name !== team); Host.writeState(dir, st); return { ok: had }; }
77
+ const names = (dir) => Host.readState(dir).teams.map((t) => t.name);
78
+
79
+ async function readAll(dir, opts = {}) {
80
+ const teams = Host.readState(dir).teams;
81
+ return Promise.all(teams.map(async (t) => {
82
+ const r = await call(t.host, 'GET', teamPath(t.name) + '/links', t.password, opts.fetch);
83
+ if (!r.ok) return { team: t.name, host: new URL(t.host).host, ok: false, kind: r.kind, error: r.kind === 'password' ? 'The team password no longer works. Ask for a new invite link.' : r.error };
84
+ const links = (Array.isArray(r.body.links) ? r.body.links : []).filter((l) => l && typeof l.id === 'string' && typeof l.url === 'string' && l.url.startsWith(t.host + '/'))
85
+ .map((l) => ({ id: l.id, name: String(l.name || ''), kind: String(l.kind || ''), by: String(l.by || ''), made: l.made || '', ends: l.ends || '', views: Number(l.views) || 0 }));
86
+ return { team: t.name, host: new URL(t.host).host, ok: true, links };
87
+ }));
88
+ }
89
+
90
+ async function open(dir, team, id, opts = {}) {
91
+ const t = Host.readState(dir).teams.find((x) => x.name === team);
92
+ if (!t) return { ok: false, error: 'This computer has not joined that team.' };
93
+ const r = await call(t.host, 'POST', teamPath(team) + '/open/' + encodeURIComponent(id), t.password, opts.fetch);
94
+ if (!r.ok) return { ok: false, error: r.kind === 'password' ? 'The team password no longer works. Ask for a new invite link.' : r.error };
95
+ const url = r.body.url; if (typeof url !== 'string' || !url.startsWith(t.host + '/b/')) return { ok: false, error: 'The host sent an address this workspace does not accept.' };
96
+ return { ok: true, url };
97
+ }
98
+
99
+ module.exports = { parseInvite, join, leave, names, readAll, open, MAX_TEAMS };
@@ -6,6 +6,10 @@
6
6
  * POST /api/board-publish/republish { id } -> { ok, ends } the same selection, as the board is now; same link, same password
7
7
  * POST /api/board-publish/off { id } -> { ok } the host deletes the copy at once
8
8
  * POST /api/board-publish/host { host } -> { ok, host } save the host address ('' clears it); PMOS_BOARDS_HOST wins over it
9
+ * GET /api/board-publish/shared -> { ok, readAt, yours, teams } the Shared view: your links, and each joined team read now (lib/boards-teams.js)
10
+ * POST /api/board-publish/join { invite } or { host, team, password } -> { ok, team } verified with the host first; the password stays on this computer
11
+ * POST /api/board-publish/leave { team } -> { ok } forgets the team here
12
+ * POST /api/board-publish/open { team, id } -> { ok, url } a one-time address for a team member, opened in a browser tab
9
13
  *
10
14
  * EVERY POST IS A PAGE PRESS (pm-guard requirePagePress): only a press on the page publishes, not a request an agent session makes (PRD P2, D97 S3).
11
15
  * THE SECRET SCAN runs on the finished pack before anything leaves (P3): a hit blocks the publish and the answer names the rule, never the text (D08).
@@ -18,6 +22,7 @@ const guard = require('./pm-guard.js');
18
22
  const Host = require('./boards-host.js');
19
23
  const shareStore = require('./share-store.js');
20
24
  const secretScan = require('./secret-scan.js');
25
+ const Teams = require('./boards-teams.js');
21
26
 
22
27
  const PUBLIC = path.join(__dirname, '..', 'public');
23
28
  let versionMemo = null;
@@ -68,7 +73,7 @@ module.exports = {
68
73
  prefixes: ['/api/board-publish'],
69
74
  handle: async (req, res, url, ctx) => {
70
75
  const p = url.pathname;
71
- if (p !== '/api/board-publish' && p !== '/api/board-publish/republish' && p !== '/api/board-publish/off' && p !== '/api/board-publish/host') return false;
76
+ if (!/^\/api\/board-publish(\/(republish|off|host|shared|join|leave|open))?$/.test(p)) return false;
72
77
  const send = (obj, code) => { ctx.json(res, obj, code); return true; };
73
78
  const dir = stateDir(ctx);
74
79
  if (!dir) return send({ ok: false, error: 'No state folder.' }, 500);
@@ -78,7 +83,12 @@ module.exports = {
78
83
  const origin = Host.hostOrigin(env);
79
84
  const ws = url.searchParams.get('ws'); let choices = null;
80
85
  if (ws) { try { choices = await require('./board-publish-choices.js').choicesOf(req, ctx, ws, url.searchParams.get('board') || ws); } catch { choices = null; } }
81
- return send({ ok: true, host: origin ? new URL(origin).host : null, days: Host.DAYS, password: shareStore.newPassword(), choices, links: Host.links(dir).map((l) => ({ id: l.id, url: l.url, team: l.team, name: l.name, kind: l.kind, by: l.by, made: l.made, ends: l.ends, views: l.views })) });
86
+ return send({ ok: true, host: origin ? new URL(origin).host : null, days: Host.DAYS, password: shareStore.newPassword(), choices, teams: Teams.names(dir), links: Host.links(dir).map((l) => ({ id: l.id, url: l.url, team: l.team, name: l.name, kind: l.kind, by: l.by, made: l.made, ends: l.ends, views: l.views })) });
87
+ }
88
+ // the Shared view's read (slice 4): your own links and every joined team's list, read now from each host. Nothing is kept from the read.
89
+ if (req.method === 'GET' && p === '/api/board-publish/shared') {
90
+ const teams = await Teams.readAll(dir);
91
+ return send({ ok: true, readAt: new Date().toISOString(), yours: Host.links(dir).map((l) => ({ id: l.id, url: l.url, team: l.team, name: l.name, kind: l.kind, by: l.by, made: l.made, ends: l.ends, views: l.views })), teams });
82
92
  }
83
93
  if (req.method !== 'POST') return send({ ok: false, error: 'GET or POST only' }, 405);
84
94
 
@@ -89,6 +99,15 @@ module.exports = {
89
99
  // D103 point 6 and PRD P2: a copy leaves this computer only on a press by the person. D98 lets an agent session take PM-only acts; this one it does not.
90
100
  if (g.actor && /^agent/.test(String(g.actor.by || ''))) return send({ ok: false, error: 'Publishing is a press on the page. An agent session cannot publish, republish or turn off a board.' }, 403);
91
101
 
102
+ if (p === '/api/board-publish/join') { // a team is joined by a pasted invite link, or by host, team and password typed
103
+ const r = await Teams.join(dir, { invite: body.invite, host: body.host, team: body.team, password: body.password });
104
+ return send(r.ok ? { ok: true, team: r.team } : { ok: false, error: r.error, kind: r.kind }, r.ok ? 200 : (r.kind === 'locked' ? 429 : 400));
105
+ }
106
+ if (p === '/api/board-publish/leave') { const r = Teams.leave(dir, String(body.team || '')); return send(r.ok ? { ok: true } : { ok: false, error: 'This computer has not joined that team.' }, r.ok ? 200 : 404); }
107
+ if (p === '/api/board-publish/open') { // the one-time address of a team's board, to open in a browser tab
108
+ const r = await Teams.open(dir, String(body.team || ''), String(body.id || ''));
109
+ return send(r.ok ? { ok: true, url: r.url } : { ok: false, error: r.error }, r.ok ? 200 : 502);
110
+ }
92
111
  if (p === '/api/board-publish/host') { // the address of the host, saved from the popover: a page press like the rest
93
112
  const r = Host.setHost(dir, body.host);
94
113
  return send(r.ok ? { ok: true, host: r.host } : { ok: false, error: r.error }, r.ok ? 200 : 400);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.470.0",
3
+ "version": "0.471.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.470.0",
9
+ "version": "0.471.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.470.0",
3
+ "version": "0.471.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -76,6 +76,7 @@ export async function refreshCount(btn) {
76
76
  const n = btn && btn.querySelector('.bpn'); if (!n) return;
77
77
  const r = await pmGet('/api/board-publish').catch(() => null); const c = r && r.ok ? COUNT(r.links) : 0;
78
78
  n.textContent = c ? String(c) : ''; n.hidden = !c;
79
+ document.dispatchEvent(new CustomEvent('bd:links', { detail: { n: c } })); // the Shared tab's number follows your own links until it has read the teams
79
80
  btn.setAttribute('aria-label', 'Publish a read-only copy of the board' + (c ? '. ' + c + (c === 1 ? ' open link' : ' open links') : ''));
80
81
  }
81
82
 
@@ -0,0 +1,31 @@
1
+ /* pm/bd-shared.css — the Shared tab of the Board (pm/bd-shared.js). The chips row, the table, the pills, the avatars and the buttons are the Board's own
2
+ * (cozy-board.css: .bd-dchips, .bd-dtw, .bd-dt, .bd-pill, .bd-av, .bd-btn); this file only sets the columns of the table and the join form. */
3
+ #cShared .bd-dt { grid-template-columns: 40px minmax(0, 1.5fr) 96px 96px minmax(0, 1fr) 84px 70px 130px 190px; }
4
+ #cShared .bd-dby { display: flex; gap: 6px; justify-content: flex-end; overflow: visible; }
5
+ #cShared .bdsh-gone { opacity: .5; }
6
+ #cShared .bdsh-cards { display: none; }
7
+ #cShared .bd-btn.on { border-color: var(--bad); color: var(--bad); }
8
+ #cShared .bdsh-join { display: grid; gap: 12px; padding: 22px 8px 14px; justify-items: start; max-width: 560px; }
9
+ #cShared .bdsh-join > b { font-size: var(--fs-4); font-weight: 800; }
10
+ #cShared .bdsh-join p { margin: 0; }
11
+ #cShared .bdsh-fr { display: flex; gap: 8px; width: 100%; max-width: 520px; }
12
+ #cShared .bdsh-in { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border: 1px solid var(--hair); border-radius: 12px; background: var(--card-solid); color: var(--ink); font: inherit; width: 100%; max-width: 520px; }
13
+ #cShared .bdsh-fr .bdsh-in { width: auto; }
14
+ #cShared .bdsh-go { min-height: 44px; background: var(--solid); color: var(--on-solid); border-color: var(--solid); }
15
+ #cShared .bdsh-go:disabled { opacity: .6; }
16
+ #cShared .bdsh-alt, #cShared .bdsh-lk { border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; min-height: 36px; padding: 0 2px; }
17
+ #cShared .bdsh-fine { font-size: var(--fs-1); margin: 8px 4px 0; }
18
+ #cShared .bdsh-pad { padding: 24px 8px; margin: 0; max-width: 560px; }
19
+ #cShared .bdsh-ban { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 10px 16px; margin: 8px 0; border: 1px solid var(--hair); border-radius: 14px; background: var(--card-solid); }
20
+ #cShared .bdsh-ban > span { flex: 1 1 240px; min-width: 0; }
21
+ #cShared .bdsh-tl { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 8px; }
22
+ #cShared :focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
23
+ @media (max-width: 720px) {
24
+ #cShared .bdsh-table { display: none; }
25
+ #cShared .bdsh-cards { display: block; }
26
+ #cShared .bdsh-card { padding: 10px 4px; border-bottom: 1px solid var(--hair); display: grid; gap: 2px; }
27
+ #cShared .bdsh-l1 { display: flex; gap: 8px; align-items: baseline; }
28
+ #cShared .bdsh-nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left; }
29
+ #cShared .bdsh-act { display: flex; gap: 8px; padding-top: 6px; }
30
+ #cShared .bdsh-fr { flex-wrap: wrap; }
31
+ }
@@ -0,0 +1,153 @@
1
+ /* pm/bd-shared.js — the Shared tab of the Board (initiative board-publish, slice 4; planning/prd/board-publish-prd.md T1 to T6; D103).
2
+ * Design: prototype/board-publish/shared-view-design.html (drawn inside the real Board; PM approved 2026-10-31). It is the Documents tab's own pattern:
3
+ * a chips row, the button on the right, and the Board's .bd-dtw table with pills and avatars (a card per row on a phone).
4
+ *
5
+ * All · Yours · one chip per joined team Yours only when you have open links. A team's chip shows its count, or no count when it cannot be read.
6
+ * a board a press opens that copy in a new browser tab, signed in (POST /api/board-publish/open: a one-time address)
7
+ * Yours Republish (same link, same password) and Turn off (a second press confirms)
8
+ * a team that cannot be read one line in its place (password changed, locked, host down): the other teams still draw, and no old rows
9
+ * a team selected Refresh · Paste a new invite link · Leave team (a second press; forgets only the password on this computer)
10
+ * nothing joined one sentence and one field for the invite link; "type the team name and password instead" is the second way
11
+ *
12
+ * Reads: GET /api/board-publish (local: your links and the team names, no host is asked) for the number on the tab at load;
13
+ * GET /api/board-publish/shared (reads each joined team's host now) when the tab opens and on Refresh. Nothing is polled and nothing from a read is kept.
14
+ * loadCount(cb) cb(n): the number of your own open links, from this computer only
15
+ * show(el, { onCount }) draw the tab into el and read the teams. onCount(n) gets the total of open copies after a read
16
+ * viewHtml(S) the tab's inside as HTML. Pure. */
17
+ import { pmGet, pmPost } from './http.js';
18
+
19
+ const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
20
+ const ICON = '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M4 4h16v16H4zM4 9h16M9 9v11"></path></svg>';
21
+ const KIND = { product: 'Product', program: 'Program', initiative: 'Initiative', multi: 'Several' };
22
+ const SOON = 36 * 3600 * 1000;
23
+ const day = (iso) => { try { return new Date(iso).toLocaleDateString(undefined, { day: 'numeric', month: 'short' }); } catch { return ''; } };
24
+
25
+ export function css() {
26
+ const href = '/pm/bd-shared.css';
27
+ if (document.querySelector(`link[href="${href}"]`)) return;
28
+ const l = document.createElement('link'); l.rel = 'stylesheet'; l.href = href; document.head.appendChild(l);
29
+ }
30
+
31
+ /** The number of open copies: yours, plus each readable team's, without counting your own twice. */
32
+ export function totalOf(S) { return rowsOf(S).filter((r) => !r.ended).length; }
33
+
34
+ function rowsOf(S, now = S.now || Date.now()) {
35
+ const mine = new Set((S.yours || []).map((l) => l.id));
36
+ const rows = (S.yours || []).map((l) => Object.assign({}, l, { mine: true }));
37
+ for (const t of S.teams || []) if (t.ok) for (const l of t.links) if (!mine.has(l.id)) rows.push(Object.assign({}, l, { team: t.team }));
38
+ for (const r of rows) { r.ended = !!r.ends && Date.parse(r.ends) <= now; r.soon = !r.ended && !!r.ends && Date.parse(r.ends) - now < SOON; }
39
+ return rows;
40
+ }
41
+ const endText = (r) => (r.ended ? 'Ended' : r.soon ? 'Tomorrow' : day(r.ends));
42
+ const agoText = (S) => { const m = Math.max(0, Math.round(((S.now || Date.now()) - Date.parse(S.readAt)) / 60000)); return m < 1 ? 'just now' : m === 1 ? 'a minute ago' : m + ' minutes ago'; };
43
+ const init = (n) => esc(String(n || '?').slice(0, 2));
44
+ const who = (r) => `<span class="bd-pt"><span class="bd-av" aria-hidden="true">${init(r.by)}</span><span class="bd-ell">${esc(r.by)}</span></span>`;
45
+ const openable = (S, r) => !r.ended && (r.team ? (S.teams || []).some((t) => t.team === r.team && t.ok) || (S.names || []).includes(r.team) : false);
46
+
47
+ function row(S, r) {
48
+ const act = r.mine ? `<button type="button" class="bd-btn sm" data-sh-re="${esc(r.id)}">Republish</button><button type="button" class="bd-btn sm${S.off === r.id ? ' on' : ''}" data-sh-off="${esc(r.id)}">${S.off === r.id ? 'Sure? Turn off' : 'Turn off'}</button>` : '';
49
+ const nm = r.ended || !openable(S, r) ? `<span class="bd-dlink" role="rowheader">${esc(r.name)}</span>` : `<button type="button" class="bd-dlink" role="rowheader" data-sh-open="${esc(r.id)}" data-sh-team="${esc(r.team)}">${esc(r.name)}</button>`;
50
+ const end = `<span role="cell" class="${r.soon ? 'cs s-risk' : r.ended ? 'bd-amut' : ''}">${r.soon ? '<i class="cz-dot risk m-warn"></i>' : ''}${esc(endText(r))}</span>`;
51
+ const table = `<div class="bd-dt${r.ended ? ' bdsh-gone' : ''}" role="row"><span class="bd-dic" aria-hidden="true">${ICON}</span>${nm}<span role="cell"><span class="bd-pill">${esc(KIND[r.kind] || 'Board')}</span></span><span role="cell" class="bd-amut">${esc(r.team || '—')}</span>${who(r)}<span role="cell">${esc(day(r.made))}</span><span role="cell">${r.views || 0}</span>${end}<span role="cell" class="bd-dby">${act}</span></div>`;
52
+ const card = `<div class="bdsh-card${r.ended ? ' bdsh-gone' : ''}"><div class="bdsh-l1">${nm.replace('bd-dlink', 'bdsh-nm bd-dlink')}<span class="${r.soon ? 'cs s-risk' : 'bd-amut'}">${r.soon ? '<i class="cz-dot risk m-warn"></i>' : ''}${esc(endText(r))}</span></div><span class="bd-amut">${esc(KIND[r.kind] || 'Board')}${r.team ? ' · ' + esc(r.team) : ''} · ${r.mine ? 'you' : esc(r.by)} · ${esc(day(r.made))} · ${r.views || 0} views</span>${act ? `<div class="bdsh-act">${act}</div>` : ''}</div>`;
53
+ return { table, card };
54
+ }
55
+
56
+ function joinHtml(S) {
57
+ const J = S.join || {}; const first = !(S.teams || []).length && !(S.yours || []).length;
58
+ const inp = (id, ph, v, type) => `<input id="${id}" type="${type || 'text'}" class="bdsh-in" placeholder="${esc(ph)}" value="${esc(v || '')}" spellcheck="false" autocomplete="off" aria-label="${esc(ph)}">`;
59
+ const body = J.typed
60
+ ? `<b>Join a team</b><p class="bd-amut">Type what the person who made the team gave you.</p>${inp('shHost', 'Board host address', J.host)}${inp('shTeam', 'Team name', J.team)}<div class="bdsh-fr">${inp('shPass', 'Team password', J.password, 'password')}<button type="button" class="bd-btn bdsh-go" data-sh="join"${J.busy ? ' disabled' : ''}>${J.busy ? 'Joining…' : 'Join'}</button></div>`
61
+ : `<b>${first ? 'Join a team to see its boards' : 'Join another team'}</b><p class="bd-amut">Ask whoever made the team for its invite link, then paste it here.</p><div class="bdsh-fr">${inp('shInvite', 'https://boards.example.com/join#Team.password', J.invite)}<button type="button" class="bd-btn bdsh-go" data-sh="join"${J.busy ? ' disabled' : ''}>${J.busy ? 'Joining…' : 'Join'}</button></div>`;
62
+ return `<div class="bdsh-join">${body}${J.err ? `<p class="cs s-risk" role="alert"><i class="cz-dot risk m-warn"></i>${esc(J.err)}</p>` : ''}<button type="button" class="bdsh-alt" data-sh="${J.typed ? 'paste' : 'typed'}">${J.typed ? 'Paste an invite link instead' : 'Type the team name and password instead'}</button><p class="bd-amut bdsh-fine">The team and its password are kept on this computer only.</p></div>`;
63
+ }
64
+
65
+ /** The tab's inside. S = { phase, yours, teams:[{team,host,ok,links|kind,error}], names, readAt, now, sel, join, off, status, leave } */
66
+ export function viewHtml(S) {
67
+ if (S.phase === 'loading') return '<p class="bd-amut bdsh-pad">Reading the teams…</p>';
68
+ const teams = S.teams || []; const rows = rowsOf(S);
69
+ const showJoin = S.join && S.join.open;
70
+ if (!teams.length && !(S.yours || []).length) return joinHtml(Object.assign({}, S, { join: Object.assign({ open: true }, S.join) }));
71
+ const count = (f) => rows.filter((r) => !r.ended && f(r)).length;
72
+ const sel = S.sel === 'mine' && (S.yours || []).length ? 'mine' : teams.some((t) => t.team === S.sel) ? S.sel : 'all';
73
+ const chip = (k, label, n) => `<button type="button" class="bd-chip${sel === k ? ' on' : ''}" data-sh-sel="${esc(k)}" aria-pressed="${sel === k}">${esc(label)}${n ? ' ' + n : ''}</button>`;
74
+ const chipsHtml = chip('all', 'All', count(() => true)) + ((S.yours || []).length ? chip('mine', 'Yours', count((r) => r.mine)) : '') + teams.map((t) => chip(t.team, t.team, t.ok ? count((r) => r.team === t.team) : 0)).join('');
75
+ const failing = teams.filter((t) => !t.ok && (sel === 'all' || sel === t.team));
76
+ const banners = failing.map((t) => `<div class="bdsh-ban" role="alert"><span class="cs s-risk"><i class="cz-dot risk m-warn"></i>${esc(t.team)}: ${esc(t.error)}</span><button type="button" class="bd-btn" data-sh="${t.kind === 'password' ? 'repaste' : 'refresh'}" data-sh-team="${esc(t.team)}">${t.kind === 'password' ? 'Paste a new invite link' : 'Refresh'}</button></div>`).join('');
77
+ const shown = rows.filter((r) => (sel === 'all' ? true : sel === 'mine' ? r.mine : r.team === sel)).sort((a, b) => Number(a.ended) - Number(b.ended) || (b.mine ? 1 : 0) - (a.mine ? 1 : 0) || String(b.made).localeCompare(String(a.made)));
78
+ const built = shown.map((r) => row(S, r));
79
+ const teamSel = teams.find((t) => t.team === sel);
80
+ const teamLine = teamSel ? `<div class="bdsh-tl"><button type="button" class="bd-btn sm" data-sh="refresh">Refresh</button><button type="button" class="bd-btn sm" data-sh="repaste" data-sh-team="${esc(teamSel.team)}">Paste a new invite link</button><button type="button" class="bd-btn sm${S.leave === teamSel.team ? ' on' : ''}" data-sh-leave="${esc(teamSel.team)}">${S.leave === teamSel.team ? 'Sure? Leave ' + esc(teamSel.team) : 'Leave team'}</button></div><p class="bd-amut bdsh-fine">${S.leave === teamSel.team ? 'Leaving only forgets the team\'s password on this computer. Copies you published stay. Join again with the invite link.' : ''}</p>` : '';
81
+ const empty = !built.length && !failing.length ? `<p class="bd-amut bdsh-pad">${sel === 'all' ? 'Nothing is shared yet.' : sel === 'mine' ? 'You have no open links.' : 'Nobody has shared a board with ' + esc(sel) + ' yet. Press the share button on the Board to publish one.'}</p>` : '';
82
+ const head = '<div class="bd-dt h" role="row"><span></span><span role="columnheader">Board</span><span role="columnheader">Selection</span><span role="columnheader">Team</span><span role="columnheader">Shared by</span><span role="columnheader">Published</span><span role="columnheader">Views</span><span role="columnheader">Ends</span><span></span></div>';
83
+ const hosts = [...new Set(teams.filter((t) => t.ok).map((t) => t.host))];
84
+ const readLine = S.readAt ? `<p class="bd-amut bdsh-fine">Read${hosts.length ? ' from ' + hosts.map(esc).join(', ') : ''} ${agoText(S)}. Press a board to open its copy in a new tab. <button type="button" class="bdsh-lk" data-sh="refresh">Refresh</button></p>` : '';
85
+ return `<div class="bd-dchips" role="group" aria-label="Shared">${chipsHtml}<span class="bd-sp"></span><button type="button" class="bd-btn" data-sh="${showJoin ? 'closejoin' : 'openjoin'}">${showJoin ? 'Close' : 'Join another team'}</button></div>`
86
+ + (showJoin ? joinHtml(S) : '') + (S.status ? `<p class="bd-amut bdsh-fine" role="status">${esc(S.status)}</p>` : '') + banners + teamLine
87
+ + (built.length ? `<div class="bd-dtw bdsh-table" role="table" aria-label="Shared boards">${head}${built.map((b) => b.table).join('')}</div><div class="bdsh-cards">${built.map((b) => b.card).join('')}</div>` : '') + empty + readLine;
88
+ }
89
+
90
+ export async function loadCount(cb) {
91
+ const r = await pmGet('/api/board-publish').catch(() => null);
92
+ if (r && r.ok) cb((r.links || []).length);
93
+ }
94
+
95
+ export function show(el, opts = {}) {
96
+ css();
97
+ const S = el.__sh || (el.__sh = { phase: 'loading', yours: [], teams: [], names: [], readAt: '', now: Date.now(), sel: 'all', join: { open: false, typed: false }, off: null, leave: null, status: '' });
98
+ const draw = (focus) => {
99
+ const keep = { invite: el.querySelector('#shInvite'), host: el.querySelector('#shHost'), team: el.querySelector('#shTeam'), pass: el.querySelector('#shPass') };
100
+ if (keep.invite) S.join.invite = keep.invite.value; if (keep.host) S.join.host = keep.host.value; if (keep.team) S.join.team = keep.team.value; if (keep.pass) S.join.password = keep.pass.value;
101
+ el.innerHTML = '<h2 class="vh">Shared</h2><div id="shBody">' + viewHtml(S) + '</div>';
102
+ const f = focus && el.querySelector(focus); if (f) f.focus();
103
+ };
104
+ const read = async (keepPhase) => {
105
+ if (!keepPhase) { S.phase = 'loading'; draw(); }
106
+ const r = await pmGet('/api/board-publish/shared').catch(() => null);
107
+ S.phase = 'ready'; S.now = Date.now();
108
+ if (r && r.ok) { S.yours = r.yours || []; S.teams = r.teams || []; S.names = S.teams.map((t) => t.team); S.readAt = r.readAt; } else S.status = (r && r.error) || 'The workspace did not answer. Try again.';
109
+ if (opts.onCount) opts.onCount(totalOf(S)); draw();
110
+ };
111
+ if (!el.__shBound) {
112
+ el.__shBound = true;
113
+ el.addEventListener('click', async (e) => {
114
+ const b = e.target.closest('button'); if (!b) return;
115
+ if (b.dataset.shSel) { S.sel = b.dataset.shSel; S.leave = null; S.off = null; return draw(`[data-sh-sel="${CSS.escape(S.sel)}"]`); }
116
+ const a = b.dataset.sh;
117
+ if (a === 'refresh') { S.status = ''; S.leave = null; return read(false); }
118
+ if (a === 'openjoin') { S.join = { open: true, typed: false }; return draw('#shInvite'); }
119
+ if (a === 'closejoin') { S.join = { open: false, typed: false }; return draw(); }
120
+ if (a === 'repaste') { S.join = { open: true, typed: false, team: b.dataset.shTeam }; return draw('#shInvite'); }
121
+ if (a === 'typed') { S.join.typed = true; S.join.err = ''; return draw('#shHost'); }
122
+ if (a === 'paste') { S.join.typed = false; S.join.err = ''; return draw('#shInvite'); }
123
+ if (a === 'join') {
124
+ const J = S.join; const body = J.typed ? { host: J.host || '', team: J.team || '', password: J.password || '' } : { invite: J.invite || '' };
125
+ const fresh = { invite: (el.querySelector('#shInvite') || {}).value, host: (el.querySelector('#shHost') || {}).value, team: (el.querySelector('#shTeam') || {}).value, password: (el.querySelector('#shPass') || {}).value };
126
+ if (J.typed) { body.host = fresh.host || ''; body.team = fresh.team || ''; body.password = fresh.password || ''; } else body.invite = fresh.invite || '';
127
+ J.busy = true; J.err = ''; draw();
128
+ const r = await pmPost('/api/board-publish/join', body).catch(() => null); J.busy = false;
129
+ if (r && r.ok) { S.join = { open: false, typed: false }; S.sel = r.team; S.status = 'Joined ' + r.team + '.'; return read(false); }
130
+ J.err = (r && r.error) || 'The workspace did not answer. Try again.'; return draw(J.typed ? '#shHost' : '#shInvite');
131
+ }
132
+ if (b.dataset.shLeave) {
133
+ if (S.leave !== b.dataset.shLeave) { S.leave = b.dataset.shLeave; return draw(`[data-sh-leave="${CSS.escape(S.leave)}"]`); }
134
+ const r = await pmPost('/api/board-publish/leave', { team: S.leave }).catch(() => null); const was = S.leave; S.leave = null; S.sel = 'all';
135
+ S.status = r && r.ok ? 'Left ' + was + '. Copies you published stay.' : (r && r.error) || 'Not saved.'; return read(true);
136
+ }
137
+ if (b.dataset.shRe) { S.status = ''; const r = await pmPost('/api/board-publish/republish', { id: b.dataset.shRe }).catch(() => null); S.status = r && r.ok ? 'Republished. The link and the password stay the same.' : (r && r.error) || 'The workspace did not answer. Try again.'; return read(true); }
138
+ if (b.dataset.shOff) {
139
+ if (S.off !== b.dataset.shOff) { S.off = b.dataset.shOff; return draw(`[data-sh-off="${CSS.escape(S.off)}"]`); }
140
+ const r = await pmPost('/api/board-publish/off', { id: S.off }).catch(() => null); S.off = null;
141
+ S.status = r && r.ok ? 'Turned off. The copy is deleted from the host.' : (r && r.error) || 'The link could not be turned off.'; return read(true);
142
+ }
143
+ if (b.dataset.shOpen) {
144
+ // the tab is opened by the press itself (a popup blocker allows that), then pointed at the one-time address
145
+ const w = window.open('about:blank', '_blank'); if (w) { try { w.opener = null; } catch { /* none */ } }
146
+ const r = await pmPost('/api/board-publish/open', { team: b.dataset.shTeam, id: b.dataset.shOpen }).catch(() => null);
147
+ if (r && r.ok && w) { w.location.href = r.url; S.status = 'Opened ' + (b.textContent || 'the board') + ' in a new tab.'; } else { if (w) w.close(); S.status = (r && r.error) || 'The workspace did not answer. Try again.'; }
148
+ return draw(`[data-sh-open="${CSS.escape(b.dataset.shOpen)}"]`);
149
+ }
150
+ });
151
+ }
152
+ return read(false);
153
+ }
@@ -62,6 +62,7 @@ let view = ['track', 'stages', 'time', 'list'].includes(store.get(VIEW_KEY)) ? s
62
62
  let pview = ['list', 'stages', 'track', 'time'].includes(store.get(PVIEW_KEY)) ? store.get(PVIEW_KEY) : 'list'; // a phone's view (BdPhone)
63
63
  let span = SPANS.some(([k]) => k === store.get(SPAN_KEY)) ? store.get(SPAN_KEY) : 'quarter';
64
64
  let tab = 'ini';
65
+ let SH_N = 0; let SH_FULL = false; let SH_LOADED = false; // the Shared tab's number, whether it has read the teams, whether the first count was asked
65
66
  let readTimer = null;
66
67
  let readTries = 0; // reads that answered "reading" in a row: the next ask waits longer each time
67
68
  let foldOpen = false; // the Monitor and Evaluate rows under the table
@@ -232,6 +233,7 @@ function drawHead() {
232
233
  $('#snap').textContent = M.header.text;
233
234
  // PMOS-self: new work starts at the pmos-router skill. All products: New asks which product the initiative is for
234
235
  $('#newIni').hidden = ALL ? (M.board.products || []).every((p) => p.self) : !!M.board.self;
236
+ if (!window.PMOS_READONLY && !SH_LOADED) { SH_LOADED = true; import('./bd-shared.js').then((S) => S.loadCount(setSharedCount)); }
235
237
  { const pb = $('#bdPublish'); const was = pb.hidden; pb.hidden = ALL || !M.board.ws || !!window.PMOS_READONLY; if (was && !pb.hidden) import('./bd-publish.js').then((P) => P.refreshCount(pb)); }
236
238
  setPageGaps(((M.header && M.header.missing) || []).length);
237
239
  }
@@ -256,7 +258,7 @@ function drawChips() {
256
258
  const askChip = `<button type="button" class="bd-chip" id="chAsks" aria-haspopup="dialog">${asks ? esc(asks) : `<i class="cz-dot you${C.asks ? ' m-info' : ''}"></i><b>${C.asks}</b> new ${plural(C.asks, 'ask', 'asks')}`}</button>`;
257
259
  if (phone) {
258
260
  const docs = M.docs && M.docs.rows ? M.docs.rows.length : 0;
259
- $('#bdChipset').innerHTML = thisSprint + jiraChip + askChip + flt(['late', 'risk', 'blocked', 'idle']) + `<button type="button" class="bd-chip" id="chDocs">Docs ${docs}</button>`;
261
+ $('#bdChipset').innerHTML = thisSprint + jiraChip + askChip + flt(['late', 'risk', 'blocked', 'idle']) + `<button type="button" class="bd-chip" id="chDocs">Docs ${docs}</button><button type="button" class="bd-chip" id="chShared">Shared${SH_N ? ' ' + SH_N : ''}</button>`;
260
262
  return;
261
263
  }
262
264
  // the timeline's legend sits at the end of the chip row (PgTimeline), with a program milestone only where a program is drawn and "On hold" only
@@ -280,6 +282,7 @@ $('#bdChipset').addEventListener('click', (e) => {
280
282
  else if (b.id === 'chSprint') Acts.open.sprint(b);
281
283
  else if (b.id === 'chAsks') Acts.open.asks(b);
282
284
  else if (b.id === 'chDocs') setTab('docs');
285
+ else if (b.id === 'chShared') setTab('shared');
283
286
  });
284
287
  /** Read Jira again: the Jira source's own refresh (POST /api/sources/refresh), the one the Sources list runs. It starts a read and changes no record. */
285
288
  async function refreshJira(btn) {
@@ -852,13 +855,19 @@ $('#bdPublish').addEventListener('click', (e) => { const btn = e.currentTarget;
852
855
  /* ── tabs: Initiatives and Documents (Documents has no frame yet: a plain list) ──────────────────────────────────────────────────────── */
853
856
  function setTab(t) {
854
857
  tab = t;
855
- $('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs'));
856
- $('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs';
858
+ $('#tabIni').setAttribute('aria-selected', String(t === 'ini')); $('#tabDocs').setAttribute('aria-selected', String(t === 'docs')); $('#tabShared').setAttribute('aria-selected', String(t === 'shared'));
859
+ $('#cIni').hidden = t !== 'ini'; $('#cDocs').hidden = t !== 'docs'; $('#cShared').hidden = t !== 'shared';
857
860
  if (t === 'docs') { closePanel(); drawDocs(); loadDocMeta(); }
861
+ // Shared (initiative board-publish, slice 4): reads each joined team's host now, on opening the tab and on Refresh, and never in between
862
+ if (t === 'shared') { closePanel(); import('./bd-shared.js').then((S) => { SH_FULL = true; S.show($('#cShared'), { onCount: setSharedCount }); }); }
858
863
  }
859
864
  $('#tabIni').onclick = () => setTab('ini');
860
865
  $('#tabDocs').onclick = () => setTab('docs');
861
- $('.bd-tabs').addEventListener('keydown', (e) => { if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return; const n = tab === 'ini' ? 'docs' : 'ini'; setTab(n); $(n === 'ini' ? '#tabIni' : '#tabDocs').focus(); });
866
+ $('#tabShared').onclick = () => setTab('shared');
867
+ $('.bd-tabs').addEventListener('keydown', (e) => { if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return; const ord = ['ini', 'docs', 'shared']; const n = ord[(ord.indexOf(tab) + (e.key === 'ArrowRight' ? 1 : ord.length - 1)) % ord.length]; setTab(n); $('#' + { ini: 'tabIni', docs: 'tabDocs', shared: 'tabShared' }[n]).focus(); });
868
+ /** The number on the Shared tab and on the phone's Shared chip: nothing when there is nothing (zero is silence). Your own open links at load, every open copy after a read. */
869
+ function setSharedCount(n) { SH_N = n; $('#nShared').textContent = n ? String(n) : ''; const c = $('#chShared'); if (c) c.textContent = 'Shared' + (n ? ' ' + n : ''); }
870
+ document.addEventListener('bd:links', (e) => { if (!SH_FULL && e.detail) setSharedCount(e.detail.n); });
862
871
 
863
872
  /** Documents (BdDocs): the kind chips, the rows and their history; a row opens the document's panel (pm/bd-acts.js). */
864
873
  function drawDocs() { if (M) $('#docBody').innerHTML = V.docsHtml(); }
@@ -27,7 +27,7 @@ export const VIEW_CONTROLS = [
27
27
  ].join(',');
28
28
 
29
29
  /** The Board's static toolbar and chips: hidden, so the page's own script keeps the elements it holds. */
30
- const HIDE = ['.bd-hd', '.bd-tabs', '#crumbHost', '#ibTabs', '#bdFind', '#bdView', '#bdColsw', '#bdSort', '#bdFilter', '#bdBell', '#bdPublish', '#newIni', '.tools-top', '#bdGrpw', '#czFab'];
30
+ const HIDE = ['.bd-hd', '.bd-tabs', '#crumbHost', '#ibTabs', '#bdFind', '#bdView', '#bdColsw', '#bdSort', '#bdFilter', '#bdBell', '#bdPublish', '#chShared', '#newIni', '.tools-top', '#bdGrpw', '#czFab'];
31
31
  /** Controls the code draws that write, or lead to something a share does not hold: removed. */
32
32
  const REMOVE = [
33
33
  '#bdChipset > :not(.tg-lgd)', '#askDates', '.tg-ft',
@@ -55,6 +55,7 @@
55
55
  <div class="bd-tabs" role="tablist" aria-label="Board">
56
56
  <button type="button" role="tab" class="bd-tab" id="tabIni" aria-selected="true" aria-controls="cIni">Initiatives <span class="n" id="nIni"></span></button>
57
57
  <button type="button" role="tab" class="bd-tab" id="tabDocs" aria-selected="false" aria-controls="cDocs">Documents <span class="n" id="docCap"></span></button>
58
+ <button type="button" role="tab" class="bd-tab" id="tabShared" aria-selected="false" aria-controls="cShared">Shared <span class="n" id="nShared"></span></button>
58
59
  </div>
59
60
  <div class="bd-seg bd-spans" id="bdSpans" role="group" aria-label="Span" hidden>
60
61
  <button type="button" data-sp="sprint" aria-pressed="false">Sprint</button><button type="button" data-sp="quarter" aria-pressed="true">Quarter</button><button type="button" data-sp="half" aria-pressed="false">Half</button><button type="button" data-sp="year" aria-pressed="false">Year</button><button type="button" data-sp="y2" aria-pressed="false">2 yr</button><button type="button" data-sp="y5" aria-pressed="false">5 yr</button>
@@ -71,6 +72,7 @@
71
72
  <h2 class="vh" id="hDocs">Documents</h2>
72
73
  <div id="docBody"></div>
73
74
  </section>
75
+ <section class="bd-sec" id="cShared" role="tabpanel" aria-labelledby="tabShared" hidden></section>
74
76
 
75
77
  <!-- the help frame: what finishes each step (the step heads open it) -->
76
78
  <div class="bd-pop bd-pop-xw" id="popSteps" role="dialog" aria-labelledby="hSteps" hidden></div>
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "_comment": "Initiative board-publish, slice 2 (planning/prd/board-publish-prd.md P1 to P5; D103): the workspace's side of publishing to the central host (lib/boards-host.js, lib/routes-board-publish.js), run against a stand-in host that follows the contract.",
3
3
  "modules": [
4
- "board-publish-host.test.js"
4
+ "board-publish-host.test.js",
5
+ "board-publish-teams.test.js"
5
6
  ],
6
7
  "seconds": {
7
- "board-publish-host.test.js": 3
8
+ "board-publish-host.test.js": 3,
9
+ "board-publish-teams.test.js": 3
8
10
  }
9
11
  }
@@ -1,9 +1,11 @@
1
1
  {
2
- "_comment": "Initiative board-publish, slice 2 page side (planning/prd/board-publish-prd.md P1 to P5; design prototype/board-publish/publish-popover-design.html): the Publish popover on the Board (pm/bd-publish.js, pm/bd-publish.css, the toolbar button).",
2
+ "_comment": "Initiative board-publish, slice 2 page side (planning/prd/board-publish-prd.md P1 to P5; design prototype/board-publish/publish-popover-design.html): the Publish popover on the Board (pm/bd-publish.js, pm/bd-publish.css, the toolbar button). Slice 4 adds the Shared tab (pm/bd-shared.js, pm/bd-shared.css; design prototype/board-publish/shared-view-design.html).",
3
3
  "panels": [
4
- "board-publish-ui-test.js"
4
+ "board-publish-ui-test.js",
5
+ "board-shared-ui-test.js"
5
6
  ],
6
7
  "seconds": {
7
- "board-publish-ui-test.js": 40
8
+ "board-publish-ui-test.js": 40,
9
+ "board-shared-ui-test.js": 45
8
10
  }
9
11
  }