create-pmos 0.381.0 → 0.383.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 +30 -40
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/REMOTE.md +39 -0
- package/workspace/briefing-premium-calendar-test.js +1 -1
- package/workspace/briefing-premium-initiative-test.js +2 -2
- package/workspace/briefing-premium-test.js +1 -1
- package/workspace/changelog.json +29 -0
- package/workspace/guide/briefing-premium.md +5 -1
- package/workspace/lib/briefing-premium-agent.js +19 -9
- package/workspace/lib/routes-briefing-premium.js +1 -1
- package/workspace/lib/share-store.js +150 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-viewer-download-test.js +179 -0
- package/workspace/premium-viewer-share-test.js +208 -0
- package/workspace/premium-work-depth-test.js +1 -1
- package/workspace/public/pm/premium-acts.js +3 -4
- package/workspace/public/pm/premium-initiative.js +6 -8
- package/workspace/public/pm/premium-insights.js +5 -7
- package/workspace/public/pm/premium-meeting.js +1 -2
- package/workspace/public/pm/premium-report-read.js +4 -3
- package/workspace/public/pm/premium-shell.js +16 -7
- package/workspace/public/pm/premium-vw-doc.css +44 -0
- package/workspace/public/pm/premium-vw-file.js +95 -6
- package/workspace/public/pm/premium-vw-share.js +112 -0
- package/workspace/public/pm/premium-work.js +4 -4
- package/workspace/public/pm/premium.css +1 -1
- package/workspace/public/pm/premium.js +7 -7
- package/workspace/server.js +82 -0
- package/workspace/share-server.js +135 -0
- package/workspace/test-lists/premium-viewer-share.json +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.383.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,35 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.383.0",
|
|
37
|
+
"at": "2026-10-21T13:13:17.082Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 994,
|
|
42
|
+
"t": "Share a viewer file as a password link that needs no Cloudflare login",
|
|
43
|
+
"s": "Share a viewer file as a password link that needs no Cloudflare login"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.382.0",
|
|
49
|
+
"at": "2026-10-21T12:58:18.296Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 991,
|
|
54
|
+
"t": "A chat in every premium popup",
|
|
55
|
+
"s": "A chat in every premium popup"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"n": 992,
|
|
59
|
+
"t": "Download a file from the viewer (premium-viewer-share slice 1)",
|
|
60
|
+
"s": "Download a file from the viewer (premium-viewer-share slice 1)"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
35
64
|
{
|
|
36
65
|
"v": "0.381.0",
|
|
37
66
|
"at": "2026-10-21T12:15:37.889Z",
|
|
@@ -282,45 +311,6 @@
|
|
|
282
311
|
"s": "Each tool the Briefing uses gets a stored read (briefing-source-flow, slice 1)"
|
|
283
312
|
}
|
|
284
313
|
]
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
"v": "0.363.0",
|
|
288
|
-
"at": "2026-10-21T00:46:24.704Z",
|
|
289
|
-
"f": 2,
|
|
290
|
-
"prs": [
|
|
291
|
-
{
|
|
292
|
-
"n": 965,
|
|
293
|
-
"t": "Chat is the big middle place in the premium rail",
|
|
294
|
-
"s": "Chat is the big middle place in the premium rail"
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
"n": 966,
|
|
298
|
-
"t": "The meeting detail is one scroll with a short head on a phone",
|
|
299
|
-
"s": "The meeting detail is one scroll with a short head on a phone"
|
|
300
|
-
}
|
|
301
|
-
]
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
"v": "0.362.0",
|
|
305
|
-
"at": "2026-10-21T00:23:03.151Z",
|
|
306
|
-
"f": 2,
|
|
307
|
-
"prs": [
|
|
308
|
-
{
|
|
309
|
-
"n": 961,
|
|
310
|
-
"t": "Settings lists every connector of your Claude session",
|
|
311
|
-
"s": "Settings › Connectors lists every connector your Claude session has, and says that your sessions can use all of them while a switch only chooses what PMOS reads on its own."
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
"n": 963,
|
|
315
|
-
"t": "The premium Board release card lists the board's past releases",
|
|
316
|
-
"s": "The premium Board release card lists the board's past releases"
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
"n": 964,
|
|
320
|
-
"t": "Premium Sprint tab folds past sprints, shows the goal from the tickets, opens every ticket",
|
|
321
|
-
"s": "Premium Sprint tab folds past sprints, shows the goal from the tickets, opens every ticket"
|
|
322
|
-
}
|
|
323
|
-
]
|
|
324
314
|
}
|
|
325
315
|
]
|
|
326
316
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T13:13:14Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T13:13:14Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-10-21T13:13:14Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/REMOTE.md
CHANGED
|
@@ -212,6 +212,45 @@ Run these from a machine that is **not** signed in to Access:
|
|
|
212
212
|
| `PMOS_PUBLIC_HOST=<hostname>` | Opt in. Add this one bare hostname to the Host allowlist, and require the token and the Access header for requests to it. The server still binds loopback only (plus the tailnet when `PMOS_REMOTE=tailnet` is also set). A scheme, port, path, IP address or `localhost` is refused, and the server does not start. |
|
|
213
213
|
| `PMOS_TOKEN=<t>` | The workspace token. Recommended in this mode. Never printed. |
|
|
214
214
|
|
|
215
|
+
## Share links (a second hostname, without Access)
|
|
216
|
+
|
|
217
|
+
A share link lets someone with no PMOS and no Cloudflare login read a copy of one file. You make it from the share icon of a file in the viewer (D97). The link names a second hostname, by default `share.` followed by your Online hostname's domain: with Online at `pmos.pm-os.app`, links read `https://share.pm-os.app/s/<id>`. To name another hostname, set `PMOS_SHARE_HOST`.
|
|
218
|
+
|
|
219
|
+
A separate server answers that hostname. It is not the workspace server. It listens on `127.0.0.1` only, on the workspace port plus one (7434 by default; `PMOS_SHARE_PORT` changes it). It can read only the shared copies and has no terminals, no API and no settings. The workspace starts it when you make your first link and stops it with itself. Your workspace hostname keeps its Access sign-in.
|
|
220
|
+
|
|
221
|
+
Do these steps one time, on the computer that runs the workspace:
|
|
222
|
+
|
|
223
|
+
1. **Route the hostname to the tunnel:**
|
|
224
|
+
|
|
225
|
+
```sh
|
|
226
|
+
cloudflared tunnel route dns pmos share.pm-os.app
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
2. **Add one ingress rule** to `~/.cloudflared/config.yml`, above the last rule:
|
|
230
|
+
|
|
231
|
+
```yaml
|
|
232
|
+
ingress:
|
|
233
|
+
- hostname: pmos.pm-os.app
|
|
234
|
+
service: http://127.0.0.1:7433
|
|
235
|
+
- hostname: share.pm-os.app
|
|
236
|
+
service: http://127.0.0.1:7434
|
|
237
|
+
- service: http_status:404
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
3. **Do not add an Access application for `share.pm-os.app`.** If a wildcard application (`*.pm-os.app`) covers it, add a second application for `share.pm-os.app` with one policy: **Bypass**, **Everyone**. The share server has its own password check.
|
|
241
|
+
|
|
242
|
+
4. Turn Online off and on again in **Settings › Online**, so the tunnel reads the new rule.
|
|
243
|
+
|
|
244
|
+
Check it: open `https://share.pm-os.app/robots.txt` in a private window. It shows `Disallow: /` with no sign-in. Any other path shows "Not found". A link opens only while this computer is on and Online runs.
|
|
245
|
+
|
|
246
|
+
What a link does:
|
|
247
|
+
|
|
248
|
+
- **A copy, not the file.** The link serves the file as it was when you pressed Create link. Later edits are not shared.
|
|
249
|
+
- **Password.** On by default, with a generated password you can change or turn off. It is stored as a hash. Five wrong tries lock the link for 15 minutes.
|
|
250
|
+
- **End date.** 1, 7 or 30 days, 7 by default. There is no "never". When a link ends, or you press **Turn off**, its copy is deleted at once.
|
|
251
|
+
- **Secrets.** PMOS scans the file first. A key or token in the file stops the link, and the message names what it found.
|
|
252
|
+
- **No indexing, no caching, no log.** Every answer tells search engines not to index it and Cloudflare not to cache it. No IP address or header is kept, only a view count and the last view time.
|
|
253
|
+
|
|
215
254
|
## Troubleshooting
|
|
216
255
|
|
|
217
256
|
- **`403` "the public host is only reachable through Cloudflare Access"** — the request reached the workspace without passing Access. Create the Access application for the hostname (Setup step 3).
|
|
@@ -143,7 +143,7 @@ const MOCKUP = fs.readFileSync(path.join(__dirname, '..', 'prototype', 'premium-
|
|
|
143
143
|
ok('C6 with no note the dialog says so', dlg && /No notes for this meeting\./.test(dlg.text));
|
|
144
144
|
ok('C7 the material is listed with the scope it was linked at', dlg && /Capacity sheet/.test(dlg.text) && /every meeting of this series/.test(dlg.text) && /Roadmap/.test(dlg.text) && /for this meeting/.test(dlg.text));
|
|
145
145
|
ok('C8 with no recording the dialog draws no Replay', dlg && !/Replay/.test(dlg.text) && !/recording/i.test(dlg.text));
|
|
146
|
-
ok('C4
|
|
146
|
+
ok('C4 a week row has its own conversation too (premium-popup-context P1)', dlg && dlg.ask === false);
|
|
147
147
|
ok('C5 the dialog says what it is about, and that the calendar is never written', dlg && /It is about Board: IDPF/.test(dlg.text) && /calendar itself is never written/.test(dlg.text));
|
|
148
148
|
await p.keyboard.press('Escape');
|
|
149
149
|
const closed = await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
@@ -126,7 +126,7 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
126
126
|
await p.click('#tkTabs [data-v="list"]');
|
|
127
127
|
await p.locator('#cIniTk .tkq').first().click(); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(500);
|
|
128
128
|
const td = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, grid: [...document.querySelectorAll('#oMain .kv2 span')].map((s) => s.textContent).join('|'), ask: document.querySelector('#askF').hidden, seg: !!document.querySelector('#oMain .tkst') }));
|
|
129
|
-
ok('I6 a Jira task opens its record as a grid, read-only: no status control and
|
|
129
|
+
ok('I6 a Jira task opens its record as a grid, read-only: no status control, and its own conversation (premium-popup-context P1)', td.title === 'Sandbox key step' && /Reference\|ONB-12\|Source\|Jira \(read-only\)/.test(td.grid) && td.ask === false && td.seg === false, JSON.stringify(td));
|
|
130
130
|
await p.keyboard.press('Escape'); await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on')));
|
|
131
131
|
/* a PMOS task: its status can be changed */
|
|
132
132
|
A.set({ status: 200, body: { ok: true, item: {} } });
|
|
@@ -223,7 +223,7 @@ const HEALTH = { ok: true, path: 'planning/prd/self-serve-v2-prd.md', health: {
|
|
|
223
223
|
ok('I8 every document row opens, including one with no file', await p.evaluate(() => [...document.querySelectorAll('#dmList .dmr')].every((r) => !!r.querySelector('.dmo[data-doc]'))));
|
|
224
224
|
await p.click('#dmList .dmo[data-doc="problem"]'); await until(() => p.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(400);
|
|
225
225
|
{ const ab = await p.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, body: document.querySelector('#oMain').textContent, draft: !!document.querySelector('#abDraft'), ask: document.querySelector('#askF').hidden }));
|
|
226
|
-
ok('I8 a document with no file says what it is for, who writes it and offers Draft it', ab.title === 'Problem statement' && /Who writes it/.test(ab.body) && ab.draft && ab.ask ===
|
|
226
|
+
ok('I8 a document with no file says what it is for, who writes it and offers Draft it', ab.title === 'Problem statement' && /Who writes it/.test(ab.body) && ab.draft && ab.ask === false, JSON.stringify(ab)); }
|
|
227
227
|
const nD = A.posts.length; A.set({ status: 200, body: { ok: true, run: 'r1' } }); await p.click('#abDraft');
|
|
228
228
|
ok('I8 Draft it in that popup posts the draft route and closes the popup', await until(() => A.posts.length > nD && A.posts[A.posts.length - 1].path === '/api/core-docs/draft' && A.posts[A.posts.length - 1].body.key === 'problem') && await until(() => p.evaluate(() => !document.querySelector('#dlg').classList.contains('on'))));
|
|
229
229
|
ok('0 no page error', A.errors.length === 0, A.errors.join(' | '));
|
|
@@ -597,7 +597,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
597
597
|
await cp.locator('#rank .rr .rhd').nth(dec).click();
|
|
598
598
|
await until(() => cp.evaluate(() => document.querySelector('#dlg').classList.contains('on')));
|
|
599
599
|
const dd = await cp.evaluate(() => ({ title: document.querySelector('#dTitle').textContent, body: document.querySelector('#dBody').textContent, ask: document.querySelector('#askF').hidden, link: (document.querySelector('#srcLink') || {}).href || '' }));
|
|
600
|
-
ok('C5 a decision opens the dialog with what its record says
|
|
600
|
+
ok('C5 a decision opens the dialog with what its record says, its source link and its own conversation (premium-popup-context P1)', dd.title === 'Pick the launch market' && /Read from the console Briefing/.test(dd.body) && !dd.ask && /J-7/.test(dd.link), JSON.stringify(dd));
|
|
601
601
|
await cp.keyboard.press('Escape');
|
|
602
602
|
await cp.route('**/premium-work.html*', (r) => r.fulfill({ contentType: 'text/html', body: '<p>work</p>' }));
|
|
603
603
|
const own = await cp.evaluate(() => [...document.querySelectorAll('#rank .rr')].findIndex((r) => /Send Priya the date/.test(r.textContent)));
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,33 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.383.0",
|
|
4
|
+
"at": "2026-10-21T13:13:17.082Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 994,
|
|
9
|
+
"t": "Share a viewer file as a password link that needs no Cloudflare login",
|
|
10
|
+
"s": "Share a viewer file as a password link that needs no Cloudflare login"
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.382.0",
|
|
16
|
+
"at": "2026-10-21T12:58:18.296Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 991,
|
|
21
|
+
"t": "A chat in every premium popup",
|
|
22
|
+
"s": "A chat in every premium popup"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"n": 992,
|
|
26
|
+
"t": "Download a file from the viewer (premium-viewer-share slice 1)",
|
|
27
|
+
"s": "Download a file from the viewer (premium-viewer-share slice 1)"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
2
31
|
{
|
|
3
32
|
"v": "0.381.0",
|
|
4
33
|
"at": "2026-10-21T12:15:37.889Z",
|
|
@@ -183,7 +183,7 @@ Not built in premium: translation, Present and the slides stage, Ask PMOS quietl
|
|
|
183
183
|
Under Today, the **Around you** card holds what the agents and the outside world have left for you. It has six rows. A row opens a dialog and states what it found in one line. The caption says how many rows wait on you, or "quiet". If a source cannot be read, its row says so and gives the reason. It never reads as empty.
|
|
184
184
|
|
|
185
185
|
- **Agent proposals.** Every open draft of the Initiative Driver, for initiatives and for Work items, when the agent mode for that kind is Approve. Each draft is one card: what it is, its target, and the draft in two lines, with **Read more** for the why and the sources. Press a card to choose it. The bar at the bottom acts on the chosen card. **Keep** is the main press, and **Send back** and **Drop** sit next to it. The notes about undo and the agent mode are behind the ⓘ line. **Keep** records that you accept it and applies it (a problem statement, a stage move, a next step). **Send back** needs a note and starts a new run. **Drop** counts as a correction. None of the three can be undone. A decided proposal stays in the list and says what was recorded.
|
|
186
|
-
- **Mentions.** The people who named you in Slack, Jira, Confluence or mail, from today's morning brief. The row names who waits on a reply. **Make it a task** adds one Work item. **Mark read** hides the mention, and **Mark unread** brings it back. **Open in Slack** (or Jira, Confluence, mail) opens the original in a new tab. Nothing here replies, reacts or posts. The Mentions dialog has
|
|
186
|
+
- **Mentions.** The people who named you in Slack, Jira, Confluence or mail, from today's morning brief. The row names who waits on a reply. **Make it a task** adds one Work item. **Mark read** hides the mention, and **Mark unread** brings it back. **Open in Slack** (or Jira, Confluence, mail) opens the original in a new tab. Nothing here replies, reacts or posts. The Mentions dialog has its own chat, like every popup.
|
|
187
187
|
- **Portfolio pulse.** How many initiatives are late or at risk, by the Calendar's own status: the promised date against the forecast, or the Jira read. It is read only and it is not a forecast of its own. **Open the initiative** goes to its page.
|
|
188
188
|
- **Horizon scan.** When the scan last ran, when it runs next, its reports and their proposals. Each proposal says what **Approve** does before you press it. **Dismiss** asks for a reason and counts as a correction, and **Undo** takes a dismissal back. **Scan now** starts an agent that reads the public web and the repository, and says how many manual scans are left. The row on the card says it too, before you open the dialog. A scan that is switched off says so and the button stays off.
|
|
189
189
|
- **Report found.** What the report finder found in your calendar, Slack and the subjects of mail you sent: each finding with its name, why, its evidence lines and how sure it is (Likely or Not sure). **Set up** creates the recurring report and drafts its first cycle on this machine. **Not a report** tells the finder not to raise it again. PMOS drafts only and nothing is sent. **Change first** and the finder settings stay in Insights and the console. A finder that is off says so.
|
|
@@ -413,6 +413,8 @@ A document opens in one sheet on both the Board and the initiative page. Its sta
|
|
|
413
413
|
|
|
414
414
|
The conversation beside every premium dialog is a real Claude Code session. Anything you can do in a Claude Code chat, you can do here.
|
|
415
415
|
|
|
416
|
+
Every popup has this chat, including the ones that have no row of their own: a task, a document with no file, a set-up report, a measure, a meeting on another day, Sources, Settings, the Around-you rows and the forms (Add a task, Add a document, the board actions). Its conversation belongs to that one thing, so it is there again the next time you open it. Opening a popup starts nothing; the session starts when you send the first message, and Claude starts from what the popup shows: its title, its sub line and its facts. A draft report keeps its own **Say how it should look** box, and Insight Studio keeps its brief.
|
|
417
|
+
|
|
416
418
|
- **Your first message** in a dialog starts one session for that row, the page or the initiative, in its repository. Claude gets the row as the page shows it: the title, what the page says, the facts and the files to start from. Then it gets your words.
|
|
417
419
|
- **The message box** takes several lines. **Enter** sends; **Shift+Enter** starts a new line. The box grows as you type, up to about eight lines, and then scrolls. The send button stays at its foot, also with a phone keyboard open.
|
|
418
420
|
- **Later messages** in the same dialog go to the same session. Write `/compact`, `/clear` or any other slash command, and Claude Code runs it.
|
|
@@ -421,6 +423,8 @@ The conversation beside every premium dialog is a real Claude Code session. Anyt
|
|
|
421
423
|
- **The conversation** is Claude Code's own record, word for word. Claude's answers are formatted as Claude Code formats them: headings, bold, lists, code, tables, quotes and links (links open in a new tab). Your messages keep their line breaks, and a paste shows without the tags Claude Code wraps around it. A run of tool calls shows as one small grey line, for example "Used Read ×2, slack_read_thread". A connector tool shows its short name.
|
|
422
424
|
- **While a session runs**, the panel reads it again every 2 seconds and changes only when there is something new. The messages already on screen stay still, so nothing blinks beside the viewer.
|
|
423
425
|
- **A file Claude names** (a path such as `briefs/drafts/plan.md`, or a link to one) is underlined. Press it to read the file beside the conversation, as a tab in the viewer; on a phone, the Detail side shows it (on the Chat page, the viewer opens over the conversation). Markdown shows as a page, an HTML file shows as the page it draws (press **Source** for its code), and other text files show as code. An HTML page runs its own scripts, so its toggles and charts work, but it cannot reach PMOS or the internet: a web font falls back to the system font. It is read-only. While the tab is open it shows the newest version, so a file Claude is still writing stays current. A file outside the workspaces PMOS serves says "Not in a workspace" and is not read.
|
|
426
|
+
- **Download a file** with the download icon at the right of its name in the viewer. An HTML file saves as **HTML** (as it is) or **PDF**. A markdown file saves as **Markdown**, **Word .docx** or **PDF**. Other text files save at once as they are, with no menu. PDF opens your browser's print window: choose **Save as PDF** there. An HTML page prints with no access to PMOS or the internet, as in the viewer. Word holds the note's headings, paragraphs, lists and tables.
|
|
427
|
+
- **Share a file** with the share icon beside download. On a phone, **Send a copy** comes first: it opens the phone's share sheet with the file, and no link is made. **Public link** makes a link to a copy of the file as it is now, for someone with no PMOS or Cloudflare login. The password is on, with a generated one you can change or turn off. The link ends after 7 days; press **1 day** or **30 days** to change it. Press **Create link**, then **Copy link and password**, and send the password in a different message. The same popover lists your **open links** with their end date and views; **Turn off** (pressed twice) deletes the copy at once. A file with a key or token in it is not shared. Links need Online and one more tunnel rule: see REMOTE.md, "Share links".
|
|
424
428
|
- **What an answer worked with** shows as buttons under it: the files Claude wrote, changed or read, the Jira tickets and Slack channels it used, and the links it named. The first one is the main one: a file Claude wrote comes first, then what it named in its words, then what it only read. When an answer finishes while the chat is open, its main one opens in the viewer by itself, once; answers that were there when you opened the chat open nothing. On a phone a bar over the message box offers it instead (**View**), so the conversation stays in view. A Jira ticket shows what PMOS last read from Jira for a board or initiative it syncs, with **Open in Jira**; a ticket PMOS has not read says so. A Slack channel or message opens with **Open in Slack**, as PMOS keeps no copy of Slack messages.
|
|
425
429
|
- **A link to a Google Doc or a Confluence page** opens beside the conversation too, as the viewer shows a copy: the text PMOS has read, or **Read it now**. **A Claude artifact link** opens a tab with **Open in Claude**: claude.ai does not let another site show an artifact inside it. Other links open in a new browser tab.
|
|
426
430
|
- **The session** is also listed in **Sessions** and in the console, where you can open its terminal.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* ask({ root, runtimeDir, key, text, model, spawnSession, wsId, now }) → { status, body } starts ONE headless, read-only run
|
|
5
5
|
* threadOf(runtimeDir, key, now) → { turns: [{ id, q, state, a?, error?, at }], working }
|
|
6
6
|
* promptFor(row, turns, question) → the prompt text. Written here: the page chooses none of it.
|
|
7
|
-
* rowFor(model, key)
|
|
7
|
+
* rowFor(model, key, context) → { title, subject, say, facts, files } | null the row as the server's own model has it (a pop: key: the popup's own context)
|
|
8
8
|
* settle(runtimeDir, a, done, now) → the answer or the reason it failed, appended to the thread file
|
|
9
9
|
*
|
|
10
10
|
* The run is the `ask` kind of lib/headless.js (origin `briefing-ask:<key>`): Read, Glob and Grep, nothing else, the PM's own login. It
|
|
@@ -17,7 +17,7 @@ const headless = require('./headless.js');
|
|
|
17
17
|
const Goal = require('./goal-chat.js');
|
|
18
18
|
|
|
19
19
|
const THREADS = 'briefing-premium-threads.jsonl';
|
|
20
|
-
const KEY_RE = /^(decision|blocked|waited|src|ev|work|board|init|doc|ins|chat):[A-Za-z0-9][A-Za-z0-9._:-]{0,100}$/; // chat: the PM's own chat on the Chat page (premium-chat-page)
|
|
20
|
+
const KEY_RE = /^(decision|blocked|waited|src|ev|work|board|init|doc|ins|chat|pop):[A-Za-z0-9][A-Za-z0-9._:-]{0,100}$/; // chat: the PM's own chat on the Chat page (premium-chat-page); pop: a popup with no row of its own (premium-popup-context P1)
|
|
21
21
|
const MAX_Q = 2000, MAX_A = 6000, MAX_QUESTIONS = 40, PROMPT_TURNS = 8;
|
|
22
22
|
const fail = (status, error) => ({ status, body: { ok: false, error } });
|
|
23
23
|
const clip = (s, n) => { s = String(s == null ? '' : s).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
@@ -48,8 +48,9 @@ function threadOf(runtimeDir, key, now = Date.now()) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/** The row as the server's own model has it, plus the files an answer should start from. null when the key names no row on the page. */
|
|
51
|
-
function rowFor(model, key) {
|
|
51
|
+
function rowFor(model, key, context) {
|
|
52
52
|
if (/^chat:/.test(String(key || '')) && KEY_RE.test(key)) return { title: '', subject: '', say: '', facts: [], files: [] }; // the PM's own chat: no page row, no context
|
|
53
|
+
if (/^pop:/.test(String(key || '')) && KEY_RE.test(key)) return popRow(context); // premium-popup-context P1: the popup says what it shows, the same facts the PM sees
|
|
53
54
|
if (!model || !KEY_RE.test(String(key || ''))) return null;
|
|
54
55
|
if (/^(src|work):this-page$/.test(key)) { // the top bar's Chat: the whole page is the context, its summary and its first rows
|
|
55
56
|
const rows = model.rows || (model.list && model.list.rows) || [];
|
|
@@ -83,6 +84,15 @@ function rowFor(model, key) {
|
|
|
83
84
|
};
|
|
84
85
|
}
|
|
85
86
|
|
|
87
|
+
/** A popup that has no row in a server model (a task, a document with no file, a report, a measure, a form): the context it shows, cut to size. null without a title. */
|
|
88
|
+
function popRow(c) {
|
|
89
|
+
if (!c || typeof c !== 'object' || typeof c.title !== 'string' || !c.title.trim()) return null;
|
|
90
|
+
const str = (v, n) => (typeof v === 'string' ? clip(v, n) : '');
|
|
91
|
+
const facts = (Array.isArray(c.facts) ? c.facts : []).filter((f) => Array.isArray(f) && f[1] != null && String(f[1]).trim()).slice(0, 12).map(([a, b]) => clip(String(a), 40) + ': ' + clip(String(b), 240));
|
|
92
|
+
const files = (Array.isArray(c.files) ? c.files : []).filter((f) => typeof f === 'string' && SAFE_PATH.test(f) && !f.includes('..')).slice(0, 4);
|
|
93
|
+
return { title: str(c.title, 160), subject: str(c.subject, 240), say: str(c.say, 600), facts, files };
|
|
94
|
+
}
|
|
95
|
+
|
|
86
96
|
function promptFor(row, turns, question) {
|
|
87
97
|
const prior = turns.filter((t) => t.state === 'answered').slice(-PROMPT_TURNS);
|
|
88
98
|
return [
|
|
@@ -115,14 +125,14 @@ function settle(runtimeDir, a, { result, timedOut, stopped, note } = {}, now = n
|
|
|
115
125
|
return end({ event: 'answered', text: text.slice(0, MAX_A) });
|
|
116
126
|
}
|
|
117
127
|
|
|
118
|
-
function ask({ runtimeDir, key, text, model, spawnSession, wsId, now = new Date() }) {
|
|
128
|
+
function ask({ runtimeDir, key, text, model, context, spawnSession, wsId, now = new Date() }) {
|
|
119
129
|
if (!runtimeDir) return fail(409, 'this workspace has no state folder to keep the conversation in');
|
|
120
130
|
if (!KEY_RE.test(String(key || ''))) return fail(400, 'key must name a row');
|
|
121
131
|
const q = String(text == null ? '' : text).trim();
|
|
122
132
|
if (!q) return fail(400, 'Write a question for the agent.');
|
|
123
133
|
if (q.length > MAX_Q) return fail(400, 'The question is too long (' + MAX_Q + ' characters at most).');
|
|
124
|
-
const row = rowFor(model, key);
|
|
125
|
-
if (!row) return fail(404, model ? 'that row is not on the page' : 'the page has not read the repository yet');
|
|
134
|
+
const row = rowFor(model, key, context);
|
|
135
|
+
if (!row) return fail(404, /^pop:/.test(key) ? 'the popup did not say what it shows' : model ? 'that row is not on the page' : 'the page has not read the repository yet');
|
|
126
136
|
if (typeof spawnSession !== 'function') return fail(409, 'this workspace cannot start sessions');
|
|
127
137
|
const origin = 'briefing-ask:' + key;
|
|
128
138
|
if (headless.kindFor({ agent: 'claude', origin }) !== 'ask') return fail(409, 'Background runs are switched off here (PMOS_HEADLESS=off), so this page cannot start the agent.');
|
|
@@ -165,7 +175,7 @@ function openingFor(row, text) {
|
|
|
165
175
|
].filter((l) => l !== '').join('\n');
|
|
166
176
|
}
|
|
167
177
|
/** sessions: { alive(id) → bool, spawn(spec) → session row, type(id, text) → bool (Enter after, `/` left as typed) }. */
|
|
168
|
-
function chat({ runtimeDir, key, text, model, sessions, wsId, now = new Date() }) {
|
|
178
|
+
function chat({ runtimeDir, key, text, model, context, sessions, wsId, now = new Date() }) {
|
|
169
179
|
if (!runtimeDir) return fail(409, 'this workspace has no state folder to keep the conversation in');
|
|
170
180
|
if (!KEY_RE.test(String(key || ''))) return fail(400, 'key must name a row');
|
|
171
181
|
const q = String(text == null ? '' : text).trim();
|
|
@@ -177,8 +187,8 @@ function chat({ runtimeDir, key, text, model, sessions, wsId, now = new Date() }
|
|
|
177
187
|
// slice 4 (PRD L2): an ended chat resumes its own Claude Code conversation when the file for it is still there
|
|
178
188
|
const prev = alive ? null : chatRecordOf(runtimeDir, key);
|
|
179
189
|
const resume = !!(prev && prev.claude && typeof sessions.hasConversation === 'function' && sessions.hasConversation(prev.claude));
|
|
180
|
-
const row = alive ? null : rowFor(model, key);
|
|
181
|
-
if (!alive && !row && !resume) return fail(404, model ? 'that row is not on the page' : 'the page has not read the repository yet');
|
|
190
|
+
const row = alive ? null : rowFor(model, key, context);
|
|
191
|
+
if (!alive && !row && !resume) return fail(404, /^pop:/.test(key) ? 'the popup did not say what it shows' : model ? 'that row is not on the page' : 'the page has not read the repository yet');
|
|
182
192
|
// slice 2 (PRD G2): `/goal <text>` becomes the PMOS grilling prompt, on record before it reaches the session
|
|
183
193
|
let msg = q, goal = null;
|
|
184
194
|
const cmd = Goal.parseCommand(q);
|
|
@@ -94,7 +94,7 @@ async function post(req, res, url, ctx) {
|
|
|
94
94
|
// premium-chat-attach A5: the files a message names must be saved files of its conversation; one closing line names each for Claude
|
|
95
95
|
const att = Files.pathsOf({ runtimeDir, key: b.key, names: b.files });
|
|
96
96
|
if (!att.ok) { ctx.json(res, { ok: false, error: att.error }, att.status); return true; }
|
|
97
|
-
const a = (ctx.chatSessions ? Ag.chat : Ag.ask)({ runtimeDir, key: b.key, text: Files.withFiles(b.text, att.paths), sessions: ctx.chatSessions, model: /^work:/.test(String(b.key || '')) ? WP.peekModel() : /^board:/.test(String(b.key || '')) ? BoardP.peekModel() : /^ins:/.test(String(b.key || '')) ? InsP.peekModel() : /^(init|doc):/.test(String(b.key || '')) ? InitP.peekModel() : sk || (/^src:/.test(String(b.key || '')) && !(b.key === 'src:this-page' && url.searchParams.get('ws'))) ? Prod.peekModel() : BP.peekModel(root), spawnSession: ctx.spawnSession, wsId });
|
|
97
|
+
const a = (ctx.chatSessions ? Ag.chat : Ag.ask)({ runtimeDir, key: b.key, text: Files.withFiles(b.text, att.paths), context: b.context, sessions: ctx.chatSessions, model: /^work:/.test(String(b.key || '')) ? WP.peekModel() : /^board:/.test(String(b.key || '')) ? BoardP.peekModel() : /^ins:/.test(String(b.key || '')) ? InsP.peekModel() : /^(init|doc):/.test(String(b.key || '')) ? InitP.peekModel() : sk || (/^src:/.test(String(b.key || '')) && !(b.key === 'src:this-page' && url.searchParams.get('ws'))) ? Prod.peekModel() : BP.peekModel(root), spawnSession: ctx.spawnSession, wsId });
|
|
98
98
|
ctx.json(res, a.body, a.status);
|
|
99
99
|
return true;
|
|
100
100
|
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* share-store.js — the copies a share link serves (premium-viewer-share slice 2, D97). The workspace server writes them on the PM's press; the share
|
|
3
|
+
* server (share-server.js) reads them and counts views and wrong passwords. Nothing else reads or writes this folder.
|
|
4
|
+
*
|
|
5
|
+
* THE FOLDER. `<runtime state>/shares/<id>/`, in the per-user runtime directory outside every repository, mode 0700:
|
|
6
|
+
* meta.json { id, name, kind, made, ends, pw: 'scrypt$<salt>$<hash>' | null, key, views, last, fails, lockedUntil } mode 0600
|
|
7
|
+
* page.html the copy as a page: an .html file as it is, markdown rendered by the caller, other text in a <pre> mode 0600
|
|
8
|
+
* file the file's own text, for the guest's Download mode 0600
|
|
9
|
+
* id is 128 random bits (base64url, 22 characters). `key` is a random secret per link that signs the guest's cookie. No IP address,
|
|
10
|
+
* header or user agent is stored (D08): a view is a count and a time.
|
|
11
|
+
*
|
|
12
|
+
* create(dir, { name, kind, page, file, days, password, now }) -> { ok, id, ends } | { ok: false, error }
|
|
13
|
+
* list(dir, now) -> [{ id, name, ends, made, views, last, pw }] the newest first; ended links are deleted on the way
|
|
14
|
+
* get(dir, id, now) -> meta | null null for an unknown, malformed or ended id (an ended one is deleted)
|
|
15
|
+
* remove(dir, id) -> boolean
|
|
16
|
+
* checkPassword(dir, id, given, now) -> { ok } | { ok: false, locked, left, until } five wrong tries lock the link for 15 minutes
|
|
17
|
+
* sign(meta, until) · verifyCookie(meta, value, now) the guest's cookie for one link
|
|
18
|
+
* view(dir, id, now) count one view
|
|
19
|
+
* newPassword() three words and two digits, from crypto.randomInt
|
|
20
|
+
*/
|
|
21
|
+
const fs = require('fs');
|
|
22
|
+
const path = require('path');
|
|
23
|
+
const crypto = require('crypto');
|
|
24
|
+
|
|
25
|
+
const DAYS = [1, 7, 30];
|
|
26
|
+
const MAX_TRIES = 5;
|
|
27
|
+
const LOCK_MS = 15 * 60 * 1000;
|
|
28
|
+
const COOKIE_MS = 12 * 60 * 60 * 1000;
|
|
29
|
+
const ID_RX = /^[A-Za-z0-9_-]{22}$/;
|
|
30
|
+
const WORDS = ('amber anchor apple arrow aspen atlas basil beacon birch bison blossom border breeze brook cabin cactus canyon cedar chalk cherry cliff clover '
|
|
31
|
+
+ 'cobalt comet coral cotton crane crystal dawn delta desert dune eagle ember falcon fern field flint forest fossil garden ginger glacier granite '
|
|
32
|
+
+ 'harbor hazel heron hollow honey island ivory jasmine juniper kettle lagoon lantern lemon lily linen lotus maple marble meadow mesa mint '
|
|
33
|
+
+ 'moss nectar oak ocean olive onyx orbit orchid otter pebble pepper pine planet plum pond poppy prairie quartz quill rain raven reef '
|
|
34
|
+
+ 'ridge river robin saffron sage salt sand shore silver slate spruce stone summit sun swan thistle thunder tide timber topaz tulip '
|
|
35
|
+
+ 'valley velvet violet walnut willow winter wren yarrow zephyr').split(' ');
|
|
36
|
+
|
|
37
|
+
const root = (dir) => path.join(dir, 'shares');
|
|
38
|
+
const at = (dir, id) => path.join(root(dir), id);
|
|
39
|
+
function writeFile(p, data) {
|
|
40
|
+
const tmp = p + '.' + process.pid + '.' + crypto.randomBytes(4).toString('hex') + '.tmp';
|
|
41
|
+
fs.writeFileSync(tmp, data, { mode: 0o600 });
|
|
42
|
+
fs.renameSync(tmp, p);
|
|
43
|
+
}
|
|
44
|
+
function readMeta(dir, id) {
|
|
45
|
+
if (!ID_RX.test(String(id || ''))) return null;
|
|
46
|
+
try { const st = fs.lstatSync(at(dir, id)); if (!st.isDirectory()) return null; return JSON.parse(fs.readFileSync(path.join(at(dir, id), 'meta.json'), 'utf8')); }
|
|
47
|
+
catch { return null; }
|
|
48
|
+
}
|
|
49
|
+
function writeMeta(dir, m) { writeFile(path.join(at(dir, m.id), 'meta.json'), JSON.stringify(m)); }
|
|
50
|
+
|
|
51
|
+
function hashPassword(pw, salt = crypto.randomBytes(16)) {
|
|
52
|
+
const h = crypto.scryptSync(String(pw), salt, 32, { N: 16384, r: 8, p: 1 });
|
|
53
|
+
return 'scrypt$' + salt.toString('base64') + '$' + h.toString('base64');
|
|
54
|
+
}
|
|
55
|
+
function samePassword(stored, given) {
|
|
56
|
+
const [kind, s, h] = String(stored || '').split('$');
|
|
57
|
+
if (kind !== 'scrypt' || !s || !h) return false;
|
|
58
|
+
const want = Buffer.from(h, 'base64');
|
|
59
|
+
const got = crypto.scryptSync(String(given), Buffer.from(s, 'base64'), want.length, { N: 16384, r: 8, p: 1 });
|
|
60
|
+
return got.length === want.length && crypto.timingSafeEqual(got, want);
|
|
61
|
+
}
|
|
62
|
+
function newPassword() {
|
|
63
|
+
const w = () => WORDS[crypto.randomInt(WORDS.length)];
|
|
64
|
+
return `${w()}-${w()}-${w()}-${String(crypto.randomInt(100)).padStart(2, '0')}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function create(dir, o = {}) {
|
|
68
|
+
const days = Number(o.days);
|
|
69
|
+
if (!DAYS.includes(days)) return { ok: false, error: 'days must be 1, 7 or 30' };
|
|
70
|
+
if (!['html', 'markdown', 'text'].includes(o.kind)) return { ok: false, error: 'kind must be html, markdown or text' };
|
|
71
|
+
if (typeof o.page !== 'string' || typeof o.file !== 'string') return { ok: false, error: 'there is nothing to share' };
|
|
72
|
+
if (o.password != null) {
|
|
73
|
+
const p = String(o.password);
|
|
74
|
+
if (p.length < 8 || p.length > 128) return { ok: false, error: 'the password needs 8 to 128 characters' };
|
|
75
|
+
}
|
|
76
|
+
const now = o.now || Date.now();
|
|
77
|
+
const id = crypto.randomBytes(16).toString('base64url');
|
|
78
|
+
const name = String(o.name || 'file').replace(/[\\/\r\n\0]/g, '-').slice(0, 160);
|
|
79
|
+
const meta = { id, name, kind: o.kind, made: new Date(now).toISOString(), ends: new Date(now + days * 86400000).toISOString(),
|
|
80
|
+
pw: o.password == null ? null : hashPassword(o.password), key: crypto.randomBytes(32).toString('base64'), views: 0, last: null, fails: 0, lockedUntil: null };
|
|
81
|
+
try {
|
|
82
|
+
fs.mkdirSync(root(dir), { recursive: true, mode: 0o700 });
|
|
83
|
+
fs.mkdirSync(at(dir, id), { mode: 0o700 });
|
|
84
|
+
writeFile(path.join(at(dir, id), 'page.html'), o.page);
|
|
85
|
+
writeFile(path.join(at(dir, id), 'file'), o.file);
|
|
86
|
+
writeMeta(dir, meta);
|
|
87
|
+
} catch (e) {
|
|
88
|
+
remove(dir, id);
|
|
89
|
+
return { ok: false, error: 'the copy could not be saved (' + String((e && e.code) || 'write failed') + ')' };
|
|
90
|
+
}
|
|
91
|
+
return { ok: true, id, ends: meta.ends };
|
|
92
|
+
}
|
|
93
|
+
function remove(dir, id) {
|
|
94
|
+
if (!ID_RX.test(String(id || ''))) return false;
|
|
95
|
+
try { fs.rmSync(at(dir, id), { recursive: true, force: true }); return true; } catch { return false; }
|
|
96
|
+
}
|
|
97
|
+
const ended = (m, now) => !m || !m.ends || Date.parse(m.ends) <= now;
|
|
98
|
+
function get(dir, id, now = Date.now()) {
|
|
99
|
+
const m = readMeta(dir, id);
|
|
100
|
+
if (!m) return null;
|
|
101
|
+
if (ended(m, now)) { remove(dir, id); return null; }
|
|
102
|
+
return m;
|
|
103
|
+
}
|
|
104
|
+
function list(dir, now = Date.now()) {
|
|
105
|
+
let ids = [];
|
|
106
|
+
try { ids = fs.readdirSync(root(dir)).filter((x) => ID_RX.test(x)); } catch { return []; }
|
|
107
|
+
const out = [];
|
|
108
|
+
for (const id of ids) {
|
|
109
|
+
const m = get(dir, id, now);
|
|
110
|
+
if (m) out.push({ id: m.id, name: m.name, kind: m.kind, made: m.made, ends: m.ends, views: m.views || 0, last: m.last || null, pw: !!m.pw });
|
|
111
|
+
}
|
|
112
|
+
return out.sort((a, b) => String(b.made).localeCompare(String(a.made)));
|
|
113
|
+
}
|
|
114
|
+
function readPart(dir, id, part) {
|
|
115
|
+
if (!['page.html', 'file'].includes(part) || !ID_RX.test(String(id || ''))) return null;
|
|
116
|
+
try { return fs.readFileSync(path.join(at(dir, id), part), 'utf8'); } catch { return null; }
|
|
117
|
+
}
|
|
118
|
+
function checkPassword(dir, id, given, now = Date.now()) {
|
|
119
|
+
const m = get(dir, id, now);
|
|
120
|
+
if (!m || !m.pw) return { ok: false, locked: false, left: 0 };
|
|
121
|
+
if (m.lockedUntil && Date.parse(m.lockedUntil) > now) return { ok: false, locked: true, left: 0, until: m.lockedUntil };
|
|
122
|
+
if (samePassword(m.pw, String(given || '').slice(0, 256))) {
|
|
123
|
+
if (m.fails || m.lockedUntil) { m.fails = 0; m.lockedUntil = null; writeMeta(dir, m); }
|
|
124
|
+
return { ok: true };
|
|
125
|
+
}
|
|
126
|
+
m.fails = (m.lockedUntil && Date.parse(m.lockedUntil) <= now ? 0 : m.fails || 0) + 1;
|
|
127
|
+
m.lockedUntil = null;
|
|
128
|
+
if (m.fails >= MAX_TRIES) { m.fails = 0; m.lockedUntil = new Date(now + LOCK_MS).toISOString(); }
|
|
129
|
+
writeMeta(dir, m);
|
|
130
|
+
return m.lockedUntil ? { ok: false, locked: true, left: 0, until: m.lockedUntil } : { ok: false, locked: false, left: MAX_TRIES - m.fails };
|
|
131
|
+
}
|
|
132
|
+
function sign(m, until) {
|
|
133
|
+
const exp = String(Math.floor(until));
|
|
134
|
+
return exp + '.' + crypto.createHmac('sha256', Buffer.from(m.key, 'base64')).update(m.id + '.' + exp).digest('base64url');
|
|
135
|
+
}
|
|
136
|
+
function verifyCookie(m, value, now = Date.now()) {
|
|
137
|
+
const [exp, sig] = String(value || '').split('.');
|
|
138
|
+
if (!/^\d{10,16}$/.test(exp || '') || !sig || Number(exp) <= now) return false;
|
|
139
|
+
const want = Buffer.from(sign(m, Number(exp)).split('.')[1]), got = Buffer.from(sig);
|
|
140
|
+
return want.length === got.length && crypto.timingSafeEqual(want, got);
|
|
141
|
+
}
|
|
142
|
+
function view(dir, id, now = Date.now()) {
|
|
143
|
+
const m = get(dir, id, now);
|
|
144
|
+
if (!m) return;
|
|
145
|
+
m.views = (m.views || 0) + 1; m.last = new Date(now).toISOString();
|
|
146
|
+
try { writeMeta(dir, m); } catch { /* a missed count is not worth a failed page */ }
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
module.exports = { create, list, get, remove, readPart, checkPassword, sign, verifyCookie, view, newPassword, hashPassword, samePassword,
|
|
150
|
+
DAYS, MAX_TRIES, LOCK_MS, COOKIE_MS, ID_RX };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.383.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.383.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED