create-pmos 0.800.0 → 0.802.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.800.0",
3
+ "version": "0.802.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": {
@@ -33,6 +33,32 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.802.0",
38
+ "at": "2026-11-25T02:04:50.325Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1831,
43
+ "t": "Chat input text spans the full width, controls row under it",
44
+ "s": "Chat input text spans the full width, controls row under it",
45
+ "k": "fix"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.801.0",
51
+ "at": "2026-11-25T01:53:19.580Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1829,
56
+ "t": "Issue a drafted document from the initiative page and the chat chip",
57
+ "s": "Issue a drafted document from the initiative page and the chat chip",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.800.0",
38
64
  "at": "2026-11-25T01:39:46.319Z",
@@ -42,16 +68,7 @@
42
68
  "n": 1825,
43
69
  "t": "Today, Work and an initiative open within 200 ms",
44
70
  "s": "Today, Work and an initiative open within 200 ms",
45
- "k": "imp",
46
- "try": {
47
- "steps": [
48
- "Open Today, then Work, then an initiative from Work.",
49
- "Change something on the initiative (a task title), wait a second, then open Work again.",
50
- "Open the same initiative again."
51
- ],
52
- "see": "each page shows its rows at once, in about the blink of an eye; the change you made shows on Work and on the initiative.",
53
- "open": "/premium-board.html"
54
- }
71
+ "k": "imp"
55
72
  }
56
73
  ]
57
74
  },
@@ -418,52 +435,6 @@
418
435
  }
419
436
  }
420
437
  ]
421
- },
422
- {
423
- "v": "0.782.0",
424
- "at": "2026-11-24T16:18:37.421Z",
425
- "f": 4,
426
- "prs": [
427
- {
428
- "n": 1767,
429
- "t": "Sprint retro from PMOS's close numbers, with one tracked change",
430
- "s": "Sprint retro from PMOS's close numbers, with one tracked change",
431
- "k": "new",
432
- "h": "Sprint retro from PMOS's close numbers, with one tracked change",
433
- "try": {
434
- "steps": [
435
- "Open Today and ask the chat: what was the retro of our last sprint?",
436
- "Then ask: drop that change, or track the in-review one instead"
437
- ],
438
- "see": "The chat answers with done of total, why work was carried (never started, started, in review, carried twice, added after the start), names one change for the next sprint, and for a sprint whose…"
439
- }
440
- },
441
- {
442
- "n": 1770,
443
- "t": "One Undo command for a multi-parent move; test that one Undo restores parent, stage and order (checker findings)",
444
- "s": "One Undo command for a multi-parent move; test that one Undo restores parent, stage and order (checker findings)",
445
- "k": "fix"
446
- },
447
- {
448
- "n": 1757,
449
- "t": "Five page layouts and one calm reading view for documents (A334)",
450
- "s": "Five page layouts and one calm reading view for documents (A334)",
451
- "k": "new"
452
- }
453
- ]
454
- },
455
- {
456
- "v": "0.781.0",
457
- "at": "2026-11-24T16:04:56.192Z",
458
- "f": 4,
459
- "prs": [
460
- {
461
- "n": 1756,
462
- "t": "✦ buttons act directly; ✦ drafts run as a PMOS background job",
463
- "s": "✦ buttons act directly; ✦ drafts run as a PMOS background job",
464
- "k": "new"
465
- }
466
- ]
467
438
  }
468
439
  ]
469
440
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@6cd2bca37
1
+ kernel-source: pmos@0d66b644e
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-25T01:39:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T02:04:46Z"}
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-11-25T01:39:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T02:04:46Z"}
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-11-25T01:39:43Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T02:04:46Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.802.0",
4
+ "at": "2026-11-25T02:04:50.325Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1831,
9
+ "t": "Chat input text spans the full width, controls row under it",
10
+ "s": "Chat input text spans the full width, controls row under it",
11
+ "k": "fix"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.801.0",
17
+ "at": "2026-11-25T01:53:19.580Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1829,
22
+ "t": "Issue a drafted document from the initiative page and the chat chip",
23
+ "s": "Issue a drafted document from the initiative page and the chat chip",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.800.0",
4
30
  "at": "2026-11-25T01:39:46.319Z",
@@ -8,16 +34,7 @@
8
34
  "n": 1825,
9
35
  "t": "Today, Work and an initiative open within 200 ms",
10
36
  "s": "Today, Work and an initiative open within 200 ms",
11
- "k": "imp",
12
- "try": {
13
- "steps": [
14
- "Open Today, then Work, then an initiative from Work.",
15
- "Change something on the initiative (a task title), wait a second, then open Work again.",
16
- "Open the same initiative again."
17
- ],
18
- "see": "each page shows its rows at once, in about the blink of an eye; the change you made shows on Work and on the initiative.",
19
- "open": "/premium-board.html"
20
- }
37
+ "k": "imp"
21
38
  }
22
39
  ]
23
40
  },
@@ -225,7 +225,7 @@ There is no My work page. The list on Today is your list:
225
225
  - **Recording.** Record a note now, with no calendar event.
226
226
  - **Initiative.** Work opens with **New initiative**, in the open product.
227
227
  - **Sessions.** A session row names its agent. The coloured dot beside it is its state: blue waits on you, amber may be blocked, green is running. A session PMOS started itself (a skill or a background job) shows on Today only while it works or asks you something. Once it finishes its prompt, it leaves the list. On an initiative's page, a session that waits on you shows once, under **Needs you**, not again under **Sessions**. **Finished sessions** does not list an old run of a chat that is open again.
228
- - **One chat box.** Every conversation has the same box: **+** (attach a file, notes, the terminal, and **Link to an initiative** for a loose chat), **/** for commands, **@** inside an initiative, the To or In chip, the mic, and Send. A chat opens at its newest message. If a message cannot be sent, a red **Not sent:** line under the box says why, and your words and files stay in the box. The chat beside a document (Library, an initiative's artefacts) is about that document and reads its file.
228
+ - **One chat box.** Every conversation has the same box: **+** (attach a file, notes, the terminal, and **Link to an initiative** for a loose chat), **/** for commands, **@** inside an initiative, the To or In chip, the mic, and Send. Your words take the box's full width on top, and these controls sit in one row under them, on a phone and on a computer. A chat opens at its newest message. If a message cannot be sent, a red **Not sent:** line under the box says why, and your words and files stay in the box. The chat beside a document (Library, an initiative's artefacts) is about that document and reads its file.
229
229
  - **While PMOS works.** A line at the top of the chat shows what PMOS is trying to do. If PMOS keeps a to-do list, the line shows the to-do in progress and how many are done, for example **2 of 5 done**. Tap the line to see the full list. If PMOS has no to-do list, the line shows PMOS's newest one-line status and the time since your message. The line never shows raw commands. To see the commands, tap the terminal icon.
230
230
  - **A session's terminal.** **Watch its terminal** in **+**, or a session row such as **Claude sign-in**, opens the session's terminal in the Viewer. While the session runs, it is a real terminal: type in it to answer PMOS or paste a code. It fills the Viewer and fits its lines again when you resize the Viewer or the window. The chat goes on showing every answer while the terminal is open and after you close it: the terminal is a second view of the same session. When the session has ended, the Viewer shows it read only and says so.
231
231
  - **Setting up your first project opens by itself** until a registered folder holds an initiative or setup has finished. The `PMOS` folder that the one-line installer makes holds no initiative yet, so a new user who opens PMOS from the Start menu or the Dock still gets the setup conversation, not an empty Today.
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Initiatives: the Roadmap, next steps, the Driver and done"
4
4
  description: "The ranked list of initiatives, how PMOS works out the next steps, the Initiative Driver, and integrated work."
5
- timestamp: 2026-11-24
5
+ timestamp: 2026-11-25
6
6
  ---
7
7
 
8
8
  # Initiatives: the Roadmap, next steps, the Driver and done
@@ -132,6 +132,15 @@ Below the strategy, a Work that shows one product has a **Principles** block. Wh
132
132
 
133
133
  You can also ask the chat to keep, drop or add a principle (`pmos principles`). Work shows the change. When there are no principles and no drafts, the block is not shown.
134
134
 
135
+ ### Issue a document PMOS drafted
136
+
137
+ When PMOS drafts a document for an initiative, for example a stage's plan that you asked the chat to update, the draft waits for you. You issue it in one of two places:
138
+
139
+ - **The initiative page.** A ✦ row at the top of **Where it stands** says "Issue the Plan document, drafted 25 Nov?". Press ✓ to issue it. Press ✎ to read or edit it first. Press ✕ to hide the row.
140
+ - **The chat.** The file chip under the answer that saved the draft has a ✓ beside it. Press ✓ to issue it.
141
+
142
+ Each issue offers Undo. Issuing marks the draft as the current version. Nothing is sent to anyone. When there are several drafts of one document, only the newest can be issued: it replaces the older ones.
143
+
135
144
  ### Now, Next and Later are retired (D105)
136
145
 
137
146
  Earlier versions put each initiative in one of three horizons: Now, Next and Later. They are retired. Nothing you placed is lost:
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Layout and first run: the places, the navigation, the Viewer, the launcher and Adler"
4
4
  description: "The places, the navigation at the left, the Viewer, the keys and the phone; the first run; when features appear; the PMOS app; and Adler."
5
- timestamp: 2026-11-24
5
+ timestamp: 2026-11-25
6
6
  ---
7
7
 
8
8
  # Layout and first run
@@ -177,7 +177,7 @@ On a computer, an initiative you open from Today, Work or Intelligence opens in
177
177
  - The chat icon opens the popup on the session that waits for you, or else the newest. The left side shows that session's work, or the list of sessions when it is about no work.
178
178
  - The chat's top bar has the session, one quiet line under it that says what the chat is about, ⋯ and ×. ⋯ has **Hide the chat**, **Sessions** and, while the session is live, **End session**. On a desk, work always opens in this popup.
179
179
  - On Today and Today the chat is drawn from the PMOS design system: your question sits in a grey box, the box you write in is one white card, and **Send** is a blue circle inside the box. When you type in the box, its grey line gets darker. No coloured ring shows.
180
- - The chat reads as on a phone: messages only, without names or times on each one. Each answer shows in full, and the small notes and steps before it fold into one line, for example "Worked 6 steps · 20 s"; press it to see them. Copy, Retry and Make it a task show on the newest answer. The box is one row: +, the words, the microphone and send.
180
+ - The chat reads as on a phone: messages only, without names or times on each one. Each answer shows in full, and the small notes and steps before it fold into one line, for example "Worked 6 steps · 20 s"; press it to see them. Copy, Retry and Make it a task show on the newest answer. In the box, your words take the full width and the box grows upward as you write. Under them is one row: **+** at the left, then ↶ (when it shows), the microphone and send at the right. The box is the same on a phone and on a computer.
181
181
  - Beside the page, a panel you slide off the edge is put away. The round Live button above the chat icon then shows, and its first row brings the panel back. Otherwise the chat icon holds your sessions, and there is no Live button.
182
182
 
183
183
  A phone keeps its own layout. A shared read-only Work has no popup.
@@ -43,7 +43,7 @@ const RETIRED_LEVELS = Object.freeze(['portfolio', 'board']);
43
43
  const RETIRED = 'PMOS no longer drafts portfolio or board documents. The product page\'s story, Intent and goals cover them, and the ones already written stay readable.';
44
44
  const CATS = Object.freeze(['Discover', 'Plan', 'Do', 'Learn']);
45
45
  const KINDS = Object.freeze(['doc', 'derived', 'report']);
46
- const EVENTS = Object.freeze(['draft', 'issue', 'drop']);
46
+ const EVENTS = Object.freeze(['draft', 'issue', 'drop', 'unissue']); // unissue: the PM's Undo of an issue (issue-from-chat)
47
47
  const BY = Object.freeze({ you: 'You write it', proposes: 'PMOS proposes', drafts: 'PMOS drafts it', files: 'PMOS files it', watches: 'PMOS watches it',
48
48
  keeps: 'PMOS keeps it current', live: 'Live view', reviews: 'PMOS reviews, you accept' });
49
49
  const LEVEL = Object.freeze({
@@ -253,10 +253,12 @@ function fold(lines) {
253
253
  for (const l of lines || []) {
254
254
  const x = get(l);
255
255
  if (l.ev === 'draft') x.drafts.push(l);
256
- else if (l.ev === 'issue') { x.issues.push(l); if (!x.issued || msOf(l.at) >= msOf(x.issued.at)) x.issued = l; }
256
+ else if (l.ev === 'issue') x.issues.push(l);
257
+ else if (l.ev === 'unissue') x.issues = x.issues.filter((i) => i.slot !== l.slot); // Undo: the issue before it no longer counts
257
258
  else if (l.ev === 'drop') x.drops.add(l.slot);
258
259
  }
259
260
  for (const x of m.values()) {
261
+ for (const l of x.issues) if (!x.issued || msOf(l.at) >= msOf(x.issued.at)) x.issued = l;
260
262
  const issuedSlots = new Set(x.issues.map((l) => l.slot));
261
263
  const open = x.drafts.filter((d) => !issuedSlots.has(d.slot) && !x.drops.has(d.slot) && (!x.issued || msOf(d.at) > msOf(x.issued.at)));
262
264
  x.draft = open.length ? open[open.length - 1] : null;
@@ -320,6 +322,8 @@ function openDraft(root, scope, key, slot) {
320
322
  if (!d) return refuse(404, `no draft ${slot} of ${c.entry.title}`);
321
323
  if (x.issues.some((l) => l.slot === slot)) return refuse(409, 'that draft is issued already');
322
324
  if (x.drops.has(slot)) return refuse(409, 'that draft was dropped');
325
+ // a newer draft replaces an older one: only the open draft is issued, so an old version never becomes the record by mistake
326
+ if (x.draft && x.draft.slot !== slot) return refuse(409, `a newer draft (${x.draft.slot}) replaces that one; issue the newer one`);
323
327
  return { ok: true, entry: c.entry, line: d };
324
328
  }
325
329
 
@@ -339,6 +343,38 @@ function issue(root, { scope, key, slot } = {}, actor, { now } = {}) {
339
343
  const line = append(ledgerFile(abs), { ev: 'issue', scope, key, slot, path: o.line.path, by: (actor && actor.by) || null }, { now: t });
340
344
  return { ok: true, line };
341
345
  }
346
+ /** The core-document draft a file path is (issue-from-chat: the chat's file chip and the initiative page offer ✓ Issue on it), or null when the
347
+ * path is no draft of the ledger. → { scope, key, slot, path, title, state: 'draft' | 'issued' | 'superseded' | 'dropped', newer? } */
348
+ function draftOfPath(root, p) {
349
+ const want = String(p || '').replace(/\\/g, '/').replace(/^\.?\//, '');
350
+ if (!/\/core-docs\/[^/]+\/[^/]+\/[^/]+\.md$/.test(want)) return null;
351
+ const lines = readLines(ledgerFile(root));
352
+ const d = lines.find((l) => l.ev === 'draft' && typeof l.path === 'string' && (want === l.path || want.endsWith('/' + l.path) || l.path.endsWith('/' + want)));
353
+ if (!d) return null;
354
+ const x = fold(lines).get(`${d.scope}|${d.key}`);
355
+ const c = checkEntry(d.scope, d.key);
356
+ const st = x.drops.has(d.slot) ? 'dropped' : x.issues.some((l) => l.slot === d.slot) ? 'issued' : x.draft && x.draft.slot === d.slot ? 'draft' : 'superseded';
357
+ return { scope: d.scope, key: d.key, slot: d.slot, path: d.path, title: c.ok ? c.entry.title : d.key, state: st, ...(st === 'superseded' && x.draft ? { newer: x.draft.slot } : {}) };
358
+ }
359
+ /** Undo an issue (issue-from-chat): one `unissue` line and `state: draft` back in the file, so the draft is open again. Only the slot that is
360
+ * issued now, and only while no newer draft replaced it. A PM press only, like issue. */
361
+ function unissue(root, { scope, key, slot } = {}, actor, { now } = {}) {
362
+ const c = checkEntry(scope, key);
363
+ if (!c.ok) return c;
364
+ if (!SLOT_RE.test(String(slot || ''))) return refuse(400, 'slot must be YYYY-MM-DD, with -2, -3 for a second draft on one day');
365
+ const x = storeOf(root).get(`${scope}|${key}`);
366
+ const is = x && x.issues.find((l) => l.slot === slot);
367
+ if (!is) return refuse(409, 'that draft is not issued');
368
+ if (x.drafts.some((d) => d.slot !== slot && msOf(d.at) > msOf(is.at))) return refuse(409, 'a newer draft came after it, so the issue stays');
369
+ const abs = path.resolve(String(root));
370
+ const file = path.join(abs, is.path);
371
+ try {
372
+ const text = fs.readFileSync(file, 'utf8');
373
+ fs.writeFileSync(file, text.replace(/^(---\r?\n[\s\S]*?)^state:[^\n]*$/m, '$1state: draft'));
374
+ } catch { /* the file is gone: the ledger line still reopens the draft */ }
375
+ const line = append(ledgerFile(abs), { ev: 'unissue', scope, key, slot, path: is.path, by: (actor && actor.by) || null }, { now });
376
+ return { ok: true, line };
377
+ }
342
378
  /** Drop a draft: one `drop` line. The file stays as it is; the fold no longer counts it. */
343
379
  function drop(root, { scope, key, slot } = {}, actor, { now } = {}) {
344
380
  const o = openDraft(root, scope, key, slot);
@@ -651,6 +687,6 @@ function batchPrompt(entries, scope, { today, label } = {}) {
651
687
  module.exports = {
652
688
  LEDGER, DIR, LEVELS, RETIRED_LEVELS, RETIRED, LEVEL, SETS, CATS, KINDS, EVENTS, BY, RESEARCH_KEEP, BUILD_ONLY_INI, STALE_ON_MOVE, ID_RE, SLOT_RE, GUIDE,
653
689
  entryOf, parseScope, levelOfScope, scopeDir, scopeLabel, draftable, storable, actOf, setFor, stateOf, summaryOf, localDay, addDays,
654
- ledgerFile, readLines, append, fold, storeOf, checkEntry, writeDraft, issue, drop, frontmatterOf,
690
+ ledgerFile, readLines, append, fold, storeOf, checkEntry, writeDraft, issue, unissue, drop, frontmatterOf, draftOfPath,
655
691
  gather, answer, initiativeDocs, initiativeSet, workflowPlan, stageEntry, WF_KEY_RE, prdSection, driverLists, runPrompt, batchPrompt,
656
692
  };
@@ -88,7 +88,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
88
88
  try { r = CD.writeDraft(root, { scope: flags.scope, key: flags.key, markdown, by: actor.by, now }); } catch (err) { return fail(`the draft was not written: ${String((err && err.message) || err).slice(0, 160)}`); }
89
89
  if (!r.ok) return fail(r.error);
90
90
  if (json) say(JSON.stringify({ ok: true, scope: flags.scope, key: flags.key, slot: r.slot, path: r.path }));
91
- else say(`✓ drafted ${r.path}. It waits for the PM, who issues it. Nothing was sent.`);
91
+ // issue-from-chat: the words the agent passes on name the real presses, so it never invents a place (it once sent the PM to a stage card)
92
+ else say(`✓ drafted ${r.path}. It waits for the PM, who issues it: ✓ on the file chip under your answer, or ✓ on the ✦ row "Issue the … document" at the top of the initiative page. Say exactly that. Nothing was sent.`);
92
93
  return 0;
93
94
  }
94
95
 
@@ -60,7 +60,7 @@ function rule(info, id) {
60
60
  'The "N days over" badge counts from the planned finish (the latest due of its tasks). While the initiative is open it counts to today. Once it is in its workflow\'s last stage (Closed, Done) it counts to when the work really finished: the end of its last Done task, else the day it moved into that stage. On time, the badge goes away and the card says Done with that date; late, it reads "Finished N days late" and that number never grows. '
61
61
  + 'Never change a date, a task or the stage to clear or shorten the badge: the dates are the record. When the PM asks why it shows, explain this rule.',
62
62
  'The Work timeline draws one bar per initiative, from the earliest start to the latest due of its tasks. An initiative with no dated task has no bar. Every stage shows there, Monitor and Evaluate included. Use these rules when the PM asks why an initiative is not on the timeline.',
63
- `A stage's document fills its card only through \`pmos coredoc write --scope initiative:${ini} --key wf-<stage key> --file <path>\` (the stage keys are in \`pmos workflow of ${ini}\`). It is a draft the PM issues on the page. A file written under planning/ is not linked to a card.`,
63
+ `A stage's document fills its card only through \`pmos coredoc write --scope initiative:${ini} --key wf-<stage key> --file <path>\` (the stage keys are in \`pmos workflow of ${ini}\`). It is a draft the PM issues. Where to issue it, in these words only: "Press ✓ on the file chip under this answer, or on the ✦ row 'Issue the … document' at the top of the initiative's Where it stands." Never name a stage card, an Issue button or any other place. A newer draft replaces the older ones, so only the newest can be issued. A file written under planning/ is not linked to a card.`,
64
64
  );
65
65
  out.push(/* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */"The card buttons run these pmos commands (the card catalog; who acts: you = one press with Undo, agent = PMOS starts a run, waits = only after the PM says yes). Run the one that fits the PM's ask, and tell the PM the Undo line it prints: pmos task set <id> --due <date> [--start <date>] [--owner <who>] [--notes <text>] [--milestone] [--pin] [--no-milestone] (Move the date, Set start and due, Change owner, Add a note, Make it a milestone, Pin, Back to a task; you); pmos task state <id> --to <state> --why <text> (Change status, Mark done; you); pmos task comment <id> <text> (Comment; you); pmos task describe <id> (Write the description; agent); pmos task remove <id> --why <text> (Remove; you); pmos task add <initiative> \"<title>\" --parent <task> [--due <date>] [--owner <who>] (Add a subtask, Add a task; you); pmos rehearse move <id> --due <date> [--by <days>] (What slips if it moves, Move a task; you); pmos task link <from> <to> --type fs|ss|ff|sf --lag <days> (Link two tasks; you); pmos task unlink <from> <to> (Unlink; you); pmos item move <item> <todo|doing|review|done> --evidence <ref> (Move on the board; you); pmos item set <item> --due <date> --owner <who> (Change date or owner; you); pmos item withdraw <item> (Withdraw; you); pmos initiative up|down <id> (Move up / down; you); pmos initiative top|bottom <id> (Move to top / bottom; you); pmos initiative after <id> <other> (Rank after another; you); pmos initiative check-by <id> <date> (Set check date; you); pmos initiative kind <id> product|project|sdlc (Change kind; you); pmos workflow switch <id> --to <workflow> --stage <stage> --why <text> (Change workflow; you); pmos workflow move <id> --stage <stage> --why <text> (Move to stage; you); pmos initiative describe <id> (Write the description; agent); pmos parked hold <id> --why <text> (Park it, Change the reason; you); pmos initiative export <id> (Export the breakdown; you); pmos initiative adopt <proposal> (Keep; you); pmos initiative drop <proposal> (Drop; you); pmos parked back <id> (Bring back; you); pmos launch check <initiative> --date <date> (Check what is not ready; you); pmos launch tier <initiative> (Set the launch tier; you); pmos ready check <initiative> (Run the check; you); pmos artefacts set <scope> <artefact> --text <text> (Write it; you); pmos artefacts undo <a-id> (Undo; you); pmos signoff ask <initiative> --who <who> (Ask; waits); pmos signoff answer <id> --answer <text> (Record the answer; you); pmos signoff drop <id> --why <text> (Drop; you); pmos rehearse end <initiative> --to <date> (Move the end; you); pmos rehearse cut <task|initiative> (Cut it; you)."/* card-catalog:end */);
66
66
  return out;
@@ -8,6 +8,9 @@
8
8
  * Every route answers 410 for a portfolio or board scope (retired, below).
9
9
  * POST /api/core-docs/issue { ws, scope, key, slot } → { ok } `state: issued` in the file and one `issue` line
10
10
  * POST /api/core-docs/drop { ws, scope, key, slot } → { ok } one `drop` line
11
+ * POST /api/core-docs/unissue { ws, scope, key, slot } → { ok } Undo of Issue: one `unissue` line, `state: draft` in the file again
12
+ * GET /api/core-docs/of?ws&path → { ok, doc: { scope, key, slot, title, state, newer? } | null } the draft a file is
13
+ * (issue-from-chat: a chat file chip shows ✓ Issue on a core-document draft). One ledger read, no gather, so it answers in a few ms.
11
14
  *
12
15
  * WHO WRITES. Every POST refuses a request that carries an agent session header (403), as routes-scan.js does. Draft it passes pm-guard
13
16
  * requirePagePress; Issue it and Drop pass requirePmPress (act `issue`): only the PM issues or drops a core document. A draft is never sent.
@@ -34,7 +37,7 @@ const headless = require('./headless.js');
34
37
 
35
38
  const text = (v) => (typeof v === 'string' ? v : '');
36
39
  const bad = (status, error) => ({ status, body: { ok: false, error } });
37
- const POSTS = ['draft', 'issue', 'drop'];
40
+ const POSTS = ['draft', 'issue', 'unissue', 'drop'];
38
41
 
39
42
  const runs = new Map(); // `${ws}|${scope}|${key}` → session id, for the core-doc runs this server started
40
43
 
@@ -109,6 +112,12 @@ async function handle(req, res, url, ctx) {
109
112
  if (!g.ok) return send(bad(g.status || 400, g.error));
110
113
  return send({ status: 200, body: CD.answer(g.facts, { running: isRunning(w.id) }) });
111
114
  }
115
+ if (sub === 'of') {
116
+ if (req.method !== 'GET') return send(bad(405, 'GET only'));
117
+ const w = wsOf(ctx, url.searchParams.get('ws'));
118
+ if (!w) return send(bad(404, 'no such workspace'));
119
+ return send({ status: 200, body: { ok: true, doc: CD.draftOfPath(w.root, url.searchParams.get('path') || '') } });
120
+ }
112
121
  if (!POSTS.includes(sub)) return send(bad(404, 'no such core-docs route'));
113
122
  if (req.method !== 'POST') return send(bad(405, 'POST only'));
114
123
  const read = await ctx.readJson(req);
@@ -135,7 +144,7 @@ async function handle(req, res, url, ctx) {
135
144
  }
136
145
  const c = CD.checkEntry(scope, key);
137
146
  if (!c.ok) return send(bad(c.status, c.error));
138
- const fn = sub === 'issue' ? CD.issue : CD.drop;
147
+ const fn = sub === 'issue' ? CD.issue : sub === 'unissue' ? CD.unissue : CD.drop;
139
148
  const r = fn(w.root, { scope, key, slot: text(body.slot) }, g.actor, { now });
140
149
  if (!r.ok) return send(bad(r.status, r.error));
141
150
  refresh();
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.800.0",
3
+ "version": "0.802.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.800.0",
9
+ "version": "0.802.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.800.0",
3
+ "version": "0.802.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -263,7 +263,8 @@ function wire(body, key) {
263
263
  const H = {
264
264
  // planned versus actual (batch 11 item 8, pm/ini-versions.js): where a draft's writes go, the read after Make live, the toast with Undo
265
265
  where: () => { const r = O.rowOf(key), M = O.M() || {}; return { ws: (r && r.ws) || (M.board && M.board.ws), board: (r && r.boardId) || (M.board && M.board.id) }; },
266
- reload: () => (O.reload ? O.reload() : null),
266
+ // the core documents are read again too, so an issued draft's ✦ goes away (issue-from-chat)
267
+ reload: () => { const r = O.rowOf(key); if (r && r.id) readPage(r, true); return O.reload ? O.reload() : null; },
267
268
  toast: (m, undo) => (O.toast ? O.toast(m, undo) : null),
268
269
  check: (uid, b) => { const r = O.rowOf(key), k = r && (r.tasks || []).find((x) => x.uid === uid); if (r && O.setTask) O.setTask(r, uid, k && k.status === 'Done' ? 'To do' : 'Done'); },
269
270
  // the quick changes (batch 9 item 5b): the status caret, the date press and a Timeline or Kanban drag, each with Undo in the toast
@@ -75,9 +75,9 @@ export function sugHtml(s) {
75
75
  const will = sugWill(s), src = (s.sources || []).map((x) => x && x.label).filter(Boolean).join(', ');
76
76
  const ans = s.choices
77
77
  ? s.choices.map((c, i) => `<button type="button" class="pm-btn outline" data-pw-choice="${esc(s.id + '|' + i)}">${esc(c.label)}</button>`).join('') + `<button type="button" class="pm-btn outline" data-pw-drop="${esc(s.id)}" aria-label="Not now" title="Not now">${SV(I.x)}</button>`
78
- : `<button type="button" class="pm-btn" data-pw-sug="${esc(s.id)}" aria-label="Change it first" title="Change it first">${SV(I.pen)}</button>`
79
- + `<button type="button" class="pm-btn primary" data-pw-keep="${esc(s.id)}" aria-label="Yes, do it" title="Yes, do it">${SV(I.ok)}</button>`
80
- + `<button type="button" class="pm-btn outline" data-pw-drop="${esc(s.id)}" aria-label="No" title="No">${SV(I.x)}</button>`;
78
+ : `<button type="button" class="pm-btn" data-pw-sug="${esc(s.id)}" aria-label="${s.issue ? 'Read it first' : 'Change it first'}" title="${s.issue ? 'Read it first' : 'Change it first'}">${SV(I.pen)}</button>`
79
+ + `<button type="button" class="pm-btn primary" data-pw-keep="${esc(s.id)}" aria-label="${s.issue ? 'Issue it' : 'Yes, do it'}" title="${s.issue ? 'Issue it' : 'Yes, do it'}">${SV(I.ok)}</button>`
80
+ + `<button type="button" class="pm-btn outline" data-pw-drop="${esc(s.id)}" aria-label="${s.issue ? 'Not now' : 'No'}" title="${s.issue ? 'Not now' : 'No'}">${SV(I.x)}</button>`;
81
81
  return `<div class="pm-sug x" role="group" aria-label="PMOS suggests"><div class="ttl">${SV(I.star)}<b class="say">${esc(s.say)}</b></div>`
82
82
  + `<dl>${row('Why', esc(s.why))}${row('PMOS will', will.length && !(will.length === 1 && will[0] === s.say) ? `<ul>${will.map((w) => `<li>${esc(w)}</li>`).join('')}</ul>` : '')}${row('Based on', esc(src), 'src')}</dl>`
83
83
  + `<div class="ans">${ans}</div></div>`;
@@ -361,7 +361,7 @@ body:has(.hm-addm:not([hidden])) .cz-fab { visibility: hidden; }
361
361
  .hm-stop i { width: 9px; height: 9px; border-radius: 2px; background: var(--cz-ink); }
362
362
  .hm-box-rich, .hm-box#hmForm, form.hm-box { display: flex; flex-direction: column; gap: 6px; padding: var(--space-8); border-radius: var(--radius-panel, 24px); background: var(--cz-well); }
363
363
  form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: none; font: inherit; font-size: var(--fs-body); color: var(--cz-ink); padding: var(--space-8) 10px; outline: none; line-height: var(--lh-body); }
364
- .hm-tb { display: flex; align-items: center; gap: var(--space-4); }
364
+ .hm-tb { display: flex; align-items: center; gap: var(--space-4); order: 5; } /* the controls row is the box's last row: the files and marks of the next message sit between the text and it */
365
365
  .hm-tb .sp { flex: 1; }
366
366
  .hm-tool { width: 36px; height: 36px; border-radius: var(--radius-md, 12px); display: grid; place-items: center; border: 0; background: none; color: var(--cz-ink2); cursor: pointer; font-size: var(--fs-body); line-height: var(--lh-body); }
367
367
  .hm-tool:hover { background: var(--cz-well2); }
@@ -551,6 +551,11 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
551
551
  .hm-chat .ctxchip b { font-size: var(--fs-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: var(--lh-meta); }
552
552
  .hm-chat .ctxchip em { font-style: normal; font-size: var(--fs-meta); color: var(--cz-ink3); line-height: var(--lh-meta); }
553
553
  .hm-chat .ctxchip.lead { box-shadow: inset 0 0 0 1.5px var(--cz-blue); }
554
+ /* a core-document draft's chip and its ✓ Issue (issue-from-chat): one icon button beside the chip, primary while the draft waits */
555
+ .hm-chat .ctxdoc { display: inline-flex; align-items: stretch; gap: var(--space-4, 4px); max-width: 100%; }
556
+ .hm-chat .ctxiss { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0; border-radius: var(--radius-md, 12px); border: 0; background: var(--cz-blue); color: var(--cz-card); cursor: pointer; }
557
+ .hm-chat .ctxiss .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
558
+ .hm-chat .ctxiss:disabled { opacity: .5; cursor: default; }
554
559
  .hm-chat .ctxchip svg, .hm-chat .i { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: none; }
555
560
  .hm-chat .tc, .hm-chat .gcard { margin-top: var(--space-8); padding: var(--space-12) 14px; border-radius: var(--radius-card, 16px); background: var(--cz-card); box-shadow: inset 0 0 0 1.5px var(--cz-blue); font-size: var(--fs-body); line-height: var(--lh-body); }
556
561
  .hm-chat .agtag, .hm-chat .askh { margin: 0 0 var(--space-4); font-size: var(--fs-badge); font-weight: var(--fw-strong); color: var(--cz-ink3); line-height: var(--lh-badge); }
@@ -968,20 +973,18 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
968
973
  body.cz-home:not(.hm-plist) .hm-a:not(.held):not(:focus-within) .hm-tools { height: 0; margin: 0; overflow: hidden; opacity: 0; }
969
974
  body.cz-home:not(.hm-plist) .hm-log > .hm-worked:has(+ .hm-a:not(.held):not(:focus-within)):not(:has([aria-expanded="true"])):not(:focus-within) { display: none; }
970
975
 
971
- /* the foot: one box, + · input · mic · send, on the card with no fade over the stream */
976
+ /* the foot: one box on the card with no fade over the stream. The text has the box's full width and grows upward; the controls
977
+ * sit in one row under it, + at the left and undo · mic · send at the right (Wawan 2026-11-25, the same layout as the desktop) */
972
978
  body.cz-home:not(.hm-plist) #hmFoot { padding: var(--space-12) var(--space-16) calc(var(--space-12) + env(safe-area-inset-bottom)); background: var(--cz-card); }
973
979
  body.cz-home:not(.hm-plist) #hmFoot::before { content: none; }
974
- body.cz-home:not(.hm-plist) form#hmForm.hm-box { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 0; padding: var(--space-4); border-radius: var(--radius-panel, 26px); }
975
- body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-tb { display: contents; }
976
- body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-tb > :is(.sp, .hm-key) { display: none; }
977
- body.cz-home:not(.hm-plist) form#hmForm.hm-box > *, body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-tb > * { order: 2; }
978
- body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-addw { order: 0; width: 44px; flex: none; margin: 0; }
979
- body.cz-home:not(.hm-plist) form#hmForm.hm-box textarea { order: 1; flex: 1; min-width: 0; box-sizing: border-box; min-height: 44px; margin: 0; padding: 11px var(--space-8) 11px var(--space-4); line-height: 22px; }
980
+ body.cz-home:not(.hm-plist) form#hmForm.hm-box { gap: 0; padding: var(--space-4); border-radius: var(--radius-panel, 26px); }
981
+ body.cz-home:not(.hm-plist) form#hmForm.hm-box textarea { width: 100%; box-sizing: border-box; min-height: 44px; margin: 0; padding: 11px var(--space-12) var(--space-4); line-height: 22px; }
980
982
  body.cz-home:not(.hm-plist) form#hmForm.hm-box textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one row: a long placeholder ends in … */
981
- body.cz-home:not(.hm-plist) form#hmForm.hm-box .ut-mic { order: 3; }
982
- body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-send { order: 4; }
983
+ body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-tb { gap: var(--space-4); }
984
+ body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-tb > .hm-key { display: none; }
985
+ body.cz-home:not(.hm-plist) form#hmForm.hm-box .hm-addw { width: 44px; flex: none; margin: 0; }
983
986
  body.cz-home:not(.hm-plist) form#hmForm.hm-box :is(.hm-tool, .ut-mic, .hm-send) { flex: none; width: 44px; height: 44px; margin: 0; }
984
- body.cz-home:not(.hm-plist) form#hmForm.hm-box > .hm-files { order: 9; flex-basis: 100%; padding: var(--space-4) var(--space-8); box-sizing: border-box; }
987
+ body.cz-home:not(.hm-plist) form#hmForm.hm-box > .hm-files { padding: var(--space-4) var(--space-8); box-sizing: border-box; }
985
988
  }
986
989
  @container hmchat (max-width: 760px) {
987
990
  /* the In: chip and "also" leave the box: the context line says it */
@@ -1006,20 +1009,18 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
1006
1009
  .cz-pop-chat .hm-tools { margin-top: var(--space-8); }
1007
1010
  .cz-pop-chat .hm-a:not(.last):not(.held):not(:focus-within) .hm-tools { height: 0; margin: 0; overflow: hidden; opacity: 0; }
1008
1011
 
1009
- /* the foot: one box, + · input · mic · send, on the card with no fade over the stream */
1012
+ /* the foot: one box on the card with no fade over the stream. The text has the box's full width and grows upward; the controls
1013
+ * sit in one row under it, + at the left and undo · mic · send at the right (Wawan 2026-11-25, the same layout as the desktop) */
1010
1014
  .cz-pop-chat #hmFoot { padding: var(--space-12) var(--space-16) calc(var(--space-12) + env(safe-area-inset-bottom)); background: var(--cz-card); }
1011
1015
  .cz-pop-chat #hmFoot::before { content: none; }
1012
- .cz-pop-chat form#hmForm.hm-box { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 0; padding: var(--space-4); border-radius: var(--radius-panel, 26px); }
1013
- .cz-pop-chat form#hmForm.hm-box .hm-tb { display: contents; }
1014
- .cz-pop-chat form#hmForm.hm-box .hm-tb > :is(.sp, .hm-key) { display: none; }
1015
- .cz-pop-chat form#hmForm.hm-box > *, .cz-pop-chat form#hmForm.hm-box .hm-tb > * { order: 2; }
1016
- .cz-pop-chat form#hmForm.hm-box .hm-addw { order: 0; width: 44px; flex: none; margin: 0; }
1017
- .cz-pop-chat form#hmForm.hm-box textarea { order: 1; flex: 1; min-width: 0; box-sizing: border-box; min-height: 44px; margin: 0; padding: 11px var(--space-8) 11px var(--space-4); line-height: 22px; }
1016
+ .cz-pop-chat form#hmForm.hm-box { gap: 0; padding: var(--space-4); border-radius: var(--radius-panel, 26px); }
1017
+ .cz-pop-chat form#hmForm.hm-box textarea { width: 100%; box-sizing: border-box; min-height: 44px; margin: 0; padding: 11px var(--space-12) var(--space-4); line-height: 22px; }
1018
1018
  .cz-pop-chat form#hmForm.hm-box textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* one row: a long placeholder ends in … */
1019
- .cz-pop-chat form#hmForm.hm-box .ut-mic { order: 3; }
1020
- .cz-pop-chat form#hmForm.hm-box .hm-send { order: 4; }
1019
+ .cz-pop-chat form#hmForm.hm-box .hm-tb { gap: var(--space-4); }
1020
+ .cz-pop-chat form#hmForm.hm-box .hm-tb > .hm-key { display: none; }
1021
+ .cz-pop-chat form#hmForm.hm-box .hm-addw { width: 44px; flex: none; margin: 0; }
1021
1022
  .cz-pop-chat form#hmForm.hm-box :is(.hm-tool, .ut-mic, .hm-send) { flex: none; width: 44px; height: 44px; margin: 0; }
1022
- .cz-pop-chat form#hmForm.hm-box > .hm-files { order: 9; flex-basis: 100%; padding: var(--space-4) var(--space-8); box-sizing: border-box; }
1023
+ .cz-pop-chat form#hmForm.hm-box > .hm-files { padding: var(--space-4) var(--space-8); box-sizing: border-box; }
1023
1024
  }
1024
1025
  /* the notes a turn's worked line folds (popup round 3 point 19c): quiet, above its steps */
1025
1026
  .hm-notes { padding: var(--space-4) 0 2px 18px; }
@@ -741,7 +741,28 @@ async function direct(d, ask, x, h) {
741
741
  if (h.reload) await h.reload();
742
742
  });
743
743
  }
744
+ /* a drafted document's ✓ (issue-from-chat): POST /api/core-docs/issue marks the draft issued; Undo posts /api/core-docs/unissue. Nothing is sent. */
745
+ async function issueDoc(s, x, h) {
746
+ const w = h.where ? h.where() : {}, o = x.o(), ws = w.ws || o.ws, body = { ws, scope: 'initiative:' + o.id, key: s.issue.key, slot: s.issue.slot };
747
+ const res = await pmPost('/api/core-docs/issue', body).catch(() => null);
748
+ if (!res || res.ok === false) { if (h.toast) h.toast((res && res.error) || 'The draft was not issued.'); if (h.reload) await h.reload(); return; }
749
+ if (h.reload) await h.reload();
750
+ undoToast(s.issue.title + ' issued. Nothing was sent to anyone.', async () => {
751
+ const u = await pmPost('/api/core-docs/unissue', body).catch(() => null);
752
+ if (!u || u.ok === false) { if (h.toast) h.toast((u && u.error) || 'The undo did not land.'); return; }
753
+ if (h.reload) await h.reload();
754
+ });
755
+ }
756
+ /* ✎ on a drafted document's ✦: the draft opens to read or edit, with Issue it on top (pm/home-draft.js) */
757
+ async function readDraft(s, x, h) {
758
+ const w = h.where ? h.where() : {}, o = x.o(), A = await import('./home-draft.js');
759
+ VW.drill();
760
+ A.openDraftVw({ VW, pmGet, pmPost, toast: h.toast || (() => {}), ws: w.ws || o.ws, scope: 'initiative:' + o.id,
761
+ doc: { key: s.issue.key, title: s.issue.title, path: s.issue.path, slot: s.issue.slot, st: 'draft', state: 'Draft' }, iniTitle: (x.v() || {}).title || '',
762
+ onIssued: async () => { if (h.reload) await h.reload(); } });
763
+ }
744
764
  async function keepSug(s, x, h) {
765
+ if (s.issue) { await issueDoc(s, x, h); return; }
745
766
  if (s.derived) {
746
767
  if (s.move && h.move) { await h.move(s.move.uid, { to: s.move.to, from: '', name: s.move.name }); return; }
747
768
  if (s.moveAll) { await moveAll(s.moveAll, h); return; }
@@ -1010,6 +1031,7 @@ function big(c, x, h) {
1010
1031
  void title;
1011
1032
  }
1012
1033
  function openSug(s, c, x, h) {
1034
+ if (s.issue) { readDraft(s, x, h); return; }
1013
1035
  VW.drill();
1014
1036
  VW.open({ kind: 'Suggestion', title: 'Suggestion', icon: 'spark', id: 'sug:' + s.id, back: true,
1015
1037
  render: (b) => {
@@ -477,8 +477,9 @@ export function mountChat(el, host) {
477
477
  function askOf(id) { const m = ((C.conv && C.conv.messages) || []).find((x) => x.role === 'tool' && x.ask && askId(x) === id); return m ? m.ask : null; }
478
478
  /* the context chips under an answer (the files, tickets, pages and links it worked with), drawn as premium-vw-ctx draws them */
479
479
  let chipsHtmlFn = null;
480
- views.ctx().then((M) => { chipsHtmlFn = M.chipsHtml; if (C.t) draw(); }).catch(() => {});
481
- const chipsOf = (items) => (chipsHtmlFn ? chipsHtmlFn(items) : '');
480
+ // a core-document draft's chip carries ✓ Issue (issue-from-chat): the module reads its state and draws again when it knows it
481
+ views.ctx().then((M) => { chipsHtmlFn = M.chipsHtml; if (M.configure) M.configure({ pmGet: (u) => host.pmGet(u), pmPost: (u, b) => host.pmPost(u, b), toast: (t) => host.toast(t), redraw: () => { if (C.t) draw(); } }); if (C.t) draw(); }).catch(() => {});
482
+ const chipsOf = (items) => (chipsHtmlFn ? chipsHtmlFn(items, { ws: (C.t && C.t.ws) || new URLSearchParams(location.search).get('ws') || '' }) : '');
482
483
  function drawFoot(R) {
483
484
  const t = C.t, goal = C.th && C.th.goal;
484
485
  const also = t.also && !(C.conv && C.conv.ask) ? `<button type="button" class="hm-also" data-hm-also><i aria-hidden="true"></i><span><b>Also waiting on you:</b> ${esc(t.also.text)}</span><em>${esc(t.also.verb || 'Answer')}</em></button>` : '';
@@ -638,6 +639,7 @@ export function mountChat(el, host) {
638
639
  if ('hmSignin' in d) { import('./cozy-settings.js').then((S) => S.openSettings('connectors')); return; } // a reach ask: Sign in to Jira opens Settings › Connectors
639
640
  if ('hmFile' in d) { const i = foot.querySelector('#hmFile'); if (i) i.click(); return; }
640
641
  if (d.reportOpen != null && d.reportOpen !== '') { e.preventDefault(); const m = ((C.conv && C.conv.messages) || [])[+d.reportOpen]; const bl = m ? splitReport(splitGoal(m.text).text).block : null; if (bl) views.block(bl, { chat: C.t.key || null }); return; }
642
+ if (d.ctxIssue != null) { e.preventDefault(); views.ctx().then((M) => M.issuePress(b)); return; }
641
643
  if (d.ctx != null) { e.preventDefault(); views.ctx().then((M) => M.openCtx(M.itemOf(b), where())); return; }
642
644
  if (d.file) { e.preventDefault(); views.file().then((M) => M.openChatFile(d.file, where())); return; }
643
645
  if (d.att) { e.preventDefault(); if (/\/notes\/n[0-9a-z]{6,16}\.md$/.test(d.att)) openNotesHere(d.att.split('/').pop().replace(/\.md$/, '')); else views.attach().then((M) => M.openAttachment(d.att)); return; }
@@ -507,7 +507,8 @@ const andList = (a) => (a.length <= 1 ? a.join('') : a.slice(0, -1).join(', ') +
507
507
  * place, so a draft could land where nothing looks. */
508
508
  const docSave = (id) => (id ? ' When I say yes, save each one where the Artefacts list reads it: a PRD as a file the record names in `prd_path:`, a rubric in `rubric_path:`, the done test with `pmos artefacts set experiment:' + id + ' done-test check --text "<one check>"` once for each check, and any other document with `pmos coredoc write --scope initiative:' + id + ' --key <key> --file <path>`.' : '');
509
509
  /** derivedOf(r, v, o, bd, arts) → { top: [s], rows: Map(uid → s) }. Each s: { id, derived: true, say, why, ask?, move?, direct? }. ask: the words ✓
510
- * sends to Ask PMOS, which does it in a real session; move: { uid, to, name } ✓ puts a task in a stage. direct: { act, to? } ✓ (or a choice)
510
+ * sends to Ask PMOS, which does it in a real session; move: { uid, to, name } ✓ puts a task in a stage; issue: { key, slot, path, title } ✓ issues a
511
+ * drafted core document (POST /api/core-docs/issue) with Undo. direct: { act, to? } ✓ (or a choice)
511
512
  * writes at once through POST /api/boards/ini-<act>, with Undo, and sends `ask` only when the route answers ask: true (bet 1f). o.dropped: the
512
513
  * ids the PM said No to. */
513
514
  export function derivedOf(r, v, o, bd, arts) {
@@ -530,6 +531,16 @@ export function derivedOf(r, v, o, bd, arts) {
530
531
  why: 'The gate to the next stage needs ' + what + ', and ' + (miss.length === 1 ? 'it is' : 'they are') + ' not written.',
531
532
  ask: 'Draft ' + what + ' for ' + title + (n ? ' from its ' + plural(n, 'document', 'documents') : '') + ', for me to read.' + docSave(o.id || v.id || v.key || r.id) });
532
533
  }
534
+ // a document PMOS drafted waits to be issued (issue-from-chat): one ✦ per draft, ✓ issues it with Undo, ✎ opens it to read or edit, ✕ hides it.
535
+ // Before, a draft the chat saved had no Issue anywhere on this page, and the chat sent the PM to a card that did not exist.
536
+ for (const d of o.docs || []) {
537
+ if (!d || d.st !== 'draft' || !d.slot || !d.path || !d.key || d.running) continue;
538
+ const name = /\bdocument\b/i.test(d.title || '') ? d.title : (d.title || 'stage') + ' document';
539
+ const on = dayText(String(d.slot).slice(0, 10), t);
540
+ top.push({ id: 'd:issue:' + d.key + ':' + d.slot, derived: true, say: 'Issue the ' + name + (on ? ', drafted ' + on : '') + '?',
541
+ why: 'PMOS drafted it and it waits for you. Issuing marks it as the current version. Nothing is sent to anyone.',
542
+ issue: { key: d.key, slot: d.slot, path: d.path, title: d.title || name } });
543
+ }
533
544
  // honest state (round 3 point 13): closed or done, with open tasks, is a contradiction PMOS asks about
534
545
  const nOpen = (v.tasks || {}).open || 0;
535
546
  if ((r.closed || r.ended || r.status === 'done') && nOpen > 0) {
@@ -549,7 +560,8 @@ export function workOf(r, v, o = {}) {
549
560
  const t = todayOf(o);
550
561
  const sum = summaryOf(r, v, o), sug = suggestsOf(v), bd = breakdownOf(r, v, o), arts = artefactsOf(v, o);
551
562
  const dv = derivedOf(r, v, o, bd, arts);
552
- const all = sug.top.concat(dv.top), rowS = new Map(sug.rows);
563
+ // a draft that waits to be issued comes first: the PM asked for it, and it is the one thing on the page only they can finish
564
+ const all = dv.top.filter((s) => s.issue).concat(sug.top, dv.top.filter((s) => !s.issue)), rowS = new Map(sug.rows);
553
565
  for (const [k, s] of dv.rows) if (!rowS.has(k)) rowS.set(k, s);
554
566
  const dates = [r.start, r.end].concat(bd.rows.flatMap((x) => [x.start, x.end])).filter(Boolean);
555
567
  const tk = trackOf(dates, o.mode || 'full', t), span = tk.span;
@@ -4,7 +4,9 @@
4
4
  * web → premium-vw-file.js openWebLink (a Google Doc or Confluence copy, or a Claude artifact's Open in Claude)
5
5
  * jira → a ticket tab from the stored Jira readings (GET /api/jira/ticket); PMOS never reads Jira from here
6
6
  * slack → a Slack tab with Open in Slack; PMOS stores no Slack message to show
7
- * Nothing here writes. */
7
+ * A file chip that is a core-document draft PMOS wrote or named (issue-from-chat) carries ✓ Issue beside it while the draft waits: the chip reads
8
+ * its state once (GET /api/core-docs/of), ✓ posts /api/core-docs/issue, and the toast's Undo posts /api/core-docs/unissue. Nothing is sent to
9
+ * anyone. That is the only write here. */
8
10
  import { vwOpen, vwStyle } from './premium-viewer.js';
9
11
  import { openChatFile, openWebLink } from './premium-vw-file.js';
10
12
  import { slackUrl } from './chat-context.js';
@@ -21,10 +23,54 @@ const ref = (it) => (it.kind === 'file' ? it.path : it.kind === 'jira' ? it.key
21
23
 
22
24
  /** The chip row under an answer. Pure. The first item is the main one: it is what opened by itself.
23
25
  * Two or more things Claude only read fold into one "+N read" (batch 17 item 5): what it wrote or named stays in sight. */
24
- const chipHtml = (it, lead) => `<button type="button" class="ctxchip${lead ? ' lead' : ''}" role="listitem" data-ctx="${esc(it.kind)}" data-ctx-ref="${esc(ref(it))}"${it.ts ? ` data-ctx-ts="${esc(it.ts)}"` : ''}${it.web ? ` data-ctx-web="${esc(it.web)}"` : ''} title="${esc(ref(it))}">${icon(it.kind)}<span><b>${esc(it.title)}</b><em>${esc(it.sub)}</em></span></button>`;
26
+ const chip0 = (it, lead, sub, role = ' role="listitem"') => `<button type="button" class="ctxchip${lead ? ' lead' : ''}"${role} data-ctx="${esc(it.kind)}" data-ctx-ref="${esc(ref(it))}"${it.ts ? ` data-ctx-ts="${esc(it.ts)}"` : ''}${it.web ? ` data-ctx-web="${esc(it.web)}"` : ''} title="${esc(ref(it))}">${icon(it.kind)}<span><b>${esc(it.title)}</b><em>${esc(sub)}</em></span></button>`;
27
+ const OK = '<svg class="i" viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
28
+
29
+ /* ── a core-document draft on a chip (issue-from-chat) ── */
30
+ const DOC_RE = /(?:^|\/)core-docs\/initiative-([A-Za-z0-9][A-Za-z0-9._-]{0,79})\/([A-Za-z0-9][A-Za-z0-9_-]{0,79})\/(\d{4}-\d{2}-\d{2}(?:-\d{1,2})?)\.md$/;
31
+ /** The draft a path names: { scope, key, slot }, or null. Pure. */
32
+ export function draftOf(p) { const m = DOC_RE.exec(String(p || '')); return m ? { scope: 'initiative:' + m[1], key: m[2], slot: m[3] } : null; }
33
+ const DST = new Map(); // ws|path → 'reading' | 'draft' | 'issued' | 'superseded' | 'dropped' | 'none'
34
+ const IO = { pmGet: null, pmPost: null, toast: null, redraw: null };
35
+ /** The page's reads and toast; home-chat.js sets them once. */
36
+ export function configure(o = {}) { Object.assign(IO, o); }
37
+ const SUB = { draft: 'Draft · waits for you to issue', issued: 'Issued', superseded: 'Older draft · a newer one replaces it', dropped: 'Dropped' };
38
+ function stateOf(it, ws) {
39
+ const k = (ws || '') + '|' + it.path;
40
+ if (!DST.has(k) && IO.pmGet) {
41
+ DST.set(k, 'reading');
42
+ IO.pmGet('/api/core-docs/of?path=' + encodeURIComponent(it.path) + (ws ? '&ws=' + encodeURIComponent(ws) : ''))
43
+ .then((r) => { DST.set(k, r && r.ok && r.doc ? r.doc.state : 'none'); if (IO.redraw && DST.get(k) !== 'none') IO.redraw(); })
44
+ .catch(() => DST.set(k, 'none'));
45
+ }
46
+ return DST.get(k) || '';
47
+ }
48
+ /** A chip; a draft PMOS wrote or named gets ✓ Issue beside it while it waits. Pure but for the one state read. */
49
+ export function chipHtml(it, lead, o = {}) {
50
+ const d = it.kind === 'file' && it.how !== 'read' && draftOf(it.path);
51
+ if (!d) return chip0(it, lead, it.sub);
52
+ const st = stateOf(it, o.ws);
53
+ if (st !== 'draft') return chip0(it, lead, SUB[st] || it.sub);
54
+ return `<span class="ctxdoc" role="listitem">${chip0(it, lead, SUB.draft, '')}<button type="button" class="ctxiss" data-ctx-issue="${esc(it.path)}" data-ctx-ws="${esc(o.ws || '')}" aria-label="Issue this draft. Nothing is sent to anyone" title="Issue it">${OK}</button></span>`;
55
+ }
56
+ /** ✓ on a draft's chip: issue it, then Undo in the toast. b: the ✓ button. */
57
+ export async function issuePress(b) {
58
+ const p = b.dataset.ctxIssue, ws = b.dataset.ctxWs || '', d = draftOf(p); if (!d || !IO.pmPost) return;
59
+ b.disabled = true;
60
+ const body = { ...(ws ? { ws } : {}), ...d }, k = ws + '|' + p;
61
+ const r = await IO.pmPost('/api/core-docs/issue', body).catch(() => null);
62
+ if (!r || r.ok === false) { b.disabled = false; DST.delete(k); if (IO.toast) IO.toast((r && r.error) || 'The draft was not issued.'); if (IO.redraw) IO.redraw(); return; }
63
+ DST.set(k, 'issued'); if (IO.redraw) IO.redraw();
64
+ const undo = async () => {
65
+ const u = await IO.pmPost('/api/core-docs/unissue', body).catch(() => null);
66
+ if (!u || u.ok === false) { if (IO.toast) IO.toast((u && u.error) || 'The undo did not land.'); return; }
67
+ DST.set(k, 'draft'); if (IO.redraw) IO.redraw();
68
+ };
69
+ try { const H = await import('./hi-pop.js'); H.undoToast('Issued. Nothing was sent to anyone.', undo); } catch { if (IO.toast) IO.toast('Issued. Nothing was sent to anyone.'); }
70
+ }
25
71
  const OPEN = new Set(); // the folds the PM opened stay open when the conversation redraws
26
72
  const foldId = (items) => items.map((it) => it.id || ref(it)).join('|');
27
- export function chipsHtml(items) {
73
+ export function chipsHtml(items, o = {}) {
28
74
  if (!items || !items.length) return '';
29
75
  const read = items.filter((it) => it.how === 'read');
30
76
  let shown = items, fold = [];
@@ -34,8 +80,8 @@ export function chipsHtml(items) {
34
80
  fold = items.filter((it) => !shown.includes(it));
35
81
  }
36
82
  const id = fold.length ? foldId(fold) : '';
37
- const more = fold.length ? `<details class="ctxmore" role="listitem" data-ctx-fold="${esc(id)}"${OPEN.has(id) ? ' open' : ''}><summary aria-label="${fold.length} more files and pages PMOS read">+${fold.length} read</summary><div class="ctxc">${fold.map((it) => chipHtml(it, false)).join('')}</div></details>` : '';
38
- return `<div class="ctxc" role="list" aria-label="What PMOS worked with">${shown.map((it, i) => chipHtml(it, i === 0)).join('')}${more}</div>`;
83
+ const more = fold.length ? `<details class="ctxmore" role="listitem" data-ctx-fold="${esc(id)}"${OPEN.has(id) ? ' open' : ''}><summary aria-label="${fold.length} more files and pages PMOS read">+${fold.length} read</summary><div class="ctxc">${fold.map((it) => chipHtml(it, false, o)).join('')}</div></details>` : '';
84
+ return `<div class="ctxc" role="list" aria-label="What PMOS worked with">${shown.map((it, i) => chipHtml(it, i === 0, o)).join('')}${more}</div>`;
39
85
  }
40
86
  if (typeof document !== 'undefined') document.addEventListener('toggle', (e) => { const d = e.target; if (!d || !d.dataset || d.dataset.ctxFold == null) return; if (d.open) OPEN.add(d.dataset.ctxFold); else OPEN.delete(d.dataset.ctxFold); }, true);
41
87
  /** An item from a chip's data attributes. */