create-pmos 0.595.0 → 0.597.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.595.0",
3
+ "version": "0.597.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.597.0",
38
+ "at": "2026-11-18T03:47:49.565Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1339,
43
+ "t": "No time limit, progress with Stop, and a version that was not made still opens",
44
+ "s": "No time limit, progress with Stop, and a version that was not made still opens",
45
+ "k": "new"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.596.0",
51
+ "at": "2026-11-18T03:21:21.557Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1333,
56
+ "t": "Settings › Connectors as a directory you can connect from",
57
+ "s": "Settings › Connectors as a directory you can connect from",
58
+ "k": "new"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.595.0",
38
64
  "at": "2026-11-18T02:36:22.728Z",
@@ -284,32 +310,6 @@
284
310
  "k": "new"
285
311
  }
286
312
  ]
287
- },
288
- {
289
- "v": "0.577.0",
290
- "at": "2026-11-17T01:37:16.629Z",
291
- "f": 4,
292
- "prs": [
293
- {
294
- "n": 1310,
295
- "t": "Improvement signals ledger, 183 feedback items, honest shallow clone, verifier that runs anywhere",
296
- "s": "Improvement signals ledger, 183 feedback items, honest shallow clone, verifier that runs anywhere",
297
- "k": "new"
298
- }
299
- ]
300
- },
301
- {
302
- "v": "0.576.0",
303
- "at": "2026-11-16T11:57:06.812Z",
304
- "f": 4,
305
- "prs": [
306
- {
307
- "n": 1308,
308
- "t": "Close the nine ADLC agent-factory gaps",
309
- "s": "Close the nine ADLC agent-factory gaps",
310
- "k": "new"
311
- }
312
- ]
313
313
  }
314
314
  ]
315
315
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@c18d4018
1
+ kernel-source: pmos@aa4bed37
2
2
  assembled: 2026-11-18
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-18T02:36:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T03:47:47Z"}
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-18T02:36:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T03:47:47Z"}
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-18T02:36:19Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T03:47:47Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.597.0",
4
+ "at": "2026-11-18T03:47:49.565Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1339,
9
+ "t": "No time limit, progress with Stop, and a version that was not made still opens",
10
+ "s": "No time limit, progress with Stop, and a version that was not made still opens",
11
+ "k": "new"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.596.0",
17
+ "at": "2026-11-18T03:21:21.557Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1333,
22
+ "t": "Settings › Connectors as a directory you can connect from",
23
+ "s": "Settings › Connectors as a directory you can connect from",
24
+ "k": "new"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.595.0",
4
30
  "at": "2026-11-18T02:36:22.728Z",
@@ -100,7 +100,7 @@ A loop never sends a message, moves a Jira ticket, merges into a product reposit
100
100
  | [Expected outcomes](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. | The PRD's success criteria, or the anchored key result | "Expected outcome" under the initiative's ✦. Today when a check is due. | `pmos ai off outcomes`. `PMOS_OUTCOMES=off` |
101
101
  | [Metric drafts](claude-proposes.md) | A product with no North Star, the first 14 days of a quarter, a program with no goal, and an initiative that gets a PRD | The last 8 weeks of real readings | The page of that product, program or initiative | `PMOS_METRIC_DRAFT=off` |
102
102
  | [Horizon scan](intelligence-okr-goals.md) | Daily by default, at most once a day, the first time you step away after 09:00. Scan now: at most 3 a day. | The public web for your kept watch list, and your repository | Report documents and proposals you approve | Cadence: Off. `PMOS_SCAN=off` |
103
- | Live round | When you press ✓ on its ✦ ask, or run `pmos lab round`. Three runs at once, 2 minutes at most. | The initiative's name, the product's Intent and its token sheet; a feedback round also reads the last version. | "PMOS prototyped it" or "PMOS improved it" under the initiative's ✦, each version as soon as it renders. | ✕ on its ✦ ask; Undo after ✓ |
103
+ | Live round | When you press ✓ on its ✦ ask, or run `pmos lab round`. Three runs at once. No time limit: you see its progress and can stop it. | The initiative's name, the product's Intent and its token sheet; a feedback round also reads the last version. | "PMOS prototyped it" or "PMOS improved it" under the initiative's ✦, each version as soon as it renders. | ✕ on its ✦ ask; Undo after ✓ |
104
104
  | Idle lab | When you have not used PMOS for 30 minutes. One run at a time, at most 3 results each time you step away. | Prototypes: the initiative's record, PRD and earlier specimens. Scans: public pages only, read through `pmos lab page`, and no repository. | "PMOS prototyped it", "PMOS improved it" and "PMOS scanned for it" under the initiative's ✦. A finding that fits no initiative: Intelligence › Lab. | `pmos ai off idle-lab` |
105
105
  | [Prototypes before a meeting](notes.md) | A meeting starts in the next 60 minutes, and its title, agenda or material names an initiative in Triage or Discover with no prototype. One round at a time. An initiative is tried once a week at most, and never while a round waits for you. | The initiative, as a live round reads it | Round 1 under the initiative's ✦ at minute 0. In the meeting, ✓ on **✦ Show it?** starts the next round. | `pmos ai off meeting-prewarm` |
106
106
  | [What you might have missed](claude-proposes.md) | Each Monday, for the week before. It uses no model. | Records only: tasks, dates, initiatives and Jira status | One ✦ in Home's chat, at most 3 items | `pmos ai off drift`. `PMOS_DRIFT=off` |
@@ -216,7 +216,7 @@ What each part does:
216
216
  - **What the run gets.** Each run gets the product's token sheet and the start of its component sheet (or PMOS's own), the initiative's name and the product's Intent, the files you attached, the element you pointed at, and your copy edits and sliders. A prototype must fit a 390 px phone screen.
217
217
  - **What the run can do.** A run can only read and write in its own folder in the runtime folder, plus the last version and the files you attached. It has no shell, no web and nothing that sends. Nothing goes into a product repository before your ✓.
218
218
  - **What the canvas can do.** The prototype runs in a sandboxed frame. It cannot reach PMOS. The canvas talks to it only to show a screen, point, pin, play and apply your edits.
219
- - **A version that does not render,** or that takes more than 2 minutes, is "not made" with the reason, and the chat says so.
219
+ - **No time limit.** A version takes as long as the ask needs. While PMOS makes it, the Viewer shows what it is doing now (for example "Building screen 3 of 7"), the steps done, a progress bar and the time so far, with a Stop press. A run that writes nothing for 10 minutes is stuck: PMOS stops it. A version that does not render, that is stuck or that you stop is "not made" with the reason, and the chat says so. The Viewer still opens it: it says why and shows the version it was made from. While a version is being made, a new ask on the same initiative waits: PMOS says what is running.
220
220
  - **Lessons.** Each change sentence, ✓ and ✕ is a Lessons line of the experiment (`pmos artefacts show`). Each version that rendered is a Specimens line. The one you keep is the kept specimen.
221
221
  - **The grill runs after the session, not during it.** When you keep a version, the grill runs once on the kept specimen, as the Review step. Its findings wait under the ✦ (D60 as amended on 2026-11-17).
222
222
  - **Order.** A live round is step 1 of the queue: what you asked for starts at once. While it runs, the idle lab does not start on that initiative. The idle lab treats a live round as one more round, so the rounds stay in one history.
@@ -13,7 +13,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
13
13
  |---|---|
14
14
  | General | The theme (Light, Dark or Auto), whether the Viewer opens as a column or a popup, the products Home, the Board and Intelligence read, when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›** and **Jev and Laya ›** open their own settings (see below). |
15
15
  | PMOS | **How PMOS decides** for each kind of change, the calls that are **Always yours**, and PMOS's **Lessons**. Then the Claude profile that new sessions start with, the Anthropic API key for PMOS's own runs, Sharpen prompts, and **Checks**: when PMOS grills an initiative by itself and the monthly credit for its checks. |
16
- | Connectors | Every connector your Claude session has. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
16
+ | Connectors | Every connector your Claude session has, and a directory of services you can connect. A switch chooses only what PMOS reads on its own. PMOS reads and never posts. |
17
17
  | Workspaces | The repositories PMOS works in. Remove forgets the address only; the folder is not deleted. Add one by its folder path. The **Workflows ›** row opens the stages each kind of initiative goes through, inside Settings, which then takes the whole window. See [Workflows](statuses.md). |
18
18
  | Updates | The version of the app and of each workspace's kit, the check for updates, and what changed. |
19
19
 
@@ -350,7 +350,20 @@ On a day with 3 or more meetings, PMOS proposes ✦ **Read it more often on meet
350
350
 
351
351
  The **Scheduled work** row under the sources lists everything that runs on a schedule: what PMOS reads, PMOS's own jobs (the day check, the initiative driver, signals) and your own scheduled tasks, each with its next run. Your own tasks can repeat every hour, every day, every week, every 2 weeks or every month.
352
352
 
353
- When all is well, there is no other line. ↻ in the Connectors header is **Refresh all**. The (i) button says what PMOS reads and that it never posts. The switches for what PMOS reads on its own, and the other connectors of your Claude session, are folded into one row: open it to see them. When a source needs you, the Connectors tab has an amber dot, an amber box at the top of the other Settings sections names it, and the place menu opens Settings at Connectors. PMOS repairs the other problems by itself, so you do not see a box for them (see below).
353
+ When all is well, there is no other line. ↻ in the Connectors header is **Refresh all**. The (i) button says what PMOS reads and that it never posts. Under the list is the connectors directory:
354
+
355
+ - **Search** and the category chips (Mail and calendar, Chat, Tickets, Code, Docs and files, Design, Analytics) filter the directory.
356
+ - **Connected · N** lists every connector your Claude session has, each with its switch. A connector that backs a Briefing source (for example Gmail for Mail) has that source's switch. ⌄ folds the group.
357
+ - **More sources** lists the Briefing sources that no connector backs yet, with their switches.
358
+ - **For you** shows at most 3 services that PMOS suggests: services your initiatives link, then services that go with what you already use.
359
+ - **All connectors** lists the other services.
360
+
361
+ PMOS cannot add a connector, because it keeps no passwords or keys. To connect a service:
362
+
363
+ 1. Press **+** on its row. Your Claude account's connector page (claude.ai/settings/connectors) opens in a new tab, and the row says **Waiting for** the service.
364
+ 2. Add the connector there and sign in.
365
+ 3. PMOS checks every 5 seconds for 2 minutes. When it sees the connector, it says so. If it does not see it in that time, the connector shows when your next session starts.
366
+ 4. When a new connector appears, a ✦ card says what PMOS proposes to read from it. Nothing reads it until you press ✓. ✕ means not now. When a source needs you, the Connectors tab has an amber dot, an amber box at the top of the other Settings sections names it, and the place menu opens Settings at Connectors. PMOS repairs the other problems by itself, so you do not see a box for them (see below).
354
367
 
355
368
  ### When a source cannot be read: PMOS repairs it first
356
369
 
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+ /* connector-directory.js — what Settings › Connectors needs from the server to be a directory (initiative connectors-directory;
3
+ * canvas CnA, CnB). Pure, except notice(), which takes its file reads and writes as arguments so the tests drive it.
4
+ *
5
+ * CONNECT_URL the connector page of the Claude account. PMOS never connects a service itself: it holds no
6
+ * key and no token. The + on a row opens this page; the PM adds the connector there.
7
+ * signalsOf(texts) → [catalog ids] the PM's initiative records point at (a github.com link → 'github'), for ✦ For you
8
+ * notice(prev, names, now) → { state, fresh } which connector names are new since the last read. The first read only
9
+ * remembers what is there (no flood of proposals). A new name becomes one pending proposal.
10
+ * decide(state, name, verdict) → { state, found } ✓ or Not now takes the proposal away; nothing else changes it
11
+ * proposalFor(name, source) → { name, label, source, reads, patch } what ✦ proposes for a new connector: the brief source
12
+ * it backs, else its own switch. The patch is what ✓ saves; until ✓ nothing reads it.
13
+ * probeNames(sources) → the connected names `claude mcp list` reported (lib/project-onboard.js parseMcpList)
14
+ */
15
+ const { connectorLabel } = require('./proactive.js');
16
+
17
+ const CONNECT_URL = 'https://claude.ai/settings/connectors';
18
+ const MAX_PENDING = 20, MAX_SEEN = 200, MAX_TEXT = 65536;
19
+
20
+ // A link in an initiative record → the catalog id the directory knows it by (pm/cozy-conndir.js CATALOG).
21
+ const SIGNAL_DOMAINS = [
22
+ [/github\.com\//i, 'github'], [/\.atlassian\.net\/(browse|jira)/i, 'jira'], [/\.atlassian\.net\/wiki/i, 'confluence'],
23
+ [/notion\.(so|site)\//i, 'notion'], [/figma\.com\//i, 'figma'], [/linear\.app\//i, 'linear'], [/docs\.google\.com\/|drive\.google\.com\//i, 'gdrive'],
24
+ [/calendar\.google\.com\//i, 'gcal'], [/slack\.com\/(archives|app)/i, 'slack'], [/miro\.com\//i, 'miro'],
25
+ [/asana\.com\//i, 'asana'], [/intercom\.com\//i, 'intercom'],
26
+ ];
27
+
28
+ function signalsOf(texts) {
29
+ const hits = new Map();
30
+ for (const t of Array.isArray(texts) ? texts : []) {
31
+ const s = String(t || '').slice(0, MAX_TEXT);
32
+ for (const [re, id] of SIGNAL_DOMAINS) if (re.test(s)) hits.set(id, (hits.get(id) || 0) + 1);
33
+ }
34
+ return [...hits.entries()].sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])).map(([id, n]) => ({ id, n }));
35
+ }
36
+
37
+ const cleanState = (s) => ({
38
+ seen: Array.isArray(s && s.seen) ? s.seen.filter((x) => typeof x === 'string').slice(0, MAX_SEEN) : null,
39
+ pending: Array.isArray(s && s.pending) ? s.pending.filter((x) => x && typeof x.name === 'string').slice(0, MAX_PENDING) : [],
40
+ });
41
+
42
+ function notice(prev, names, now = Date.now()) {
43
+ const st = cleanState(prev);
44
+ const list = [...new Set((Array.isArray(names) ? names : []).filter((x) => typeof x === 'string' && x))];
45
+ if (st.seen === null) return { state: { seen: list.slice(0, MAX_SEEN), pending: [] }, fresh: [] }; // the first read remembers only
46
+ const seen = new Set(st.seen);
47
+ const fresh = list.filter((n) => !seen.has(n));
48
+ const pending = [...st.pending.filter((p) => list.includes(p.name)), ...fresh.map((name) => ({ name, at: new Date(now).toISOString() }))].slice(-MAX_PENDING);
49
+ return { state: { seen: [...new Set([...st.seen, ...list])].slice(-MAX_SEEN), pending }, fresh };
50
+ }
51
+
52
+ function decide(prev, name, verdict) {
53
+ const st = cleanState(prev);
54
+ if (verdict !== 'approve' && verdict !== 'dismiss') return { state: st, found: false };
55
+ const found = st.pending.some((p) => p.name === name);
56
+ return { state: { seen: st.seen || [], pending: st.pending.filter((p) => p.name !== name) }, found };
57
+ }
58
+
59
+ const SOURCE_READS = { calendar: 'your meetings for the Briefing', mail: 'mail that needs you for the Briefing', slack: 'threads that mention you for the Briefing',
60
+ jira: 'the tasks of your initiatives for the Briefing and the Board', confluence: 'pages your initiatives link', github: 'pull requests and checks for the Briefing',
61
+ drive: 'documents your initiatives link', figma: 'design comments your initiatives link', wispr: 'meeting notes for the Briefing' };
62
+ function proposalFor(name, source) {
63
+ const label = connectorLabel(name) || name;
64
+ if (source && SOURCE_READS[source]) return { name, label, source, reads: 'read ' + SOURCE_READS[source], patch: { briefSources: { [source]: true } } };
65
+ return { name, label, source: null, reads: 'keep it on, so a reader can use it when one comes', patch: { connectors: { [name]: true } } };
66
+ }
67
+
68
+ const probeNames = (sources) => (Array.isArray(sources) ? sources : []).filter((s) => s && s.status === 'connected' && s.id).map((s) => String(s.id));
69
+
70
+ module.exports = { CONNECT_URL, SIGNAL_DOMAINS, signalsOf, notice, decide, proposalFor, probeNames, MAX_PENDING };
@@ -256,7 +256,11 @@ function compareOf(P, id, { key = '', titleOf = () => '', proven = PROVEN } = {}
256
256
  const file = p.group === 'improved' ? p.data.file : spec && spec.file;
257
257
  const making = !!(p.data && p.data.live && (p.data.live.slots || []).some((s) => s.state === 'working' || s.state === 'proving'));
258
258
  // a live round still being made is readable before its file lands (the Viewer opens on it and reads again until it renders)
259
- if (!file && !(p.data && p.data.live && (p.group === 'prototyped' || making))) return null;
259
+ // a live version that was not made (its run failed or stopped) still opens: it says why and shows the version it was made from
260
+ // (Wawan 2026-11-18: "I click version 2, but got error page")
261
+ const lost = !file && !making && p.group === 'improved' && p.data && p.data.live ? ((p.data.live.slots || [])[0] || {}) : null;
262
+ if (!file && !lost && !(p.data && p.data.live && (p.group === 'prototyped' || making))) return null;
263
+ const fromFile = lost ? (() => { const f = rounds.find((r) => r.data.round === p.data.from && r.data.file); return f ? f.data.file : ((specs.find((s) => s.key === p.data.base) || {}).file || ''); })() : '';
260
264
  const round = p.group === 'improved' ? p.data.round : 1;
261
265
  const c = (p.data && p.data.compare) || {};
262
266
  const cols = [];
@@ -291,8 +295,10 @@ function compareOf(P, id, { key = '', titleOf = () => '', proven = PROVEN } = {}
291
295
  // the version's companions as data, read by the route next to its file (lib/routes-lab.js), and their state while it is being made
292
296
  const slotNow = live ? (p.data.live.slots || []).find((s) => s.key === k) || (p.data.live.slots || [])[0] : null;
293
297
  return { ini: p.ini, board: p.board || '', id: p.id, sig: PRsig(p), state: stateOf(p), title: name, round, key: k, say, columns: cols, pins, history,
294
- ...(file ? { file } : {}), ...(upd ? { updated: upd, also: p.data.also || '' } : {}), ...(slotNow && slotNow.parts ? { parts: slotNow.parts } : {}),
295
- ...(live ? { live: true, working: (p.data.live.slots || []).some((s) => s.state === 'working' || s.state === 'proving' || Object.values(s.parts || {}).includes('working')) } : {}) };
298
+ ...(file ? { file } : {}), ...(lost ? { notMade: lost.why || (lost.state === 'working' ? 'its run stopped before it finished' : 'it did not render'), ...(fromFile ? { fallback: fromFile, fallbackN: p.data.from } : {}) } : {}), ...(upd ? { updated: upd, also: p.data.also || '' } : {}), ...(slotNow && slotNow.parts ? { parts: slotNow.parts } : {}),
299
+ ...(live ? { live: true, run: p.data.live.id || '', startedAt: p.data.live.startedAt || '', working: (p.data.live.slots || []).some((s) => s.state === 'working' || s.state === 'proving' || Object.values(s.parts || {}).includes('working')) } : {}),
300
+ // what the run is doing now (its progress.json, lib/live-round.js progressOf): the Viewer's progress line while it is made
301
+ ...(slotNow && slotNow.progress && making ? { progress: slotNow.progress } : {}) };
296
302
  }
297
303
 
298
304
  /** PURE. The initiative's prototype rounds, newest first, open or not: a kept or dropped round stays reachable from the initiative page
@@ -144,8 +144,8 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, stdin
144
144
  if (!r) { say('✗ no PMOS server answers: start PMOS, then ask again'); return 1; }
145
145
  if (!r.ok) { say('✗ ' + (r.error || 'the round did not start')); return 1; }
146
146
  if (body.propose) { say(`✓ filed under the initiative's ✦: ${r.said}. The PM's ✓ starts it.`); return 0; }
147
- if (body.from === 'chat') { say(`✓ version ${r.round.n} started from ${r.round.directions.map((d) => d.key).join(', ')}. PMOS tells this chat when it is in the Viewer (2 minutes at most). Do not build it yourself.`); return 0; }
148
- say(`✓ round ${r.round.n} started: ${r.round.directions.map((d) => d.key + ' · ' + d.title).join('; ')}. Each version shows under the initiative's ✦ as soon as it renders (2 minutes at most).`);
147
+ if (body.from === 'chat') { say(`✓ version ${r.round.n} started from ${r.round.directions.map((d) => d.key).join(', ')}. PMOS tells this chat when it is in the Viewer, or that it was not made. The Viewer shows its progress. Do not build it yourself.`); return 0; }
148
+ say(`✓ round ${r.round.n} started: ${r.round.directions.map((d) => d.key + ' · ' + d.title).join('; ')}. Each version shows under the initiative's ✦ as soon as it renders; the Viewer shows its progress.`);
149
149
  return 0;
150
150
  }
151
151
 
@@ -24,7 +24,9 @@
24
24
  * feedback ONE run on the base specimen (it reads the earlier file). Files group `improved`, `changed` = the PM's sentence.
25
25
  * Each run gets a per-product scaffold (scaffoldOf: the product's tokens.css and the head of its components.css, else PMOS's own), the
26
26
  * initiative's name, description and Intent, and the viewport pin (dry run finding a: 2 of 9 ran wider than the phone and were cut off).
27
- * A 2-minute budget: a run past it is stopped and its slot says "not made" with the reason.
27
+ * NO TIME LIMIT (Wawan 2026-11-18: "No need limit, but need a visual guidance of the progression"). The run writes progress.json
28
+ * ({ now, done, total }) at each step; the Viewer shows it with the time so far and a Stop press (stop()). Only a run that writes
29
+ * nothing for STALL_MS (no progress, no file) is stopped, and its slot says "not made" with the reason.
28
30
  * PROOF PER FILE (proven-only rule). PMOS watches each run's folder. When a file lands and stops growing it opens it in a headless browser
29
31
  * (lib/idle-lab-engine.js renderCheck, at desk width and at 390 px: a version wider than the phone is not proven) and only then puts it on the card. The card exists from the start, so the PM sees honest state: a
30
32
  * slot is working, made (a thumbnail) or not made (why). Nothing is written to a product repository before ✓ (D60, D65).
@@ -34,7 +36,7 @@
34
36
  * THE LEDGERS. The proposal lines are lib/proposals.js's (one id per round; the newest line for an id wins, so each proven file rewrites it).
35
37
  * Each run's start and end are lines of <runtime>/idle-lab/runs.jsonl (job `live-round`), so its cost counts with the idle lab's.
36
38
  *
37
- * JOB · BUDGET_MS · KEYS · DEFAULT_DIRECTIONS · ORIGIN
39
+ * JOB · STALL_MS · progressOf · KEYS · DEFAULT_DIRECTIONS · ORIGIN
38
40
  * intentOf(text, { waiting }) PURE → { kind: 'new' | 'feedback', brief, base? } | null what a chat sentence asks for
39
41
  * parseDirs(text) PURE → [{ key, title }] | null "A: …|B: …|C: …"
40
42
  * askOf({ ini, board, brief, directions, base?, round?, from? }) PURE → the ✦ ask's proposal line (without at/by)
@@ -57,7 +59,14 @@ const E = require('./idle-lab-engine.js');
57
59
 
58
60
  const JOB = 'live-round';
59
61
  const ORIGIN = 'live-round';
60
- const BUDGET_MS = 2 * 60 * 1000;
62
+ const STALL_MS = 10 * 60 * 1000; // a run that writes nothing (no progress line, no file) this long is stuck
63
+ /** PURE. The run's progress.json, read loosely: { now, done, total } or null. */
64
+ function progressOf(j) {
65
+ if (!isObj(j)) return null;
66
+ const now = one(j.now, 140), total = Math.max(0, Math.min(99, Math.floor(Number(j.total) || 0))), done = Math.max(0, Math.min(total || 99, Math.floor(Number(j.done) || 0)));
67
+ return now || total ? { now, done, total } : null;
68
+ }
69
+ const minsOf = (ms) => { const m = Math.max(1, Math.round(ms / 60000)); return m + ' minute' + (m === 1 ? '' : 's'); };
61
70
  const KEYS = Object.freeze(['A', 'B', 'C']);
62
71
  const DEFAULT_DIRECTIONS = Object.freeze([
63
72
  Object.freeze({ key: 'A', title: 'Summary first: the plainest layout, a few rows and a quiet meta line' }),
@@ -242,6 +251,7 @@ function promptOf(o) {
242
251
  // the design sprint's good practice, silent (Wawan 2026-11-17: "the design sprint runs in silent"): a target user, one question, real
243
252
  // content, Goldilocks fidelity. Never a step the PM has to fill in.
244
253
  L.push('', 'Good practice, in the background: work out from the initiative who this is for and the one question the prototype must answer, and build for that. Real content from the initiative, never placeholders. Just real enough to react to, not polished. 2 to 6 screens.');
254
+ L.push('', `Progress: the PM watches it. Before you start and after each step, overwrite ${path.join(dir, 'progress.json')} with { "now": "<what you are doing, e.g. Reading the design brief, Building screen 3 of 7: AST1 7680×1550, Writing the flow>", "done": <steps done>, "total": <steps in all> }. Take as long as the idea needs.`);
245
255
  L.push('', `Write these files with the Write tool, in this order, in ${dir}:`,
246
256
  `1. ${o.file}: the prototype. Write it FIRST: the PM sees it as soon as it lands.`,
247
257
  ' - One self-contained HTML page: inline CSS only, no script, no network, no image files. Real draft copy, never lorem ipsum or a placeholder.',
@@ -404,7 +414,7 @@ function contextOf(cur, { ini, ws = '', rt = null, versions = [] } = {}) {
404
414
  const fin = (x) => x.state === 'ok' || x.state === 'not made' || x.state === 'none';
405
415
  const partsLine = (s) => Object.fromEntries((s.parts || []).map((x) => [x.kind, x.state === 'not made' ? 'not made: ' + one(x.why, 120) : x.state]));
406
416
  function roundLine(R, now) {
407
- const slots = R.slots.map((s) => ({ key: s.key, title: s.title, state: s.state, ...(s.file && s.state === 'ok' ? { file: s.file } : {}), ...(s.why ? { why: one(s.why, 200) } : {}), ...(s.dims ? { dims: s.dims } : {}), ...(s.said ? { said: s.said } : {}), ...((s.parts || []).length ? { parts: partsLine(s) } : {}) }));
417
+ const slots = R.slots.map((s) => ({ key: s.key, title: s.title, state: s.state, ...(s.file && s.state === 'ok' ? { file: s.file } : {}), ...(s.why ? { why: one(s.why, 200) } : {}), ...(s.dims ? { dims: s.dims } : {}), ...(s.said ? { said: s.said } : {}), ...(s.progress && s.state === 'working' ? { progress: s.progress } : {}), ...((s.parts || []).length ? { parts: partsLine(s) } : {}) }));
408
418
  const ok = R.slots.filter((s) => s.state === 'ok');
409
419
  const done = R.slots.every((s) => fin(s) && (s.parts || []).every(fin));
410
420
  const checked = ok.length ? (ok.length === 1 ? 'It opened and rendered' : `All ${ok.length} opened and rendered`) + ' in a headless browser (' + ok.map((s) => s.dims).join(', ') + ')' : '';
@@ -426,14 +436,13 @@ function roundLine(R, now) {
426
436
  * deps: { runtimeDir() → folder, product(ws) → { w: { id, root }, dir } | null, info(ws, ini) → { title, board, description?, intent? } | null,
427
437
  * spawn(spec) → session (server spawnSession: { name, agent, ws, origin, initialInput, initiative, writePaths, addDirs, onDone }),
428
438
  * stop(session), render?(abs) → Promise<{ ok, w, h, why? }>, artefact?(dir, line) (lib/artefacts.js set, as agent:live-round),
429
- * ownRoot? (PMOS's own folder, for the scaffold), pollMs?, budgetMs?, now?() , warn(what, e) }
439
+ * ownRoot? (PMOS's own folder, for the scaffold), pollMs?, stallMs?, now?() , warn(what, e) }
430
440
  */
431
441
  function create(deps) {
432
442
  const warn = deps.warn || (() => {});
433
443
  const now = () => (deps.now ? deps.now() : Date.now());
434
444
  const render = deps.render || ((abs) => E.renderCheck(abs, { phone: true })); // proven at 390 px too: the viewport pin
435
445
  const pollMs = deps.pollMs || 1000;
436
- const budgetMs = deps.budgetMs || BUDGET_MS;
437
446
  const rounds = new Map(); // id → round
438
447
 
439
448
  function lesson(dir, ini, text, by = 'agent:live-round') {
@@ -481,7 +490,8 @@ function create(deps) {
481
490
  // the off switch (`pmos ai off live-round`, or every AI job off) holds it, as it holds every other job
482
491
  let off = null; try { off = require('./ai-guard.js').off(JOB, { env: deps.env || process.env, settingsDir: rt }); } catch { off = null; }
483
492
  if (off) return { ok: false, error: 'live rounds are off: ' + off };
484
- if (running(c.ini)) return { ok: false, error: 'a round is already running on this initiative: it ends within 2 minutes' };
493
+ const busy = runningOf(c.ini);
494
+ if (busy) return { ok: false, error: `Version ${busy.n} is still being made on this initiative${busy.progress && busy.progress.now ? ' (' + busy.progress.now + (busy.progress.total ? ', ' + busy.progress.done + ' of ' + busy.progress.total + ' done' : '') + ')' : ''}, ${minsOf(now() - busy.start)} so far. Wait for it, or stop it in the Viewer.` };
485
495
  const t = now(), id = 'lr' + t.toString(36) + crypto.randomBytes(3).toString('hex');
486
496
  const from = FROM[input.from] ? input.from : 'chat', step = Number(input.step) === 2 ? 2 : 1;
487
497
  const P = PR.read(c.dir);
@@ -514,8 +524,7 @@ function create(deps) {
514
524
  for (const s of R.slots) launch(R, s, { info: c.info, scaffold, b });
515
525
  R.timer = setInterval(() => { poll(R).catch((e) => warn('live round poll', e)); }, pollMs);
516
526
  if (R.timer.unref) R.timer.unref();
517
- R.budget = setTimeout(() => over(R), budgetMs);
518
- if (R.budget.unref) R.budget.unref();
527
+ R.stallMs = deps.stallMs || STALL_MS; R.seen = t;
519
528
  settle(R);
520
529
  return { ok: true, round: { id, n: R.n, keys: R.slots.map((s) => s.key), directions: R.slots.map((s) => ({ key: s.key, title: s.title })), proposal: R.propId, parts: PARTS.map((x) => x.kind) }, runs: R.slots.map((s) => s.run) };
521
530
  }
@@ -599,14 +608,20 @@ function create(deps) {
599
608
  }
600
609
  async function poll(R) {
601
610
  for (const s of R.slots) {
611
+ // the run's own progress line: what it is doing now, steps done and left (the Viewer's progress line)
612
+ if (s.state === 'working' && s.abs) {
613
+ let pj = null; try { pj = progressOf(JSON.parse(fs.readFileSync(path.join(path.dirname(s.abs), 'progress.json'), 'utf8'))); } catch { pj = null; }
614
+ if (pj && JSON.stringify(pj) !== JSON.stringify(s.progress || null)) { s.progress = pj; R.seen = now(); write(R); }
615
+ }
602
616
  for (const x of s.state === 'not made' ? [] : [s, ...(s.parts || [])]) {
603
617
  if (x.state !== 'working') continue;
604
618
  let size = -1; try { size = fs.statSync(x.abs).size; } catch { size = -1; }
605
619
  // a file that stopped growing for one poll has landed: prove it now, before the run ends
606
620
  if (size > 0 && size === x.size) { if (x === s) await prove(R, s); else provePart(R, s, x); }
607
- else x.size = size;
621
+ else { if (size !== x.size) R.seen = now(); x.size = size; }
608
622
  }
609
623
  }
624
+ if (!R.ended && now() - R.seen > R.stallMs) over(R, 'it stopped making progress: nothing new for ' + minsOf(R.stallMs));
610
625
  }
611
626
  async function ended(R, s, res = {}) {
612
627
  const out = (res && res.result) || {};
@@ -623,12 +638,12 @@ function create(deps) {
623
638
  if (have) provePart(R, s, x); else partNotMade(R, s, x, 'the run ended without writing ' + x.name);
624
639
  }
625
640
  }
626
- function over(R) {
641
+ function over(R, why) {
627
642
  for (const s of R.slots) {
628
643
  const busy = [s, ...(s.parts || [])].some((x) => x.state === 'working');
629
644
  if (busy && s.session && s.session.state !== 'exited' && deps.stop) try { deps.stop(s.session); } catch { /* best effort */ }
630
- if (s.state === 'working') notMade(R, s, 'past the 2 minute budget'); // a file being proven finishes its proof
631
- for (const x of s.parts || []) partNotMade(R, s, x, 'past the 2 minute budget');
645
+ if (s.state === 'working') notMade(R, s, why); // a file being proven finishes its proof
646
+ for (const x of s.parts || []) partNotMade(R, s, x, why);
632
647
  }
633
648
  }
634
649
  function settle(R) {
@@ -636,7 +651,7 @@ function create(deps) {
636
651
  for (const s of R.slots) if (fin(s) && (s.parts || []).every(fin) && s.session && s.session.state !== 'exited' && deps.stop && !s.stopped) { s.stopped = true; try { deps.stop(s.session); } catch { /* it ends by itself */ } }
637
652
  if (R.ended || !R.slots.every((s) => fin(s) && (s.parts || []).every(fin))) return;
638
653
  R.ended = true;
639
- clearInterval(R.timer); clearTimeout(R.budget);
654
+ clearInterval(R.timer);
640
655
  // what each version changed against the one it was made from: the chat's "Also updated" and the cards' Updated
641
656
  if (R.base) {
642
657
  const s = R.slots[0], prev = R.baseFile ? LAB.specimenPath(R.rt, R.baseFile) : null;
@@ -647,7 +662,7 @@ function create(deps) {
647
662
  const lost = (s) => [...(s.parts || [])].filter((x) => x.state === 'not made').map((x) => (PARTS.find((p) => p.kind === x.kind) || {}).title || x.kind);
648
663
  if (R.slots.length === 1) {
649
664
  const s = R.slots[0], v = 'Version ' + R.n;
650
- if (s.state !== 'ok') tell(R, `[PMOS] ${v} was not made: ${s.why}. Say so to the PM in one line, nothing else.`);
665
+ if (s.state !== 'ok') tell(R, `[PMOS] ${v} was not made: ${s.why}. Tell the PM in one line that it was not made and why, and offer to try again. Nothing else.`);
651
666
  else {
652
667
  const also = s.changes && s.changes.line, miss = lost(s);
653
668
  tell(R, `[PMOS] ${v} is in the Viewer${s.said ? ': "' + s.said + '"' : ''}.${also ? ' Also updated: ' + also + '.' : ''}${miss.length ? ' Not made this time: ' + andOf(miss) + '.' : ''} Reply to the PM starting with "${v}: ", then one or two sentences on what ${R.base ? 'changed' : 'it shows and for whom'}${also ? ', then "Also updated: ' + also + '."' : ''}. Nothing else. Do not build anything here.`);
@@ -678,10 +693,13 @@ function create(deps) {
678
693
  return true;
679
694
  } catch (e) { warn('live round undo', e); return false; }
680
695
  }
681
- function running(ini) { for (const R of rounds.values()) if (R.ini === ini && !R.ended) return true; return false; }
696
+ function runningOf(ini) { for (const R of rounds.values()) if (R.ini === ini && !R.ended) return { id: R.id, n: R.n, start: R.start, progress: (R.slots.find((s) => s.progress) || {}).progress || null }; return null; }
697
+ function running(ini) { return !!runningOf(ini); }
698
+ /** The PM's Stop in the Viewer: the round's runs end now, and each unfinished version is "not made: you stopped it". */
699
+ function stop(id) { const R = rounds.get(id); if (!R || R.ended) return { ok: false, error: 'that version is not being made now' }; cancel(id, 'you stopped it'); return { ok: true }; }
682
700
  function status() { return [...rounds.values()].map((R) => ({ id: R.id, ws: R.ws, ini: R.ini, ended: R.ended, slots: R.slots.map((s) => ({ key: s.key, state: s.state, why: s.why })) })); }
683
701
 
684
- return { start, propose, cancel, dropCard, running, status, _rounds: rounds, _poll: poll };
702
+ return { start, propose, cancel, stop, dropCard, running, status, _rounds: rounds, _poll: poll };
685
703
  }
686
704
 
687
705
  /* ── the module-level shortcuts (server.js calls create once; W2, the routes and the CLI route call these) ── */
@@ -694,8 +712,9 @@ function proposeNow(input) { return inst ? inst.propose(input) : { ok: false, er
694
712
  function cancel(id, why) { return inst ? inst.cancel(id, why) : { ok: false }; }
695
713
  function dropCard(dir, propId) { return inst ? inst.dropCard(dir, propId) : false; }
696
714
  function running(ini) { return inst ? inst.running(ini) : false; }
715
+ function stopRound(id) { return inst ? inst.stop(id) : { ok: false, error: NOT_READY }; }
697
716
  function status() { return inst ? inst.status() : []; }
698
717
 
699
- module.exports = { JOB, ORIGIN, BUDGET_MS, KEYS, DEFAULT_DIRECTIONS, ONE_DIRECTION, PARTS, FROM, marksOf, intentOf, parseDirs, askOf, waiting, baseOf, currentOf: PR.currentOf, contextOf, scaffoldOf, promptOf, saidOf, roundLine,
718
+ module.exports = { JOB, ORIGIN, STALL_MS, progressOf, KEYS, DEFAULT_DIRECTIONS, ONE_DIRECTION, PARTS, FROM, marksOf, intentOf, parseDirs, askOf, waiting, baseOf, currentOf: PR.currentOf, contextOf, scaffoldOf, promptOf, saidOf, roundLine,
700
719
  flowOf, lanesOf, tweaksOf, copyOf, changesOf, partsAt, editsOf,
701
- create, install, round, startNow, proposeNow, cancel, dropCard, running, status };
720
+ create, install, round, startNow, proposeNow, cancel, stopRound, dropCard, running, status };
@@ -124,8 +124,8 @@ const READS = {
124
124
  for (const col of c.columns) if (col.file) col.url = LAB.specimenUrl(col.file);
125
125
  if (c.live) {
126
126
  // the version's companions as data, and the comments on the initiative (Prototype by chatting)
127
- const abs = c.file ? LAB.specimenPath(ctx.runtimeDir, c.file) : null;
128
- if (abs) { c.url = LAB.specimenUrl(c.file); c.data = require('./live-round.js').partsAt(abs); }
127
+ const f = c.file || c.fallback || '', abs = f ? LAB.specimenPath(ctx.runtimeDir, f) : null;
128
+ if (abs) { c.url = LAB.specimenUrl(f); c.data = require('./live-round.js').partsAt(abs); }
129
129
  c.comments = commentsOf(dir, c.ini);
130
130
  }
131
131
  ctx.json(res, { ok: true, compare: c });
@@ -214,6 +214,14 @@ const WRITES = {
214
214
  ctx.json(res, { ok: true, edits: next });
215
215
  return true;
216
216
  },
217
+ // the PM's Stop on a version being made (no time limit since 2026-11-18): its run ends and the version is "not made: you stopped it"
218
+ '/api/lab/stop': (ctx, res, body) => {
219
+ const run = String(body.run || ''); if (!/^lr[0-9a-z]{4,40}$/.test(run)) return fail(ctx, res, 400, 'run names the version being made');
220
+ const r = require('./live-round.js').stopRound(run);
221
+ if (!r.ok) return fail(ctx, res, 409, r.error || 'that version is not being made now');
222
+ ctx.json(res, { ok: true });
223
+ return true;
224
+ },
217
225
  '/api/lab/comment': (ctx, res, body, g, w, dir) => {
218
226
  const ini = String(body.ini || ''), text = typeof body.text === 'string' ? body.text.replace(/\s+/g, ' ').trim().slice(0, 500) : '';
219
227
  if (!ID_RE.test(ini) || !text) return fail(ctx, res, 400, 'ini and text name the initiative and the comment');
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.595.0",
3
+ "version": "0.597.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.595.0",
9
+ "version": "0.597.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.595.0",
3
+ "version": "0.597.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",
@@ -0,0 +1,67 @@
1
+ /* pm/cozy-conndir.js — Settings › Connectors as a directory (initiative connectors-directory; canvas CnA, CnB). Pure: no DOM, no fetch.
2
+ * CATS the category chips, All first
3
+ * CATALOG services a connector can be added for in the Claude account: id, name, category, what it does
4
+ * catOf(label) → the category of a connected connector by its name, 'other' when the catalog does not know it
5
+ * directory({ connected, signals, q, cat }) → { count, connected, forYou, all, empty }
6
+ * connected every connector the session has, each { name, label, id, cat }, filtered by the search and the chip. count is the
7
+ * number of connected rows before the filter, so the heading says how many you have, not how many match.
8
+ * forYou at most 3 services not connected yet, each with why: a link in your initiatives (signals) or what you already use
9
+ * all the rest of the catalog, not connected, not in For you
10
+ * letter(name) the letter tile on each row (the connector's own icon is not known to PMOS)
11
+ * PMOS holds no key or token: the + on a row opens the connector page of the Claude account, and PMOS notices the connector there. */
12
+ export const CATS = [['all', 'All'], ['mail', 'Mail and calendar'], ['chat', 'Chat'], ['tickets', 'Tickets'], ['code', 'Code'], ['docs', 'Docs and files'], ['design', 'Design'], ['analytics', 'Analytics']];
13
+
14
+ export const CATALOG = [
15
+ { id: 'gmail', name: 'Gmail', cat: 'mail', what: 'Read and search mail', re: /gmail/i },
16
+ { id: 'gcal', name: 'Google Calendar', cat: 'mail', what: 'Meetings and free time', re: /google.?calendar|gcal/i },
17
+ { id: 'teams', name: 'Microsoft Teams', cat: 'chat', what: 'Chats and channels', re: /teams/i },
18
+ { id: 'outlook', name: 'Microsoft 365', cat: 'mail', what: 'Outlook mail and calendar', re: /outlook|microsoft|m365|office/i },
19
+ { id: 'wispr', name: 'Wispr Flow', cat: 'mail', what: 'Meeting notes and transcripts', re: /wispr/i },
20
+ { id: 'slack', name: 'Slack', cat: 'chat', what: 'Channels, threads and mentions', re: /slack/i },
21
+ { id: 'intercom', name: 'Intercom', cat: 'chat', what: 'Customer conversations', re: /intercom/i },
22
+ { id: 'jira', name: 'Jira', cat: 'tickets', what: 'Issues, sprints and boards', re: /jira|atlassian/i },
23
+ { id: 'linear', name: 'Linear', cat: 'tickets', what: 'Issues and projects', re: /linear/i },
24
+ { id: 'asana', name: 'Asana', cat: 'tickets', what: 'Tasks and projects', re: /asana/i },
25
+ { id: 'github', name: 'GitHub', cat: 'code', what: 'Pull requests, issues and checks', re: /github/i },
26
+ { id: 'sentry', name: 'Sentry', cat: 'code', what: 'Errors and releases', re: /sentry/i },
27
+ { id: 'confluence', name: 'Confluence', cat: 'docs', what: 'Pages and spaces', re: /confluence/i },
28
+ { id: 'notion', name: 'Notion', cat: 'docs', what: 'Pages and databases', re: /notion/i },
29
+ { id: 'gdrive', name: 'Google Drive', cat: 'docs', what: 'Search, read and share files', re: /google.?drive|\bdrive\b|google.?docs|sheets|slides/i },
30
+ { id: 'box', name: 'Box', cat: 'docs', what: 'Files and folders', re: /\bbox\b/i },
31
+ { id: 'figma', name: 'Figma', cat: 'design', what: 'Designs and comments', re: /figma/i },
32
+ { id: 'miro', name: 'Miro', cat: 'design', what: 'Boards and stickies', re: /miro/i },
33
+ { id: 'canva', name: 'Canva', cat: 'design', what: 'Designs and brand kits', re: /canva/i },
34
+ { id: 'bigquery', name: 'BigQuery', cat: 'analytics', what: 'Query your data warehouse', re: /bigquery/i },
35
+ { id: 'hex', name: 'Hex', cat: 'analytics', what: 'Notebooks and data apps', re: /\bhex\b/i },
36
+ ];
37
+ const BY_ID = new Map(CATALOG.map((c) => [c.id, c]));
38
+ // what you already use → what goes with it (✦ For you, when no initiative links a service)
39
+ const PAIRS = { gmail: ['gcal', 'gdrive'], gcal: ['gmail'], outlook: ['teams'], slack: ['jira', 'github'], jira: ['confluence', 'github'], confluence: ['jira'],
40
+ github: ['linear', 'sentry'], linear: ['github'], notion: ['linear'], figma: ['miro'], gdrive: ['gmail'] };
41
+
42
+ const labelOf = (name) => String(name || '').replace(/^claude\.ai\s+/i, '').trim();
43
+ export const matchOf = (label) => CATALOG.find((c) => c.re.test(labelOf(label))) || null;
44
+ export const catOf = (label) => { const m = matchOf(label); return m ? m.cat : 'other'; };
45
+ export const letter = (name) => (labelOf(name).match(/[A-Za-z0-9]/) || ['?'])[0].toUpperCase();
46
+
47
+ const hit = (q, ...xs) => !q || xs.some((x) => String(x || '').toLowerCase().includes(q));
48
+
49
+ export function directory({ connected = [], signals = [], q = '', cat = 'all' } = {}) {
50
+ const query = String(q || '').trim().toLowerCase(), chip = CATS.some(([k]) => k === cat) ? cat : 'all';
51
+ const inCat = (c) => chip === 'all' || c === chip;
52
+ const mine = connected.map((c) => { const label = c.label || labelOf(c.name); const m = matchOf(label); return { ...c, label, id: m ? m.id : null, service: m ? m.name : '', cat: m ? m.cat : 'other', what: m ? m.what : '' }; });
53
+ const have = new Set(mine.map((c) => c.id).filter(Boolean));
54
+ // For you: services your initiatives link first (most links first), then what goes with what you use; never one you have
55
+ const why = new Map();
56
+ for (const s of Array.isArray(signals) ? signals : []) {
57
+ const id = s && (s.id || s); if (!BY_ID.has(id) || have.has(id) || why.has(id)) continue;
58
+ const n = s && s.n; why.set(id, n > 1 ? `Because ${n} initiatives link ${BY_ID.get(id).name}` : `Because an initiative links ${BY_ID.get(id).name}`);
59
+ }
60
+ for (const c of mine) for (const id of PAIRS[c.id] || []) if (!have.has(id) && !why.has(id)) why.set(id, 'Because you use ' + (BY_ID.get(c.id) || c).name);
61
+ const forYouIds = [...why.keys()].slice(0, 3);
62
+ const pick = (c) => inCat(c.cat) && hit(query, c.name, c.what, CATS.find(([k]) => k === c.cat)[1]);
63
+ const conn = mine.filter((c) => inCat(c.cat) && hit(query, c.label, c.name, c.service, c.what));
64
+ const forYou = forYouIds.map((id) => ({ ...BY_ID.get(id), why: why.get(id) })).filter(pick);
65
+ const all = CATALOG.filter((c) => !have.has(c.id) && !forYouIds.includes(c.id)).filter(pick);
66
+ return { count: mine.length, connected: conn, forYou, all, empty: !conn.length && !forYou.length && !all.length };
67
+ }
@@ -307,6 +307,31 @@
307
307
  .ev-st .ev-fold { border-top: 1px solid var(--cz-hair); border-bottom: 0; }
308
308
  .ev-st .ev-con-more { padding-left: 16px; border-left: 2px solid var(--cz-hair); margin-bottom: 12px; }
309
309
  @media (max-width: 760px) { .ev-st .ev-fr .ev-ib, .ev-st .ev-fr .ev-ib-sp { width: 44px; height: 44px; } }
310
+ /* Settings › Connectors as a directory (initiative connectors-directory; canvas CnA, CnB) */
311
+ .ev-st .ev-cn { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
312
+ .ev-st .ev-cn-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 999px; background: var(--cz-well); color: var(--cz-ink3); }
313
+ .ev-st .ev-cn-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; flex: none; }
314
+ .ev-st .ev-cn-search input.ev-inp { background: transparent; padding: 0; height: 38px; }
315
+ .ev-st .ev-cn-search input.ev-inp:focus { outline: none; }
316
+ .ev-st .ev-cn-search:focus-within { outline: 2px solid var(--cz-blue); outline-offset: 1px; }
317
+ .ev-st .ev-cn-chips { display: flex; gap: 6px; flex-wrap: wrap; }
318
+ .ev-st .ev-cn-sec { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
319
+ .ev-st .ev-cn-note { margin: -6px 0 0; }
320
+ .ev-st .ev-cn-note svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; vertical-align: -2px; }
321
+ .ev-st .ev-cn-sec svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; vertical-align: -2px; }
322
+ .ev-st .ev-cn-grp { background: var(--cz-card); border: 1px solid var(--cz-hair); border-radius: 16px; padding: 0 14px; }
323
+ .ev-st .ev-cn-r { padding: 10px 0; }
324
+ .ev-st .ev-cn-lg { width: 36px; height: 36px; border-radius: 10px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: var(--cz-well); color: var(--cz-ink); font-weight: var(--fw-strong); font-size: var(--fs-row); }
325
+ .ev-st .ev-cn-slot:empty { display: none; }
326
+ .ev-st .ev-cn-add { background: var(--cz-solid); color: var(--cz-onsolid); }
327
+ .ev-st .ev-cn-add:hover { background: var(--cz-solid); opacity: .88; }
328
+ .ev-st .ev-cn-ok { background: var(--cz-solid); color: var(--cz-onsolid); }
329
+ .ev-st .ev-cn-rec { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-top: 12px; border-radius: 16px; background: var(--cz-bluebg); }
330
+ .ev-st .ev-cn-rec p { margin: 2px 0 0; }
331
+ .ev-st .ev-cn-rec p svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; vertical-align: -2px; }
332
+ .ev-st .ev-cn-none { padding: 12px 0; margin: 0; }
333
+ .ev-st .ev-cn-foot { margin: 4px 0 0; }
334
+ @media (max-width: 760px) { .ev-st .ev-cn-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .ev-st .ev-cn-r .ev-ib, .ev-st .ev-cn-rec .ev-ib { width: 44px; height: 44px; } .ev-st .ev-cn-r { flex-wrap: nowrap; } }
310
335
 
311
336
  /* New for you's item Viewers (batch 18 items 2 and 2b, canvas OvA5Overlap, OvA6Given): the summary, then the two initiatives, the pick and ONE primary */
312
337
  .nv { display: flex; flex-direction: column; gap: 10px; }
@@ -46,6 +46,13 @@
46
46
  .pc-making { margin: 0; display: flex; align-items: center; gap: 5px; font-size: var(--fs-meta); color: var(--cz-blueink); }
47
47
  .pc-making i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .35; animation: pcPulse 1.2s ease-in-out infinite; }
48
48
  .pc-making i:nth-child(2) { animation-delay: .2s; } .pc-making i:nth-child(3) { animation-delay: .4s; }
49
+ .pc-prog { display: grid; gap: 6px; margin-bottom: 8px; }
50
+ .pc-prog .pc-making { flex-wrap: wrap; }
51
+ .pc-prog .pc-making .w { flex: 1 1 auto; min-width: 0; }
52
+ .pc-prog small { color: var(--cz-ink3); font-variant-numeric: tabular-nums; }
53
+ .pc-bar2 { display: block; height: 4px; border-radius: 2px; background: var(--cz-well); overflow: hidden; }
54
+ .pc-bar2 i { display: block; height: 100%; background: var(--cz-blue); transition: width .4s ease; }
55
+ .pc-lost { display: block; color: var(--cz-ink2); padding: 8px 10px; border-radius: 8px; background: var(--cz-well); margin-bottom: 8px; }
49
56
  @keyframes pcPulse { 50% { opacity: 1; } }
50
57
  @media (prefers-reduced-motion: reduce) { .pc-making i { animation: none; opacity: .7; } }
51
58
 
@@ -154,6 +154,8 @@ const say = (m, u) => { if (V.H && V.H.toast) V.H.toast(m, u); };
154
154
  /** The version shown: the compare itself, or (while the next version is being made) the last one that rendered, with a note. */
155
155
  function shown(c) {
156
156
  if (c && c.file) return { v: c, making: c.working && !c.file };
157
+ // a version that was not made shows the one it was made from, with why (lib/idle-lab.js compareOf notMade)
158
+ if (c && c.notMade) return { v: c, making: false };
157
159
  if (V.last && c && V.last.ini === c.ini) return { v: V.last, making: true };
158
160
  return { v: c, making: true };
159
161
  }
@@ -186,6 +188,16 @@ function trayHtml(c) {
186
188
  + `<span class="pc-tacts">${c.state === 'open' && !c.working ? ib('data-pc-tray="keep"', 'Keep ' + c.key, I.check, 'blue') : ''}${ib('data-pc-tray="close"', 'Close these ways', I.x)}</span></div>`;
187
189
  }
188
190
  const upd = (c, k) => (c.updated && c.updated[k] ? '<span class="pc-upd">Updated</span>' : '');
191
+ /** While a version is made (no time limit): what the run is doing now, steps done of all, the time so far, and Stop. */
192
+ const clock = (iso) => { const s = Math.max(0, Math.round((Date.now() - Date.parse(iso || '')) / 1000)); return Number.isFinite(s) ? Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0') : ''; };
193
+ function progressHtml(c) {
194
+ const p = c.progress || null, pct = p && p.total ? Math.round((p.done / p.total) * 100) : 0;
195
+ return `<div class="pc-prog" role="status"><p class="pc-making"><i></i><i></i><i></i> <span class="w">PMOS is making version ${c.round}${p && p.now ? ': ' + esc(p.now) : ''}</span>`
196
+ + `${p && p.total ? `<small>${p.done} of ${p.total} done</small>` : ''}<small data-pc-clock="${esc(c.startedAt || '')}">${clock(c.startedAt)}</small>`
197
+ + `${c.run ? ib(`data-pc-stop="${esc(c.run)}"`, 'Stop making this version', I.x) : ''}</p>`
198
+ + `${p && p.total ? `<span class="pc-bar2" aria-hidden="true"><i style="width:${pct}%"></i></span>` : ''}</div>`;
199
+ }
200
+ if (typeof document !== 'undefined' && typeof setInterval === 'function') setInterval(() => { for (const el of document.querySelectorAll('[data-pc-clock]')) el.textContent = clock(el.dataset.pcClock); }, 1000);
189
201
  function protoCard(c, v, making) {
190
202
  const data = v.data || {}, tw = ((data.tweaks && data.tweaks.tweaks) || []).filter((t) => !t.el || (V.sel && t.el === V.sel.el));
191
203
  const tweaks = tw.length ? `<div class="pc-tw" aria-label="Tweaks">${tw.map((t) => { const val = parseFloat(V.edits.vars[t.var]) || t.value; return `<label><span>${esc(t.label)}</span><input type="range" min="${t.min}" max="${t.max}" step="${t.step}" value="${val}" data-pc-var="${esc(t.var)}" data-pc-unit="${esc(t.unit)}"><em>${esc(val + t.unit)}</em></label>`; }).join('')}</div>` : '';
@@ -195,7 +207,8 @@ function protoCard(c, v, making) {
195
207
  const list = cm.length ? `<ol class="pc-cms">${cm.map((x, i) => `<li><span class="pc-pin">${i + 1}</span><span class="w">${x.label ? `<small>on ${esc(x.label)}</small>` : ''}${esc(x.text)}</span>${ib(`data-pc-make="${esc(x.id)}"`, 'Make this change', I.star)}</li>`).join('')}</ol>` : '';
196
208
  const sug = suggestion(c);
197
209
  const draw = V.mode === 'draw' ? `<canvas class="pc-ink" aria-label="Sketch over the prototype"></canvas><span class="pc-inkacts">${ib('data-pc-ink="attach"', 'Attach the sketch to your next message', I.attach, 'blue')}${ib('data-pc-ink="clear"', 'Clear the sketch', I.x)}</span>` : '';
198
- return `<section class="pc-card pc-proto" aria-label="The prototype">${making ? `<p class="pc-making"><i></i><i></i><i></i> PMOS is making version ${c.round}${c.working ? '' : ''}.</p>` : ''}`
210
+ const lost = c.notMade ? `<p class="pc-making pc-lost">Version ${c.round} was not made: ${esc(c.notMade)}.${c.fallbackN ? ` This is version ${c.fallbackN}.` : ''} Ask in the chat for it in smaller steps, one screen or format at a time.</p>` : '';
211
+ return `<section class="pc-card pc-proto" aria-label="The prototype">${lost}${making ? progressHtml(c) : ''}`
199
212
  + `<div class="pc-dev ${V.device}"><div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}</div>${sel}${tweaks}${draft}${list}${sug}</section>`;
200
213
  }
201
214
  function suggestion(c) {
@@ -251,7 +264,7 @@ export function draw(body, c, o = {}) {
251
264
  if (!root) { body.innerHTML = '<div class="pc"></div>'; root = body.querySelector('.pc'); wire(root); }
252
265
  V.body = body;
253
266
  // keep the frame (and what the PM typed) while the canvas reads again every 2 seconds
254
- const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.updated, c.parts, (c.comments || []).length, V.mode, V.device, V.sel && V.sel.el, !!V.draft, (c.history || []).length, c.state, V.copy]);
267
+ const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.progress, c.notMade, c.updated, c.parts, (c.comments || []).length, V.mode, V.device, V.sel && V.sel.el, !!V.draft, (c.history || []).length, c.state, V.copy]);
255
268
  const focus = document.activeElement && root.contains(document.activeElement) && document.activeElement.matches('[data-pc-copy],textarea,input');
256
269
  if (sig === V.sig && root.firstChild) return;
257
270
  if (focus && prevFile === v.file) return; // the PM is typing in this version: draw on a later read
@@ -325,6 +338,7 @@ function wire(root) {
325
338
  if (d.pcFrom) { fire('pmos:from', { ini: V.c.ini, n: Number(d.pcFrom) }); say('The next change you send continues from version ' + d.pcFrom + '.'); return; }
326
339
  if (d.pcScreen) { V.screen = d.pcScreen; toFrame({ t: 'screen', id: d.pcScreen }); return; }
327
340
  if (d.pcScen) { startPlay(d.pcScen, 0, true); return; }
341
+ if ('pcStop' in d) { pmPost('/api/lab/stop', { ws: (V.at || {}).ws, run: d.pcStop }).then((r) => { if (!r || !r.ok) say((r && r.error) || 'It did not stop.'); }).catch(() => say('It did not stop.')); return; }
328
342
  if ('pcUnsel' in d) { V.sel = null; toFrame({ t: 'sel', el: '' }); fire('pmos:point', { ini: V.c.ini, el: '', label: '' }); V.sig = ''; draw(V.body, V.c); return; }
329
343
  if (d.pcCm) { comment(d.pcCm); return; }
330
344
  if (d.pcMake) { const x = (V.c.comments || []).find((y) => y.id === d.pcMake); if (x) fire('pmos:say', { ini: V.c.ini, text: (x.label || x.el ? `[On: ${x.label || x.el}${x.el ? ' · ' + x.el : ''}] ` : '') + x.text }); return; }
@@ -22,7 +22,9 @@
22
22
  * /api/sources/refresh, or the place to fix it); a quiet row has its name and time, and "Checked 10:42 · same since 09:15"
23
23
  * where a measured read applies (SrSee R3). Claude's failed background work and the Git sync failure are rows too. ↻ in the
24
24
  * header reads every source (POST /api/sources/refresh-all); (i) says what PMOS reads and that it never posts. The switches
25
- * (what PMOS reads on its own, the connectors your sessions have; GET and POST /api/proactive/settings) fold into one row.
25
+ * (what PMOS reads on its own, the connectors your sessions have; GET and POST /api/proactive/settings) sit under a directory
26
+ * (initiative connectors-directory, CnA/CnB): search, category chips, Connected · N, More sources, ✦ For you, All connectors,
27
+ * a + that opens the Claude account's connector page; PMOS notices the new connector and ✦ proposes what to read (pm/cozy-conndir.js).
26
28
  * Scheduled work (batch 31 item 2, agreed design SwC): a scheduled source's line says how often and when it reads next, amber
27
29
  * with ↻ only when PMOS missed a read; › on the row opens its page (Active, Next run, Repeats, ✦ rhythm, History, ▶ Read now),
28
30
  * and one quiet entry opens the Scheduled work list, your own scheduled tasks too (pm/cozy-schedwork.js; T.sub 'sw:…').
@@ -49,6 +51,7 @@ import * as JL from './cozy-jl.js';
49
51
  import { pmGet, pmPost, pressFetch } from './http.js';
50
52
  import { esc, svg, ICON, toast, wsParam, wsQ } from './cozy-evui.js';
51
53
  import { connectorRows, bannerOf } from './cozy-evmodel.js';
54
+ import * as CD from './cozy-conndir.js';
52
55
  import * as SW from './cozy-schedwork.js';
53
56
  import * as AD from './cozy-adler.js';
54
57
  import * as SE from './cozy-seasons.js';
@@ -63,7 +66,7 @@ const SECTIONS = [['general', 'General'], ['claude', 'PMOS'], ['connectors', 'Co
63
66
  const SUBS = { adler: 'Adler', jl: 'Jev and Laya', workflows: 'Workflows' }; // General › Extras and Workspaces › Workflows: each opens as a sub-panel of its section (U4, U1)
64
67
  const SRC = { calendar: 'Calendar', wispr: 'Wispr Flow', mail: 'Mail', slack: 'Slack', jira: 'Jira', confluence: 'Confluence', github: 'GitHub', drive: 'Google Drive', figma: 'Figma', website: 'Your websites' };
65
68
  const VIEWER_KEY = 'pmos.cz.viewer';
66
- const T = { el: null, sec: 'general', sub: '', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, info: false, fold: false, dress: false, more: false, bday: false, dset: {}, wkOpen: new Set(), wkMore: new Set(), arc: false };
69
+ const T = { el: null, sec: 'general', sub: '', ws: null, st: {}, src: null, con: {}, conn: [], set: null, prods: null, msg: '', busy: false, phase: '', say: '', back: null, fresh: null, reading: '', note: {}, info: false, fold: false, dir: null, q: '', cat: 'all', wait: null, dress: false, more: false, bday: false, dset: {}, wkOpen: new Set(), wkMore: new Set(), arc: false };
67
70
  const cmpVer = (a, b) => { const x = String(a || '0').split('-')[0].split('.').map(Number), y = String(b || '0').split('-')[0].split('.').map(Number); for (let i = 0; i < 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) < (y[i] || 0) ? -1 : 1; return 0; };
68
71
  const home = () => (T.ws && T.ws[0] ? T.st[T.ws[0].id] : null);
69
72
  const latest = () => { const s = home(); return (s && (s.latest || (s.lastCheck && s.lastCheck.latest))) || null; };
@@ -221,20 +224,92 @@ function staleHtml() {
221
224
  : `<a class="ev-ib ev-ib-card" href="${esc(a.href || '#' + a.sec)}"${a.href ? ' target="_blank" rel="noopener"' : ` data-ev-sec="${esc(a.sec)}"`} aria-label="${esc(a.label)}" title="${esc(a.label)}">${svg(ICON.open, 18)}</a>`;
222
225
  return `<div class="ev-warn ev-line ev-st-warn" id="srcWarn" data-cause="${esc(b.cause || '')}"><i class="ev-dot risk" aria-hidden="true"></i><p class="ev-grow"><b>${esc(b.title)}</b> ${esc(b.body)}${a.read ? '' : ' ' + esc(a.how)}</p>${act}</div>`;
223
226
  }
224
- const INFO = 'PMOS reads these sources and never posts to them. A switch chooses only what PMOS reads on its own; your Claude sessions can use every connector.';
227
+ const INFO = 'PMOS reads these sources and never posts to them. A switch chooses only what PMOS reads on its own; your Claude sessions can use every connector. PMOS keeps no passwords or keys.';
228
+ /* The directory (initiative connectors-directory; canvas CnA, CnB): search and category chips, Connected · N with every switch of
229
+ * before (a brief source or a connector of the session; each row keeps a slot for the event relay's Listening), ✦ For you, All
230
+ * connectors, a + on each. PMOS cannot add a connector: + opens the connector page of the Claude account, and PMOS waits and notices
231
+ * it (GET /api/connectors/directory?probe=1 every 5 s for 2 minutes). A connector that appears gets one ✦ proposal of what to read;
232
+ * nothing reads it until ✓ (POST /api/proactive/settings with the proposal's patch, then POST /api/connectors/decide). */
233
+ const CONNECT_URL = 'https://claude.ai/settings/connectors';
234
+ const tile = (name) => `<span class="ev-cn-lg" aria-hidden="true">${esc(CD.letter(name))}</span>`;
235
+ const slot = (name) => `<span class="ev-cn-slot" data-ev-listen-slot="${esc(name)}"></span>`; // the event relay's Listening (initiative event-relay)
236
+ const plusBtn = (c) => T.wait && T.wait.id === c.id
237
+ ? `<span class="ev-pill y ev-cn-wait" role="status">Waiting for ${esc(c.name)}</span>`
238
+ : `<a class="ev-ib ev-cn-add" href="${esc((T.dir && T.dir.connectUrl) || CONNECT_URL)}" target="_blank" rel="noopener" data-ev-cadd="${esc(c.id)}" aria-label="${esc('Connect ' + c.name + ' in your Claude account')}" title="${esc('Connect ' + c.name + ' in your Claude account')}">${svg(PLUS, 18)}</a>`;
239
+ function propCards() {
240
+ const ps = (T.dir && T.dir.proposals) || [];
241
+ return ps.map((x) => `<div class="ev-cn-rec" data-ev-prop="${esc(x.name)}">${tile(x.label, x.label)}<div class="ev-grow"><b>${esc(x.label)} is connected.</b><p class="ev-small ev-mut">${svg(SPARK, 14)} PMOS proposes: ${esc(x.reads)}. Nothing reads it until you approve.</p></div>`
242
+ + `<button type="button" class="ev-ib" data-ev-pno="${esc(x.name)}" aria-label="${esc('Not now: ' + x.label)}" title="Not now">${svg(CROSS, 18)}</button>`
243
+ + `<button type="button" class="ev-ib ev-cn-ok" data-ev-pok="${esc(x.name)}" aria-label="${esc('Approve: ' + x.reads)}" title="Approve">${svg(ICON.check, 18)}</button></div>`).join('');
244
+ }
245
+ function connList() {
246
+ const D = CD.directory({ connected: (T.dir && T.dir.connected) || T.conn, signals: (T.dir && T.dir.signals) || [], q: T.q, cat: T.cat });
247
+ const q = String(T.q || '').trim().toLowerCase(), cOk = (label) => (T.cat === 'all' || CD.catOf(label) === T.cat) && (!q || label.toLowerCase().includes(q));
248
+ const row = (label, key, sub, right, name) => `<div class="ev-trow ev-cn-r">${tile(label, key)}<div class="ev-tx ev-grow"><b>${esc(label)}</b><p class="ev-small ev-mut">${esc(sub)}</p></div>${slot(name || key)}${right}</div>`;
249
+ // a connected connector that backs a brief source carries that source's switch; one that backs none, its own switch (as before)
250
+ const list = (T.dir && T.dir.connected) || T.conn, backed = new Set(list.map((c) => c.source).filter(Boolean));
251
+ const conRows = D.connected.map((c) => { const label = c.label || c.name;
252
+ return c.source && c.source in T.src ? row(label, label, T.src[c.source] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', sw(T.src[c.source], `data-ev-src="${c.source}"`, label), c.name)
253
+ : row(label, label, T.con[c.name] ? 'On. Your sessions can use it' : 'Your sessions can use it', sw(T.con[c.name], `data-ev-conn="${esc(c.name)}"`, label), c.name); });
254
+ // the brief sources no connector backs yet keep their switch, with a + when the directory knows the service
255
+ const loose = Object.keys(SRC).filter((k) => k in T.src && !backed.has(k) && cOk(SRC[k]));
256
+ const looseIds = new Set(loose.map((k) => (CD.matchOf(SRC[k]) || {}).id).filter(Boolean));
257
+ const looseRows = loose.map((k) => { const m = CD.matchOf(SRC[k]); return row(SRC[k], SRC[k], T.src[k] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', (m ? plusBtn(m) : '') + sw(T.src[k], `data-ev-src="${k}"`, SRC[k]), k); });
258
+ const count = D.count;
259
+ const head = `<div class="ev-cn-sec"><b class="ev-lbl ev-grow">Connected · ${count}</b>`
260
+ + `<button type="button" class="ev-ib" data-ev-fold aria-expanded="${!T.fold}" aria-controls="evConMore" aria-label="${T.fold ? 'Show the connected ones' : 'Hide the connected ones'}" title="${T.fold ? 'Show the connected ones' : 'Hide the connected ones'}">${svg(T.fold ? CHEV : ICON.down, 18)}</button></div><p class="ev-small ev-mut ev-cn-note">Your sessions can use all of them. A switch chooses what PMOS reads on its own.</p>`;
261
+ const conn = head + (T.fold && !q && T.cat === 'all' ? '' : `<div class="ev-cn-grp" id="evConMore">${conRows.join('') || '<p class="ev-small ev-mut ev-cn-none">None match.</p>'}</div>`)
262
+ + (looseRows.length ? `<div class="ev-cn-sec"><b class="ev-lbl">More sources</b></div><div class="ev-cn-grp">${looseRows.join('')}</div>` : '');
263
+ const add = (c, sub) => `<div class="ev-trow ev-cn-r">${tile(c.name, c.id)}<div class="ev-tx ev-grow"><b>${esc(c.name)}</b><p class="ev-small ev-mut">${esc(sub)}</p></div>${plusBtn(c)}</div>`;
264
+ D.forYou = D.forYou.filter((c) => !looseIds.has(c.id));
265
+ const fy = D.forYou.length ? `<div class="ev-cn-sec"><b class="ev-lbl">For you</b></div><p class="ev-small ev-mut ev-cn-note">${svg(SPARK, 14)} PMOS suggests these from what you connected and what your initiatives link</p><div class="ev-cn-grp">${D.forYou.map((c) => add(c, c.why)).join('')}</div>` : '';
266
+ const rest = D.all.filter((c) => !looseIds.has(c.id));
267
+ const all = rest.length ? `<div class="ev-cn-sec"><b class="ev-lbl">All connectors</b></div><div class="ev-cn-grp">${rest.map((c) => add(c, c.what)).join('')}</div>` : '';
268
+ return conn + fy + all;
269
+ }
225
270
  function connectors() {
226
271
  if (T.sub && T.sub.startsWith('sw:')) return SW.swBody(T.sub);
227
272
  const info = T.info ? `<p class="ev-small ev-mut ev-info" id="evConInfo">${esc(INFO)}</p>` : '';
228
273
  if (T.src === null) return info + readsHtml() + '<p class="ev-small ev-mut">Reading the connectors.</p>';
229
- const brief = Object.keys(SRC).filter((k) => k in T.src).map((k) => [SRC[k], trow(SRC[k], T.src[k] ? 'PMOS reads it on its own' : 'PMOS does not read it on its own', sw(T.src[k], `data-ev-src="${k}"`, SRC[k]))]);
230
- const more = T.conn.filter((c) => !c.source).map((c) => [c.label, trow(c.label, T.con[c.name] ? 'On. Your sessions can use it' : 'Your sessions can use it', sw(T.con[c.name], `data-ev-conn="${esc(c.name)}"`, c.label))]);
231
- const all = [...brief, ...more];
232
- if (!all.length) return info + readsHtml();
233
- // the other connectors fold to one row (CnA): how many, and the first three names
234
- const names = all.map((x) => x[0]), sub = names.length > 3 ? names.slice(0, 3).join(', ') + ' and ' + (names.length - 3) + (names.length - 3 === 1 ? ' other' : ' others') : names.join(', ');
235
- const fold = `<div class="ev-trow ev-fr ev-fold"><span class="ev-gut"></span><div class="ev-tx ev-grow"><span>${all.length} more in your Claude session</span><p class="ev-small ev-mut">${esc(sub)}</p></div>`
236
- + `<button type="button" class="ev-ib" data-ev-fold aria-expanded="${!!T.fold}" aria-controls="evConMore" aria-label="${T.fold ? 'Hide the other connectors' : 'Open the other connectors'}" title="${T.fold ? 'Hide the other connectors' : 'Open the other connectors'}">${svg(T.fold ? ICON.down : CHEV, 18)}</button></div>`;
237
- return info + readsHtml() + fold + (T.fold ? `<div class="ev-con-more" id="evConMore">${all.map((x) => x[1]).join('')}</div>` : '');
274
+ const search = `<label class="ev-cn-search"><span class="ev-vh">Search connectors</span>${svg(ICON.search, 16)}<input type="search" class="ev-inp" id="evConQ" placeholder="Search connectors" value="${esc(T.q || '')}" autocomplete="off"></label>`;
275
+ const chips = `<div class="ev-cn-chips" role="group" aria-label="Category">${CD.CATS.map(([k, l]) => `<button type="button" class="ev-chip${T.cat === k ? ' on' : ''}" data-ev-ccat="${k}" aria-pressed="${T.cat === k}">${esc(l)}</button>`).join('')}</div>`;
276
+ return info + readsHtml() + propCards() + `<div class="ev-cn">${search}${chips}<div id="evConList">${connList()}</div>`
277
+ + `<p class="ev-small ev-mut ev-cn-foot">PMOS keeps no passwords or keys. A connector is added in your Claude account: + opens that page, and PMOS notices when it is there.</p></div>`;
278
+ }
279
+ /** The directory's read; after a +, again every 5 s with the probe until the connector shows or 2 minutes pass. */
280
+ async function readDir(probe) {
281
+ const d = await pmGet('/api/connectors/directory' + (probe ? '?probe=1' : '')).catch(() => null);
282
+ if (d && d.ok) T.dir = d;
283
+ return d && d.ok ? d : null;
284
+ }
285
+ let waitTimer = null;
286
+ function stopWait() { if (waitTimer) clearTimeout(waitTimer); waitTimer = null; T.wait = null; }
287
+ function startWait(id) {
288
+ const c = CD.CATALOG.find((x) => x.id === id); if (!c) return;
289
+ stopWait();
290
+ const before = new Set(((T.dir && T.dir.connected) || T.conn).map((x) => x.name));
291
+ T.wait = { id, name: c.name, until: Date.now() + 120000 };
292
+ const tick = async () => {
293
+ if (!T.wait || T.wait.id !== id || !T.el || T.el.hidden) return;
294
+ const d = await readDir(true);
295
+ const got = d && d.connected.find((x) => !before.has(x.name) && (CD.matchOf(x.label || x.name) || {}).id === id);
296
+ if (got) { stopWait(); T.conn = d.connected; toast(c.name + ' is connected.'); draw(); return; }
297
+ if (Date.now() > T.wait.until) { stopWait(); T.msg = 'PMOS has not seen ' + c.name + ' yet. It shows here once it is added in your Claude account and a session starts.'; draw(); return; }
298
+ waitTimer = setTimeout(tick, 5000);
299
+ };
300
+ waitTimer = setTimeout(tick, 5000);
301
+ }
302
+ async function decideProp(name, ok) {
303
+ const x = ((T.dir && T.dir.proposals) || []).find((y) => y.name === name); if (!x) return;
304
+ if (ok) {
305
+ const r = await pmPost('/api/proactive/settings', x.patch);
306
+ if (!(r && r.ok)) { T.msg = (r && r.error) || 'Not saved.'; draw(); return; }
307
+ if (x.patch.briefSources) Object.assign(T.src, x.patch.briefSources); if (x.patch.connectors) Object.assign(T.con, x.patch.connectors);
308
+ }
309
+ const d = await pmPost('/api/connectors/decide', { name, verdict: ok ? 'approve' : 'dismiss' });
310
+ if (d && d.ok) T.dir = { ...T.dir, proposals: T.dir.proposals.filter((y) => y.name !== name) }; else if (!ok) T.msg = (d && d.error) || 'Not saved.';
311
+ if (ok) toast('Approved. PMOS will ' + x.reads + '.');
312
+ draw();
238
313
  }
239
314
  function workspaces() {
240
315
  if (T.sub === 'workflows') return subHead('workflows') + '<div class="ev-wfh" data-ev-wfhost></div>'; // pm/wf-page.js draws into it (UI grill U1)
@@ -468,11 +543,15 @@ function mount() {
468
543
  const we = r && r.ok && T.set && Array.isArray(T.set.settings) ? T.set.settings.find((x) => x.key === 'time.workEnd') : null; if (we) we.value = Number(e.target.value);
469
544
  draw();
470
545
  });
546
+ T.el.addEventListener('input', (e) => { if (e.target.id !== 'evConQ') return; T.q = e.target.value.slice(0, 80); const l = T.el.querySelector('#evConList'); if (l) l.innerHTML = connList(); });
471
547
  T.el.addEventListener('click', press);
472
548
  return T.el;
473
549
  }
474
550
  async function press(e) {
475
- const t = e.target.closest('a[data-ev-sec], button'); if (!t) return;
551
+ const t = e.target.closest('a[data-ev-sec], a[data-ev-cadd], button'); if (!t) return;
552
+ if (t.dataset.evCadd) { startWait(t.dataset.evCadd); draw(); return; } // the link opens the Claude account's connector page; PMOS waits for it
553
+ if (t.dataset.evCcat) { T.cat = t.dataset.evCcat; draw(); const f = T.el.querySelector(`[data-ev-ccat="${T.cat}"]`); if (f) f.focus(); return; }
554
+ if (t.dataset.evPok || t.dataset.evPno) { if (T.busy) return; T.busy = true; try { await decideProp(t.dataset.evPok || t.dataset.evPno, !!t.dataset.evPok); } finally { T.busy = false; } return; }
476
555
  if (t.dataset.evSec) { e.preventDefault(); const m = MOVED[t.dataset.evSec]; T.sec = m ? m[0] : t.dataset.evSec; T.sub = m ? m[1] : ''; T.msg = ''; T.dress = false; draw(); const f = T.el.querySelector(`[data-ev-sec="${T.sec}"]`); if (f) f.focus(); openCheck(); return; }
477
556
  if ('evClose' in t.dataset) { closeSettings(); return; }
478
557
  if (t.dataset.evWk) { const k = t.dataset.evWk; if (T.wkOpen.has(k)) T.wkOpen.delete(k); else T.wkOpen.add(k); draw(); return; }
@@ -621,6 +700,7 @@ async function load() {
621
700
  JL.load(T.ws.filter((x) => !x.linked), draw); // a linked worktree is its repository: one row each
622
701
  T.src = p && p.ok && p.settings ? { ...p.settings.briefSources } : {}; T.con = p && p.ok && p.settings ? { ...p.settings.connectors } : {};
623
702
  T.conn = p && p.connectors && Array.isArray(p.connectors.list) ? p.connectors.list : [];
703
+ readDir(false).then(() => draw()); // the directory: proposals, ✦ For you signals (initiative connectors-directory)
624
704
  T.set = s && s.ok ? s : null;
625
705
  if (T.set) await AD.loadPrefs(async () => T.set);
626
706
  // the registered products with their ticks: the pick's own read, the one Home, Board and Intelligence share (workspace grill W4: the
@@ -639,7 +719,7 @@ export function openSettings(section, o = {}) {
639
719
  const m = MOVED[section];
640
720
  if (m) { T.sec = m[0]; T.sub = m[1]; T.dress = section === 'dress'; } else if (section && BODY[section]) { T.sec = section; T.sub = ''; T.dress = false; }
641
721
  else if (el.hidden) { T.sec = 'general'; T.sub = ''; T.dress = false; } // a fresh open with no section opens on General (R2), not on the section of the last visit
642
- if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dset = {}; T.cl = null; T.gr = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); SW.swReset(); }
722
+ if (el.hidden) { const ae = document.activeElement; T.back = ae && ae !== document.body ? ae : null; T.ws = null; T.src = null; T.msg = ''; T.phase = ''; T.auto = false; T.wkOpen = new Set(); T.wkMore = new Set(); T.arc = false; T.fresh = null; T.note = {}; T.info = false; T.fold = false; T.dir = null; T.q = ''; T.cat = 'all'; stopWait(); T.dset = {}; T.cl = null; T.gr = null; T.np = null; T.ck = null; T.ls = null; JL.reset(); SW.swReset(); }
643
723
  el.hidden = false; document.getElementById('evStScrim').hidden = false; el.setAttribute('data-esc-layer', '');
644
724
  draw();
645
725
  const f = el.querySelector('[aria-current="page"]'); if (f) f.focus();
@@ -648,6 +728,7 @@ export function openSettings(section, o = {}) {
648
728
  return el;
649
729
  }
650
730
  export function closeSettings() {
731
+ stopWait();
651
732
  if (!T.el || T.el.hidden) return;
652
733
  if (disposeClaudeSetup) { disposeClaudeSetup(); disposeClaudeSetup = null; }
653
734
  if (WF) WF.release();
@@ -5734,6 +5734,22 @@ function dayMarkIds(brief, run) {
5734
5734
  for (const e of brief.calendar || []) known.set(e.id, 'event');
5735
5735
  return known;
5736
5736
  }
5737
+ const CONN_SEEN = () => path.join(STATE, 'connectors-seen.json');
5738
+ let connProbeAt = 0, connProbed = [], connSigMemo = null;
5739
+ /** The services the initiative records of every registered repository link, read at most every 10 minutes (✦ For you). */
5740
+ function connSignals(now = Date.now()) {
5741
+ if (connSigMemo && now - connSigMemo.at < 600000) return connSigMemo.list;
5742
+ const texts = [];
5743
+ for (const w of workspaces.values()) {
5744
+ if (!w || !w.root || texts.length >= 400) continue;
5745
+ const dir = path.join(w.root, 'planning', 'initiatives');
5746
+ let names = []; try { names = fs.readdirSync(dir).filter((f) => f.endsWith('.md')).slice(0, 400 - texts.length); } catch { continue; }
5747
+ for (const f of names) { try { texts.push(fs.readFileSync(path.join(dir, f), 'utf8').slice(0, 65536)); } catch { /* skip */ } }
5748
+ }
5749
+ const list = require('./lib/connector-directory.js').signalsOf(texts);
5750
+ connSigMemo = { at: now, list };
5751
+ return list;
5752
+ }
5737
5753
  // ── Background prepare, slice D3 (initiative proactive-engine) ──────────────────────────────────────────────────
5738
5754
  // The PM approves ONE plan hash from Today. The 60-second tick later starts that session through the SAME path a next-step
5739
5755
  // `go` uses (startWork with origin next-step and the prompt that was shown), only while background prepare is on, outside quiet
@@ -10099,6 +10115,42 @@ async function handleRequest(req, res) {
10099
10115
  if (!w) return json(res, { ok: false, error: 'no workspace' }, 400);
10100
10116
  return json(res, { ok: true, ws: w.id, name: w.name, ...validateLib.readFindings(validationFindingsFile(w)) });
10101
10117
  }
10118
+ /* ── Settings › Connectors as a directory (initiative connectors-directory; canvas CnA, CnB) ──
10119
+ * GET /api/connectors/directory[?probe=1]: the connectors the Claude session has, the new ones ✦ proposes what to read from, and the
10120
+ * services the initiative records link (for ✦ For you). probe=1 (the page sends it while it waits after a +) also asks `claude mcp
10121
+ * list` of the verified login, at most every 20 s, because a connector added in the Claude account reaches the config file only when
10122
+ * a session starts. POST /api/connectors/decide { name, verdict: approve|dismiss } takes a proposal away; the page saves the
10123
+ * proposal's switch with POST /api/proactive/settings first, so nothing reads a new connector before ✓. PMOS stores no key or token. */
10124
+ if (p === '/api/connectors/directory' && req.method === 'GET') {
10125
+ const CD = require('./lib/connector-directory.js');
10126
+ const sc = sessionConnectors(); const list = sc.list.slice(); let probed = false;
10127
+ if (url.searchParams.get('probe') === '1' && Date.now() - connProbeAt > 20000) {
10128
+ connProbeAt = Date.now();
10129
+ try {
10130
+ const b = claudeSetup.bound(defaultProfileFor('claude') || undefined);
10131
+ if (b) {
10132
+ const r = await require('./lib/project-onboard.js').discover({ bound: b });
10133
+ if (r.ok) { probed = true; for (const n of CD.probeNames(r.sources)) if (!list.some((c) => c.name === n)) list.push({ name: n, label: proactiveLib.connectorLabel(n) || n, source: proactiveLib.connectorSource(n), probed: true }); }
10134
+ }
10135
+ } catch { /* the config read stands */ }
10136
+ connProbed = list.filter((c) => c.probed);
10137
+ } else for (const c of connProbed) if (!list.some((x) => x.name === c.name)) list.push(c);
10138
+ let prev = null; try { prev = JSON.parse(fs.readFileSync(CONN_SEEN(), 'utf8')); } catch { /* the first read */ }
10139
+ const n = CD.notice(prev, list.map((c) => c.name));
10140
+ if (JSON.stringify(n.state) !== JSON.stringify(prev)) { try { fs.mkdirSync(STATE, { recursive: true }); fs.writeFileSync(CONN_SEEN(), JSON.stringify(n.state) + '\n'); } catch (e) { warnWriteFail('connectors-seen.json', e); } }
10141
+ return json(res, { ok: true, connectUrl: CD.CONNECT_URL, connected: list, probed,
10142
+ proposals: n.state.pending.map((x) => CD.proposalFor(x.name, proactiveLib.connectorSource(x.name))), signals: connSignals() });
10143
+ }
10144
+ if (p === '/api/connectors/decide' && req.method === 'POST') {
10145
+ let body = {}; try { body = JSON.parse((await readBody(req)) || '{}'); } catch { return json(res, { ok: false, error: 'invalid JSON body' }, 400); }
10146
+ const g = pmGuard.requirePagePress(req, body); if (!g.ok) return json(res, { ok: false, error: g.error }, g.status);
10147
+ const CD = require('./lib/connector-directory.js');
10148
+ let prev = null; try { prev = JSON.parse(fs.readFileSync(CONN_SEEN(), 'utf8')); } catch { /* none */ }
10149
+ const d = CD.decide(prev, String(body.name || ''), body.verdict);
10150
+ if (!d.found) return json(res, { ok: false, error: 'no proposal for that connector' }, 404);
10151
+ try { fs.writeFileSync(CONN_SEEN(), JSON.stringify(d.state) + '\n'); } catch (e) { warnWriteFail('connectors-seen.json', e); return json(res, { ok: false, error: 'could not save — nothing changed' }, 500); }
10152
+ return json(res, { ok: true });
10153
+ }
10102
10154
  /* ── today-goals (G1, G4, G5): the PM's goals for the day, the plan that joins them to the brief and Today, and "plan my
10103
10155
  * day". The goals routes write only goals/<date>.json in the state folder. "Plan my day" seeds the morning-brief
10104
10156
  * schedule when the repository has none and runs it through fireSchedule, the run-now path. Nothing else starts. ── */
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Initiative connectors-directory (feedback batch 31 item 3a; canvas CnA, CnB): Settings › Connectors as a directory. connectors-directory.test.js is pure: pm/cozy-conndir.js and lib/connector-directory.js.",
3
+ "modules": [
4
+ "connectors-directory.test.js"
5
+ ],
6
+ "seconds": {
7
+ "connectors-directory.test.js": 1
8
+ }
9
+ }