create-pmos 0.600.0 → 0.601.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.600.0",
3
+ "version": "0.601.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,25 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.601.0",
38
+ "at": "2026-11-18T07:30:23.248Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1338,
43
+ "t": "Signed event relay for GitHub and Jira; an event only starts a read",
44
+ "s": "Signed event relay for GitHub and Jira; an event only starts a read",
45
+ "k": "new"
46
+ },
47
+ {
48
+ "n": 1342,
49
+ "t": "Your tools as one row per service, and a stuck read says why",
50
+ "s": "Your tools as one row per service, and a stuck read says why",
51
+ "k": "new"
52
+ }
53
+ ]
54
+ },
36
55
  {
37
56
  "v": "0.600.0",
38
57
  "at": "2026-11-18T06:46:12.110Z",
@@ -297,19 +316,6 @@
297
316
  "k": "new"
298
317
  }
299
318
  ]
300
- },
301
- {
302
- "v": "0.581.0",
303
- "at": "2026-11-17T02:30:27.550Z",
304
- "f": 4,
305
- "prs": [
306
- {
307
- "n": 1314,
308
- "t": "Live round from the initiative chat",
309
- "s": "Live round from the initiative chat",
310
- "k": "new"
311
- }
312
- ]
313
319
  }
314
320
  ]
315
321
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@5cdf7b91
1
+ kernel-source: pmos@c44a1e60
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-18T06:46:09Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T07:30:19Z"}
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-18T06:46:09Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T07:30:19Z"}
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-18T06:46:09Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-18T07:30:19Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,23 @@
1
1
  [
2
+ {
3
+ "v": "0.601.0",
4
+ "at": "2026-11-18T07:30:23.248Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1338,
9
+ "t": "Signed event relay for GitHub and Jira; an event only starts a read",
10
+ "s": "Signed event relay for GitHub and Jira; an event only starts a read",
11
+ "k": "new"
12
+ },
13
+ {
14
+ "n": 1342,
15
+ "t": "Your tools as one row per service, and a stuck read says why",
16
+ "s": "Your tools as one row per service, and a stuck read says why",
17
+ "k": "new"
18
+ }
19
+ ]
20
+ },
2
21
  {
3
22
  "v": "0.600.0",
4
23
  "at": "2026-11-18T06:46:12.110Z",
@@ -346,6 +346,20 @@ Press › on a row to open its page. A change you make there shows on the Connec
346
346
  | History | The last five runs, with the result. |
347
347
  | ▶ | Read it now. |
348
348
 
349
+ **Your tools, one row per service.** Mail, Slack, Wispr Flow, Confluence, GitHub, Drive, Figma and Your websites each have their own row, so each can have its own rhythm. On a service's page, **Repeats** has **Same as Your tools**, which is the default. Services due at the same minute share one session. Jira mentions are read with every read of Your tools.
350
+
351
+ **When a read is stuck.** A read that does not end says why on its row, for example **Stuck since 10:00 · waiting for your permission**. Its page says how to fix it, with two buttons:
352
+
353
+ | Reason | What to do |
354
+ |---|---|
355
+ | Waiting for your permission | A background read cannot ask you. Open the session and allow it, or stop it and read again. |
356
+ | Waiting for your answer | Open the session and answer it, or stop it and read again. |
357
+ | Still reading after N min | Nothing, usually. PMOS stops it at 30 min. |
358
+ | Signed out | Sign in again in Settings › PMOS. PMOS ends the read at once. |
359
+ | The session was gone | Nothing. PMOS restarted or the computer slept, and the next read starts on time. |
360
+
361
+ ↗ opens the session. ■ is **Stop and read again**: it stops the read and starts the same services again. A read of a tool that has not ended after 30 minutes is stopped by itself, and History says why. A stuck service holds back only itself: the other services keep their rhythm.
362
+
349
363
  On a day with 3 or more meetings, PMOS proposes ✦ **Read it more often on meeting days**: Calendar every 15 min on such days, other days as set. Nothing changes until you press ✓. **Undo** puts the old rhythm back, and ✕ hides the proposal for today.
350
364
 
351
365
  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.
@@ -365,6 +379,16 @@ PMOS cannot add a connector, because it keeps no passwords or keys. To connect a
365
379
  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
380
  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).
367
381
 
382
+ ### Listening: GitHub and Jira tell PMOS when something changes
383
+
384
+ At the end of Settings › Connectors, **Listening** has a row for GitHub and a row for Jira. A service with no listening set up is read on its schedule, as before. To make PMOS read a service within a minute of a change, even while this computer sleeps:
385
+
386
+ 1. Press the bell on the row. PMOS makes an address and a secret on the central host and shows the steps.
387
+ 2. Copy the address and the secret, and paste them into a new webhook in GitHub (repository or organization Settings › Webhooks) or Jira (Settings › System › WebHooks).
388
+ 3. The row then says **Listening** and shows when the last event came. The last events are listed under the rows.
389
+
390
+ An event only starts a read of that service: GitHub starts the read of your tools, and Jira starts the Jira read and the read of work assigned to you. A read that you turned off stays off. An event never changes your records, never accepts or merges work, and PMOS keeps only its kind, its id, its time and the item it is about (D110). To stop, press the crossed-out bell: the address and its queue are deleted on the host. Listening needs the central host address that Board publishing uses.
391
+
368
392
  ### When a source cannot be read: PMOS repairs it first
369
393
 
370
394
  You do not need to watch the sources. When a source that is on is past its limit, never read, or its last read failed, PMOS reads it again by itself, without a press. Calendar, Jira, My work, tracker items and Your tools are each repaired this way.
@@ -70,6 +70,7 @@ const JOBS = Object.freeze([
70
70
  { id: 'refresh', step: 2, label: 'Data refresh' },
71
71
  { id: 'reports', step: 2, label: 'Report schedules' },
72
72
  { id: 'sync', step: 2, label: 'Git sync', ai: false },
73
+ { id: 'relay', step: 2, label: 'Event relay', ai: false }, // D110: pulls the signed event queue; an event only starts a read (lib/event-relay.js)
73
74
  { id: 'meeting-prewarm', step: 2, label: 'Prototypes before a meeting' }, // lib/live-round-meeting.js: round 1 waits at minute 0
74
75
  { id: 'driver', step: 3, label: 'Initiative Driver' },
75
76
  { id: 'goal-loops', step: 3, label: 'Goal loops' }, // D106: the rounds of a long-running goal (lib/goal-loop.js)
@@ -0,0 +1,202 @@
1
+ 'use strict';
2
+ /* event-relay.js — the workspace's side of the signed event relay (initiative event-relay; D110). An event is a doorbell, never a door.
3
+ *
4
+ * THE CONTRACT with the host (board-host/src/relay.js):
5
+ * POST <host>/api/relay/hooks Bearer <relay key> { source } -> { ok, id, url, secret, source }
6
+ * DELETE <host>/api/relay/hooks/<id> Bearer <relay key> -> { ok }
7
+ * GET <host>/api/relay/events?after=n Bearer <relay key> -> { ok, events: [{ seq, source, kind, id, at, key }], cursor }
8
+ * The host is the D103 host: the same address as board publishing (lib/boards-host.js hostOrigin / addressOf).
9
+ *
10
+ * THE STATE, <runtime state>/event-relay/state.json (mode 0600; never a record, never logged, the key never leaves for the browser):
11
+ * { key, sources: { github?: { id, url, secret, made }, jira?: {…} }, cursor, seen: [eid…200], recent: [{ source, kind, key, at }…20],
12
+ * last: { at, ok, error? }, rang: { source: iso } }
13
+ *
14
+ * THE DOORBELL (D110 point 5). pull() hands each source that had events to ring(readId) ONCE per pull, for the reads in READS. That is all an
15
+ * event can do: ring is lib/refresh-run.js runNow in the server, the same read the schedule starts. This module writes only its own state file.
16
+ *
17
+ * SOURCES · READS · KEEP_MS
18
+ * status(dir, { env }) -> { host, sources: { github: { listening, url, made, last }, jira: … }, recent, last } (no secret)
19
+ * steps(dir, source) -> { ok, source, url, secret, steps: [sentence] } | { ok: false, error } for the PM to paste
20
+ * setup(dir, source, { fetch, env, now }) -> { ok, …steps(dir, source) } | { ok: false, error, status }
21
+ * stop(dir, source, { fetch, env }) -> { ok } | { ok: false, error }
22
+ * pull(dir, { fetch, env, now, ring }) -> { ok, events: n, rang: [readId] } | { ok: true, idle: true } | { ok: false, error }
23
+ * puller({ dir, refreshRun, register }) -> { tick } the background job; register(tick) hands it to the queue
24
+ * doorbell(refreshRun) -> ring: (readId) => refreshRun.runNow(readId) when that read is on, else { ok: false, skipped: 'off' }
25
+ */
26
+ const fs = require('fs');
27
+ const path = require('path');
28
+ const crypto = require('crypto');
29
+ const boardsHost = require('./boards-host.js');
30
+
31
+ const SOURCES = Object.freeze(['github', 'jira']);
32
+ const LABEL = Object.freeze({ github: 'GitHub', jira: 'Jira' });
33
+ /** Which lib/refresh.js reads an event starts. GitHub is read through "Your tools" (sources-read); Jira by the Jira and work-assigned reads. */
34
+ const READS = Object.freeze({ github: Object.freeze(['tools']), jira: Object.freeze(['jira', 'mywork']) });
35
+ const KEEP_MS = 7 * 24 * 60 * 60 * 1000;
36
+ const TIMEOUT_MS = 15000;
37
+
38
+ const fileOf = (dir) => path.join(dir, 'event-relay', 'state.json');
39
+
40
+ function readState(dir) {
41
+ try {
42
+ const s = JSON.parse(fs.readFileSync(fileOf(dir), 'utf8'));
43
+ return { key: typeof s.key === 'string' ? s.key : null, sources: s.sources && typeof s.sources === 'object' ? s.sources : {}, cursor: Number(s.cursor) || 0,
44
+ seen: Array.isArray(s.seen) ? s.seen : [], recent: Array.isArray(s.recent) ? s.recent : [], last: s.last || null, rang: s.rang && typeof s.rang === 'object' ? s.rang : {} };
45
+ } catch { return { key: null, sources: {}, cursor: 0, seen: [], recent: [], last: null, rang: {} }; }
46
+ }
47
+ function writeState(dir, st) {
48
+ const f = fileOf(dir);
49
+ fs.mkdirSync(path.dirname(f), { recursive: true, mode: 0o700 });
50
+ const tmp = f + '.' + process.pid + '.' + crypto.randomBytes(4).toString('hex') + '.tmp';
51
+ fs.writeFileSync(tmp, JSON.stringify(st), { mode: 0o600 });
52
+ fs.renameSync(tmp, f);
53
+ }
54
+ const originOf = (dir, env) => boardsHost.hostOrigin(boardsHost.addressOf(dir, env || process.env));
55
+
56
+ /** One request to the host. Never throws. */
57
+ async function call(origin, method, p, key, body, fetchFn) {
58
+ const f = fetchFn || (typeof fetch === 'function' ? fetch : null);
59
+ if (!f) return { ok: false, error: 'This computer cannot reach the host.' };
60
+ const ctl = typeof AbortController === 'function' ? new AbortController() : null;
61
+ const timer = ctl ? setTimeout(() => ctl.abort(), TIMEOUT_MS) : null;
62
+ try {
63
+ const res = await f(origin + p, { method, redirect: 'error', signal: ctl ? ctl.signal : undefined,
64
+ headers: Object.assign({ Authorization: 'Bearer ' + key, Accept: 'application/json' }, body ? { 'Content-Type': 'application/json' } : {}),
65
+ body: body ? JSON.stringify(body) : undefined });
66
+ let j = null; try { j = await res.json(); } catch { /* not JSON */ }
67
+ if (!res.ok || !j || j.ok === false) return { ok: false, status: res.status, error: (j && typeof j.error === 'string' && j.error.slice(0, 200)) || 'The host refused the request (' + res.status + ').' };
68
+ return { ok: true, body: j };
69
+ } catch (e) {
70
+ return { ok: false, error: e && e.name === 'AbortError' ? 'The host did not answer in time.' : 'The host could not be reached.' };
71
+ } finally { if (timer) clearTimeout(timer); }
72
+ }
73
+
74
+ /** The exact steps the PM follows in the other service. Sentences only; PMOS sends nothing to GitHub or Jira. */
75
+ function stepsFor(source, url, secret) {
76
+ if (source === 'github') return [
77
+ 'In GitHub, open the repository (or the organization), then Settings › Webhooks › Add webhook.',
78
+ 'Payload URL: ' + url,
79
+ 'Content type: application/json.',
80
+ 'Secret: paste the secret shown here.',
81
+ 'Events: choose "Let me select individual events" and tick Pull requests, Issues, Pushes and Releases. Keep Active on, then Add webhook.',
82
+ 'GitHub sends a ping at once. When PMOS shows it under Listening, the address works.',
83
+ ];
84
+ return [
85
+ 'In Jira, open Settings › System › WebHooks (you need to be a Jira admin), then Create a WebHook.',
86
+ 'URL: ' + url,
87
+ 'Secret: paste the secret shown here.',
88
+ 'Events: tick Issue created, updated and deleted. You can limit it with a JQL filter such as project = PMOS.',
89
+ 'Save. The next change to an issue shows under Listening.',
90
+ ];
91
+ }
92
+
93
+ function steps(dir, source) {
94
+ if (!SOURCES.includes(source)) return { ok: false, status: 400, error: 'PMOS listens to GitHub and Jira.' };
95
+ const s = readState(dir).sources[source];
96
+ if (!s) return { ok: false, status: 404, error: LABEL[source] + ' is not set up to send events yet.' };
97
+ return { ok: true, source, url: s.url, secret: s.secret, steps: stepsFor(source, s.url, s.secret) };
98
+ }
99
+
100
+ function status(dir, { env } = {}) {
101
+ const st = readState(dir);
102
+ const sources = {};
103
+ for (const id of SOURCES) {
104
+ const s = st.sources[id];
105
+ sources[id] = s ? { listening: true, url: s.url, made: s.made, last: st.rang[id] || null, reads: READS[id] } : { listening: false, reads: READS[id] };
106
+ }
107
+ return { host: !!originOf(dir, env), sources, recent: st.recent.slice(0, 10), last: st.last };
108
+ }
109
+
110
+ const noHost = { ok: false, status: 409, error: 'Listening for events needs the central host. Set its address under Board › Publish (or PMOS_BOARDS_HOST), then try again.' };
111
+
112
+ async function setup(dir, source, opts = {}) {
113
+ if (!SOURCES.includes(source)) return { ok: false, status: 400, error: 'PMOS listens to GitHub and Jira.' };
114
+ const origin = originOf(dir, opts.env); if (!origin) return noHost;
115
+ const st = readState(dir);
116
+ if (!st.key) { st.key = crypto.randomBytes(32).toString('base64url'); writeState(dir, st); }
117
+ const r = await call(origin, 'POST', '/api/relay/hooks', st.key, { source }, opts.fetch);
118
+ if (!r.ok) return r;
119
+ const b = r.body;
120
+ if (typeof b.id !== 'string' || typeof b.secret !== 'string' || b.secret.length < 20 || typeof b.url !== 'string' || !b.url.startsWith(origin + '/hook/')) return { ok: false, status: 502, error: 'The host sent an answer this workspace does not accept.' };
121
+ const cur = readState(dir);
122
+ cur.key = st.key;
123
+ cur.sources[source] = { id: b.id, url: b.url, secret: b.secret, made: new Date(opts.now || Date.now()).toISOString() };
124
+ writeState(dir, cur);
125
+ return steps(dir, source);
126
+ }
127
+
128
+ async function stop(dir, source, opts = {}) {
129
+ if (!SOURCES.includes(source)) return { ok: false, status: 400, error: 'PMOS listens to GitHub and Jira.' };
130
+ const st = readState(dir); const s = st.sources[source];
131
+ if (!s) return { ok: true };
132
+ const origin = originOf(dir, opts.env);
133
+ if (origin && st.key) {
134
+ const r = await call(origin, 'DELETE', '/api/relay/hooks/' + encodeURIComponent(s.id), st.key, null, opts.fetch);
135
+ if (!r.ok && r.status !== 404) return r;
136
+ }
137
+ const cur = readState(dir); delete cur.sources[source]; delete cur.rang[source]; cur.recent = cur.recent.filter((e) => e.source !== source);
138
+ writeState(dir, cur);
139
+ return { ok: true };
140
+ }
141
+
142
+ /** Pull the queue once and ring the doorbell. A source rings once per pull however many events it had; a delivery already seen does not ring;
143
+ * an event older than 7 days is dropped. ring(readId) is the only effect outside this module's state file. */
144
+ async function pull(dir, opts = {}) {
145
+ const st = readState(dir);
146
+ const live = SOURCES.filter((s) => st.sources[s]);
147
+ if (!st.key || !live.length) return { ok: true, idle: true };
148
+ const origin = originOf(dir, opts.env); if (!origin) return noHost;
149
+ const t = opts.now || Date.now();
150
+ const r = await call(origin, 'GET', '/api/relay/events?after=' + st.cursor, st.key, null, opts.fetch);
151
+ const cur = readState(dir);
152
+ if (!r.ok) { cur.last = { at: new Date(t).toISOString(), ok: false, error: r.error }; writeState(dir, cur); return r; }
153
+ const events = Array.isArray(r.body.events) ? r.body.events : [];
154
+ const seen = new Set(cur.seen);
155
+ const fresh = [];
156
+ for (const e of events) {
157
+ if (!e || !live.includes(e.source)) continue;
158
+ const at = Date.parse(e.at); if (!Number.isFinite(at) || t - at > KEEP_MS) continue;
159
+ const id = String(e.id || ''); if (!id || seen.has(id)) continue;
160
+ seen.add(id);
161
+ fresh.push({ source: e.source, kind: String(e.kind || '').slice(0, 80), key: String(e.key || '').slice(0, 160), at: new Date(at).toISOString(), id });
162
+ }
163
+ const rang = [];
164
+ const ring = typeof opts.ring === 'function' ? opts.ring : null;
165
+ for (const src of live) {
166
+ if (!fresh.some((e) => e.source === src)) continue;
167
+ cur.rang[src] = new Date(t).toISOString();
168
+ if (!ring) continue;
169
+ for (const readId of READS[src]) { try { const x = ring(readId, src); if (!x || x.ok !== false || x.status === 409) rang.push(readId); } catch { /* the next event rings again */ } }
170
+ }
171
+ const cursor = Number(r.body.cursor); if (Number.isFinite(cursor) && cursor > cur.cursor) cur.cursor = cursor;
172
+ cur.seen = [...seen].slice(-200);
173
+ cur.recent = fresh.map(({ source, kind, key, at }) => ({ source, kind, key, at })).reverse().concat(cur.recent).filter((e) => t - Date.parse(e.at) <= KEEP_MS).slice(0, 20);
174
+ cur.last = { at: new Date(t).toISOString(), ok: true };
175
+ writeState(dir, cur);
176
+ return { ok: true, events: fresh.length, rang };
177
+ }
178
+
179
+ /** The ring the server hands pull(): start the read through the refresh engine (lib/refresh-run.js), the same read the schedule starts.
180
+ * A read the PM turned off stays off: the doorbell does not turn it on. */
181
+ function doorbell(refreshRun) {
182
+ return (readId) => {
183
+ const set = refreshRun.settings(); const s = set && set.sources && set.sources[readId];
184
+ if (!s || s.on !== true) return { ok: false, skipped: 'off' };
185
+ return refreshRun.runNow(readId, {});
186
+ };
187
+ }
188
+
189
+ /** The background job: registers one tick with the queue (lib/bg-queue.js job 'relay'). A tick pulls once; a pull still going skips the tick. */
190
+ function puller({ dir, refreshRun, register, fetch: fetchFn, env } = {}) {
191
+ let busy = false;
192
+ const tick = () => {
193
+ if (busy) return null;
194
+ const rr = typeof refreshRun === 'function' ? refreshRun() : refreshRun;
195
+ busy = true;
196
+ return pull(dir, { fetch: fetchFn, env, ring: rr ? doorbell(rr) : null }).catch(() => ({ ok: false })).finally(() => { busy = false; });
197
+ };
198
+ if (typeof register === 'function') register(tick);
199
+ return { tick };
200
+ }
201
+
202
+ module.exports = { SOURCES, LABEL, READS, KEEP_MS, readState, status, steps, stepsFor, setup, stop, pull, doorbell, puller };
@@ -136,6 +136,7 @@ const JOBS = Object.freeze([
136
136
  q('refresh', 'lib/refresh.js', ['<runtime>/refresh-log.jsonl'], ['connectors']),
137
137
  q('reports', 'lib/routes-report-setups.js', ['<state>/report-setups.jsonl', '<state>/ready-reports.jsonl'], ['<state>/report-setups.jsonl']),
138
138
  q('sync', 'lib/auto-sync.js', [], ['git'], 'git only: no model and no ledger'),
139
+ q('relay', 'lib/event-relay.js', [], ['the central host'], 'D110: no model and no ledger; it keeps its own state file (event-relay/state.json) and an event only starts a read of its source through the refresh engine, never a record'),
139
140
  q('driver', 'lib/driver.js', ['<state>/driver.jsonl'], ['initiative records', 'jira']),
140
141
  q('goal-loops', 'lib/goal-loop.js', ['<runtime>/goal-loops.jsonl'], ['<runtime>/goal-loops.jsonl'], 'D106: each round is a run started through the capacity governor; the run writes its own records'),
141
142
  q('finder', 'lib/report-finder.js', ['<state>/report-setups.jsonl'], ['connectors']),