create-pmos 0.353.0 → 0.355.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 +25 -25
- 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/briefing-premium-test.js +12 -1
- package/workspace/briefing-premium-work-test.js +1 -1
- package/workspace/changelog.json +24 -0
- package/workspace/guide/briefing-premium.md +11 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-pad-test.js +125 -0
- package/workspace/public/pm/premium-insights.js +2 -2
- package/workspace/public/pm/premium-pad.js +89 -0
- package/workspace/public/pm/premium-shell.js +18 -10
- package/workspace/public/pm/premium.css +30 -2
- package/workspace/server.js +25 -0
- package/workspace/test-lists/premium-pad.json +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.355.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,30 @@
|
|
|
32
32
|
"audit"
|
|
33
33
|
],
|
|
34
34
|
"pmosChanges": [
|
|
35
|
+
{
|
|
36
|
+
"v": "0.355.0",
|
|
37
|
+
"at": "2026-10-20T09:07:17.325Z",
|
|
38
|
+
"f": 2,
|
|
39
|
+
"prs": [
|
|
40
|
+
{
|
|
41
|
+
"n": 954,
|
|
42
|
+
"t": "A Scratchpad in the chat panel",
|
|
43
|
+
"s": "A Scratchpad chip under the message box opens a pad above it."
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"v": "0.354.0",
|
|
49
|
+
"at": "2026-10-20T08:48:31.686Z",
|
|
50
|
+
"f": 2,
|
|
51
|
+
"prs": [
|
|
52
|
+
{
|
|
53
|
+
"n": 953,
|
|
54
|
+
"t": "Multi-line chat reply box in premium dialogs",
|
|
55
|
+
"s": "The box takes several lines."
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
35
59
|
{
|
|
36
60
|
"v": "0.353.0",
|
|
37
61
|
"at": "2026-10-20T08:29:44.242Z",
|
|
@@ -262,30 +286,6 @@
|
|
|
262
286
|
"s": "The first message in a dialog starts one interactive Claude Code session for that row, with the PM's own login, model and permission settings."
|
|
263
287
|
}
|
|
264
288
|
]
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
"v": "0.335.0",
|
|
268
|
-
"at": "2026-10-20T01:35:14.740Z",
|
|
269
|
-
"f": 2,
|
|
270
|
-
"prs": [
|
|
271
|
-
{
|
|
272
|
-
"n": 932,
|
|
273
|
-
"t": "Portfolio drafts, report Issue and board document Open stay in premium",
|
|
274
|
-
"s": "A portfolio drafts row opens the draft in the same document sheet the Board page uses, on the Briefing, with Issue it and Draft it again."
|
|
275
|
-
}
|
|
276
|
-
]
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
"v": "0.334.0",
|
|
280
|
-
"at": "2026-10-20T01:24:31.835Z",
|
|
281
|
-
"f": 2,
|
|
282
|
-
"prs": [
|
|
283
|
-
{
|
|
284
|
-
"n": 922,
|
|
285
|
-
"t": "The meeting sheet's During stage is the live capture while the Briefing records",
|
|
286
|
-
"s": "On the Briefing, while a note records or is paused, the meeting sheet's During part is the live capture itself."
|
|
287
|
-
}
|
|
288
|
-
]
|
|
289
289
|
}
|
|
290
290
|
]
|
|
291
291
|
}
|
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-20T09:07: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-20T09:07: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-20T09:07:14Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -403,6 +403,17 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
403
403
|
thread = { ok: true, turns: [], working: false }; answer = { status: 200, body: { ok: true } };
|
|
404
404
|
await pg.fill('#askIn', '');
|
|
405
405
|
ok('A1 an empty question is not sent', await (async () => { const n = posts.length; await pg.press('#askIn', 'Enter'); await sleep(200); return posts.length === n && /Write a message/.test(await pg.textContent('#askNote')); })());
|
|
406
|
+
{ // the reply box is several lines: Shift+Enter is a new line, the box grows to a cap and then scrolls, Enter sends all the lines
|
|
407
|
+
await pg.click('#askIn'); const h1 = await pg.evaluate(() => document.querySelector('#askIn').getBoundingClientRect().height);
|
|
408
|
+
await pg.keyboard.type('line one'); await pg.keyboard.press('Shift+Enter'); await pg.keyboard.type('line two');
|
|
409
|
+
const two = await pg.evaluate(() => ({ v: document.querySelector('#askIn').value, h: document.querySelector('#askIn').getBoundingClientRect().height, tag: document.querySelector('#askIn').tagName }));
|
|
410
|
+
ok('A9 Shift+Enter adds a line and the box grows with it, nothing is sent', two.tag === 'TEXTAREA' && two.v === 'line one\nline two' && two.h > h1 + 10, JSON.stringify({ h1, two }));
|
|
411
|
+
for (let i = 0; i < 20; i++) await pg.keyboard.press('Shift+Enter');
|
|
412
|
+
const cap = await pg.evaluate(() => { const t = document.querySelector('#askIn'), g = document.querySelector('#askGo').getBoundingClientRect(); return { h: t.getBoundingClientRect().height, sh: t.scrollHeight, go: g.bottom <= innerHeight && g.top >= 0 }; });
|
|
413
|
+
ok('A9 a long message stops growing at the cap and scrolls, and Send stays on screen', cap.h <= 222 && cap.sh > cap.h && cap.go, JSON.stringify(cap));
|
|
414
|
+
await pg.fill('#askIn', 'line one\nline two'); const n = posts.length; await pg.press('#askIn', 'Enter');
|
|
415
|
+
ok('A9 Enter sends both lines, then the box shrinks back to one line', await until(() => posts.length === n + 1) && posts[n].body.text === 'line one\nline two' && await until(() => pg.evaluate(() => document.querySelector('#askIn').value === '' && document.querySelector('#askIn').getBoundingClientRect().height < 50), 4000), JSON.stringify(posts[n] && posts[n].body));
|
|
416
|
+
}
|
|
406
417
|
await shut();
|
|
407
418
|
// return a run
|
|
408
419
|
await pg.locator('#tl .ev.src-run').first().click();
|
|
@@ -422,7 +433,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
422
433
|
await q.locator('#rank .rhd').nth(3).click(); await until(() => q.evaluate(() => document.querySelector('#dlg').classList.contains('on'))); await sleep(800);
|
|
423
434
|
await q.click('#dTabs [data-t="chat"]'); await sleep(300);
|
|
424
435
|
await q.locator('#card .op').nth(0).click(); await q.fill('#why', 'A reason'); await q.click('#laterBtn');
|
|
425
|
-
const m = await q.evaluate(() => { const hs = (sel) => [...document.querySelectorAll(sel)].map((b) => Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [].concat(hs('#card .seg2 button'), hs('#recBtn'), hs('
|
|
436
|
+
const m = await q.evaluate(() => { const hs = (sel) => [...document.querySelectorAll(sel)].map((b) => Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [].concat(hs('#card .seg2 button'), hs('#recBtn'), hs('#askIn'), hs('#askGo'), hs('#card .op')).filter((h) => h < 44) }; });
|
|
426
437
|
ok('W10 at 390 px (' + theme + ') the decision card has no sideways scroll and every new control is 44 px', !m.over && m.small.length === 0, JSON.stringify(m));
|
|
427
438
|
await c.close();
|
|
428
439
|
}
|
|
@@ -240,7 +240,7 @@ const MOCKUP = path.join(__dirname, '..', 'prototype', 'premium-ux-concept', 'br
|
|
|
240
240
|
await q.click('#dTabs [data-t="chat"]'); await sleep(900);
|
|
241
241
|
const g2 = await geo();
|
|
242
242
|
ok(`M12 at 390 px (${theme}) with the conversation brought in it is still full width`, g2.l === 0 && g2.w === g2.vw && await q.evaluate(() => document.querySelector('#dTabs [data-t="chat"]').getAttribute('aria-pressed') === 'true' && getComputedStyle(document.querySelector('#dBody')).display !== 'none' && getComputedStyle(document.querySelector('#dOut')).display === 'none'), JSON.stringify(g2));
|
|
243
|
-
const m = await q.evaluate(() => { const hs = (sel) => [...document.querySelectorAll(sel)].map((b) => Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [].concat(hs('#card .cta'), hs('#card .seg2 button'), hs('#wOn'), hs('
|
|
243
|
+
const m = await q.evaluate(() => { const hs = (sel) => [...document.querySelectorAll(sel)].map((b) => Math.round(b.getBoundingClientRect().height)); return { over: document.documentElement.scrollWidth > innerWidth + 1 || document.querySelector('#dlg').scrollWidth > document.querySelector('#dlg').clientWidth + 1, small: [].concat(hs('#card .cta'), hs('#card .seg2 button'), hs('#wOn'), hs('#askIn'), hs('#askGo')).filter((h) => h < 44) }; });
|
|
244
244
|
ok(`M12 at 390 px (${theme}) the dialog has no sideways scroll and every control is 44 px`, !m.over && m.small.length === 0, JSON.stringify(m));
|
|
245
245
|
await q.keyboard.press('Escape'); await sleep(300);
|
|
246
246
|
const pg = await q.evaluate(() => ({ over: document.documentElement.scrollWidth > innerWidth + 1, small: [...document.querySelectorAll('.wck, .capb, .wrh, #revBtn, .fchip, .qtb')].filter((b) => !b.closest('[hidden]') && b.getBoundingClientRect().height < 44 && b.getBoundingClientRect().height > 0).map((b) => b.className + ':' + Math.round(b.getBoundingClientRect().height)) }));
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.355.0",
|
|
4
|
+
"at": "2026-10-20T09:07:17.325Z",
|
|
5
|
+
"f": 2,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 954,
|
|
9
|
+
"t": "A Scratchpad in the chat panel",
|
|
10
|
+
"s": "A Scratchpad chip under the message box opens a pad above it."
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"v": "0.354.0",
|
|
16
|
+
"at": "2026-10-20T08:48:31.686Z",
|
|
17
|
+
"f": 2,
|
|
18
|
+
"prs": [
|
|
19
|
+
{
|
|
20
|
+
"n": 953,
|
|
21
|
+
"t": "Multi-line chat reply box in premium dialogs",
|
|
22
|
+
"s": "The box takes several lines."
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
},
|
|
2
26
|
{
|
|
3
27
|
"v": "0.353.0",
|
|
4
28
|
"at": "2026-10-20T08:29:44.242Z",
|
|
@@ -396,6 +396,7 @@ A document opens in one sheet on both the Board and the initiative page. Its sta
|
|
|
396
396
|
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.
|
|
397
397
|
|
|
398
398
|
- **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.
|
|
399
|
+
- **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.
|
|
399
400
|
- **Later messages** in the same dialog go to the same session. Write `/compact`, `/clear` or any other slash command, and Claude Code runs it.
|
|
400
401
|
- **What it may do** is set by your own Claude Code settings. Claude can change files and run commands. When your settings say to ask first, the question shows in the panel with its options; press one to answer.
|
|
401
402
|
- **Stop** shows while Claude works. It presses Esc in the session.
|
|
@@ -407,6 +408,16 @@ The conversation beside every premium dialog is a real Claude Code session. Anyt
|
|
|
407
408
|
|
|
408
409
|
Sending and the option presses need the page's launch nonce, so an agent session cannot type into your chat.
|
|
409
410
|
|
|
411
|
+
### The Scratchpad
|
|
412
|
+
|
|
413
|
+
Under the message box, **Scratchpad** opens a pad above the box. It keeps notes for this conversation only. Claude does not see them until you add them to a message.
|
|
414
|
+
|
|
415
|
+
- The text is saved on this machine as you type. It is there when you open the same row again, also after a reload.
|
|
416
|
+
- **Add to message** puts the pad text into the message box. Nothing is sent: read it, change it and press send yourself. If you select part of the pad first, the button reads **Add selection to message** and adds only that part. The pad keeps its text.
|
|
417
|
+
- To hide the pad, press **Scratchpad** again. The text is kept, and the chip shows how many lines it holds. The page remembers if the pad was open.
|
|
418
|
+
- To make the pad taller or shorter, drag the grip on its top edge, or select the grip and press the up arrow or the down arrow. Double-click the grip for the default height.
|
|
419
|
+
- A dialog with no conversation has no pad.
|
|
420
|
+
|
|
410
421
|
### Give Claude a goal with `/goal`
|
|
411
422
|
|
|
412
423
|
Type `/` in the box to see the commands: `/goal`, `/compact` and `/clear`. Use the arrow keys and Enter, or press one.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.355.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.355.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
/* premium-pad-test.js — the Scratchpad in the premium chat panel (initiative premium-chat-scratchpad).
|
|
4
|
+
* Serves the real My work page from the real server with a fixture model; the pad saves through the real /api/scratchpad in a scratch state folder.
|
|
5
|
+
* P1 the chip, pad closed · P2 open, type, saved for the row · P3 back after close and reload · P4 another row has its own pad
|
|
6
|
+
* P5 Add selection / Add to message fill the message box and send nothing · P6 no key, no pad · P7 the file name is a hash · P8 phone
|
|
7
|
+
*/
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { spawn } = require('child_process');
|
|
11
|
+
const { findBrowser } = require('./lib/find-browser');
|
|
12
|
+
const T = require('./test-run').configure({ name: 'premium-pad' });
|
|
13
|
+
const WP = require('./lib/my-work-premium.js');
|
|
14
|
+
const F = require('./fixtures/my-work-premium-facts.js');
|
|
15
|
+
|
|
16
|
+
const BASE = T.BASE;
|
|
17
|
+
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
18
|
+
const until = async (fn, ms = 6000, step = 100) => { const t0 = Date.now(); for (;;) { const v = await fn(); if (v) return v; if (Date.now() - t0 > ms) return v; await sleep(step); } };
|
|
19
|
+
const results = [];
|
|
20
|
+
const ok = (name, cond, extra = '') => { results.push({ name, cond: !!cond }); console.log(`${cond ? '✓' : '✗'} ${name}${!cond && extra !== '' ? ' — ' + extra : ''}`); };
|
|
21
|
+
let srv = null; let browser = null;
|
|
22
|
+
const finish = async (code) => {
|
|
23
|
+
if (browser) await browser.close().catch(() => {});
|
|
24
|
+
if (srv) { try { srv.kill('SIGKILL'); } catch { /* gone */ } }
|
|
25
|
+
T.killTmux();
|
|
26
|
+
const bad = results.filter((x) => !x.cond).length;
|
|
27
|
+
console.log(`\n${results.length - bad}/${results.length} premium-pad assertions passed`);
|
|
28
|
+
process.exit(code !== undefined ? code : (bad ? 1 : 0));
|
|
29
|
+
};
|
|
30
|
+
process.on('unhandledRejection', (e) => { console.error(e); finish(1); });
|
|
31
|
+
const get = async (u) => (await fetch(BASE + u)).json();
|
|
32
|
+
const SHOTS = process.env.PAD_SHOTS || ''; // a folder: the suite also saves screenshots there for review
|
|
33
|
+
const shot = async (page, n) => { if (SHOTS) await page.screenshot({ path: path.join(SHOTS, n + '.png') }); };
|
|
34
|
+
const KEY = 'pad-test:row/../1', KEY2 = 'pad-test:row-2';
|
|
35
|
+
|
|
36
|
+
(async () => {
|
|
37
|
+
const exe = findBrowser();
|
|
38
|
+
if (!exe) { console.log('✗ no Chrome/Chromium on this machine — the suite cannot run'); return finish(1); }
|
|
39
|
+
let chromium;
|
|
40
|
+
try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
|
|
41
|
+
srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
|
|
42
|
+
await T.waitForServer(BASE);
|
|
43
|
+
browser = await chromium.launch({ executablePath: exe });
|
|
44
|
+
const model = WP.build({ v: F.view(), now: F.NOW });
|
|
45
|
+
|
|
46
|
+
const open = async ({ w = 1280, h = 900, ctx = null } = {}) => {
|
|
47
|
+
ctx = ctx || await browser.newContext({ viewport: { width: w, height: h } });
|
|
48
|
+
const page = await ctx.newPage();
|
|
49
|
+
const errors = [], asks = [];
|
|
50
|
+
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
51
|
+
await page.route('**/api/my-work-premium', (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model, as_of: Date.now() }) }));
|
|
52
|
+
await page.route('**/api/briefing-premium/**', (r) => { const rq = r.request(); if (rq.method() !== 'GET') asks.push(new URL(rq.url()).pathname); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false }) }); });
|
|
53
|
+
await page.goto(BASE + '/premium-work.html', { waitUntil: 'domcontentloaded' });
|
|
54
|
+
await page.waitForFunction(() => document.querySelector('#dBody') !== null);
|
|
55
|
+
return { page, ctx, errors, asks };
|
|
56
|
+
};
|
|
57
|
+
const dlg = (page, key) => page.evaluate(async (key) => { const m = await import('/pm/premium-shell.js'); m.openDlg({ eye: 'Test', title: 'Pad test', say: 'Hello.', noteKey: key, html: '<p>detail</p>' }); }, key);
|
|
58
|
+
const close = (page) => page.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.closeDlg(); });
|
|
59
|
+
|
|
60
|
+
/* P1 */
|
|
61
|
+
let { page, ctx, errors, asks } = await open();
|
|
62
|
+
await dlg(page, KEY);
|
|
63
|
+
ok('P1 the Scratchpad chip is under the message box', await page.isVisible('#sPadT'));
|
|
64
|
+
ok('P1 the pad starts closed', await page.isHidden('#sPad'));
|
|
65
|
+
/* P2 */
|
|
66
|
+
await page.click('#sPadT');
|
|
67
|
+
ok('P2 the chip opens the pad and the pad has focus', await page.isVisible('#sPad') && await page.evaluate(() => document.activeElement && document.activeElement.id === 'sPadTa'));
|
|
68
|
+
ok('P2 the pad sits above the message box', await page.evaluate(() => document.querySelector('#sPad').getBoundingClientRect().bottom <= document.querySelector('#askIn').getBoundingClientRect().top + 1));
|
|
69
|
+
ok('P2 Add to message is off while the pad is empty', await page.isDisabled('#sPadAdd'));
|
|
70
|
+
await page.fill('#sPadTa', 'first line\nsecond keep this\nthird line');
|
|
71
|
+
ok('P2 typing saves the pad for this row', !!(await until(async () => (await get('/api/scratchpad?key=' + encodeURIComponent(KEY))).text === 'first line\nsecond keep this\nthird line')));
|
|
72
|
+
/* P5 */
|
|
73
|
+
await page.evaluate(() => { const t = document.querySelector('#sPadTa'); const a = t.value.indexOf('keep this'); t.focus(); t.setSelectionRange(a, a + 'keep this'.length); t.dispatchEvent(new Event('select')); });
|
|
74
|
+
ok('P5 with a selection the button reads Add selection to message', (await page.textContent('#sPadAdd')).trim() === 'Add selection to message');
|
|
75
|
+
await shot(page, 'build-select-1280-light');
|
|
76
|
+
await page.click('#sPadAdd');
|
|
77
|
+
ok('P5 only the selection goes into the message box', (await page.inputValue('#askIn')) === 'keep this');
|
|
78
|
+
ok('P5 the message box has focus and nothing was sent', await page.evaluate(() => document.activeElement.id === 'askIn') && asks.length === 0, JSON.stringify(asks));
|
|
79
|
+
ok('P5 the pad keeps its text', (await page.inputValue('#sPadTa')).includes('keep this'));
|
|
80
|
+
await page.evaluate(() => { const t = document.querySelector('#sPadTa'); t.setSelectionRange(0, 0); t.dispatchEvent(new Event('select')); });
|
|
81
|
+
await page.click('#sPadAdd');
|
|
82
|
+
const multi = await page.evaluate(() => document.querySelector('#askIn').tagName === 'TEXTAREA');
|
|
83
|
+
const want = 'keep this\nfirst line\nsecond keep this\nthird line';
|
|
84
|
+
ok('P5 Add to message adds the whole pad after what is typed', (await page.inputValue('#askIn')) === (multi ? want : want.replace(/\n/g, ' ')), JSON.stringify(await page.inputValue('#askIn')));
|
|
85
|
+
ok('P5 still nothing sent', asks.length === 0);
|
|
86
|
+
/* P3 */
|
|
87
|
+
await page.fill('#sPadTa', 'saved on close');
|
|
88
|
+
await close(page);
|
|
89
|
+
ok('P3 closing the dialog saves an edit at once', !!(await until(async () => (await get('/api/scratchpad?key=' + encodeURIComponent(KEY))).text === 'saved on close', 2000)));
|
|
90
|
+
await page.click('body').catch(() => {});
|
|
91
|
+
/* P4 */
|
|
92
|
+
await dlg(page, KEY2);
|
|
93
|
+
ok('P4 another row has its own, empty pad', (await page.inputValue('#sPadTa')) === '' && await page.isVisible('#sPad'));
|
|
94
|
+
await close(page);
|
|
95
|
+
await page.reload({ waitUntil: 'domcontentloaded' }); await page.waitForFunction(() => document.querySelector('#dBody') !== null);
|
|
96
|
+
await dlg(page, KEY);
|
|
97
|
+
ok('P3 after a reload the row\'s pad text is back and the pad is open as left', !!(await until(async () => (await page.inputValue('#sPadTa')) === 'saved on close')) && await page.isVisible('#sPad'));
|
|
98
|
+
await page.click('#sPadT');
|
|
99
|
+
ok('P3 closed, the chip says how many lines the pad holds', /1 line/.test(await page.textContent('#sPadT')) && await page.isHidden('#sPad'));
|
|
100
|
+
await close(page);
|
|
101
|
+
/* P6 */
|
|
102
|
+
await dlg(page, null);
|
|
103
|
+
ok('P6 a dialog with no conversation has no pad', await page.isHidden('#sPadT') && await page.isHidden('#sPad'));
|
|
104
|
+
await close(page);
|
|
105
|
+
/* P7 */
|
|
106
|
+
const files = []; const walk = (d) => { for (const n of fs.readdirSync(d, { withFileTypes: true })) { const f = path.join(d, n.name); if (n.isDirectory()) walk(f); else files.push(path.relative(T.STATE_DIR, f)); } };
|
|
107
|
+
try { walk(path.join(T.STATE_DIR, 'scratchpad')); } catch { /* none */ }
|
|
108
|
+
ok('P7 a row pad is filed under a hashed name, never the key', files.length > 0 && files.every((f) => /^scratchpad\/[^/]+\/row-[0-9a-f]{32}\.txt$/.test(f)), files.join(', '));
|
|
109
|
+
const bad = await fetch(BASE + '/api/scratchpad?key=', { method: 'GET' }); ok('P7 an empty key is refused', bad.status === 400);
|
|
110
|
+
ok('P1-P7 no page errors', errors.length === 0, errors.join(' | '));
|
|
111
|
+
await ctx.close();
|
|
112
|
+
|
|
113
|
+
/* P8 phone */
|
|
114
|
+
({ page, ctx, errors } = await open({ w: 390, h: 844 }));
|
|
115
|
+
await dlg(page, KEY);
|
|
116
|
+
await until(async () => (await page.inputValue('#sPadTa')) === 'saved on close');
|
|
117
|
+
await page.evaluate(async () => { const m = await import('/pm/premium-shell.js'); m.setTab('chat'); });
|
|
118
|
+
if (await page.isHidden('#sPad')) await page.click('#sPadT');
|
|
119
|
+
await shot(page, 'build-open-390-light');
|
|
120
|
+
ok('P8 on a phone the pad and chip fit the width', await page.evaluate(() => { const w = innerWidth; return ['#sPad', '#sPadT', '#askIn'].every((s) => { const r = document.querySelector(s).getBoundingClientRect(); return r.width > 0 && r.left >= 0 && r.right <= w + 1; }); }));
|
|
121
|
+
ok('P8 the chip is a 44px target on a phone', await page.evaluate(() => document.querySelector('#sPadT').getBoundingClientRect().height >= 44));
|
|
122
|
+
ok('P8 no page errors', errors.length === 0, errors.join(' | '));
|
|
123
|
+
await ctx.close();
|
|
124
|
+
finish();
|
|
125
|
+
})();
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* adds New report and Shape it in the Studio, whose presses are POST /api/report-setups/setup | from-dashboard and POST /api/report-structure/turn | remove |
|
|
8
8
|
* revert | accept (PRD R5 to R8). insights-one-list puts the insight first, the pinned dashboard on top and one paged list of dashboards and reports below
|
|
9
9
|
* (PRD L1 to L6); its one new press is Pin, POST /api/premium-dashboards/pin. Nothing else posts, and nothing is sent outward. */
|
|
10
|
-
import { $, $$, esc, openDlg, closeDlg, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, crumbHtml, wireCrumb, kv, setPageGaps, infoBtn } from './premium-shell.js';
|
|
10
|
+
import { $, $$, esc, openDlg, closeDlg, toast, loadThread, onScroll, wireRail, logHtml, turnA, ptx, pillOf, crumbHtml, wireCrumb, kv, setPageGaps, infoBtn, growAsk } from './premium-shell.js';
|
|
11
11
|
import { pmPost, pmGet } from './http.js';
|
|
12
12
|
import { openStudio } from './premium-studio.js';
|
|
13
13
|
import { openReport } from './premium-report-read.js';
|
|
@@ -58,7 +58,7 @@ $('#insHero').addEventListener('click', (e) => {
|
|
|
58
58
|
const a = e.target.closest('[data-askwhy]'); if (!a) return;
|
|
59
59
|
openChart(byKey(a.dataset.askwhy));
|
|
60
60
|
const t = $('#dTabs [data-t="chat"]'); if (t) t.click();
|
|
61
|
-
const inp = $('#askIn'); if (inp) { inp.value = 'Why is this happening, and what would change it?'; inp.focus(); }
|
|
61
|
+
const inp = $('#askIn'); if (inp) { inp.value = 'Why is this happening, and what would change it?'; growAsk(); inp.focus(); }
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
/* ── charts ───────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/* pm/premium-pad.js — the Scratchpad in the premium chat panel (initiative premium-chat-scratchpad).
|
|
2
|
+
* The console's per-session pad (c3-session-term.js makePad), kept per conversation: one pad for each row's key, because a row's session
|
|
3
|
+
* starts with its first message and can end and start again. Saved on this machine through /api/scratchpad?key=… as you type.
|
|
4
|
+
* "Add to message" puts the pad text, or the selected part of it, into the message box. Nothing is sent; the pad keeps its text. */
|
|
5
|
+
import { pmGet, pmPost } from './http.js';
|
|
6
|
+
|
|
7
|
+
const OPEN_KEY = 'pmos.premium.pad.open', H_KEY = 'pmos.premium.pad.h';
|
|
8
|
+
export const PAD_H = 132, PAD_MIN = 64, PAD_STEP = 18;
|
|
9
|
+
const PEN = '<svg class="i" viewBox="0 0 24 24"><path d="M4 20h4L19 9l-4-4L4 16v4z"/><path d="M14 6l4 4"/></svg>';
|
|
10
|
+
|
|
11
|
+
/** The lines the pad holds, for the closed chip ("Scratchpad · 3 lines"). Blank lines at the ends do not count. Pure. */
|
|
12
|
+
export function padLines(text) { const t = String(text || '').replace(/^\s+|\s+$/g, ''); return t ? t.split('\n').length : 0; }
|
|
13
|
+
/** The message box after Add to message: the added text goes after what is already typed, on a new line. Pure. */
|
|
14
|
+
export function addToMessage(cur, add) {
|
|
15
|
+
const a = String(add || '').replace(/^\n+|\s+$/g, ''); if (!a) return String(cur || '');
|
|
16
|
+
const c = String(cur || '').replace(/\s+$/, '');
|
|
17
|
+
return c ? c + '\n' + a : a;
|
|
18
|
+
}
|
|
19
|
+
/** The pad height in px, kept between the minimum and 60% of the room. Pure. */
|
|
20
|
+
export function clampPadH(h, room) { const n = Math.round(Number(h)); const max = Math.max(PAD_MIN, Math.round((Number(room) || 600) * 0.6)); return Number.isFinite(n) ? Math.min(max, Math.max(PAD_MIN, n)) : PAD_H; }
|
|
21
|
+
|
|
22
|
+
const store = { get: (k) => { try { return localStorage.getItem(k); } catch { return null; } }, set: (k, v) => { try { localStorage.setItem(k, v); } catch { /* not remembered */ } } };
|
|
23
|
+
export const padMarkup = () => `<div class="spad" id="sPad" hidden><div class="spad-grip" id="sPadGrip" role="separator" aria-orientation="horizontal" tabindex="0" aria-label="Resize the scratchpad" title="Drag to resize the scratchpad. Double-click for the default size."><i></i></div><div class="spad-h"><b>Scratchpad</b><span>This conversation · saved on this machine</span></div><textarea id="sPadTa" aria-label="Scratchpad" placeholder="Notes for this conversation. Claude does not see them until you add them to a message." maxlength="200000"></textarea><div class="spad-f"><button type="button" class="cta alt sm" id="sPadAdd" disabled title="Put the text in the message box. Nothing is sent.">Add to message</button></div></div>`;
|
|
24
|
+
export const padChipMarkup = () => `<button type="button" class="padt" id="sPadT" aria-expanded="false" aria-controls="sPad" hidden>${PEN}<span>Scratchpad</span><em id="sPadN"></em></button>`;
|
|
25
|
+
|
|
26
|
+
let cur = null; // the pad on show: { key, ws, ta, flush }
|
|
27
|
+
/** Flush the open pad's unsaved text at once (the dialog closes, the page hides). */
|
|
28
|
+
export function flushPad() { if (cur) cur.flush(); }
|
|
29
|
+
|
|
30
|
+
/** Wire the pad that padMarkup() and padChipMarkup() drew into the dialog for the row `key`. No key: no conversation, so no pad. */
|
|
31
|
+
export function mountPad({ key, ws, input }) {
|
|
32
|
+
flushPad(); cur = null;
|
|
33
|
+
const box = document.getElementById('sPad'), chip = document.getElementById('sPadT');
|
|
34
|
+
if (!box || !chip) return;
|
|
35
|
+
if (!key) { chip.hidden = true; box.hidden = true; return; }
|
|
36
|
+
const ta = document.getElementById('sPadTa'), add = document.getElementById('sPadAdd'), grip = document.getElementById('sPadGrip'), n = document.getElementById('sPadN');
|
|
37
|
+
const q = 'key=' + encodeURIComponent(key) + (ws ? '&ws=' + encodeURIComponent(ws) : '');
|
|
38
|
+
let typed = false, timer = null, pending = null;
|
|
39
|
+
const me = { key, ws, ta };
|
|
40
|
+
me.flush = () => {
|
|
41
|
+
if (timer) { clearTimeout(timer); timer = null; }
|
|
42
|
+
if (pending === null) return;
|
|
43
|
+
const text = pending; pending = null;
|
|
44
|
+
pmPost('/api/scratchpad', { key, ws: ws || undefined, text }).catch(() => { /* the text stays in the box */ });
|
|
45
|
+
};
|
|
46
|
+
cur = me;
|
|
47
|
+
const sel = () => (ta.selectionEnd > ta.selectionStart ? ta.value.slice(ta.selectionStart, ta.selectionEnd) : '');
|
|
48
|
+
const sync = () => {
|
|
49
|
+
const s = sel().trim();
|
|
50
|
+
add.disabled = !ta.value.trim();
|
|
51
|
+
add.textContent = s ? 'Add selection to message' : 'Add to message';
|
|
52
|
+
const k = padLines(ta.value);
|
|
53
|
+
n.textContent = box.hidden && k ? ` · ${k} ${k === 1 ? 'line' : 'lines'}` : '';
|
|
54
|
+
};
|
|
55
|
+
const setOpen = (on) => {
|
|
56
|
+
box.hidden = !on; chip.classList.toggle('on', on); chip.setAttribute('aria-expanded', String(on));
|
|
57
|
+
chip.title = on ? 'Hide the scratchpad. The text is kept.' : 'Show the scratchpad';
|
|
58
|
+
sync();
|
|
59
|
+
};
|
|
60
|
+
let h = Number(store.get(H_KEY)) || 0;
|
|
61
|
+
const room = () => (document.getElementById('dBody') || document.body).clientHeight;
|
|
62
|
+
const applyH = () => { // the height is the box's own rows, as the console pad does, so no inline style
|
|
63
|
+
ta.rows = Math.max(2, Math.round((h || PAD_H) / (parseFloat(getComputedStyle(ta).lineHeight) || 21))); grip.setAttribute('aria-valuenow', String(h || PAD_H)); };
|
|
64
|
+
const setH = (v) => { h = clampPadH(v, room()); applyH(); };
|
|
65
|
+
const saveH = () => store.set(H_KEY, h ? String(h) : '');
|
|
66
|
+
chip.hidden = false;
|
|
67
|
+
chip.onclick = () => { const on = box.hidden; store.set(OPEN_KEY, on ? 'open' : 'closed'); setOpen(on); if (on) ta.focus(); };
|
|
68
|
+
ta.oninput = () => { typed = true; pending = ta.value; if (timer) clearTimeout(timer); timer = setTimeout(me.flush, 500); sync(); };
|
|
69
|
+
ta.onselect = sync; ta.onkeyup = sync; ta.onmouseup = sync;
|
|
70
|
+
ta.onkeydown = (e) => { if (e.key === 'Enter') e.stopPropagation(); }; // Enter is a new line in the pad, never a send
|
|
71
|
+
add.onclick = () => {
|
|
72
|
+
const text = sel() || ta.value; if (!text.trim() || !input) return;
|
|
73
|
+
const v = addToMessage(input.value, text);
|
|
74
|
+
input.value = input.tagName === 'TEXTAREA' ? v : v.replace(/[ \t]*\n[ \t]*/g, ' '); // a one-line box would drop the line breaks and join the words
|
|
75
|
+
input.dispatchEvent(new Event('input', { bubbles: true })); // the message box grows and the / menu reads it, as if typed
|
|
76
|
+
input.focus();
|
|
77
|
+
try { input.setSelectionRange(input.value.length, input.value.length); } catch { /* a box without a caret */ }
|
|
78
|
+
const note = document.getElementById('askNote'); if (note) note.textContent = 'Added to your message. Press send when it reads right. The pad keeps its text.';
|
|
79
|
+
};
|
|
80
|
+
let y0 = null, h0 = 0;
|
|
81
|
+
grip.onpointerdown = (e) => { y0 = e.clientY; h0 = h || PAD_H; try { grip.setPointerCapture(e.pointerId); } catch { /* none */ } };
|
|
82
|
+
grip.onpointermove = (e) => { if (y0 != null) setH(h0 + (y0 - e.clientY)); };
|
|
83
|
+
grip.onpointerup = grip.onpointercancel = () => { if (y0 == null) return; y0 = null; saveH(); };
|
|
84
|
+
grip.ondblclick = () => { h = 0; applyH(); saveH(); };
|
|
85
|
+
grip.onkeydown = (e) => { if (e.key !== 'ArrowUp' && e.key !== 'ArrowDown') return; e.preventDefault(); setH((h || PAD_H) + (e.key === 'ArrowUp' ? PAD_STEP : -PAD_STEP)); saveH(); };
|
|
86
|
+
ta.value = ''; applyH(); setOpen(store.get(OPEN_KEY) === 'open');
|
|
87
|
+
pmGet('/api/scratchpad?' + q).then((r) => { if (cur === me && !typed && r && typeof r.text === 'string') { ta.value = r.text; sync(); } }).catch(() => { /* an empty pad */ });
|
|
88
|
+
}
|
|
89
|
+
if (typeof addEventListener === 'function') addEventListener('pagehide', flushPad);
|
|
@@ -7,6 +7,7 @@ import { chipActs, openLive, openFocus, mountRecord, HL_LINE } from './premium-v
|
|
|
7
7
|
import { lineItems, behindOf, refreshTargets, whenRead } from './freshness-words.js';
|
|
8
8
|
import { splitGoal, shownUser, goalBlockHtml, goalProgressHtml, slashMatches } from './goal-chat.js';
|
|
9
9
|
import { mdHtml, userHtml, toolLine, webKind } from './chat-md.js';
|
|
10
|
+
import { padMarkup, padChipMarkup, mountPad, flushPad } from './premium-pad.js';
|
|
10
11
|
import { railModel, railHtml, teaser, menuCount, loudestRow, factsOf, titleOf, DOT, WORD } from './session-rail.js';
|
|
11
12
|
export const $ = (s, r = document) => r.querySelector(s);
|
|
12
13
|
export const $$ = (s, r = document) => [...r.querySelectorAll(s)];
|
|
@@ -194,7 +195,8 @@ export function openDlg(o) {
|
|
|
194
195
|
$('#dlg').inert = false; document.documentElement.style.overflow = 'hidden';
|
|
195
196
|
$('#dEye').textContent = o.eye; $('#dTitle').textContent = o.title; $('#dSub').textContent = o.sub || ''; $('#dSub').hidden = !o.sub;
|
|
196
197
|
$('#oMain').innerHTML = o.pane || `<article class="paper doc">${o.html}</article>`; $('#oLab').textContent = o.label || 'Detail'; vwReset(); // extra viewer tabs belong to the dialog that opened them
|
|
197
|
-
$('#dBody').innerHTML = `<div class="stream" role="log">${o.stream || turnA(ptx(o.say))}</div><form class="askbar" id="askF"><div class="slashm" id="slashM" role="listbox" aria-label="Commands" hidden></div
|
|
198
|
+
$('#dBody').innerHTML = `<div class="stream" role="log">${o.stream || turnA(ptx(o.say))}</div><form class="askbar" id="askF"><div class="slashm" id="slashM" role="listbox" aria-label="Commands" hidden></div>${padMarkup()}<textarea id="askIn" rows="1" placeholder="Message Claude, or type /" maxlength="8000" autocomplete="off" enterkeyhint="send" aria-label="A message for Claude" aria-controls="slashM"></textarea><button type="submit" data-act="ask" id="askGo" aria-label="Send to Claude" title="Send to Claude"><svg class="i" viewBox="0 0 24 24"><path d="M5 12h14M13 6l6 6-6 6"/></svg></button></form><div class="askfoot"><p class="fine2" id="askNote">${CHAT_NOTE}</p>${padChipMarkup()}</div>`;
|
|
199
|
+
mountPad({ key: S.key, ws: new URLSearchParams(location.search).get('ws'), input: $('#askIn') });
|
|
198
200
|
$('#dlg').classList.remove('full'); setMode('split'); setTab('out'); // on a phone the dialog opens on the Detail tab and the Detail / Conversation switch brings the conversation, as the mockup draws it
|
|
199
201
|
$('#veil').classList.add('on'); $('#dlg').classList.add('on');
|
|
200
202
|
$$('#dGrid .pane').forEach((p) => { p.scrollTop = 0; });
|
|
@@ -202,7 +204,7 @@ export function openDlg(o) {
|
|
|
202
204
|
setTimeout(() => $('#dlg').focus(), 60);
|
|
203
205
|
}
|
|
204
206
|
export function closeDlg() {
|
|
205
|
-
clearTimeout(threadTimer); S.key = null; railOnClose();
|
|
207
|
+
clearTimeout(threadTimer); S.key = null; flushPad(); railOnClose();
|
|
206
208
|
park();
|
|
207
209
|
$('#veil').classList.remove('on'); $$('.rail,main.stage,#dock').forEach((x) => { x.inert = false; });
|
|
208
210
|
$('#dlg').inert = true; document.documentElement.style.overflow = ''; $('#dlg').classList.remove('on');
|
|
@@ -371,14 +373,20 @@ function drawSlash() {
|
|
|
371
373
|
m.innerHTML = list.map((x, i) => `<button type="button" role="option" id="slash-${i}" aria-selected="${i === slashAt}" class="${i === slashAt ? 'sel' : ''}" data-slash="${esc(x.cmd)}"><code>${esc(x.cmd)}</code><b>${esc(x.name)}</b><em>${esc(x.say)}</em></button>`).join('');
|
|
372
374
|
m.hidden = false; m.setAttribute('data-esc-layer', ''); inp.setAttribute('aria-activedescendant', 'slash-' + slashAt);
|
|
373
375
|
}
|
|
374
|
-
function pickSlash(cmd) { const inp = $('#askIn'); inp.value = cmd + ' '; slashAt = 0; drawSlash(); inp.focus(); }
|
|
375
|
-
|
|
376
|
+
function pickSlash(cmd) { const inp = $('#askIn'); inp.value = cmd + ' '; slashAt = 0; drawSlash(); growAsk(); inp.focus(); }
|
|
377
|
+
/** The reply box grows with its lines up to the CSS max-height, then scrolls. Call it after any code sets the value. */
|
|
378
|
+
export function growAsk() {
|
|
379
|
+
const t = $('#askIn'); if (!t || t.tagName !== 'TEXTAREA') return;
|
|
380
|
+
t.style.height = 'auto'; t.style.height = t.scrollHeight + 'px';
|
|
381
|
+
}
|
|
382
|
+
$('#dBody').addEventListener('input', (e) => { if (e.target.id === 'askIn') { slashAt = 0; drawSlash(); growAsk(); } });
|
|
376
383
|
$('#dBody').addEventListener('keydown', (e) => {
|
|
377
|
-
if (e.target.id !== 'askIn') return;
|
|
378
|
-
const list = slashMatches(e.target.value)
|
|
379
|
-
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') { e.preventDefault(); slashAt = (slashAt + (e.key === 'ArrowDown' ? 1 : list.length - 1)) % list.length; drawSlash(); }
|
|
380
|
-
else if (e.key === 'Tab' || (e.key === 'Enter' && e.target.value !== list[slashAt].cmd)) { e.preventDefault(); pickSlash(list[slashAt].cmd); }
|
|
381
|
-
else if (e.key === 'Escape') { e.preventDefault(); e.target.value = ''; drawSlash(); }
|
|
384
|
+
if (e.target.id !== 'askIn' || e.isComposing || e.keyCode === 229) return; // an IME is still composing: its Enter picks the word, it does not send
|
|
385
|
+
const list = slashMatches(e.target.value), menu = list.length && !$('#slashM').hidden;
|
|
386
|
+
if (menu && (e.key === 'ArrowDown' || e.key === 'ArrowUp')) { e.preventDefault(); slashAt = (slashAt + (e.key === 'ArrowDown' ? 1 : list.length - 1)) % list.length; drawSlash(); }
|
|
387
|
+
else if (menu && (e.key === 'Tab' || (e.key === 'Enter' && !e.shiftKey && e.target.value !== list[slashAt].cmd))) { e.preventDefault(); pickSlash(list[slashAt].cmd); }
|
|
388
|
+
else if (menu && e.key === 'Escape') { e.preventDefault(); e.target.value = ''; drawSlash(); growAsk(); }
|
|
389
|
+
else if (e.key === 'Enter' && !e.shiftKey && !e.altKey && !e.ctrlKey && !e.metaKey) { e.preventDefault(); e.target.form.requestSubmit(); } // Enter sends, Shift+Enter is a new line
|
|
382
390
|
});
|
|
383
391
|
$('#dBody').addEventListener('submit', async (e) => {
|
|
384
392
|
e.preventDefault();
|
|
@@ -391,7 +399,7 @@ $('#dBody').addEventListener('submit', async (e) => {
|
|
|
391
399
|
}
|
|
392
400
|
if (!key) { $('#askNote').textContent = 'This row has no conversation, so the message was not sent.'; return; }
|
|
393
401
|
if (!text) { $('#askNote').textContent = 'Write a message for Claude.'; return; }
|
|
394
|
-
if (await sendText(key, text)) { inp.value = ''; inp.placeholder = 'Message Claude, or type /'; drawSlash(); }
|
|
402
|
+
if (await sendText(key, text)) { inp.value = ''; inp.placeholder = 'Message Claude, or type /'; drawSlash(); growAsk(); }
|
|
395
403
|
});
|
|
396
404
|
|
|
397
405
|
/* ── the hero folds into the dock on scroll ─────────────────────────────────────────────────────────────── */
|
|
@@ -469,7 +469,7 @@ a.round{color:inherit;text-decoration:none}
|
|
|
469
469
|
.kv2{display:grid;grid-template-columns:minmax(110px,auto) minmax(0,1fr);gap:8px 18px;font-size:var(--fs-3);margin:6px 0}
|
|
470
470
|
.kv2 span:nth-child(odd){color:var(--ink-3)}.kv2 span:nth-child(even){color:var(--ink);font-weight:500;line-height:1.5;overflow-wrap:anywhere}
|
|
471
471
|
.vtb{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:8px;margin:6px 0}.vtb div{display:grid;gap:2px;padding:10px 12px;border-radius:12px;background:var(--well)}.vtb span{font:600 var(--fs-1) var(--mono);color:var(--ink-3);text-transform:uppercase;letter-spacing:.04em;overflow-wrap:anywhere}.vtb b{font-size:var(--fs-3)}
|
|
472
|
-
.askbar input:disabled,.askbar button:disabled{opacity:.55;cursor:not-allowed}
|
|
472
|
+
.askbar input:disabled,.askbar textarea:disabled,.askbar button:disabled{opacity:.55;cursor:not-allowed}
|
|
473
473
|
@media (max-width:700px){.card .ch{flex-wrap:wrap}.kv2{grid-template-columns:minmax(96px,auto) minmax(0,1fr)}}
|
|
474
474
|
/* floors the mockup left under 44 px (PRD deviation D6) */
|
|
475
475
|
.rpin{min-width:44px!important;min-height:44px!important}.fchip{min-height:44px!important}.fbtn{min-width:44px!important;min-height:44px!important}#theme2{min-width:44px!important;min-height:44px!important;flex:none}
|
|
@@ -484,7 +484,7 @@ a.round{color:inherit;text-decoration:none}
|
|
|
484
484
|
.whyl{display:block;margin:4px 0 6px;font:600 var(--t-micro) var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3)}
|
|
485
485
|
.nodef.err{color:var(--bad)}
|
|
486
486
|
.nodef.err[hidden]{display:none}
|
|
487
|
-
.askbar input,.askbar button{min-height:44px}
|
|
487
|
+
.askbar input,.askbar textarea,.askbar button{min-height:44px}
|
|
488
488
|
|
|
489
489
|
/* slice 3: the agent's answers */
|
|
490
490
|
.agtag{margin:0 0 6px;font:600 var(--t-micro) var(--mono);letter-spacing:.08em;text-transform:uppercase;color:var(--ink-3)}
|
|
@@ -2363,6 +2363,10 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2363
2363
|
.ilead{margin:6px 0 14px;font-size:var(--fs-3);font-weight:600;color:var(--ember-ink)}
|
|
2364
2364
|
.footi{margin-top:28px;display:flex;align-items:center}
|
|
2365
2365
|
.ifold .foot{margin:0;max-width:90ch}
|
|
2366
|
+
/* the chat reply box is several lines: it grows with what is typed up to a cap, then scrolls; the send button stays at its foot */
|
|
2367
|
+
.askbar:has(textarea){align-items:flex-end}
|
|
2368
|
+
.askbar textarea{flex:1;min-width:0;height:46px;min-height:46px;max-height:min(220px,32vh);box-sizing:border-box;resize:none;overflow-y:auto;border-radius:23px;border:0;background:var(--well);padding:12px 18px;font:inherit;line-height:22px;color:var(--ink);outline:0;scrollbar-width:thin}
|
|
2369
|
+
.askbar textarea:focus{box-shadow:0 0 0 2px var(--b3)}
|
|
2366
2370
|
/* ── Sessions beside the chat (initiative premium-session-list): the list, its dots, the chip, the folds ── */
|
|
2367
2371
|
.srl{display:none;flex-direction:column;min-height:0;overflow:hidden;border-right:1px solid var(--hair);padding-right:10px}
|
|
2368
2372
|
.srl-hd{display:flex;align-items:center;gap:6px;padding:4px 2px 8px 8px}
|
|
@@ -2439,3 +2443,27 @@ button.wl-row[aria-pressed="true"] .wl-tog{background:var(--solid);color:var(--o
|
|
|
2439
2443
|
.dlg.srl-open .srl-hd{display:none}
|
|
2440
2444
|
.stease{height:44px}
|
|
2441
2445
|
}
|
|
2446
|
+
|
|
2447
|
+
/* the Scratchpad in the chat panel (premium-pad.js): above the message box, one pad for each conversation */
|
|
2448
|
+
.askfoot{display:flex;align-items:flex-start;gap:10px}
|
|
2449
|
+
.askfoot .fine2{flex:1;min-width:0}
|
|
2450
|
+
.padt{flex:none;display:inline-flex;align-items:center;gap:6px;margin-top:2px;padding:5px 12px;border-radius:var(--r-chip);background:var(--well);color:var(--ink-2);font-size:var(--fs-2);font-weight:600;white-space:nowrap;min-height:30px}
|
|
2451
|
+
.padt[hidden]{display:none}
|
|
2452
|
+
.padt.on{background:var(--solid);color:var(--on-solid)}
|
|
2453
|
+
.padt svg{width:14px;height:14px}
|
|
2454
|
+
.padt em{font-style:normal;font-weight:500;opacity:.75}
|
|
2455
|
+
.spad{flex:1 0 100%;box-sizing:border-box;border-radius:var(--r-in);background:var(--well);overflow:hidden;margin-bottom:2px}
|
|
2456
|
+
.spad[hidden]{display:none}
|
|
2457
|
+
.spad-grip{height:14px;display:grid;place-items:center;cursor:ns-resize;touch-action:none}
|
|
2458
|
+
.spad-grip i{width:36px;height:4px;border-radius:9px;background:var(--ink-3);opacity:.35}
|
|
2459
|
+
.spad-grip:focus-visible{outline:0;box-shadow:inset 0 0 0 2px var(--b3)}
|
|
2460
|
+
.spad-h{display:flex;align-items:baseline;justify-content:space-between;gap:8px;padding:0 16px}
|
|
2461
|
+
.spad-h b{font-size:var(--fs-3);font-weight:600}
|
|
2462
|
+
.spad-h span{font-size:var(--fs-2);color:var(--ink-3);text-align:right}
|
|
2463
|
+
.askbar .spad textarea{flex:none;height:auto;min-height:0;max-height:none;border-radius:0;overflow-y:auto;display:block;width:100%;box-sizing:border-box;border:0;background:transparent;padding:6px 16px 8px;font:inherit;font-size:var(--fs-3);line-height:1.5;color:var(--ink);resize:none;outline:0}
|
|
2464
|
+
.askbar .spad textarea:focus{box-shadow:none}
|
|
2465
|
+
.spad:focus-within{box-shadow:0 0 0 2px var(--b3)}
|
|
2466
|
+
.spad-f{display:flex;justify-content:flex-end;padding:0 10px 10px}
|
|
2467
|
+
.askbar .spad-f .cta{width:auto;height:34px;min-height:34px;padding:0 14px;border-radius:var(--r-chip);display:inline-flex;font-size:var(--fs-2);background:var(--card);color:var(--ink)}
|
|
2468
|
+
.askbar .spad-f .cta:disabled{opacity:.5;cursor:not-allowed}
|
|
2469
|
+
@media (max-width:700px){.spad-h span{display:none}.askbar .spad textarea{font-size:var(--fs-4)}.padt{min-height:44px}}
|
package/workspace/server.js
CHANGED
|
@@ -5032,6 +5032,14 @@ function scratchpadPath(w, sessionId) {
|
|
|
5032
5032
|
if (!/^[A-Za-z0-9._-]{1,64}$/.test(sid) || sid === '.' || sid === '..') return null;
|
|
5033
5033
|
return path.join(SCRATCH_DIR, w.id, sid + '.txt');
|
|
5034
5034
|
}
|
|
5035
|
+
// A premium conversation's pad belongs to its ROW, not to a session: the row's session starts with
|
|
5036
|
+
// its first message and can end and start again. The key is the page's own conversation key, so it
|
|
5037
|
+
// is hashed into the file name and never reaches the disk as given.
|
|
5038
|
+
function rowScratchpadId(key) {
|
|
5039
|
+
const k = String(key == null ? '' : key);
|
|
5040
|
+
if (!k || k.length > 400) return null;
|
|
5041
|
+
return 'row-' + crypto.createHash('sha256').update(k).digest('hex').slice(0, 32);
|
|
5042
|
+
}
|
|
5035
5043
|
function readScratchpad(w, sessionId) {
|
|
5036
5044
|
const f = scratchpadPath(w, sessionId);
|
|
5037
5045
|
if (!f) return '';
|
|
@@ -7301,6 +7309,14 @@ async function handleRequest(req, res) {
|
|
|
7301
7309
|
let body = {};
|
|
7302
7310
|
try { body = JSON.parse((await readBody(req)) || '{}'); }
|
|
7303
7311
|
catch { return json(res, { ok: false, error: 'invalid JSON' }, 400); }
|
|
7312
|
+
if (body.key != null) {
|
|
7313
|
+
const rid = rowScratchpadId(body.key), w = getWs(body.ws);
|
|
7314
|
+
if (!rid) return json(res, { ok: false, error: 'no such conversation' }, 400);
|
|
7315
|
+
if (!w) return json(res, { ok: false, error: 'no workspace' }, 404);
|
|
7316
|
+
try { writeScratchpad(w, rid, body.text); }
|
|
7317
|
+
catch (e) { warnWriteFail('scratchpad', e); return json(res, { ok: false, error: 'could not save scratchpad' }, 500); }
|
|
7318
|
+
return json(res, { ok: true, key: true });
|
|
7319
|
+
}
|
|
7304
7320
|
const s = body.session ? sessions.get(String(body.session)) : null;
|
|
7305
7321
|
if (body.session && !s) return json(res, { ok: false, error: 'no such session' }, 404);
|
|
7306
7322
|
const w = s ? workspaces.get(s.ws) : getWs(body.ws);
|
|
@@ -7309,6 +7325,15 @@ async function handleRequest(req, res) {
|
|
|
7309
7325
|
catch (e) { warnWriteFail('scratchpad', e); return json(res, { ok: false, error: 'could not save scratchpad' }, 500); }
|
|
7310
7326
|
return json(res, { ok: true, session: s ? s.id : null });
|
|
7311
7327
|
}
|
|
7328
|
+
if (p === '/api/scratchpad' && url.searchParams.has('key')) {
|
|
7329
|
+
const rid = rowScratchpadId(url.searchParams.get('key')), w = getWs(url.searchParams.get('ws'));
|
|
7330
|
+
if (!rid) return json(res, { ok: false, error: 'no such conversation' }, 400);
|
|
7331
|
+
if (!w) return json(res, { ok: false, error: 'no workspace' }, 404);
|
|
7332
|
+
// readScratchpad with an id never claims the legacy workspace pad for a row: that pad belongs to a terminal tab
|
|
7333
|
+
const f = scratchpadPath(w, rid); let text = '';
|
|
7334
|
+
try { text = fs.readFileSync(f, 'utf8'); } catch { /* an empty pad */ }
|
|
7335
|
+
return json(res, { ok: true, key: true, text });
|
|
7336
|
+
}
|
|
7312
7337
|
if (p === '/api/scratchpad') {
|
|
7313
7338
|
const sid = url.searchParams.get('session');
|
|
7314
7339
|
const s = sid ? sessions.get(sid) : null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Initiative premium-chat-scratchpad: the Scratchpad in the premium chat panel (pure parts, and the pad on the real page and server).",
|
|
3
|
+
"modules": [
|
|
4
|
+
"premium-pad.test.js"
|
|
5
|
+
],
|
|
6
|
+
"panels": [
|
|
7
|
+
"premium-pad-test.js"
|
|
8
|
+
],
|
|
9
|
+
"seconds": {
|
|
10
|
+
"premium-pad.test.js": 1,
|
|
11
|
+
"premium-pad-test.js": 40
|
|
12
|
+
}
|
|
13
|
+
}
|