create-pmos 0.750.0 → 0.752.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 +45 -52
- package/payload/KIT-VERSION +2 -2
- 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/payload/state/log.md +1 -1
- package/workspace/changelog.json +44 -0
- package/workspace/guide/cli.md +11 -0
- package/workspace/guide/home.md +3 -1
- package/workspace/guide/settings-and-switches.md +2 -2
- package/workspace/lib/autonomy.js +2 -1
- package/workspace/lib/driver-decide.js +8 -0
- package/workspace/lib/driver-needs.js +3 -20
- package/workspace/lib/driver-run.js +16 -1
- package/workspace/lib/driver.js +23 -11
- package/workspace/lib/line-cli.js +99 -0
- package/workspace/lib/line.js +231 -0
- package/workspace/lib/never-wait.js +144 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/positioning-draft.js +5 -3
- package/workspace/lib/routes-today-log.js +6 -3
- package/workspace/lib/today-log.js +21 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-today-app.js +17 -2
- package/workspace/public/pm/cozy-today-model.js +21 -3
- package/workspace/public/pm/cozy-today-view.js +4 -2
- package/workspace/public/pm/quiet-batch.js +111 -0
- package/workspace/public/pm/quiet-rows.js +130 -0
- package/workspace/public/pm/wf-page.css +2 -0
- package/workspace/public/pm/wf-page.js +38 -8
- package/workspace/test-lists/line.json +9 -0
- package/workspace/test-lists/never-wait-on-drafts.json +9 -0
- package/workspace/test-lists/quiet-rows.json +9 -0
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
* FIRST ("!"). What the PM marked first, a verdict or a grill finding on shipped or late work (move-rank's ranks 1 and 2), and a send that
|
|
31
31
|
* goes out today. The rest follow in the rank's order. Done rows close the table. */
|
|
32
32
|
import { rowsOf as questionRows, overviewSay as questionsSay } from './open-questions-view.js'; // open-questions-today (A420): the register in the Decide tab
|
|
33
|
-
import { didLeft, notASentence, asWritten, askTitle, proofText } from './mention-one-model.js';
|
|
33
|
+
import { didLeft, notASentence, asWritten, askTitle, proofText } from './mention-one-model.js';
|
|
34
|
+
import * as QR from './quiet-rows.js'; // quiet-rows: at most 3 line rows a day per product, and one batch row for what others will see // what PMOS did on an ask, from records (round 3 point 13); the title when no sentence can be made
|
|
34
35
|
|
|
35
36
|
export const CARRY_DROP = 30; // days carried before PMOS suggests to drop it
|
|
36
37
|
export const LATE_DAYS = 14; // a row carried this long reads late (the one colour in the When column)
|
|
@@ -158,7 +159,10 @@ function typeOf(r) {
|
|
|
158
159
|
* o: { rank: { rows, wait } (rankMove), move: home-list move rows, items: my-work-premium Today rows ({ key, id, title, ini, at, due?, overdue }),
|
|
159
160
|
* drafts: [{ id, title, ini? }], review: { title } | null, own: today-log entries, marks: today-log marks, lab: [{ ws, board, id, title, why }],
|
|
160
161
|
* questions: GET /api/open-questions lines, each with its ws (open-questions-today), titleOf(ini) → the initiative's name,
|
|
161
|
-
* shipOf(ini) → its ship date 'YYYY-MM-DD' or '' (Your move: a line with no default on work that ships soon blocks it), now
|
|
162
|
+
* shipOf(ini) → its ship date 'YYYY-MM-DD' or '' (Your move: a line with no default on work that ships soon blocks it), now,
|
|
163
|
+
* fixed: GET /api/today-log fixed ({ [ws]: keys }, quiet-rows: the line rows Your move shows today per product) }
|
|
164
|
+
* quiet-rows: the drafts in the outbox are one row, Today's batch (pm/quiet-rows.js batchRow); Your move keeps at most 3 line rows a day per
|
|
165
|
+
* product (capLine), the rest wait under Later (`held`), and `toFix` is what the page writes once to the day ledger.
|
|
162
166
|
* A row: { key, src, bullet, first, title, work, ini, ws, job, when, late, carried, done, dates: 'task' | 'item' | 'mark', drop, ref }
|
|
163
167
|
*/
|
|
164
168
|
export function logModel(o = {}) {
|
|
@@ -262,6 +266,15 @@ export function logModel(o = {}) {
|
|
|
262
266
|
const ex = (rank.expired || []).length;
|
|
263
267
|
if (ex) out.push({ key: 'expired:' + today, keys: ['expired:' + today], src: 'note', bullet: 'note', type: 'Note', first: false, title: plural(ex, 'ask', 'asks') + ' expired after 14 days with no answer. PMOS wrote why in History',
|
|
264
268
|
work: '', ini: null, ws: '', job: 'Note', when: '', late: false, carried: 0, done: false, drop: false, dates: 'mark', ref: null });
|
|
269
|
+
// quiet-rows: everything other people will see is one row, Today's batch; a draft left 7 days lapses as not sent and leaves it
|
|
270
|
+
const obRows = out.filter((r) => !r.done && r.src === 'ask' && r.ref && r.ref.kind === 'outbox' && r.ref.outbox);
|
|
271
|
+
let batch = null;
|
|
272
|
+
if (obRows.length) {
|
|
273
|
+
batch = QR.batchOf(obRows.map((r) => ({ ...r.ref.outbox, ws: r.ref.outbox.ws || r.ws || '' })), today, { productOf });
|
|
274
|
+
for (const r of obRows) out.splice(out.indexOf(r), 1);
|
|
275
|
+
const bm = batch ? marks['batch:' + today] || {} : {};
|
|
276
|
+
if (batch && !bm.dropped && !(bm.until && bm.until > today)) out.push(QR.batchRow(batch, today));
|
|
277
|
+
}
|
|
265
278
|
sameJob(out, marks);
|
|
266
279
|
const open = out.filter((r) => !r.done), done = out.filter((r) => r.done);
|
|
267
280
|
const n = (j) => open.filter((r) => r.job === j).length;
|
|
@@ -271,12 +284,16 @@ export function logModel(o = {}) {
|
|
|
271
284
|
const line = [counts.decide && counts.decide + ' to decide', counts.do && counts.do + ' to do', counts.reply && counts.reply + ' to reply', counts.send && counts.send + ' to send'].filter(Boolean).join(' · ');
|
|
272
285
|
const types = {}; for (const r of open) types[r.type] = (types[r.type] || 0) + 1;
|
|
273
286
|
const G = groupLog(open, today, { shipOf: o.shipOf });
|
|
287
|
+
// quiet-rows: at most 3 line rows a day per product, fixed on the first read; the rest wait under Later and come back tomorrow
|
|
288
|
+
const C = QR.capLine(G.move, o.fixed || {});
|
|
289
|
+
for (const r of C.held) { delete r.tier; delete r.why; r.held = true; r.reason = 'Waits for tomorrow: today has 3 for its product'; }
|
|
290
|
+
if (C.held.length) { G.move = C.move; G.first = C.move.slice(0, YM_CAP); G.more = C.move.slice(YM_CAP); G.wait = C.held.concat(G.wait); }
|
|
274
291
|
// every row says why it is on Today, in a short phrase after its title (round 3 point 12); a Your move row also has its ✦ why (its place)
|
|
275
292
|
for (const r of open) if (!r.reason) { const w = whyOf(r, today); if (w) r.reason = w; }
|
|
276
293
|
for (const r of G.first) r.group = 'first'; for (const r of G.more) r.group = 'more'; for (const r of G.today) r.group = 'today'; for (const r of G.wait) r.group = 'wait';
|
|
277
294
|
for (const r of done) r.group = 'today';
|
|
278
295
|
const merged = open.reduce((k, r) => k + (r.merged ? r.merged - 1 : 0), 0);
|
|
279
|
-
return { rows: G.first.concat(G.more, G.today, done, G.wait), move: G.move, first: G.first, more: G.more, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old,
|
|
296
|
+
return { toFix: C.toFix, batch, held: C.held, rows: G.first.concat(G.more, G.today, done, G.wait), move: G.move, first: G.first, more: G.more, todayRows: G.today.concat(done), wait: G.wait, open: open.length, done: done.length, counts, types, merged, line, today, old,
|
|
280
297
|
questions: { mine: Q.mine, others: Q.others } };
|
|
281
298
|
}
|
|
282
299
|
/** ONE THING, ONE LINE (Wawan's live Today, 2026-11-19): the lines of one brief item or one Jira ticket (srcOf) are one line, with every key
|
|
@@ -412,6 +429,7 @@ function lateDays(r, today) {
|
|
|
412
429
|
export function costOf(r, today, shipOf = () => '') {
|
|
413
430
|
if (!r || r.done || r.drop || r.looks || r.bullet !== 'task' || r.src === 'gone' || r.src === 'note' || r.src === 'lab') return null;
|
|
414
431
|
if (r.type === 'Ask' && !(r.who && r.who.length)) return null; // nobody waits on the answer
|
|
432
|
+
if (r.src === 'batch') return [2, r.left == null ? QR.LAPSE_DAYS : r.left, r.why]; // quiet-rows: Today's batch, a send today, soonest lapse first
|
|
415
433
|
const ref = r.ref || {}, c = ref.call || null, ld = lateDays(r, today);
|
|
416
434
|
const waits = r.src === 'ask' || r.src === 'question' || r.src === 'draft' || r.src === 'review' || (r.src === 'own' && r.first) || ld > 0;
|
|
417
435
|
if (!waits) return null;
|
|
@@ -125,7 +125,7 @@ function moveAct(r) {
|
|
|
125
125
|
export function moveRowHtml(r, n, o = {}) {
|
|
126
126
|
const [kd, kl] = kindOf(r);
|
|
127
127
|
const late = lateOf(r), age = ageOf(r);
|
|
128
|
-
const meta = [r.work || '', r.src === 'question' ? '' : KIND_WORD[r.type] || '', !late && r.tier !== 3 && age ? plural(age, 'day', 'days') : ''].filter(Boolean).join(' · ');
|
|
128
|
+
const meta = [r.work || '', r.src === 'question' || r.src === 'batch' ? '' : KIND_WORD[r.type] || '', !late && r.tier !== 3 && age ? plural(age, 'day', 'days') : ''].filter(Boolean).join(' · ');
|
|
129
129
|
// what the PM typed opens nothing: its words are the whole of it
|
|
130
130
|
const title = r.src === 'own' ? `<span class="t td-t">${esc(r.title)}</span>`
|
|
131
131
|
: `<button type="button" class="t td-t" data-td="open" data-key="${esc(r.key)}"${r.members ? ` aria-expanded="${!!o.sopen}"` : ''}>${esc(r.title)}${r.members ? ic(I.more, 14) : ''}</button>`;
|
|
@@ -143,7 +143,9 @@ export function moveHtml(rows, o = {}) {
|
|
|
143
143
|
if (!rows || !rows.length) return '';
|
|
144
144
|
const so = new Set(o.sopen || []), shown = rows.slice(0, YM_SHOW), rest = rows.slice(YM_SHOW);
|
|
145
145
|
const n = rest.length ? shown.length + ' of ' + rows.length : String(rows.length);
|
|
146
|
-
|
|
146
|
+
// quiet-rows (board QuietToday): at most 3 line rows a day per product, plus one batch for what others will see
|
|
147
|
+
const quiet = rows.some((r) => r.src === 'batch') ? ' · at most 3 per product, plus one batch' : ' · at most 3 per product';
|
|
148
|
+
let h = `<div class="td-gr pm-group now ym-g">${ic(I.sun, 14)}Your move <span class="td-n">${esc(n + quiet)}</span></div>`
|
|
147
149
|
+ `<div class="rows">${shown.map((r, i) => moveRowHtml(r, i + 1, { sopen: so.has(r.key) })).join('')}`;
|
|
148
150
|
if (rest.length && o.ymOpen) h += rest.map((r, i) => moveRowHtml(r, YM_SHOW + i + 1, { sopen: so.has(r.key) })).join('');
|
|
149
151
|
h += '</div>';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/* pm/quiet-batch.js — Today's batch, the popup (initiative quiet-rows; boards QuietBatch and QuietPhone on the main canvas, In development).
|
|
2
|
+
*
|
|
3
|
+
* batchHtml(B, o) PURE → the desk popup's body: one line on what the batch is, PMOS's Suggestion to approve all, then the drafts
|
|
4
|
+
* grouped by kind (pm-group), each a ListRow (pm-li) that names who will see it, with Change it first (✎), Skip (✕)
|
|
5
|
+
* and Approve (✓). o: { tried: { [id]: reason } } (an approve that could not send says why under the row)
|
|
6
|
+
* phoneBatchHtml(B, i, o) PURE → the phone: one draft at a time, its full text first, then ✎ ✕ ✓; swipe right approves, swipe left skips.
|
|
7
|
+
* No Approve all on a phone.
|
|
8
|
+
* openBatch(B, H) opens the popup full size, with Back (the Viewer's trail; panel rule). H: { pmPost, toast, toastUndo, reload,
|
|
9
|
+
* isPhone, noteUse, onSwipe(root, act) }
|
|
10
|
+
*
|
|
11
|
+
* NOTHING IS SENT WITHOUT A PRESS. Approve is the outbox's own confirm (POST /api/outbox/confirm with the draft's hash): the trust rules and
|
|
12
|
+
* the PM-only press stay where they are. With no channel connected the draft stays in the batch and the row says so. Skip is the outbox's
|
|
13
|
+
* discard (POST /api/outbox/discard), with Undo. Change it first opens the draft itself (pm/outbox-view.js), and Back comes back here.
|
|
14
|
+
* B: pm/quiet-rows.js batchOf(). Text from records goes through esc(). The UI says PMOS. */
|
|
15
|
+
import { dayWord } from './quiet-rows.js';
|
|
16
|
+
|
|
17
|
+
const esc = (s) => String(s == null ? '' : s).replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
18
|
+
const ic = (d, w = 16, cls = '') => `<svg class="pm-ic${cls ? ' ' + cls : ''}" aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24"><path d="${d}"/></svg>`;
|
|
19
|
+
const I = { yes: 'M5 12.5l4.5 4.5L19 7.5', no: 'M6 6l12 12M18 6L6 18', pen: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4',
|
|
20
|
+
spark: 'M12 3l1.8 5.4L19 10.2l-5.2 1.8L12 17.4l-1.8-5.4L5 10.2l5.2-1.8z', send: 'M4 12l16-8-6 16-3-7z' };
|
|
21
|
+
const btn = (act, label, d, id, v = '') => `<button type="button" class="pm-btn${v ? ' ' + v : ''}" data-qb="${act}" data-id="${esc(id)}" aria-label="${esc(label)}" title="${esc(label)}">${ic(d)}</button>`;
|
|
22
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
23
|
+
|
|
24
|
+
/** What an approve that could not send says, in words a person reads. */
|
|
25
|
+
export function triedWord(reason) {
|
|
26
|
+
if (!reason) return '';
|
|
27
|
+
if (/no channel/i.test(reason)) return 'Not sent: no channel is connected for it yet. It stays here until one is.';
|
|
28
|
+
if (/claim/i.test(reason)) return 'Not sent: a claim in it needs a look. Change it first.';
|
|
29
|
+
if (/hash/i.test(reason)) return 'Not sent: the draft changed. Read it again, then approve.';
|
|
30
|
+
return 'Not sent: ' + reason;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function rowHtml(x, o = {}) {
|
|
34
|
+
const tried = (o.tried || {})[x.id];
|
|
35
|
+
const meta = [x.product, x.blocked ? 'a claim needs a look' : ''].filter(Boolean).join(' · ');
|
|
36
|
+
return `<div class="pm-li qb-r" data-id="${esc(x.id)}"><span class="txt"><span class="t">${esc(x.title)}</span>`
|
|
37
|
+
+ (meta ? `<span class="w">${esc(meta)}</span>` : '') + `<span class="w qb-sees">${esc(x.sees)}</span>`
|
|
38
|
+
+ (tried ? `<span class="w qb-tried" role="status">${esc(triedWord(tried))}</span>` : '') + '</span>'
|
|
39
|
+
+ `<span class="acts">${btn('edit', 'Change it first: ' + x.title, I.pen, x.id)}${btn('skip', 'Skip: ' + x.title, I.no, x.id, 'outline')}${btn('yes', 'Approve: ' + x.title, I.yes, x.id, 'primary')}</span></div>`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** The desk popup's body. '' when the batch is empty (zero is silence: the row is gone too). PURE. */
|
|
43
|
+
export function batchHtml(B, o = {}) {
|
|
44
|
+
if (!B || !B.items || !B.items.length) return '';
|
|
45
|
+
const head = `<p class="qb-say">${esc(plural(B.n, 'thing', 'things') + ' other people will see. PMOS drafted each one; nothing leaves until you approve it.')}`
|
|
46
|
+
+ (B.lapse ? ` ${esc('Left alone, a draft lapses as not sent on ' + dayWord(B.lapse) + '.')}` : '') + '</p>';
|
|
47
|
+
const all = B.n > 1 ? `<div class="pm-sug" role="group" aria-label="PMOS suggests">${ic(I.spark, 16, 'pm-star')}<span class="say">${esc('Approve and send all ' + B.n + ': each says who will see it.')}</span>`
|
|
48
|
+
+ `<button type="button" class="pm-btn primary" data-qb="all" aria-label="${esc('Approve and send all ' + B.n)}" title="${esc('Approve and send all ' + B.n)}">${ic(I.send)}</button></div>` : '';
|
|
49
|
+
const groups = B.groups.map((g) => `<div class="pm-group">${esc(g.title)} <span class="pm-meta">${esc(g.items.length)}</span></div><div class="rows">${g.items.map((x) => rowHtml(x, o)).join('')}</div>`).join('');
|
|
50
|
+
return `<section class="pm-block list qb" aria-label="Today’s batch">${head}${all}${groups}</section>`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The phone: one draft at a time, its full text first. i: which one (0 to n-1). PURE. */
|
|
54
|
+
export function phoneBatchHtml(B, i = 0, o = {}) {
|
|
55
|
+
if (!B || !B.items || !B.items.length) return '';
|
|
56
|
+
const k = Math.max(0, Math.min(B.items.length - 1, i | 0)), x = B.items[k], tried = (o.tried || {})[x.id];
|
|
57
|
+
return `<section class="qb qb-ph" aria-label="Today’s batch"><p class="pm-meta">${esc((k + 1) + ' of ' + B.n + ' · ' + (B.groups.find((g) => g.items.includes(x)) || { title: '' }).title)}</p>`
|
|
58
|
+
+ `<article class="qb-one" data-id="${esc(x.id)}" data-sw-right="yes" data-sw-left="skip" aria-describedby="qbHint"><h3 class="pm-h-sm">${esc(x.title)}</h3>`
|
|
59
|
+
+ `<p class="qb-body">${esc(x.body).replace(/\n/g, '<br>')}</p><p class="pm-meta">${esc(x.sees)}${x.product ? ' · ' + esc(x.product) : ''}</p>`
|
|
60
|
+
+ (tried ? `<p class="qb-tried" role="status">${esc(triedWord(tried))}</p>` : '') + '</article>'
|
|
61
|
+
+ `<p class="pm-meta" id="qbHint">Swipe right to approve, left to skip.</p>`
|
|
62
|
+
+ `<div class="qb-acts">${btn('edit', 'Change it first: ' + x.title, I.pen, x.id)}${btn('skip', 'Skip: ' + x.title, I.no, x.id, 'outline')}${btn('yes', 'Approve: ' + x.title, I.yes, x.id, 'primary')}</div></section>`;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const S = { B: null, H: null, tried: {}, gone: new Set(), i: 0, body: null };
|
|
66
|
+
const left = () => (S.B ? { ...S.B, items: S.B.items.filter((x) => !S.gone.has(x.id)), groups: S.B.groups.map((g) => ({ ...g, items: g.items.filter((x) => !S.gone.has(x.id)) })).filter((g) => g.items.length), n: S.B.items.filter((x) => !S.gone.has(x.id)).length } : null);
|
|
67
|
+
function draw() {
|
|
68
|
+
if (!S.body) return;
|
|
69
|
+
const B = left();
|
|
70
|
+
if (!B || !B.n) { S.body.innerHTML = '<p class="pm-meta">Nothing left to send today.</p>'; return; }
|
|
71
|
+
S.body.innerHTML = S.H.isPhone && S.H.isPhone() ? phoneBatchHtml(B, S.i, { tried: S.tried }) : batchHtml(B, { tried: S.tried });
|
|
72
|
+
}
|
|
73
|
+
async function approve(x) {
|
|
74
|
+
const r = await S.H.pmPost('/api/outbox/confirm', { id: x.id, hash: x.hash }).catch(() => null);
|
|
75
|
+
if (r && r.ok) { S.gone.add(x.id); return true; }
|
|
76
|
+
S.tried[x.id] = (r && (r.reason || r.error)) || 'it could not be sent';
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
async function press(act, id) {
|
|
80
|
+
const H = S.H, B = left(); if (!B) return;
|
|
81
|
+
if (H.noteUse) H.noteUse('qr-batch');
|
|
82
|
+
console.info('[quiet-rows] batch ' + act + ' n=' + B.n);
|
|
83
|
+
const x = B.items.find((y) => y.id === id);
|
|
84
|
+
if (act === 'all') {
|
|
85
|
+
let sent = 0; for (const y of B.items) if (await approve(y)) sent++;
|
|
86
|
+
H.toast(sent ? 'Sent ' + plural(sent, 'draft', 'drafts') + '.' + (sent < B.n ? ' The rest say why under them.' : '') : 'Nothing was sent. Each draft says why.');
|
|
87
|
+
draw(); if (sent && H.reload) H.reload(); return;
|
|
88
|
+
}
|
|
89
|
+
if (!x) return;
|
|
90
|
+
if (act === 'edit') { const VW = window.czViewer; if (VW) VW.drill(); import('./outbox-view.js').then((O) => O.openDraft(x.e, { pmPost: H.pmPost, toast: H.toast, toastUndo: H.toastUndo, reload: H.reload })).catch(() => {}); return; }
|
|
91
|
+
if (act === 'yes') { const ok = await approve(x); if (!ok && H.isPhone && H.isPhone()) S.i++; H.toast(ok ? 'Sent: ' + x.title + '.' : triedWord(S.tried[x.id])); draw(); if (ok && H.reload) H.reload(); return; }
|
|
92
|
+
if (act === 'skip') {
|
|
93
|
+
const r = await H.pmPost('/api/outbox/discard', { id: x.id }).catch(() => null);
|
|
94
|
+
if (!r || r.ok === false) { H.toast((r && r.error) || 'It could not be skipped.'); return; }
|
|
95
|
+
S.gone.add(x.id); draw();
|
|
96
|
+
H.toastUndo('Skipped: ' + x.title + '. It is not sent.', async () => { const u = await H.pmPost('/api/outbox/discard', { id: x.id, undo: true }).catch(() => null); S.gone.delete(x.id); draw(); if (H.reload) H.reload(); return u || { ok: false }; });
|
|
97
|
+
if (H.reload) H.reload();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** Open Today's batch full size, with Back. */
|
|
101
|
+
export function openBatch(B, H) {
|
|
102
|
+
const VW = window.czViewer; if (!VW || !B || !B.n) return;
|
|
103
|
+
S.B = B; S.H = H; S.tried = {}; S.gone = new Set(); S.i = 0;
|
|
104
|
+
VW.open({ id: 'qb:batch', kind: 'Today’s batch', title: 'Today’s batch', sub: plural(B.n, 'thing', 'things') + ' other people will see', icon: I.send, full: true, presses: [],
|
|
105
|
+
render: (body) => {
|
|
106
|
+
S.body = body; draw();
|
|
107
|
+
body.onclick = (e) => { const b = e.target.closest('[data-qb]'); if (b && body.contains(b)) press(b.dataset.qb, b.dataset.id || ''); };
|
|
108
|
+
if (H.onSwipe) H.onSwipe(body, (row, way) => press(way === 'right' ? 'yes' : 'skip', row.dataset.id || ''));
|
|
109
|
+
},
|
|
110
|
+
onClose: () => { S.body = null; } });
|
|
111
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/* pm/quiet-rows.js — quiet rows on Today (initiative quiet-rows, product line slice 4; boards QuietToday, QuietBatch and QuietPhone on the
|
|
2
|
+
* main canvas, In development; brief /mnt/project-files/design-system/quiet-rows/brief.md). Pure: Node imports it (quiet-rows.test.js).
|
|
3
|
+
*
|
|
4
|
+
* isLineRow(r) → true for a row a product's records raise (the product line): an open question, a check, a grill
|
|
5
|
+
* finding, a meeting's date change, a key result, what PMOS proposes on an initiative
|
|
6
|
+
* capLine(move, fixed, { cap }) → { move, held, toFix } Your move with at most `cap` line rows a day per product
|
|
7
|
+
* batchOf(entries, today) → { items, groups, n, lapsed, lapse, products, sum } | null Today's batch (null: zero is silence)
|
|
8
|
+
* batchRow(B, today) → the one Your move row for the batch
|
|
9
|
+
* KINDS · kindOf(e) · whoSees(e) · lapseDay(e)
|
|
10
|
+
*
|
|
11
|
+
* THE CAP. Your move takes at most LINE_CAP line rows a day per product. The rows are fixed for the day on the first read that has rows: the
|
|
12
|
+
* page writes the keys once (POST /api/today-log/fix, the day ledger in lib/today-log.js) and every later read that day shows only those.
|
|
13
|
+
* A row that is done leaves; nothing refills it until the next day. A new ship-date blocker (tier 1) takes the place of the product's lowest
|
|
14
|
+
* row that is not a blocker; it never adds a row past the cap. The rows over the cap are `held`: they wait under Later and come back
|
|
15
|
+
* tomorrow. A row that is not a line row (a person who waits on a reply, the PM's own task, a draft, a session) is never capped.
|
|
16
|
+
* THE BATCH. Everything other people will see is a draft in the outbox (lib/outbox-store.js): one row, "Today's batch: n to send", across
|
|
17
|
+
* every product. Nothing leaves without the PM's press on the outbox's own confirm. A draft left LAPSE_DAYS days lapses as not sent: it
|
|
18
|
+
* leaves the batch, and the weekly digest says so. A nudge (e.about, a Waiting on others row) is not in the batch. */
|
|
19
|
+
|
|
20
|
+
export const LINE_CAP = 3;
|
|
21
|
+
export const LAPSE_DAYS = 7;
|
|
22
|
+
const DAY = 864e5;
|
|
23
|
+
const MON = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
24
|
+
const DOW = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
25
|
+
const DAY_RE = /^(\d{4})-(\d{2})-(\d{2})/;
|
|
26
|
+
const plural = (n, a, b) => n + ' ' + (n === 1 ? a : b);
|
|
27
|
+
const dayKey = (ms) => { const d = new Date(ms); return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0') + '-' + String(d.getDate()).padStart(2, '0'); };
|
|
28
|
+
const dayMs = (k) => { const m = DAY_RE.exec(String(k || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]).getTime() : null; };
|
|
29
|
+
const addDays = (k, n) => { const t = dayMs(k); return t == null ? '' : dayKey(new Date(t).setDate(new Date(t).getDate() + n)); };
|
|
30
|
+
/** "Mon 30 Nov" */
|
|
31
|
+
export const dayWord = (k) => { const t = dayMs(k); if (t == null) return ''; const d = new Date(t); return DOW[d.getDay()] + ' ' + d.getDate() + ' ' + MON[d.getMonth()]; };
|
|
32
|
+
|
|
33
|
+
/** The ✦ kinds a product's records raise on Your move (pm/move-rank.js ranks 1 to 6). */
|
|
34
|
+
const LINE_KINDS = new Set(['verdict', 'grill', 'meeting', 'ahead', 'kr', 'other']);
|
|
35
|
+
/** A row of the product line: an open question, or an ask whose kind a product's records raise. */
|
|
36
|
+
export function isLineRow(r) {
|
|
37
|
+
if (!r || r.src === 'batch') return false;
|
|
38
|
+
if (r.src === 'question') return true;
|
|
39
|
+
return r.src === 'ask' && LINE_KINDS.has(String((r.ref && r.ref.kind) || ''));
|
|
40
|
+
}
|
|
41
|
+
/** The product a line row is on ('' for the one workspace). */
|
|
42
|
+
export const productOf = (r) => String((r && (r.ws || (r.ref && r.ref.ws))) || '');
|
|
43
|
+
|
|
44
|
+
/** Your move with at most `cap` line rows a day per product. move: yourMove's ranked rows (each with r.tier). fixed: { [ws]: keys } of
|
|
45
|
+
* today (GET /api/today-log fixed). → { move: the rows that show, in the same order; held: the line rows over the cap, in rank order;
|
|
46
|
+
* toFix: { [ws]: keys } the page writes once (POST /api/today-log/fix), or null when the ledger already says it }. PURE. */
|
|
47
|
+
export function capLine(move, fixed = {}, o = {}) {
|
|
48
|
+
const cap = o.cap || LINE_CAP, F = fixed || {};
|
|
49
|
+
const by = new Map();
|
|
50
|
+
for (const r of move || []) if (isLineRow(r)) { const w = productOf(r); if (!by.has(w)) by.set(w, []); by.get(w).push(r); }
|
|
51
|
+
const out = new Set(), toFix = {};
|
|
52
|
+
for (const [w, rows] of by) {
|
|
53
|
+
const f = Array.isArray(F[w]) ? F[w].map(String) : null;
|
|
54
|
+
if (!f) { for (const r of rows.slice(cap)) out.add(r); toFix[w] = rows.slice(0, cap).map((r) => r.key); continue; }
|
|
55
|
+
const keys = f.slice(0, cap), on = new Set(keys);
|
|
56
|
+
let shown = rows.filter((r) => on.has(r.key)), changed = false;
|
|
57
|
+
// a new ship-date blocker: a free slot (never used today), else the place of the lowest row that is not a blocker; never a fourth
|
|
58
|
+
for (const b of rows.filter((r) => r.tier === 1 && !on.has(r.key))) {
|
|
59
|
+
if (keys.length < cap) { keys.push(b.key); on.add(b.key); shown.push(b); changed = true; continue; }
|
|
60
|
+
const low = shown.filter((r) => r.tier !== 1).pop();
|
|
61
|
+
if (!low) break;
|
|
62
|
+
keys[keys.indexOf(low.key)] = b.key; on.delete(low.key); on.add(b.key);
|
|
63
|
+
shown = shown.filter((r) => r !== low).concat(b); changed = true;
|
|
64
|
+
}
|
|
65
|
+
for (const r of rows) if (!on.has(r.key)) out.add(r);
|
|
66
|
+
if (changed) toFix[w] = keys;
|
|
67
|
+
}
|
|
68
|
+
const kept = (move || []).filter((r) => !out.has(r));
|
|
69
|
+
return { move: kept, held: (move || []).filter((r) => out.has(r)), toFix: Object.keys(toFix).length ? toFix : null };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* ── Today's batch ── */
|
|
73
|
+
/** The kinds of the batch, in the popup's order, with the words for one and for many. */
|
|
74
|
+
export const KINDS = [
|
|
75
|
+
['review', 'Review', 'review request', 'review requests'],
|
|
76
|
+
['jira', 'Jira', 'Jira ticket', 'Jira tickets'],
|
|
77
|
+
['followup', 'Follow-up', 'follow-up', 'follow-ups'],
|
|
78
|
+
['message', 'Message', 'message', 'messages'],
|
|
79
|
+
['calendar', 'Calendar', 'calendar hold', 'calendar holds'],
|
|
80
|
+
['close', 'Closing an ask', 'closed ask', 'closed asks'],
|
|
81
|
+
];
|
|
82
|
+
const CHANNEL_KIND = { 'jira-write': 'jira', 'team-note': 'followup', 'customer-note': 'message', 'calendar-hold': 'calendar' };
|
|
83
|
+
/** The kind of one draft: its own `kind` when it names one, else its channel's. */
|
|
84
|
+
export function kindOf(e) {
|
|
85
|
+
const k = String((e && e.kind) || '');
|
|
86
|
+
if (KINDS.some(([id]) => id === k)) return k;
|
|
87
|
+
return CHANNEL_KIND[String((e && e.channel) || '')] || 'message';
|
|
88
|
+
}
|
|
89
|
+
/** Who will see one draft, said once. */
|
|
90
|
+
export function whoSees(e) {
|
|
91
|
+
const to = String((e && e.recipient) || '').trim();
|
|
92
|
+
switch (kindOf(e)) {
|
|
93
|
+
case 'jira': return to ? 'The ' + to + ' board sees it' : 'The Jira board sees it';
|
|
94
|
+
case 'calendar': return to ? to + ' sees it, on the calendar' : 'Everyone invited sees it';
|
|
95
|
+
case 'close': return to ? to + ', who asked, sees the reason' : 'Who asked sees the reason';
|
|
96
|
+
default: return to ? to + ' sees it' : 'Who you send it to sees it';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/** The day one draft lapses as not sent: LAPSE_DAYS after the day it was made. '' when it says no day. */
|
|
100
|
+
export function lapseDay(e) {
|
|
101
|
+
const t = Date.parse(String((e && (e.created_at || e.at)) || ''));
|
|
102
|
+
return Number.isFinite(t) ? addDays(dayKey(t), LAPSE_DAYS) : '';
|
|
103
|
+
}
|
|
104
|
+
/** Today's batch. entries: the outbox drafts (GET /api/outbox, or the rank's outbox rows' entries). → null when nothing waits (zero is
|
|
105
|
+
* silence). items: [{ id, kind, title, to, sees, body, product, lapse, blocked, e }], groups: [{ kind, title, items }] in KINDS order,
|
|
106
|
+
* n, lapsed: the drafts that lapsed as not sent, lapse: the soonest lapse day, products: their names, sum: "2 Jira tickets, 1 follow-up". */
|
|
107
|
+
export function batchOf(entries, today, o = {}) {
|
|
108
|
+
const nameOf = typeof o.productOf === 'function' ? o.productOf : (w) => w;
|
|
109
|
+
const items = [], lapsed = [];
|
|
110
|
+
for (const e of entries || []) {
|
|
111
|
+
if (!e || !e.id || e.about || (e.state && e.state !== 'queued' && e.state !== 'blocked')) continue;
|
|
112
|
+
const lapse = lapseDay(e);
|
|
113
|
+
const it = { id: String(e.id), key: 'ob:' + e.id, kind: kindOf(e), title: String(e.subject || String(e.body || '').split('\n')[0] || 'A draft').slice(0, 140),
|
|
114
|
+
to: String(e.recipient || ''), sees: whoSees(e), body: String(e.body || ''), product: e.ws ? nameOf(e.ws) || '' : '', lapse, blocked: e.state === 'blocked', hash: e.hash || '', e };
|
|
115
|
+
if (lapse && today && lapse <= today) lapsed.push(it); else items.push(it);
|
|
116
|
+
}
|
|
117
|
+
if (!items.length) return null;
|
|
118
|
+
const groups = KINDS.map(([kind, title]) => ({ kind, title, items: items.filter((x) => x.kind === kind) })).filter((g) => g.items.length);
|
|
119
|
+
const sum = KINDS.map(([kind, , one, many]) => { const n = items.filter((x) => x.kind === kind).length; return n ? plural(n, one, many) : ''; }).filter(Boolean).join(', ');
|
|
120
|
+
const lapse = items.map((x) => x.lapse).filter(Boolean).sort()[0] || '';
|
|
121
|
+
const products = [...new Set(items.map((x) => x.product).filter(Boolean))];
|
|
122
|
+
return { items, groups, n: items.length, lapsed, lapse, products, sum };
|
|
123
|
+
}
|
|
124
|
+
/** The one Your move row for the batch: job Send, tier 2 (a send today), ranked by its soonest lapse. */
|
|
125
|
+
export function batchRow(B, today) {
|
|
126
|
+
const left = B.lapse && today ? Math.round((dayMs(B.lapse) - dayMs(today)) / DAY) : LAPSE_DAYS;
|
|
127
|
+
return { key: 'batch:' + today, keys: B.items.map((x) => x.key), src: 'batch', bullet: 'task', type: 'Report', first: false, title: 'Today’s batch: ' + B.n + ' to send',
|
|
128
|
+
work: [B.products.join(', '), B.sum].filter(Boolean).join(' · '), ini: null, ws: '', job: 'Send', when: '', late: false, carried: 0, done: false, drop: false, dates: 'mark',
|
|
129
|
+
tier: 2, left, why: 'Nothing leaves until you approve' + (B.lapse ? '; left alone it lapses as not sent on ' + dayWord(B.lapse) : ''), batch: B, ref: { kind: 'batch' } };
|
|
130
|
+
}
|
|
@@ -29,6 +29,8 @@ body.cz-vw-over .wf-in .wf-vw .cz-vw { box-shadow: var(--cz-vlift); }
|
|
|
29
29
|
|
|
30
30
|
/* ── the list ── */
|
|
31
31
|
.wf-list { gap: 2px; overflow: auto; }
|
|
32
|
+
.wf-ws { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-8) 10px 0; }
|
|
33
|
+
.wf-ws select { font: inherit; padding: var(--space-4) var(--space-8); border: 1px solid var(--cz-hair); border-radius: var(--radius-md); background: var(--cz-card); color: var(--cz-ink); }
|
|
32
34
|
.wf-list .lhead { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) 6px 10px 10px; }
|
|
33
35
|
.wf-list h2 { margin: 0; font-size: var(--fs-section); font-weight: var(--fw-strong); line-height: var(--lh-section); }
|
|
34
36
|
.wf-page .ib { width: 36px; height: 36px; border-radius: 12px; display: inline-grid; place-items: center; border: 0; background: none; color: var(--cz-ink2); cursor: pointer; padding: 0; flex: none; }
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Reads GET /api/workflows and GET /api/workflows/draft. Every write is the PM's press: POST /api/workflows/save | copy | archive | draft.
|
|
17
17
|
* Product feature ships with PMOS and is read-only here: Copy makes an editable one. */
|
|
18
18
|
import { pmGet, pmPost } from './http.js';
|
|
19
|
-
import { esc, svg, ICON, wsParam
|
|
19
|
+
import { esc, svg, ICON, wsParam } from './cozy-evui.js';
|
|
20
20
|
import * as VW from './cozy-viewer.js';
|
|
21
21
|
import { CATS, wfIcon, PRODUCT_FEATURE_ID } from './wf-model.js';
|
|
22
22
|
import * as E from './wf-edit.js';
|
|
@@ -24,7 +24,13 @@ import { openStage, setStageHost } from './wf-stage.js';
|
|
|
24
24
|
import { mapOf } from './ini-wf-model.js'; // the bridge: where each stage of the workflow it replaces lands (batch 20 item 3)
|
|
25
25
|
|
|
26
26
|
const $ = (s) => document.querySelector(s);
|
|
27
|
-
|
|
27
|
+
/* THE WORKSPACE THIS PAGE SHOWS. Each workspace keeps its own library (its pmos/state/workflows.jsonl), so the page says which one it shows
|
|
28
|
+
* and lets the PM pick another (bug 2026-11-24: Settings opened the server's home, a demo repository, and the PM's own workflows in IDPF
|
|
29
|
+
* looked lost). ?ws= wins, then the PM's last pick, then the server's own. */
|
|
30
|
+
const WS_KEY = 'pmos.wf.ws';
|
|
31
|
+
const wsNow = () => wsParam() || store.get(WS_KEY) || '';
|
|
32
|
+
const wsQs = () => (wsNow() ? '?ws=' + encodeURIComponent(wsNow()) : '');
|
|
33
|
+
const post = (path, body) => pmPost(path, wsNow() ? { ws: wsNow(), ...body } : body);
|
|
28
34
|
const PHONE = 760;
|
|
29
35
|
const isPhone = () => innerWidth <= PHONE;
|
|
30
36
|
const CHAT_KEY = 'pmos.wf.chat';
|
|
@@ -32,7 +38,7 @@ const store = { get(k) { try { return localStorage.getItem(k); } catch { return
|
|
|
32
38
|
const DRAG = 'M9 6h.01M15 6h.01M9 12h.01M15 12h.01M9 18h.01M15 18h.01', PLUS = 'M12 5v14M5 12h14', BRANCH = ICON.branch, OK = 'M5 12.5l4.5 4.5L19 7.5';
|
|
33
39
|
|
|
34
40
|
/* S.list: [wf + { count }] | null while reading; S.sel: the picked id, 'new' for New workflow; S.edit: a draft opened by hand (not saved yet) */
|
|
35
|
-
const S = { list: null, sel: null, draft: null, edit: null, err: '', msg: '', renaming: false, renErr: '', busy: false, pop: null, poll: 0, phoneOpen: false, want: null };
|
|
41
|
+
const S = { wss: null, list: null, sel: null, draft: null, edit: null, err: '', msg: '', renaming: false, renErr: '', busy: false, pop: null, poll: 0, phoneOpen: false, want: null };
|
|
36
42
|
const wfOf = (id) => (S.edit && id === S.edit.id ? S.edit : (S.list || []).find((w) => w.id === id) || null);
|
|
37
43
|
const cur = () => (S.sel && S.sel !== 'new' ? wfOf(S.sel) : null);
|
|
38
44
|
/** A New workflow chat is still going (its key is kept until Create), or PMOS has drafted one. */
|
|
@@ -49,7 +55,7 @@ function toast(text, undo) {
|
|
|
49
55
|
|
|
50
56
|
/* ── reading ── */
|
|
51
57
|
async function load() {
|
|
52
|
-
const r = await pmGet('/api/workflows' +
|
|
58
|
+
const r = await pmGet('/api/workflows' + wsQs());
|
|
53
59
|
if (r && r.ok && Array.isArray(r.workflows)) { S.list = r.workflows; S.err = ''; }
|
|
54
60
|
else { S.list = S.list || []; S.err = (r && r.error) || 'The workflows could not be read.'; }
|
|
55
61
|
// mount(host, { wf, stage }) or the address (?wf=, ?stage=): that workflow is picked, and that stage opens once, on the first read
|
|
@@ -61,7 +67,7 @@ async function load() {
|
|
|
61
67
|
if (W.stage && S.sel === want) openKey(W.stage); // the Board's "Add an exit step" (XipB)
|
|
62
68
|
}
|
|
63
69
|
async function readDraft() {
|
|
64
|
-
const r = await pmGet('/api/workflows/draft' +
|
|
70
|
+
const r = await pmGet('/api/workflows/draft' + wsQs());
|
|
65
71
|
const d = r && r.ok && r.draft ? r.draft.draft || null : null; // { draft, note, at } | null
|
|
66
72
|
const was = JSON.stringify(S.draft), now = JSON.stringify(d);
|
|
67
73
|
S.draft = d;
|
|
@@ -89,13 +95,35 @@ function drawList() {
|
|
|
89
95
|
// a live draft keeps its row while another workflow is open, so its chat and draft are one press away (batch 24 item 4)
|
|
90
96
|
const onNew = S.sel === 'new';
|
|
91
97
|
const newRow = onNew || draftLive() ? `<button type="button" class="wfl${onNew ? ' sel' : ''}" data-wf="new"${onNew ? ' aria-current="true"' : ''}><span class="wfi new" aria-hidden="true">${svg(PLUS, 14)}</span><span class="t">${esc((S.draft && S.draft.name) || 'New workflow')}</span><span class="n">draft</span></button>` : '';
|
|
92
|
-
el.innerHTML = `<div class="lhead"><h2>Workflows</h2><button type="button" class="ib sm" data-wf-new aria-label="New workflow: describe it and PMOS drafts it" title="New workflow: describe it and PMOS drafts it">${svg(PLUS, 16)}</button></div>`
|
|
98
|
+
el.innerHTML = wsPick() + `<div class="lhead"><h2>Workflows</h2><button type="button" class="ib sm" data-wf-new aria-label="New workflow: describe it and PMOS drafts it" title="New workflow: describe it and PMOS drafts it">${svg(PLUS, 16)}</button></div>`
|
|
93
99
|
+ (L === null ? '<p class="wf-mut wf-small wf-pad">Reading the workflows.</p>' : on.map(rowHtml).join('') + newRow
|
|
94
100
|
+ (off.length ? `<p class="wf-sub">Archived</p>${off.map(rowHtml).join('')}` : '')
|
|
95
101
|
// + describes it to Claude in the chat; these two start one without a conversation (WfANew's "start blank or from a copy")
|
|
96
102
|
+ '<p class="wf-hint wf-small wf-mut">Or start one <button type="button" class="wf-link" data-wf-blank>blank</button> or <button type="button" class="wf-link" data-wf-fromcopy aria-haspopup="menu">from a copy</button>.</p>');
|
|
97
103
|
}
|
|
98
104
|
|
|
105
|
+
/** The workspace picker over the list, when PMOS works in more than one: the library shown is that workspace's. */
|
|
106
|
+
function wsPick() {
|
|
107
|
+
const L = (S.wss || []).filter((w) => w && w.id && !w.linked);
|
|
108
|
+
if (L.length < 2) return '';
|
|
109
|
+
const now = wsNow() || (L.find((w) => w.home) || {}).id || '';
|
|
110
|
+
return `<label class="wf-ws wf-small"><span class="wf-mut">Workspace</span><select data-wf-ws aria-label="Workspace whose workflows show">`
|
|
111
|
+
+ L.map((w) => `<option value="${esc(w.id)}"${w.id === now ? ' selected' : ''}>${esc(w.label || w.name || w.id)}</option>`).join('') + '</select></label>';
|
|
112
|
+
}
|
|
113
|
+
async function readWorkspaces() {
|
|
114
|
+
const r = await pmGet('/api/workspaces').catch(() => null);
|
|
115
|
+
S.wss = r && Array.isArray(r.workspaces) ? r.workspaces : [];
|
|
116
|
+
// a remembered pick that is no longer a workspace falls back to the server's own
|
|
117
|
+
if (!wsParam() && store.get(WS_KEY) && !S.wss.some((w) => w.id === store.get(WS_KEY))) store.set(WS_KEY, '');
|
|
118
|
+
drawList();
|
|
119
|
+
}
|
|
120
|
+
function pickWs(id) {
|
|
121
|
+
if (wsParam() || id === wsNow()) return;
|
|
122
|
+
store.set(WS_KEY, id);
|
|
123
|
+
VW.close(); S.sel = null; S.list = null; S.draft = null; S.edit = null; S.msg = ''; S.err = '';
|
|
124
|
+
draw(); load(); readDraft();
|
|
125
|
+
}
|
|
126
|
+
|
|
99
127
|
/* ── the picked workflow (WfAModel) ── */
|
|
100
128
|
function cardHtml(wf, s, ro) {
|
|
101
129
|
const n = E.numOf(wf, s.key), mode = (s.when && s.when.mode) || 'always';
|
|
@@ -287,7 +315,7 @@ export function newWorkflowTopic() {
|
|
|
287
315
|
if (!key) { key = 'pop:workflow:new-' + Date.now().toString(36); store.set(CHAT_KEY, key); }
|
|
288
316
|
return {
|
|
289
317
|
key, title: 'New workflow', scope: { text: 'New workflow', icon: NEW_ICON },
|
|
290
|
-
context: 'The PM is describing a new workflow (Settings › Workflows' + (
|
|
318
|
+
context: 'The PM is describing a new workflow (Settings › Workflows' + (wsNow() ? ', workspace ' + wsNow() : '') + '). Follow the workflow-setup skill: draft it with pmos workflow draft, and explain each choice in the chat. '
|
|
291
319
|
+ 'The draft waits in Settings › Workspaces › Workflows as the "New workflow · draft" row, with Create workflow and Edit by hand: say so once it is written. Never create the workflow yourself: the PM does.',
|
|
292
320
|
intro: 'Tell me how this work goes, in your own words: who does what, in what order, and what has to be true before each step. Add a policy or an old checklist if you have one. I will draft the stages and it waits in Settings › Workflows for you to create.',
|
|
293
321
|
placeholder: 'How does this work go?',
|
|
@@ -300,7 +328,7 @@ export function newWorkflowChat(o = {}) {
|
|
|
300
328
|
if (o.close) o.close();
|
|
301
329
|
if (!dispatchEvent(new CustomEvent('pmos-chat-about', { detail: t, cancelable: true }))) return t; // Home took it
|
|
302
330
|
try { sessionStorage.setItem('pmos-chat-about', JSON.stringify(t)); } catch { /* Home opens the chat with no context */ }
|
|
303
|
-
const q = new URLSearchParams({ about: t.key, label: t.title }); if (
|
|
331
|
+
const q = new URLSearchParams({ about: t.key, label: t.title }); if (wsNow()) q.set('ws', wsNow());
|
|
304
332
|
location.href = '/premium.html?' + q.toString();
|
|
305
333
|
return t;
|
|
306
334
|
}
|
|
@@ -411,6 +439,7 @@ function bindDrag(main) {
|
|
|
411
439
|
|
|
412
440
|
/* ── presses ── */
|
|
413
441
|
function bind() {
|
|
442
|
+
$('#wfList').addEventListener('change', (e) => { if (e.target.matches && e.target.matches('[data-wf-ws]')) pickWs(e.target.value); });
|
|
414
443
|
$('#wfList').addEventListener('click', (e) => {
|
|
415
444
|
if (e.target.closest('[data-wf-new]')) { startNew(); return; }
|
|
416
445
|
if (e.target.closest('[data-wf-blank]')) { startBlank(); return; }
|
|
@@ -471,6 +500,7 @@ export function mount(host, o = {}) {
|
|
|
471
500
|
draw();
|
|
472
501
|
load();
|
|
473
502
|
readDraft(); // a draft PMOS wrote (in this chat or another) shows as its row, by name
|
|
503
|
+
readWorkspaces();
|
|
474
504
|
return ROOT;
|
|
475
505
|
}
|
|
476
506
|
/** Settings leaves the panel (another section, or closed): the Viewer leaves the dialog, and nothing keeps reading. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "pmos line (initiative pmos-line, done test L1-L7): where each initiative stands on its own workflow, its missing exit items, next move and stuck flag. Pure checks plus one scratch repository read through the CLI. No server, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"line.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"line.test.js": 10
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "PMOS never waits on its own drafts (initiative never-wait-on-drafts, done test N1-N7): an open Driver draft holds no run; sourced class A/B drafts apply with Undo, questions default after 2 days, class C lapses as not sent after 7. Pure checks on temp state folders. No server, connector, model or network.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"never-wait.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"never-wait.test.js": 5
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Quiet rows on Today (initiative quiet-rows, done test Q1-Q9): the cap per product, the day ledger, the batch row and popup, the phone. Pure; no browser, no server.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"quiet-rows.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"quiet-rows.test.js": 1
|
|
8
|
+
}
|
|
9
|
+
}
|