create-pmos 0.669.0 → 0.671.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 +20 -14
- 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/changelog.json +19 -0
- package/workspace/guide/agent-capabilities.md +6 -6
- package/workspace/guide/claude-proposes.md +1 -1
- package/workspace/guide/cli.md +2 -2
- package/workspace/guide/cloud.md +2 -2
- package/workspace/guide/home.md +2 -2
- package/workspace/guide/initiatives-and-next-steps.md +12 -2
- package/workspace/guide/layout.md +1 -1
- package/workspace/guide/settings-and-switches.md +19 -14
- package/workspace/lib/driver-run.js +1 -1
- package/workspace/lib/driver.js +4 -1
- package/workspace/lib/routes-boards.js +115 -4
- package/workspace/lib/source-heal.js +1 -1
- package/workspace/lib/tracker-refresh-run.js +162 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-ev.css +18 -4
- package/workspace/public/pm/cozy-evmodel.js +1 -1
- package/workspace/public/pm/cozy-pop-work.js +23 -3
- package/workspace/public/pm/cozy-settings.js +108 -89
- package/workspace/public/pm/next-prompt-ui.js +1 -1
- package/workspace/public/pm/pop-work-model.js +7 -5
- package/workspace/public/pm/set-ds.js +54 -0
- package/workspace/server.js +27 -0
- package/workspace/skills/tracker-refresh.skill +2 -0
- package/workspace/test-lists/direct-plain-actions.json +11 -0
- package/workspace/test-lists/settings-ds-page.json +9 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* tracker-refresh-run.js — the weekly tracker refresh as a plain script, not an agent session (initiative direct-plain-actions, bet 1f B4).
|
|
3
|
+
*
|
|
4
|
+
* refresh(root, { runtimeDir, now }) → { ok, moved: [line], left: [line], notFound: [line], skipped: n, read }
|
|
5
|
+
* line: { item, title, ref, from?, to?, file?, date?, why? }
|
|
6
|
+
*
|
|
7
|
+
* The tracker-refresh skill (skills/tracker-refresh.skill) was an agent run that needed no judgement: find the plan items a tracker owns,
|
|
8
|
+
* find the local file that states each one's status, and move the item to that state with the file as its evidence. This module does the
|
|
9
|
+
* same procedure by code, under the same rules (D71):
|
|
10
|
+
* 1. LOCAL FILES ONLY: no tracker call, no network, no git fetch.
|
|
11
|
+
* 2. READ-ONLY on every source; the only write is a `moved` line in the plan-items ledger with `file:<path>` evidence, by the same writer
|
|
12
|
+
* `pmos item move` uses (lib/plan-items.js), plus the freshness record of the read (lib/tracker-read.js), which is not a ledger line.
|
|
13
|
+
* 3. Evidence for every move: no file, no move.
|
|
14
|
+
* 4. Nothing invented: a file that states more than one status for the reference is not evidence; no file, the item is "not found".
|
|
15
|
+
* 5. Light on content: only the lines that name the reference are read for a status. A file whose name says private, personal,
|
|
16
|
+
* confidential or HR is skipped and counted.
|
|
17
|
+
* 6. Never a Done or Withdrawn item: only items in todo, doing or review are read.
|
|
18
|
+
* 7. A file PMOS writes is never evidence: no `*.jsonl`, nothing under <state>/runs/, <state>/reports/ or <state>/tracker/jira/ (the Jira
|
|
19
|
+
* snapshot belongs to the Jira tickets tab, not to plan items).
|
|
20
|
+
* 8. An old file never undoes a newer move: the file's date (its `timestamp` frontmatter, else its last commit) must be later than the
|
|
21
|
+
* item's last move. A file with neither date is not evidence.
|
|
22
|
+
* Where it looks, in order: <state>/requirements/, the rest of <state>/, then docs/. <state> is pmos/state/ when it exists, else planning/.
|
|
23
|
+
* The newest accepted file wins; when two accepted files disagree, the line says so.
|
|
24
|
+
*/
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const path = require('path');
|
|
27
|
+
const { execFileSync } = require('child_process');
|
|
28
|
+
const planItems = require('./plan-items.js');
|
|
29
|
+
const TR = require('./tracker-read.js');
|
|
30
|
+
|
|
31
|
+
const OPEN = new Set(['todo', 'doing', 'review']);
|
|
32
|
+
// the skill's table, most specific first so "In Progress" is never read as "Open" or "Done"
|
|
33
|
+
const STATUS = [
|
|
34
|
+
['review', /\b(in review|code review|qa|testing)\b/i],
|
|
35
|
+
['doing', /\b(in progress|doing|started)\b/i],
|
|
36
|
+
['done', /\b(done|closed|resolved|released)\b/i],
|
|
37
|
+
['todo', /\b(to do|todo|open|backlog|ready)\b/i],
|
|
38
|
+
];
|
|
39
|
+
const PRIVATE = /private|personal|confidential|(^|[^a-z])hr([^a-z]|$)/i;
|
|
40
|
+
const TEXT = /\.(md|markdown|txt|csv|tsv|json|ya?ml|html?)$/i;
|
|
41
|
+
const MAX_BYTES = 1 << 20;
|
|
42
|
+
const MAX_FILES = 5000;
|
|
43
|
+
|
|
44
|
+
function stateDirOf(root) {
|
|
45
|
+
const kit = path.join(root, 'pmos', 'state');
|
|
46
|
+
try { if (fs.statSync(kit).isDirectory()) return kit; } catch { /* not a kit layout */ }
|
|
47
|
+
return path.join(root, 'planning');
|
|
48
|
+
}
|
|
49
|
+
const escapeRe = (s) => String(s).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
50
|
+
|
|
51
|
+
/** The text files to search, in the skill's order, with the files PMOS writes left out. → { files: [abs], skipped } */
|
|
52
|
+
function filesOf(root, state) {
|
|
53
|
+
const out = [], seen = new Set();
|
|
54
|
+
let skipped = 0;
|
|
55
|
+
const banned = [path.join(state, 'runs'), path.join(state, 'reports'), path.join(state, 'tracker', 'jira')].map((d) => d + path.sep);
|
|
56
|
+
const walk = (dir) => {
|
|
57
|
+
let names;
|
|
58
|
+
try { names = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
59
|
+
for (const d of names.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
60
|
+
if (out.length >= MAX_FILES) return;
|
|
61
|
+
if (d.name.startsWith('.') || d.name === 'node_modules') continue;
|
|
62
|
+
const p = path.join(dir, d.name);
|
|
63
|
+
if (d.isDirectory()) { if (!banned.some((b) => (p + path.sep).startsWith(b))) walk(p); continue; }
|
|
64
|
+
if (!d.isFile() || seen.has(p) || /\.jsonl$/i.test(d.name) || !TEXT.test(d.name) || banned.some((b) => p.startsWith(b))) continue;
|
|
65
|
+
if (PRIVATE.test(d.name)) { skipped++; seen.add(p); continue; }
|
|
66
|
+
seen.add(p); out.push(p);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
walk(path.join(state, 'requirements'));
|
|
70
|
+
walk(state);
|
|
71
|
+
walk(path.join(root, 'docs'));
|
|
72
|
+
return { files: out, skipped };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** The date of a file: its `timestamp` frontmatter, else its last commit, else null. */
|
|
76
|
+
function dateOf(root, abs, text) {
|
|
77
|
+
const fm = /^---\r?\n([\s\S]*?)\r?\n---/.exec(text);
|
|
78
|
+
const ts = fm && /^timestamp:\s*["']?([0-9]{4}-[0-9]{2}-[0-9]{2}[^"'\s]*)/m.exec(fm[1]);
|
|
79
|
+
if (ts && Number.isFinite(Date.parse(ts[1]))) return new Date(Date.parse(ts[1])).toISOString();
|
|
80
|
+
try {
|
|
81
|
+
const out = execFileSync('git', ['log', '-1', '--format=%cI', '--', path.relative(root, abs)], { cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], timeout: 5000 }).trim();
|
|
82
|
+
if (out && Number.isFinite(Date.parse(out))) return new Date(Date.parse(out)).toISOString();
|
|
83
|
+
} catch { /* not a git repository, or not committed */ }
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** The status one file states for a reference: { state } | { many: [states] } | null (the file does not name it, or names no status). */
|
|
88
|
+
function statusIn(text, ref) {
|
|
89
|
+
const re = new RegExp('(^|[^A-Za-z0-9-])' + escapeRe(ref) + '(?![A-Za-z0-9])', 'i');
|
|
90
|
+
const found = new Set();
|
|
91
|
+
for (const line of text.split(/\r?\n/)) {
|
|
92
|
+
if (!re.test(line)) continue;
|
|
93
|
+
const rest = line.replace(new RegExp(escapeRe(ref), 'ig'), ' ');
|
|
94
|
+
// every status the line names counts: "was In Review, now Done" states two, and two is not evidence
|
|
95
|
+
let left = rest;
|
|
96
|
+
for (const [state, sre] of STATUS) { const g = new RegExp(sre.source, 'ig'); if (g.test(left)) { found.add(state); left = left.replace(g, ' '); } }
|
|
97
|
+
}
|
|
98
|
+
if (!found.size) return null;
|
|
99
|
+
return found.size === 1 ? { state: [...found][0] } : { many: [...found] };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The item's last move (or its creation): the day a file must be later than. */
|
|
103
|
+
function lastMoveOf(it) {
|
|
104
|
+
const moved = (it.history || []).filter((h) => h && h.ev === 'moved' && h.at).map((h) => h.at).sort();
|
|
105
|
+
return moved.length ? moved[moved.length - 1] : it.createdAt || null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function refresh(root, { runtimeDir, now = new Date() } = {}) {
|
|
109
|
+
let fold;
|
|
110
|
+
try { fold = planItems.readFold(root); } catch (e) { return { ok: false, error: 'could not read the plan items: ' + String((e && e.message) || e).slice(0, 160) }; }
|
|
111
|
+
const state = stateDirOf(root);
|
|
112
|
+
const items = Object.values(fold.items || {}).filter((it) => it && !it.proposed && OPEN.has(it.state) && /^tracker:./.test(String(it.owner || '')));
|
|
113
|
+
const moved = [], left = [], notFound = [];
|
|
114
|
+
const { files, skipped } = items.length ? filesOf(root, state) : { files: [], skipped: 0 };
|
|
115
|
+
const texts = new Map();
|
|
116
|
+
const textOf = (f) => {
|
|
117
|
+
if (!texts.has(f)) { let t = null; try { if (fs.statSync(f).size <= MAX_BYTES) t = fs.readFileSync(f, 'utf8'); } catch { t = null; } texts.set(f, t); }
|
|
118
|
+
return texts.get(f);
|
|
119
|
+
};
|
|
120
|
+
const events = [];
|
|
121
|
+
for (const it of items) {
|
|
122
|
+
const ref = String(it.owner).slice('tracker:'.length).trim();
|
|
123
|
+
const base = { item: it.id, title: it.title, ref };
|
|
124
|
+
const hits = [];
|
|
125
|
+
let many = null;
|
|
126
|
+
for (const f of files) {
|
|
127
|
+
const text = textOf(f);
|
|
128
|
+
if (!text || !text.toLowerCase().includes(ref.toLowerCase())) continue;
|
|
129
|
+
const st = statusIn(text, ref);
|
|
130
|
+
if (!st) continue;
|
|
131
|
+
const rel = path.relative(root, f).split(path.sep).join('/');
|
|
132
|
+
if (st.many) { many = many || { file: rel, states: st.many }; continue; }
|
|
133
|
+
const date = dateOf(root, f, text);
|
|
134
|
+
if (!date) continue;
|
|
135
|
+
hits.push({ file: rel, date, state: st.state });
|
|
136
|
+
}
|
|
137
|
+
if (!hits.length) { notFound.push({ ...base, why: many ? `${many.file} states more than one status (${many.states.join(', ')})` : 'no local file states its status' }); continue; }
|
|
138
|
+
hits.sort((a, b) => b.date.localeCompare(a.date) || a.file.localeCompare(b.file));
|
|
139
|
+
const top = hits[0];
|
|
140
|
+
const disagree = hits.some((h) => h.state !== top.state) ? ` (older files say ${[...new Set(hits.filter((h) => h.state !== top.state).map((h) => h.state))].join(', ')}; the newest is used)` : '';
|
|
141
|
+
const since = lastMoveOf(it);
|
|
142
|
+
if (since && !(top.date > since)) { left.push({ ...base, file: top.file, date: top.date, why: 'file older than the last move' + disagree }); continue; }
|
|
143
|
+
if (top.state === it.state) { left.push({ ...base, file: top.file, date: top.date, why: 'already ' + it.state + disagree }); continue; }
|
|
144
|
+
events.push({ ev: 'moved', item: it.id, to: top.state, evidence: 'file:' + top.file });
|
|
145
|
+
moved.push({ ...base, from: it.state, to: top.state, file: top.file, date: top.date, ...(disagree ? { why: disagree.trim() } : {}) });
|
|
146
|
+
}
|
|
147
|
+
if (events.length) {
|
|
148
|
+
const w = planItems.appendFromCli(root, events, { isTTY: false, env: {}, now: now.getTime ? now.getTime() : undefined });
|
|
149
|
+
if (!w.ok) return { ok: false, error: 'the moves were not saved: ' + w.error, moved: [], left, notFound };
|
|
150
|
+
}
|
|
151
|
+
let read = null;
|
|
152
|
+
if (runtimeDir) { try { read = TR.write(runtimeDir, root, { moved: moved.length, left: left.length, not_found: notFound.length }, now); } catch { read = null; } }
|
|
153
|
+
return { ok: true, moved, left, notFound, skipped, read };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** One short summary line for a run record. */
|
|
157
|
+
function summary(r) {
|
|
158
|
+
if (!r || !r.ok) return (r && r.error) || 'the refresh failed';
|
|
159
|
+
return `${r.moved.length} moved, ${r.left.length} left as they are, ${r.notFound.length} not found` + (r.skipped ? `, ${r.skipped} private files skipped` : '');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
module.exports = { refresh, summary, statusIn, stateDirOf };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.671.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.671.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -371,7 +371,6 @@
|
|
|
371
371
|
.cz .ev-gcap { flex-wrap: wrap; }
|
|
372
372
|
.cz .ev-gcap .ev-small { flex: 1 1 160px; }
|
|
373
373
|
.cz .ev-gbar { position: relative; flex: 1 1 200px; height: 8px; border-radius: 4px; background: var(--cz-well2, var(--cz-well)); overflow: hidden; }
|
|
374
|
-
.cz .ev-gbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--cz-blue); }
|
|
375
374
|
@media (max-width: 600px) { .cz .ev-trow:has(.ev-seg[aria-label="Grill by itself"]), .cz .ev-trow:has(.ev-seg[aria-label="Monthly credit for checks"]) { flex-wrap: wrap; } }
|
|
376
375
|
/* Settings › Jev and Laya (canvas JlA1Empty–JlA4Phone): the key and Laya rows, Claude's ✦ for Laya, the repositories in one well */
|
|
377
376
|
.ev-st .ev-jl-lead { margin: 0 0 8px; }
|
|
@@ -490,9 +489,6 @@
|
|
|
490
489
|
}
|
|
491
490
|
@media (min-width: 761px) and (max-height: 640px) { .pm-ds .cz-fabm.ev-menu.ev-rail a { height: 48px; } }
|
|
492
491
|
/* Settings, one container (slice 1, board StSettings): each group of rows is one card with a thin border */
|
|
493
|
-
.ev-st .ev-tcard { border-radius: 16px; background: var(--cz-card); box-shadow: inset 0 0 0 1px var(--cz-hair); overflow: hidden; margin: 6px 0 4px; flex: none; }
|
|
494
|
-
.ev-st .ev-tcard > .ev-trow { padding-left: 18px; padding-right: 18px; margin: 0; border-radius: 0; }
|
|
495
|
-
.ev-st .ev-tcard > .ev-trow:last-child { border-bottom: 0; }
|
|
496
492
|
/* a published read-only copy (pm/readonly.js, html.ro) has no places to go to: no rail, and the page keeps its own left edge */
|
|
497
493
|
@media (min-width: 761px) {
|
|
498
494
|
html.ro body.cz-railon .cz-fabw { display: none !important; }
|
|
@@ -525,3 +521,21 @@
|
|
|
525
521
|
body.cz-phmore .lb-bar, body.cz-phmore .evp-hd { padding-right: 48px; } /* so do Library and Events: their + sat under the ⋯ */
|
|
526
522
|
body.cz-phmore .ev-scrim { background: rgba(42,46,53,.22); }
|
|
527
523
|
}
|
|
524
|
+
|
|
525
|
+
/* Settings from the design system (settings-ds-page, board SettingsDS; pm/set-ds.js). The parts (pm-set, pm-tabs, pm-switch, pm-block,
|
|
526
|
+
* pm-sug, pm-badge, pm-path) come from komorebi.css; this only places them inside the dialog. */
|
|
527
|
+
.ev-st.pm-ds .ev-st-nav .pm-tab { height: auto; min-height: 36px; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: var(--radius-md); text-align: left; text-decoration: none; font-size: var(--fs-body); }
|
|
528
|
+
.ev-st.pm-ds .ev-st-nav .pm-tab[aria-current="page"] { background: var(--card); color: var(--ink); }
|
|
529
|
+
.ev-st.pm-ds .ev-st-nav .pm-tab .ev-k { margin-left: auto; }
|
|
530
|
+
.ev-st.pm-ds .ev-st-main { gap: 16px; }
|
|
531
|
+
.ev-st.pm-ds .ev-top .ev-grow { flex: 1; }
|
|
532
|
+
.ev-st.pm-ds .ev-trow.pm-set { padding: 8px 0; border-bottom: 0; }
|
|
533
|
+
.ev-st.pm-ds .pm-block > .pm-set:first-child, .ev-st.pm-ds .pm-block > .head + .pm-set { border-top: 0; }
|
|
534
|
+
.ev-st.pm-ds .pm-block .ev-lead { margin: 0; }
|
|
535
|
+
.ev-st.pm-ds .pm-block.list .ev-lead { padding: 0 16px 8px; }
|
|
536
|
+
.ev-st.pm-ds .pm-block.list .pm-li { min-height: 44px; }
|
|
537
|
+
.ev-st.pm-ds .pm-tabs { flex: none; }
|
|
538
|
+
.ev-st.pm-ds svg.ev-gbar { flex: 1 1 200px; height: 8px; }
|
|
539
|
+
.ev-st.pm-ds svg.ev-gbar .bg { fill: var(--well); }
|
|
540
|
+
.ev-st.pm-ds svg.ev-gbar .fg { fill: var(--leaf); }
|
|
541
|
+
|
|
@@ -197,7 +197,7 @@ export function connectorRows(sources, health, now = Date.now()) {
|
|
|
197
197
|
const behind = (s.state === 'stale' || s.state === 'never') && s.id !== 'repository' && !mend && !sch.next_run;
|
|
198
198
|
out.push({ id: s.id, name, trouble: 0, why: line && !mend && s.state !== 'building' ? line.text : '', when, act: behind ? read : null, ...(job ? { job } : {}) });
|
|
199
199
|
}
|
|
200
|
-
for (const i of alone) out.push({ id: 'issue:' + i.key, name: i.name || 'Background work', trouble: 3, why: i.why, when: '', act: i.key === 'signedout' ? { kind: 'sec', label: 'Open Settings ›
|
|
200
|
+
for (const i of alone) out.push({ id: 'issue:' + i.key, name: i.name || 'Background work', trouble: 3, why: i.why, when: '', act: i.key === 'signedout' ? { kind: 'sec', label: 'Open Settings › Your account', sec: 'account' } : null });
|
|
201
201
|
return out.map((r, k) => ({ r, k })).sort((a, b) => (a.r.trouble || 9) - (b.r.trouble || 9) || a.k - b.k).map((x) => x.r);
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -382,8 +382,8 @@ function sugPageHtml(s, W) {
|
|
|
382
382
|
}
|
|
383
383
|
|
|
384
384
|
/* ── writes ── */
|
|
385
|
-
/* the suggestions PMOS reads from the record (pop-work-model.js derivedOf): ✓ puts a task in a stage,
|
|
386
|
-
* does it in a real session; ✕ hides it on this computer */
|
|
385
|
+
/* the suggestions PMOS reads from the record (pop-work-model.js derivedOf): ✓ puts a task in a stage, writes a plain change at once (direct),
|
|
386
|
+
* or sends the words to Ask PMOS, which does it in a real session; ✕ hides it on this computer */
|
|
387
387
|
const DROP = 'pw-dropped';
|
|
388
388
|
const dropped = () => new Set(store.get(DROP, []));
|
|
389
389
|
let ASK_AT = null; // the initiative shown ({ id, ws }): a phone sends the words to Ask PMOS about it
|
|
@@ -399,10 +399,30 @@ function sendToChat(text) {
|
|
|
399
399
|
const f = ta.closest('form'); if (f && f.requestSubmit) f.requestSubmit(); else ta.focus();
|
|
400
400
|
return true;
|
|
401
401
|
}
|
|
402
|
+
/* a direct ✓ (bet 1f): the plan end, closing the open tasks, reopening. One press writes through POST /api/boards/ini-<act> with Undo; no chat
|
|
403
|
+
* message, no session. Only when the route answers ask: true (the plain reading does not hold) do the words go to Ask PMOS, as before. */
|
|
404
|
+
async function direct(d, ask, x, h) {
|
|
405
|
+
const w = h.where ? h.where() : {}, id = x.o().id;
|
|
406
|
+
const res = await pmPost('/api/boards/ini-' + d.act, { ws: w.ws, board: w.board, id, ...(d.to ? { to: d.to } : {}) }).catch(() => null);
|
|
407
|
+
if (!res || res.ask) { if (ask && !sendToChat(ask) && h.toast) h.toast('Open Ask PMOS to send this.'); return; }
|
|
408
|
+
if (res.ok === false) { if (h.toast) h.toast(res.error || 'Nothing was changed.'); return; }
|
|
409
|
+
if (h.reload) await h.reload();
|
|
410
|
+
if (res.same) { if (h.toast) h.toast(res.said || 'Nothing to change.'); return; }
|
|
411
|
+
const back = async (route, body) => { const u = await pmPost(route, { ws: w.ws, board: w.board, ...body }).catch(() => null); return !!u && u.ok !== false; };
|
|
412
|
+
undoToast(res.said || 'Done.', async () => {
|
|
413
|
+
let ok = true;
|
|
414
|
+
if (d.act === 'plan-end') ok = await back('/api/boards/tasks/edit', { task: res.task, due: (res.from && res.from.due) || '' });
|
|
415
|
+
else if (d.act === 'close-open') { for (const c of res.closed || []) ok = (await back('/api/boards/tasks/state', { task: c.task, state: c.from })) && ok; }
|
|
416
|
+
else if (res.undo && /^\/api\/boards\/(move|wontdo)$/.test(res.undo.route)) ok = await back(res.undo.route, res.undo.body);
|
|
417
|
+
if (!ok && h.toast) h.toast('The undo did not land.');
|
|
418
|
+
if (h.reload) await h.reload();
|
|
419
|
+
});
|
|
420
|
+
}
|
|
402
421
|
async function keepSug(s, x, h) {
|
|
403
422
|
if (s.derived) {
|
|
404
423
|
if (s.move && h.move) { await h.move(s.move.uid, { to: s.move.to, from: '', name: s.move.name }); return; }
|
|
405
424
|
if (s.moveAll) { await moveAll(s.moveAll, h); return; }
|
|
425
|
+
if (s.direct) { await direct(s.direct, s.ask, x, h); return; }
|
|
406
426
|
if (s.ask && !sendToChat(s.ask) && h.toast) h.toast('Open Ask PMOS to send this.');
|
|
407
427
|
return;
|
|
408
428
|
}
|
|
@@ -506,7 +526,7 @@ export function wire(body, h0, x0) {
|
|
|
506
526
|
if (d.pwLdrop) { const dd = dropped(); for (const k of d.pwLdrop.split(',')) dd.add(k); store.set(DROP, [...dd].slice(-200)); redraw(); return; }
|
|
507
527
|
if ('pwPdocs' in d) { if (PH_ARTS.has(c.id)) PH_ARTS.delete(c.id); else PH_ARTS.add(c.id); redraw(); return; }
|
|
508
528
|
if (d.pwSrc) { if (h.doc) h.doc(d.pwSrc); return; }
|
|
509
|
-
if (d.pwChoice) { const [sid, k] = d.pwChoice.split('|'), s = findSug(W, sid), ch = s && s.choices && s.choices[+k]; if (ch && !sendToChat(ch.ask) && h.toast) h.toast('Open Ask PMOS to send this.'); return; }
|
|
529
|
+
if (d.pwChoice) { const [sid, k] = d.pwChoice.split('|'), s = findSug(W, sid), ch = s && s.choices && s.choices[+k]; if (ch && ch.direct) { b.disabled = true; await direct(ch.direct, ch.ask, x, h); return; } if (ch && !sendToChat(ch.ask) && h.toast) h.toast('Open Ask PMOS to send this.'); return; }
|
|
510
530
|
if (d.pwMore != null) { S.moreOpen.add(d.pwMore); redraw(); return; }
|
|
511
531
|
if (d.pwVer) { if (ARTOPEN.has(d.pwVer)) ARTOPEN.delete(d.pwVer); else ARTOPEN.add(d.pwVer); redraw(); return; }
|
|
512
532
|
if (d.pwRowMore) { rowMenu(b, d.pwRowMore, c, h, body); return; }
|