create-pmos 0.572.0 → 0.574.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.572.0",
3
+ "version": "0.574.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.574.0",
38
+ "at": "2026-11-16T06:14:05.146Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1306,
43
+ "t": "The phone chat's composer and menu button stay in place after touch scrolling",
44
+ "s": "The phone chat's composer and menu button stay in place after touch scrolling",
45
+ "k": "fix"
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "v": "0.573.0",
51
+ "at": "2026-11-16T04:53:10.251Z",
52
+ "f": 4,
53
+ "prs": [
54
+ {
55
+ "n": 1304,
56
+ "t": "The kill switch reaches open factory PRs; clearer build help, policy and next",
57
+ "s": "The kill switch reaches open factory PRs; clearer build help, policy and next",
58
+ "k": "fix"
59
+ }
60
+ ]
61
+ },
36
62
  {
37
63
  "v": "0.572.0",
38
64
  "at": "2026-11-16T04:39:30.480Z",
@@ -278,38 +304,6 @@
278
304
  "k": "new"
279
305
  }
280
306
  ]
281
- },
282
- {
283
- "v": "0.554.0",
284
- "at": "2026-11-10T22:52:00.722Z",
285
- "f": 4,
286
- "prs": [
287
- {
288
- "n": 1281,
289
- "t": "Say PMOS, not Claude, across the workspace",
290
- "s": "Say PMOS, not Claude, across the workspace",
291
- "k": "new"
292
- },
293
- {
294
- "n": 1283,
295
- "t": "PMOS-self records leave workspace/state; CLAUDE.md names the tracked record and OKF v0.2; judging skills link their guides",
296
- "s": "PMOS-self records leave workspace/state; CLAUDE.md names the tracked record and OKF v0.2; judging skills link their guides",
297
- "k": "fix"
298
- }
299
- ]
300
- },
301
- {
302
- "v": "0.553.0",
303
- "at": "2026-11-10T22:27:26.069Z",
304
- "f": 4,
305
- "prs": [
306
- {
307
- "n": 1282,
308
- "t": "The Board groups By goal in every view and on a shared Board link",
309
- "s": "The Board groups By goal in every view and on a shared Board link",
310
- "k": "new"
311
- }
312
- ]
313
307
  }
314
308
  ]
315
309
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@3421561f
1
+ kernel-source: pmos@fffed702
2
2
  assembled: 2026-11-16
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-16T04:39:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-16T06:14:01Z"}
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-16T04:39:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-16T06:14:01Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1409,7 +1409,8 @@ function cliMain(argv) {
1409
1409
  const ledger = path.join(__dirname, '..', 'planning', 'work-items.jsonl');
1410
1410
  const read = () => { try { return readLedgerSafely(ledger); } catch (e) { if (e && e.code === 'ENOENT') return ''; throw e; } };
1411
1411
  const usage = () => {
1412
- console.log('usage: node scripts/work-item.js declare <initiative> --type <t> --blast <b> --criterion "<text>" --check <kind> --ref "<ref>" [--plan-item <id>] [--agent <who>] [--hours N]');
1412
+ console.log('usage: node scripts/work-item.js declare <initiative> --type <t> --blast <b> --criterion "<text>" --check <kind> --ref "<ref>" [--plan-item <id>] [--agent <who>] [--hours N] [--no-claim]');
1413
+ console.log(' declare claims the item for you; add --no-claim to leave it for the Builder (pmos build next lists only unclaimed items)');
1413
1414
  console.log(' [--scope <path,…>] [--flag <name> [--metric <name> --budget <max>] | --no-user-facing] [--kr] (D108: what the merge guardrail reads)');
1414
1415
  console.log(' node scripts/work-item.js verify <item> --evidence "<what passed>"');
1415
1416
  console.log(' node scripts/work-item.js claim <item> [--agent <who>] [--hours N]');
@@ -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-16T04:39:26Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-16T06:14:01Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,30 @@
1
1
  [
2
+ {
3
+ "v": "0.574.0",
4
+ "at": "2026-11-16T06:14:05.146Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1306,
9
+ "t": "The phone chat's composer and menu button stay in place after touch scrolling",
10
+ "s": "The phone chat's composer and menu button stay in place after touch scrolling",
11
+ "k": "fix"
12
+ }
13
+ ]
14
+ },
15
+ {
16
+ "v": "0.573.0",
17
+ "at": "2026-11-16T04:53:10.251Z",
18
+ "f": 4,
19
+ "prs": [
20
+ {
21
+ "n": 1304,
22
+ "t": "The kill switch reaches open factory PRs; clearer build help, policy and next",
23
+ "s": "The kill switch reaches open factory PRs; clearer build help, policy and next",
24
+ "k": "fix"
25
+ }
26
+ ]
27
+ },
2
28
  {
3
29
  "v": "0.572.0",
4
30
  "at": "2026-11-16T04:39:30.480Z",
@@ -461,7 +461,7 @@ For each pull request on a `pmos/` branch, the check runs the default branch's c
461
461
  - **AUTO.** The item is verified in the default branch's records, every changed file is inside the item's declared scope, the change reads its flag (or the item has no user-facing effect), and no trigger fires. The check marks the pull request ready and turns on auto-merge. GitHub merges when every required check is green.
462
462
  - **HUMAN.** The check names every reason and turns auto-merge off. You merge.
463
463
 
464
- These triggers always make the answer HUMAN: migrations or data deletion; auth, permissions, payments, personal data or secrets; CI, gates, the guardrail or PMOS records; a new dependency; a public API or contract; anything sent outward; a new agent path; a changed existing test, test configuration or the item's own check; an item that failed before; a revert on the default branch in the last 14 days; a folder untouched for 90 days. When agents are switched off (`pmos ai off`) or the factory is back to propose-only after a revert, PMOS writes `PMOS-Merge: human` in the pull request, and the check reads HUMAN. To stop one merge yourself, add that line to the pull request's description. A pull request from a fork always reads HUMAN.
464
+ These triggers always make the answer HUMAN: migrations or data deletion; auth, permissions, payments, personal data or secrets; CI, gates, the guardrail or PMOS records; a new dependency; a public API or contract; anything sent outward; a new agent path; a changed existing test, test configuration or the item's own check; an item that failed before; a revert on the default branch in the last 14 days; a folder untouched for 90 days. When agents are switched off (`pmos ai off`) or the factory is back to propose-only after a revert, PMOS writes `PMOS-Merge: human` in the pull request, and the check reads HUMAN. `pmos ai off` also reaches pull requests that are already open: PMOS turns each open pull request on a `pmos/` branch back into a draft, which drops GitHub's auto-merge, and adds `PMOS-Merge: human` to its description. The server does the same when the factory goes back to propose-only. To stop one merge yourself, add that line to the pull request's description. A pull request from a fork always reads HUMAN.
465
465
 
466
466
  `pmos build policy <item>` shows the answer on this computer before the check runs.
467
467
 
@@ -45,7 +45,7 @@ A key that you type in a field, or in a terminal, goes to the field or the termi
45
45
 
46
46
  ## On a phone
47
47
 
48
- At phone width, Home's list is the page. A row opens its item over the list, with a back bar. The menu button is at the bottom right. In a chat it sits just above the message box, never on it. Search fills the screen. The Viewer fills the screen, and ← at the first item closes it.
48
+ At phone width, Home's list is the page. A row opens its item over the list, with a back bar. The menu button is at the bottom right. In a chat the message box stays at the bottom of the screen while you scroll, and the menu button sits just above it, with the Live count beside it. Messages fade out under them. Search fills the screen. The Viewer fills the screen, and ← at the first item closes it.
49
49
 
50
50
  ## First run
51
51
 
@@ -100,6 +100,17 @@ function run(argv, { say = (s) => console.log(s), env = process.env, stateDir =
100
100
  if (!r || !r.ok) { say('✗ ' + ((r && r.error) || 'could not save')); return 1; }
101
101
  const envWins = verb === 'on' && AG.off(job, { env, settingsDir: null });
102
102
  say(`${job || 'every AI job'}: ${verb}${envWins ? ' in Settings, but ' + envWins + ' wins' : ''}`);
103
+ // D108: off reaches the factory's pull requests that are already open (they go back to draft with PMOS-Merge: human)
104
+ if (verb === 'off' && !job) {
105
+ const WK = require('./work-kind.js');
106
+ for (const root of roots || rootsOf(dir, cwd)) {
107
+ if (!WK.factoryDir(root)) continue;
108
+ let r;
109
+ try { r = require('./factory-rollout.js').holdOnce(root, 'agents are off (pmos ai off)', { now: Date.now(), env }); } catch (e) { r = { ok: false, error: e.message }; }
110
+ if (r && r.held && r.held.length) say(` ${path.basename(root)}: held ${r.held.map((n) => '#' + n).join(', ')} for a person (draft, PMOS-Merge: human)`);
111
+ else if (r && r.ok === false) say(` ${path.basename(root)}: ${r.error}`);
112
+ }
113
+ }
103
114
  return 0;
104
115
  }
105
116
 
@@ -6,7 +6,8 @@
6
6
  * pmos build claim <item> [--json] claim one, on a new branch pmos/<item> in a worktree of its own
7
7
  * pmos build propose <item> "<what it does>" --evidence "<the check that passed>" [--json]
8
8
  * commit, mark verified, and file "Open a draft pull request" under the ✦
9
- * pmos build open <item> [--json] the PM only: push the branch and open the DRAFT pull request
9
+ * (PMOS opens it by itself, D108 point 6; with agents off it waits for the ✓)
10
+ * pmos build open <item> [--json] never a role run: push the branch and open the DRAFT pull request
10
11
  * pmos build status [--json] every work item, its branch and whether its worktree is here
11
12
  * pmos build policy <item> [--json] what the merge guardrail reads for it now: auto or human, and why (D108)
12
13
  * pmos build rollout [<item> [--to <percent>]] [--json] no item: where every flag stands; an item: the PM's own next step
@@ -28,8 +29,9 @@ const USAGE = [
28
29
  ' pmos build next [<initiative>] the declared work items no Builder has taken',
29
30
  ' pmos build claim <item> claim one; PMOS makes the branch pmos/<item> in a worktree outside this folder',
30
31
  ' pmos build propose <item> "<what it does>" --evidence "<the check that passed>"',
31
- ' commit it and file "Open a draft pull request" under the initiative\'s ✦',
32
- ' pmos build open <item> you only (the ✓ runs it): push pmos/<item> and open the draft pull request',
32
+ ' commit it; PMOS then opens the draft pull request by itself (Undo closes it)',
33
+ ' pmos build open <item> open it now yourself: push pmos/<item> and open the draft pull request',
34
+ ' (with pmos ai off, the pull request waits for this or your ✓)',
33
35
  ' pmos build status every work item and its branch',
34
36
  ' pmos build policy <item> auto or human: whether its pull request merges by itself, and why',
35
37
  ' pmos build rollout [<item> [--to <percent>]] where every flag stands; with an item, take its flag to the next step',
@@ -70,7 +72,13 @@ async function run(argv, { say = (s) => console.log(s), env = process.env, cwd =
70
72
  if (verb === 'next' || verb === 'status') {
71
73
  const list = verb === 'next' ? BE.next(root, pos[0]) : BE.status(root);
72
74
  if (json) return ok({ items: list });
73
- if (!list.length) { say(verb === 'next' ? 'No declared work item waits for a Builder.' : 'No work items.'); return 0; }
75
+ if (!list.length) {
76
+ if (verb !== 'next') { say('No work items.'); return 0; }
77
+ const taken = BE.itemsOf(root).filter((x) => x.state === 'claimed' && (!pos[0] || x.initiative_id === pos[0]));
78
+ say('No declared work item waits for a Builder.');
79
+ if (taken.length) say(`${taken.length === 1 ? '1 item is' : taken.length + ' items are'} claimed already: ${taken.slice(0, 5).map((x) => `${x.item_id} by ${(x.claim && x.claim.agent) || 'someone'}`).join(', ')}. To leave an item for the Builder, declare it with --no-claim.`);
80
+ return 0;
81
+ }
74
82
  for (const x of list) say(verb === 'next' ? `${x.item_id} ${x.type || ''} ${(x.criterion && x.criterion.text) || ''}` : `${x.item} ${x.state} ${x.branch}${x.here ? ' (worktree here)' : ''}`);
75
83
  return 0;
76
84
  }
@@ -56,6 +56,9 @@ function mergePolicy(root, it, { env = process.env } = {}) {
56
56
  if (k) return human(`A person merges this pull request: ${k}.`, [{ rule: 'autonomy-off', detail: k }], true);
57
57
  if (typeof root !== 'string' || !it || !it.item_id) return human('A person merges this pull request.');
58
58
  const top = topOf(root) || root;
59
+ if (!git(top, ['rev-parse', '--verify', '--quiet', 'refs/heads/' + branchOf(it.item_id)]).ok) {
60
+ return human(`There is no branch ${branchOf(it.item_id)} yet, so there is nothing to judge. The guardrail reads it after pmos build claim and propose.`, [{ rule: 'no-branch', detail: `no branch ${branchOf(it.item_id)} yet` }]);
61
+ }
59
62
  try {
60
63
  const sd = require('./driver.js').stateDirOf(top, { create: false });
61
64
  const dm = sd ? A.demotedNow(A.fold(A.read(sd)), FACTORY_JOB, null) : null;
@@ -248,6 +251,37 @@ function revert(root, item, { env = process.env, why = 'its guard metric left it
248
251
  return o.ok ? { ok: true, branch, url: o.url } : { ok: false, branch, error: o.error };
249
252
  }
250
253
 
254
+ function ghEnvOf(top, env) {
255
+ const login = require('./git-identity.js').pushLogin(top);
256
+ if (!login) return { ...env };
257
+ const t = cp.spawnSync('gh', ['auth', 'token', '--user', login], { encoding: 'utf8', env });
258
+ return t.status === 0 && String(t.stdout).trim() ? { ...env, GH_TOKEN: String(t.stdout).trim() } : { ...env };
259
+ }
260
+
261
+ /** The kill switch reaches pull requests already open (D108 point 5). For every open pull request on a pmos/ branch whose description
262
+ * lacks the line, PMOS turns it back into a draft (GitHub drops auto-merge from a draft) and adds `PMOS-Merge: human` to the
263
+ * description, so the guardrail reads HUMAN when it runs again. It closes and merges nothing. → { ok, held: [number] } | { ok: false, error } */
264
+ function holdOpen(root, { env = process.env, why = 'agents are off' } = {}) {
265
+ if (env.PMOS_TEAM_RUN) return { ok: false, error: 'a role run cannot change pull requests' };
266
+ const top = topOf(root) || root;
267
+ const ghEnv = ghEnvOf(top, env);
268
+ const l = cp.spawnSync('gh', ['pr', 'list', '--state', 'open', '--limit', '100', '--json', 'number,headRefName,body,isDraft'], { cwd: top, encoding: 'utf8', env: ghEnv });
269
+ if (l.error || l.status !== 0) return { ok: false, error: `gh could not list the open pull requests: ${one(l.stderr || (l.error && l.error.message), 200)}. Turn auto-merge off on PMOS's pull requests by hand` };
270
+ let list = [];
271
+ try { list = JSON.parse(l.stdout || '[]'); } catch { list = []; }
272
+ const held = [], failed = [];
273
+ for (const p of Array.isArray(list) ? list : []) {
274
+ if (!p || !/^pmos\//.test(String(p.headRefName || '')) || !/^[0-9]+$/.test(String(p.number))) continue;
275
+ if (/^PMOS-Merge:\s*human\s*$/mi.test(String(p.body || ''))) continue;
276
+ const n = String(p.number);
277
+ if (!p.isDraft) cp.spawnSync('gh', ['pr', 'ready', n, '--undo'], { cwd: top, encoding: 'utf8', env: ghEnv });
278
+ const body = `${String(p.body || '').replace(/\s+$/, '')}\n\nPMOS-Merge: human\n(${one(why, 160)})`;
279
+ const e = cp.spawnSync('gh', ['pr', 'edit', n, '--body', body], { cwd: top, encoding: 'utf8', env: ghEnv });
280
+ if (e.error || e.status !== 0) failed.push(n); else held.push(Number(n));
281
+ }
282
+ return failed.length ? { ok: false, held, error: `could not hold pull request ${failed.map((x) => '#' + x).join(', ')}` } : { ok: true, held };
283
+ }
284
+
251
285
  /** Undo of an opened pull request (D108): close it with gh, comment why, leave the branch. → { ok } | { ok: false, error } */
252
286
  function close(root, item, { url = '', env = process.env } = {}) {
253
287
  if (env.PMOS_TEAM_RUN) return { ok: false, error: 'a role run cannot close a pull request' };
@@ -264,4 +298,4 @@ function status(root) {
264
298
  return itemsOf(root).map((x) => { const wt = worktreeOf(root, x.item_id); return { item: x.item_id, state: x.state, branch: branchOf(x.item_id), worktree: wt, here: fs.existsSync(wt) }; });
265
299
  }
266
300
 
267
- module.exports = { POLICY, FACTORY_JOB, FORBIDDEN, mergePolicy, forbiddenIn, branchOf, revertBranchOf, worktreeOf, defaultBranch, itemsOf, next, claim, propose, open, revert, close, status };
301
+ module.exports = { POLICY, FACTORY_JOB, FORBIDDEN, mergePolicy, forbiddenIn, branchOf, revertBranchOf, worktreeOf, defaultBranch, itemsOf, next, claim, propose, open, revert, close, holdOpen, status };
@@ -102,7 +102,12 @@ function flagged(root) {
102
102
  function tick(root, { now = Date.now(), env = process.env } = {}) {
103
103
  const A = require('./autonomy.js');
104
104
  const k = A.killed({ env });
105
- if (k) return { acted: [], why: k };
105
+ if (k) { holdOnce(root, k, { now, env }); return { acted: [], why: k }; }
106
+ try {
107
+ const sd0 = stateDir(root), st = sd0 ? A.fold(A.read(sd0)) : null;
108
+ const dm = st && (A.demotedNow(st, JOB, null, now) || A.demotedNow(st, OPEN_JOB, null, now));
109
+ if (dm) holdOnce(root, `the factory is back to propose-only until ${String(dm.until).slice(0, 10)}`, { now, env });
110
+ } catch { /* no autonomy ledger: nothing demoted */ }
106
111
  const items = flagged(root);
107
112
  if (!items.length) return { acted: [] };
108
113
  const cfg = configOf(root);
@@ -149,6 +154,14 @@ function tick(root, { now = Date.now(), env = process.env } = {}) {
149
154
  return { acted };
150
155
  }
151
156
 
157
+ /** Once per reason: hold the factory's open pull requests (lib/build-engine.js holdOpen). Logged without an item, so no rollout reads it. */
158
+ function holdOnce(root, why, { now, env }) {
159
+ const prev = lines(root).filter((l) => l.step === 'hold-prs').pop();
160
+ if (prev && prev.why === why && prev.ok) return null;
161
+ const r = require('./build-engine.js').holdOpen(root, { env, why });
162
+ return log(root, { step: 'hold-prs', why, ok: !!r.ok, held: r.held || [], ...(r.ok ? {} : { error: r.error }) }, now);
163
+ }
164
+
152
165
  function itemFlag(root, item) {
153
166
  const it = require('./build-engine.js').itemsOf(root).find((x) => x.item_id === item);
154
167
  if (!it) return { error: `${item} is not a work item here` };
@@ -187,4 +200,4 @@ function statusOf(root) {
187
200
  return [...lastOf(root).values()].map((l) => ({ item: l.item, flag: l.flag, percent: Number(l.percent) || 0, step: l.step, at: l.at, why: l.why }));
188
201
  }
189
202
 
190
- module.exports = { STEPS, JOB, LEDGER, configOf, tick, rollout, rollback, statusOf };
203
+ module.exports = { STEPS, JOB, OPEN_JOB, LEDGER, configOf, tick, rollout, rollback, statusOf, holdOnce };
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.572.0",
3
+ "version": "0.574.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.572.0",
9
+ "version": "0.574.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.572.0",
3
+ "version": "0.574.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",
@@ -476,6 +476,14 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
476
476
  .hv-why input, .hv-why select, .hv-why textarea { font-size: var(--fs-field); min-height: 44px; }
477
477
  .hx-row select, .hx-add input { font-size: var(--fs-field); min-height: 44px; } /* a task's status and Add a task: 44 px targets that do not zoom the page */
478
478
  .hm-foot { position: sticky; bottom: 0; z-index: 5; margin: 0 -16px; padding: 8px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--cz-ground); } /* the composer stays on the screen while the conversation scrolls */
479
+ /* Home's composer is fixed to the screen's bottom, not sticky (batch 30 item 2): the place menu's button is fixed just above it, so the
480
+ * two share one layer and the button's offset is the composer's height alone. Sticky with a measured offset left the button over the
481
+ * messages after touch scrolling on iOS. The chat keeps the composer's height under its last message. */
482
+ body.cz-home #hmFoot { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; }
483
+ body.cz-home #hmChat { box-sizing: border-box; padding-bottom: var(--bd-hmfoot, 232px); }
484
+ /* a short fade over the text that scrolls under the button, so the button never sits on a readable line; home-line.css takes it away
485
+ * where the phone chat has no button */
486
+ body.cz-home #hmFoot::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 72px; pointer-events: none; background: var(--cz-ground); background-size: 100% 1000px; -webkit-mask-image: linear-gradient(to bottom, transparent, black 40%); mask-image: linear-gradient(to bottom, transparent, black 40%); } /* the ground is a gradient: its first colours meet the composer's top */
479
487
  .hm-x { opacity: 1; }
480
488
  .hm-unfold, .hm-folded .hm-unfold { display: none; }
481
489
  .hm-reopen { display: none; }
@@ -484,7 +492,9 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
484
492
  }
485
493
  /* the menu button sits just above the foot (the box, its bars and the hint: home-chat.js keeps --bd-hmfoot), never over a press; the log ends
486
494
  * with room for it, so the last message scrolls clear of it */
487
- @media (max-width: 760px) { body.cz-home .cz-fabw { bottom: calc(var(--bd-hmfoot, 232px) + 10px); } body.cz-home.hm-sheet .cz-fabw { bottom: 118px; } .hm-log { padding-bottom: 76px; } }
495
+ @media (max-width: 760px) { body.cz-home .cz-fabw { bottom: calc(var(--bd-hmfoot, 232px) + 10px); } body.cz-home.hm-sheet .cz-fabw { bottom: 118px; } .hm-log { padding-bottom: 76px; }
496
+ /* the Live pill sits beside the button, inside the fade, not stacked over the messages (batch 30 item 2) */
497
+ body.cz-home:not(.hm-plist):not(.hm-sheet) .cz-fabw .cz-live { left: auto; right: 68px; bottom: 6px; } }
488
498
  .hv-term { margin: 0; height: 100%; box-sizing: border-box; padding: 16px 20px; overflow: auto; white-space: pre-wrap; word-break: break-word; font-family: var(--cz-mono); font-size: var(--fs-meta); line-height: 1.5; color: var(--cz-ink2); background: var(--cz-well); }
489
499
  .hv-xt { height: 100%; box-sizing: border-box; padding: 12px 16px; overflow: auto; background: var(--cz-well); } /* term-view.js: the session's terminal drawn by xterm.js, read only */
490
500
  .hv-xt .xterm { display: inline-block; zoom: .8; } /* xterm's 15px default drawn at 12px */
@@ -59,6 +59,7 @@ import { mountRecRow, clockOf as recClock } from './home-rec-row.js';
59
59
  import { mountSesName } from './home-ses-name.js'; // session names A: tap the session's name to rename it (canvas XmsNames)
60
60
  import * as SM from './split-merge.js'; // split one initiative in two, or merge two: Claude suggests, the PM approves (batch 11 item 14)
61
61
  import * as PM from './prog-move.js'; // move an initiative out of its program, or to another (canvas LpA1More, LpA2Other, LpA4Phone)
62
+ import { wireSettle } from './vv-settle.js'; // the phone's fixed layer back in place after the keyboard and touch scrolls (batch 30 item 2)
62
63
  import * as CW from './ctx-wedge.js'; // how full a session's context is, and Claude's ✦ Compact (batch 13 item 8, XctxA1Desk)
63
64
  import * as SO from './sort-order.js'; // the sort button and ONE order with the Board (batch 14 item 8, canvas SoAHomePhone)
64
65
  import * as PO from './prog-order.js'; // a program's order on Home: the grip, hold-then-drag on a phone, ✦ Claude's order from the dates (canvas RoAPhone)
@@ -84,6 +85,7 @@ const BOARD = P.get('board') || ''; // the Board's expand link names its board
84
85
  const boardQ = (pre = '?') => (BOARD ? pre + 'board=' + encodeURIComponent(BOARD) : '');
85
86
  const PHONE = 760;
86
87
  const isPhone = () => innerWidth <= PHONE;
88
+ if (navigator.maxTouchPoints > 0) wireSettle(window); // a touch screen only: on a desktop the page does not scroll and the nudge is not needed
87
89
  const SVG = (d, w = 16, sw = 1.8) => `<svg aria-hidden="true" width="${w}" height="${w}" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="${sw}" stroke-linecap="round" stroke-linejoin="round"><path d="${d}"/></svg>`;
88
90
  /** The Everything chip's globe (chief-of-staff C1, board CsA). */
89
91
  const GLOBE = 'M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18M3 12h18M12 3c3 3 3 15 0 18M12 3c-3 3-3 15 0 18';
@@ -75,19 +75,12 @@ export function mountChat(el, host) {
75
75
  const toEnd = () => { log.scrollTop = log.scrollHeight; if (log.clientHeight && pageScrolls()) { const se = document.scrollingElement || document.documentElement; se.scrollTop = se.scrollHeight; } };
76
76
  if (typeof ResizeObserver === 'function') new ResizeObserver(() => { if (C.jump && log.clientHeight) { toEnd(); if (C.conv) C.jump = false; } }).observe(log);
77
77
  reopen.onclick = () => host.reopenViewer();
78
- // for the place menu's button on a phone (cozy-home.css): the room from the top of the foot to the bottom of the screen, so the button
79
- // sits just above the box and its bars. Not the foot's height: when the page is short the foot ends above the screen's bottom (the page's
80
- // own padding is under it) and a height alone put the button over the box's right end (batch 29 item 2)
81
- const footRoom = () => {
82
- const r = foot.getBoundingClientRect(); if (!r.height) return;
83
- const vh = window.innerHeight || r.bottom;
84
- document.body.style.setProperty('--bd-hmfoot', Math.round(Math.min(Math.max(r.height, vh - r.top), vh - 72)) + 'px');
85
- };
86
- let roomQ = 0;
87
- const roomSoon = () => { if (!roomQ) roomQ = requestAnimationFrame(() => { roomQ = 0; footRoom(); }); };
88
- if (typeof ResizeObserver === 'function') new ResizeObserver(roomSoon).observe(foot);
89
- window.addEventListener('resize', roomSoon, { passive: true });
90
- window.addEventListener('scroll', roomSoon, { passive: true });
78
+ // for the place menu's button on a phone (cozy-home.css): the composer's height. On a phone the composer is fixed to the screen's bottom
79
+ // and the button is fixed just above it, so both sit in the same layer and the height alone places the button. #1280 measured the room
80
+ // from the composer's top to innerHeight instead; after touch scrolling on iOS that room was wrong and the button floated over the
81
+ // messages (batch 30 item 2). The chat also keeps this much room under its last message.
82
+ const footRoom = () => { const h = foot.getBoundingClientRect().height; if (h) document.body.style.setProperty('--bd-hmfoot', Math.round(h) + 'px'); };
83
+ if (typeof ResizeObserver === 'function') new ResizeObserver(footRoom).observe(foot);
91
84
 
92
85
  const role = () => (C.t && C.t.role) || roleOf(C.sess || null, host.roles(), firstUser());
93
86
  const firstUser = () => { const m = ((C.conv && C.conv.messages) || []).find((x) => x.role === 'user'); return m ? m.text : ''; };
@@ -56,4 +56,5 @@ body.cz-home:not(.hm-vw-open) .hm-plw { box-sizing: border-box; width: 100%; max
56
56
  /* a phone chat has no floating menu (the line and the top bar hold what it held), and the log needs no room for it */
57
57
  body.cz-home:not(.hm-plist):not(.hm-sheet) .cz-fabw { display: none; }
58
58
  body.cz-home:not(.hm-plist) .hm-log { padding-bottom: 12px; }
59
+ body.cz-home:not(.hm-plist) #hmFoot::before { content: none; } /* no button, so no fade over the last message (cozy-home.css) */
59
60
  }
@@ -0,0 +1,61 @@
1
+ /* pm/vv-settle.js — puts the phone's fixed layer back in place (batch 30 item 2, initiative phone-chat-touch-layout).
2
+ *
3
+ * On iOS WebKit the layer that holds position:fixed and position:sticky boxes can be left out of place after the soft keyboard closes,
4
+ * and stays there while the PM scrolls by touch: on Home's phone chat the top bar went off the screen and the composer stood in the
5
+ * middle of it with messages under it (Wawan's iPhone, 2026-11-16). A one-pixel scroll and back makes WebKit place the layer again;
6
+ * anywhere else it is a no-op. premium-shell.js does the same on the Board (2026-10-20); Home does not load premium-shell.js.
7
+ *
8
+ * settleFixed(win) nudges. drifted(v) is the pure check: the visual viewport is offset with no keyboard up and no zoom.
9
+ * wireSettle(win) settles after an input loses focus, when the keyboard closes, and when a scroll ends with the viewport drifted. */
10
+ export const EDITABLE = 'input,textarea,select,[contenteditable="true"],[contenteditable=""]';
11
+ const KB_ROOM = 150; // the visual viewport this much shorter than the layout viewport: the keyboard is up (cozy-live-pill.js uses the same)
12
+
13
+ /** v: { offsetTop, height, scale, layoutH, typing }. True when the fixed layer is likely out of place and a settle is due. */
14
+ export function drifted(v) {
15
+ if (!v || v.typing) return false;
16
+ if (v.scale && Math.abs(v.scale - 1) > 0.01) return false; // a pinch zoom offsets the viewport on purpose
17
+ if (v.layoutH && v.height && v.layoutH - v.height > KB_ROOM) return false; // the keyboard is up: the offset keeps the box in view
18
+ return Math.abs(v.offsetTop || 0) > 0.5;
19
+ }
20
+
21
+ let busy = false;
22
+ export function settleFixed(win = window) {
23
+ if (busy) return; busy = true;
24
+ try { const y = win.scrollY, d = y > 0 ? -1 : 1; win.scrollTo(win.scrollX, y + d); win.scrollTo(win.scrollX, y); }
25
+ finally { win.setTimeout(() => { busy = false; }, 0); } // the nudge's own scroll events do not start another settle
26
+ }
27
+
28
+ /** Wires the settles once per window. Returns { check } (a settle when drifted), for the caller and the tests. */
29
+ export function wireSettle(win = window) {
30
+ if (win.__czSettle) return win.__czSettle;
31
+ const doc = win.document, vv = win.visualViewport || null;
32
+ const typing = () => { const a = doc.activeElement; return !!(a && a.matches && a.matches(EDITABLE)); };
33
+ const state = () => ({ offsetTop: vv ? vv.offsetTop : 0, height: vv ? vv.height : 0, scale: vv ? vv.scale : 1, layoutH: doc.documentElement.clientHeight, typing: typing() });
34
+ // armed by the PM's own touch (or the page coming back): one settle per gesture, so a nudge that does not help cannot repeat forever
35
+ let armed = true;
36
+ const arm = () => { armed = true; };
37
+ const check = () => { if (armed && !busy && drifted(state())) { armed = false; settleFixed(win); } };
38
+ doc.addEventListener('focusout', (e) => {
39
+ if (!e.target || !e.target.matches || !e.target.matches(EDITABLE)) return;
40
+ win.setTimeout(() => settleFixed(win), 60); win.setTimeout(() => settleFixed(win), 400); // the keyboard closes over ~300 ms
41
+ });
42
+ if (vv) {
43
+ let kb = false;
44
+ vv.addEventListener('resize', () => {
45
+ const shut = state().layoutH - vv.height <= KB_ROOM;
46
+ if (kb && shut) settleFixed(win);
47
+ kb = !shut;
48
+ });
49
+ vv.addEventListener('scroll', () => { if (!kb) idle(); });
50
+ }
51
+ // a scroll's end: no scroll event for 160 ms (scrollend where there is one), or the finger lifts
52
+ let t = 0;
53
+ const idle = () => { win.clearTimeout(t); t = win.setTimeout(check, 160); };
54
+ win.addEventListener('scroll', idle, { passive: true });
55
+ win.addEventListener('scrollend', check, { passive: true });
56
+ win.addEventListener('touchend', idle, { passive: true });
57
+ win.addEventListener('touchstart', arm, { passive: true });
58
+ win.addEventListener('pageshow', () => { arm(); check(); });
59
+ win.__czSettle = { check };
60
+ return win.__czSettle;
61
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "_comment": "Batch 30 item 2, initiative phone-chat-touch-layout: the phone's fixed layer settles after the keyboard and touch scrolls (pm/vv-settle.js). Pure check and a fake window.",
3
+ "modules": [
4
+ "vv-settle.test.js"
5
+ ]
6
+ }