create-pmos 0.817.0 → 0.818.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.817.0",
3
+ "version": "0.818.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": {
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.817.0",
38
- "at": "2026-11-25T08:16:43.538Z",
37
+ "v": "0.818.0",
38
+ "at": "2026-11-25T08:22:03.053Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
@@ -53,6 +53,22 @@
53
53
  "open": "/premium-board.html"
54
54
  },
55
55
  "i": "approver-memory"
56
+ },
57
+ {
58
+ "n": 1867,
59
+ "t": "Each report draft in each reader's language",
60
+ "s": "Each report draft in each reader's language",
61
+ "k": "new",
62
+ "i": "report-reader-language",
63
+ "try": {
64
+ "steps": [
65
+ "On Today, ask the chat: Dita reads the weekly report in Indonesian.",
66
+ "Open that report from Today, press Redraft, then open ⋯ and press Also in Indonesian.",
67
+ "Compare a number and an initiative id with the original."
68
+ ],
69
+ "see": "The copy opens in the Viewer, says it is a translation for Dita, and every number and id matches the original.",
70
+ "open": "/today.html"
71
+ }
56
72
  }
57
73
  ]
58
74
  },
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@66f8f6661
1
+ kernel-source: pmos@33bacf175
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-25T08:16:39Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T08:21:59Z"}
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-25T08:16:39Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T08:21:59Z"}
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-25T08:16:39Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T08:21:59Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  [
2
2
  {
3
- "v": "0.817.0",
4
- "at": "2026-11-25T08:16:43.538Z",
3
+ "v": "0.818.0",
4
+ "at": "2026-11-25T08:22:03.053Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
@@ -19,6 +19,22 @@
19
19
  "open": "/premium-board.html"
20
20
  },
21
21
  "i": "approver-memory"
22
+ },
23
+ {
24
+ "n": 1867,
25
+ "t": "Each report draft in each reader's language",
26
+ "s": "Each report draft in each reader's language",
27
+ "k": "new",
28
+ "i": "report-reader-language",
29
+ "try": {
30
+ "steps": [
31
+ "On Today, ask the chat: Dita reads the weekly report in Indonesian.",
32
+ "Open that report from Today, press Redraft, then open ⋯ and press Also in Indonesian.",
33
+ "Compare a number and an initiative id with the original."
34
+ ],
35
+ "see": "The copy opens in the Viewer, says it is a translation for Dita, and every number and id matches the original.",
36
+ "open": "/today.html"
37
+ }
22
38
  }
23
39
  ]
24
40
  },
@@ -117,6 +117,7 @@ A loop never sends a message, moves a Jira ticket, merges into a product reposit
117
117
  | [You decided this before](claude-proposes.md) | You add an initiative that repeats an earlier decision | `DECISIONS.md`, the decision records, the PM journal, `planning/out-of-scope/` and the initiative records | The initiative's ✦ | `pmos ai off past-repeat` |
118
118
  | [✦ drafts](claude-proposes.md#drafts-from-a-) | You press ✓ on a ✦ that offers a draft: a line of the Overview, a program's For or Goal, the documents a gate needs, a goal or initiatives from the strategy, an outcome verdict or a goal's name. One short run for each press. | The records in the product's folder. It writes nothing and sends nothing. | The row you pressed: "PMOS is drafting it", then the draft | Press ✕ on the draft. Nothing is kept until you keep it. |
119
119
  | [Report readers](claude-proposes.md) | A report draft is written | The draft, read as the CFO, the engineering lead and the sceptic | The ✦ of each initiative the question quotes | `pmos ai off report-readers` |
120
+ | [Report translations](reports.md) | A report draft is written and its definition names `languages:` | The draft | A translated copy beside the draft, written only when every number and name is unchanged | `pmos ai off report-translate` |
120
121
  | [Stuck work](claude-proposes.md) | Each time you open an initiative's ✦. No run, no model. | The tasks' own state days, and the last change of each Jira ticket | "Stuck" under the initiative's ✦: a drafted note to the owner, or Park | Press ✕ on the step. Nothing is sent: a note waits in the Outbox. |
121
122
  | [Initiative descriptions](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. | The PRD's first Problem or Why paragraph, or the record's own first paragraph | "Description" under the initiative's ✦ | `pmos ai off descriptions`. `PMOS_DESCRIPTIONS=off` |
122
123
  | [Expected outcomes](claude-proposes.md) | Once a day. At most 3 drafts a day for each product. When a check date passes: the verdict, from the goal's reading or one short run. | The PRD's success criteria, or the anchored key result. For a verdict: the goal's reading, or the lines the run cites | "Expected outcome" under the initiative's ✦. A verdict is recorded with Undo. Your move when PMOS cannot tell. | `pmos ai off outcomes`. `PMOS_OUTCOMES=off` |
@@ -167,7 +168,7 @@ When you ask an agent session to do a piece of work, it can finish it, including
167
168
  - `pmos ai log [<job>]`: the last audit lines. Each dropped proposal shows why.
168
169
  - `pmos ai off [<job>]` and `pmos ai on [<job>]`: turn every AI job, or one job, off or on. `PMOS_AI=off` in the environment wins over the setting.
169
170
 
170
- The AI jobs are `past-repeat`, `report-readers`, `decision-memory`, `outcomes`, `descriptions`, `drift`, `rehearse`, `next-prompt`, `sharpen-prompt`, `idle-lab` and `live-round` (`pmos ai off live-round` stops new live rounds; one that runs ends by itself). The switch also covers each job in the queue by its queue name: `schedules`, `proactive`, `prepare`, `day`, `refresh`, `reports`, `meeting-prewarm`, `driver`, `goal-loops`, `finder`, `coredocs`, `milestones`, `propose`, `grill`, `metric-drafts`, `impact`, `metric-reads`, `forecast`, `report-design`, `report-structure`, `team`, `scan` and `idle-lab`. `pmos ai off` with no job stops all of them. Git sync uses no model, so the switch does not stop it. A background run cannot change the switch.
171
+ The AI jobs are `past-repeat`, `report-readers`, `report-translate`, `decision-memory`, `outcomes`, `descriptions`, `drift`, `rehearse`, `next-prompt`, `sharpen-prompt`, `idle-lab` and `live-round` (`pmos ai off live-round` stops new live rounds; one that runs ends by itself). The switch also covers each job in the queue by its queue name: `schedules`, `proactive`, `prepare`, `day`, `refresh`, `reports`, `meeting-prewarm`, `driver`, `goal-loops`, `finder`, `coredocs`, `milestones`, `propose`, `grill`, `metric-drafts`, `impact`, `metric-reads`, `forecast`, `report-design`, `report-structure`, `team`, `scan` and `idle-lab`. `pmos ai off` with no job stops all of them. Git sync uses no model, so the switch does not stop it. A background run cannot change the switch.
171
172
 
172
173
  ## The team of role agents
173
174
 
@@ -1032,6 +1032,8 @@ pmos report issue biweekly 2026-10-16
1032
1032
 
1033
1033
  `pmos report finder` shows the report finder setting, or changes it.
1034
1034
 
1035
+ `pmos report language <cadence> "<Language>[ for <reader>]"` adds a reader who reads the report in another language. After each draft, PMOS writes a translated copy beside it with every number and name unchanged. Add `--off` to remove the language. With no language, the command lists the languages. Nothing is sent.
1036
+
1035
1037
  `pmos report library` writes one page with every slide layout of the report library, filled with placeholder words. Open it in a browser to see the layouts a report can use. Add `--out <file>` to choose the file. `pmos report library --template <id>` draws one template with placeholder words.
1036
1038
 
1037
1039
  Every command accepts `--root <dir>` to name the repository. `draft` and `list` also accept `--json`.
@@ -352,6 +352,14 @@ If a block is off track or at risk and has no reason, the script stops and write
352
352
 
353
353
  The definition file tells the script and the agent what the report is for. For PMOS itself it is `planning/reports/definitions/biweekly.md`. In a kit repository it is `pmos/state/reports/definitions/biweekly.md`. Its frontmatter gives the `cadence`, the `audience` and the `sections`. If the definition names no audience, Needs your call stays empty.
354
354
 
355
+ ### In each reader's language
356
+
357
+ A definition can name readers who read the report in another language: `languages: "Indonesian for Dita; Japanese"`. Ask PMOS in the chat, or run `pmos report language <cadence> "Indonesian for Dita"`. Add `--off` to stop one language.
358
+
359
+ After each draft, PMOS writes one translated copy per language beside the draft, for example `2026-11-20.id.md`. The copy opens with one line that says it is a translation, for whom, and that PMOS checked the numbers and names. PMOS writes a copy only when every number, initiative id, note, link and acronym of the original is in it. If one is missing, PMOS writes no copy and the server log says why. A draft whose text did not change is not translated again.
360
+
361
+ To read a copy, open the report and press **⋯ › Also in Indonesian**. The copy is not a cycle, so it has no Issue. Nothing is sent: share the copy yourself. `pmos ai off report-translate` stops the translations.
362
+
355
363
  ### Notes
356
364
 
357
365
  Each block has a note between two markers:
@@ -171,6 +171,7 @@ const JOBS = Object.freeze([
171
171
  q('meeting-prewarm', 'lib/live-round-meeting.js', ['<runtime>/idle-lab/meeting-prewarm.jsonl'], [props, 'calendar', '<runtime>/meeting-material.jsonl'], 'round 1 itself is filed by lib/live-round.js (W1)'),
172
172
  ai('past-repeat', 'lib/past-repeat.js', [props], ['repo:DECISIONS.md']),
173
173
  ai('report-readers', 'lib/report-readers.js', [props, '<runtime>/spec-critic.jsonl'], ['report drafts']), // report-reader-review: each report draft read as the CFO, the engineer and the sceptic
174
+ ai('report-translate', 'lib/report-translate.js', [], ['report drafts', 'report definitions']), // report-reader-language: a translated copy beside each draft, numbers and names checked
174
175
  ai('decision-memory', 'lib/decision-memory.js', [props], ['repo:DECISIONS.md']),
175
176
  ai('outcomes', 'lib/outcome-props.js', [props, '<state>/outcome-runs.jsonl'], ['initiative records', 'repo:planning/runs/outcome_checks.jsonl', '<state>/metric-reads.jsonl']),
176
177
  ai('descriptions', 'lib/description-props.js', [props], ['initiative records']),
@@ -9,6 +9,7 @@
9
9
  * pmos report definitions [--json] the report definitions (read-only)
10
10
  * pmos report setups [--json] the recurring reports (read-only)
11
11
  * pmos report finder <weekly|off> the PM's: how often PMOS looks for reports you send (also: finder source <name> <on|off>)
12
+ * pmos report language <cadence> "<Language>[ for <reader>]" [--off] who reads it in another language (lib/report-translate.js; agent-allowed)
12
13
  *
13
14
  * `draft` is the script with no model (R22.1): lib/report-draft.js folds the ledgers since the last issue and writes
14
15
  * every number into `<state>/reports/<cadence>/<slot>.md`, with one empty note marker per block. It refuses a slot that
@@ -37,7 +38,7 @@ const actorLib = require('./actor.js');
37
38
  const RS = require('./report-setups.js');
38
39
  const { parseArgs } = require('./schedule-cli');
39
40
 
40
- const COMMANDS = { report: ['make', 'read', 'find', 'write', 'check', 'rule', 'draft', 'issue', 'list', 'propose', 'definitions', 'setups', 'finder', 'library'] };
41
+ const COMMANDS = { report: ['make', 'read', 'find', 'write', 'check', 'rule', 'draft', 'issue', 'list', 'propose', 'definitions', 'setups', 'finder', 'library', 'language'] };
41
42
  const USAGE = [
42
43
  'usage: pmos report make|read|find|write|check|rule — the report engine: brief, read, find, answer, render (any report, any shape)',
43
44
  ' pmos report make <id> [--ask "<the question>"] [--readers "<who>"] [--source <kind:ref>,…] [--template <id>] [--slot <date>]',
@@ -74,12 +75,15 @@ const USAGE = [
74
75
  ' Show the recurring reports (read-only).',
75
76
  ' pmos report finder <weekly|off> | pmos report finder source <calendar|slack|mail|drive> <on|off>',
76
77
  ' Only the PM can change how PMOS looks for the reports you send (default weekly; mail is off until you turn it on).',
78
+ ' pmos report language <cadence> "<Language>[ for <reader>]" [--off]',
79
+ ' A reader who reads the report in another language. After each draft PMOS writes a translated copy beside it',
80
+ ' (<slot>.<code>.md) with every number and name unchanged; --off stops it. Nothing is sent. With no language: the list.',
77
81
  ' every command: [--json] [--root <dir>]. The cadence is the report skill id without "report-", for example biweekly.',
78
82
  ];
79
- const BOOL = new Set(['json', 'redraft', 'help']);
83
+ const BOOL = new Set(['json', 'redraft', 'help', 'off']);
80
84
  const VALUE = new Set(['now', 'root', 'ask', 'readers', 'source', 'slot', 'from', 'out', 'template']);
81
85
  const ALLOWED = { make: ['json', 'now', 'root', 'ask', 'readers', 'source', 'slot', 'template'], read: ['json', 'now', 'root', 'slot', 'from', 'source'], find: ['json', 'now', 'root', 'slot', 'from'],
82
- write: ['json', 'now', 'root', 'slot', 'from'], check: ['json', 'root', 'slot'], rule: ['json', 'root'], draft: ['json', 'redraft', 'now', 'root'], issue: ['root'], list: ['json', 'root'], propose: ['json', 'root'], definitions: ['json', 'root'], setups: ['json', 'root'], finder: ['json', 'root'], library: ['json', 'out', 'template'] };
86
+ write: ['json', 'now', 'root', 'slot', 'from'], check: ['json', 'root', 'slot'], rule: ['json', 'root'], draft: ['json', 'redraft', 'now', 'root'], issue: ['root'], list: ['json', 'root'], propose: ['json', 'root'], definitions: ['json', 'root'], setups: ['json', 'root'], finder: ['json', 'root'], language: ['json', 'root', 'off'], library: ['json', 'out', 'template'] };
83
87
  const CADENCE_RE = /^[a-z][a-z0-9-]{0,39}$/;
84
88
  const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
85
89
 
@@ -166,7 +170,7 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
166
170
  return 0;
167
171
  }
168
172
  if (['make', 'read', 'find', 'write', 'check', 'rule'].includes(verb)) return engineVerb(verb, { pos, flags, root, json, say, fail, isTTY, env, stdin, now });
169
- if (verb === 'definitions' || verb === 'setups' || verb === 'propose' || verb === 'finder') return reportWorkspace(verb, { pos, flags, root, json, say, fail, cwd, isTTY, env, stdin, now });
173
+ if (verb === 'definitions' || verb === 'setups' || verb === 'propose' || verb === 'finder' || verb === 'language') return reportWorkspace(verb, { pos, flags, root, json, say, fail, cwd, isTTY, env, stdin, now });
170
174
 
171
175
  const [cadence, slot] = pos;
172
176
  if (!cadence || !CADENCE_RE.test(cadence) || pos.length > 2) { say(`usage: pmos report ${verb} <cadence> ${verb === 'issue' ? '<slot>' : '[<slot>]'}`); return 2; }
@@ -312,6 +316,22 @@ async function engineVerb(verb, { pos, flags, root, json, say, fail, isTTY, env,
312
316
  function reportWorkspace(verb, { pos, flags, root, json, say, fail, isTTY, env, stdin, now }) {
313
317
  const E = env === undefined ? process.env : env;
314
318
  const stamp = now == null ? undefined : now;
319
+ if (verb === 'language') {
320
+ const RT = require('./report-translate.js');
321
+ const cadence = pos[0], entry = pos.slice(1).join(' ').trim();
322
+ if (!cadence || !CADENCE_RE.test(cadence)) { say('usage: pmos report language <cadence> "<Language>[ for <reader>]" [--off]'); return 2; }
323
+ if (!entry) {
324
+ const list = RT.definitionLanguages(root, cadence);
325
+ if (json) { say(JSON.stringify({ ok: true, cadence, languages: list })); return 0; }
326
+ say(list.length ? list.map((x) => `${x.language}${x.reader ? ' for ' + x.reader : ''}`).join('\n') : `The ${cadence} report is read in one language.`);
327
+ return 0;
328
+ }
329
+ const r = RT.setLanguage(root, cadence, entry, { off: !!flags.off });
330
+ if (!r.ok) return fail(r.error);
331
+ if (json) { say(JSON.stringify(r)); return 0; }
332
+ say(`✓ ${r.path}: ${r.languages.length ? 'also in ' + r.languages.map((x) => `${x.language}${x.reader ? ' for ' + x.reader : ''}`).join(', ') : 'one language only'}. The next draft writes the copies; nothing is sent.`);
333
+ return 0;
334
+ }
315
335
  if (verb === 'definitions') {
316
336
  const defs = RS.definitionsOf(root);
317
337
  if (json) { say(JSON.stringify({ ok: true, definitions: defs })); return 0; }
@@ -0,0 +1,238 @@
1
+ 'use strict';
2
+ /* report-translate.js — a report in each reader's language (initiative report-reader-language, idea A111).
3
+ *
4
+ * WHY. A PM whose readers read different languages writes the report once and translates it by hand, or sends it in a language
5
+ * some readers read slowly. A hand translation is where a number or a name goes wrong. PMOS acts by itself: no run button.
6
+ *
7
+ * WHO READS WHAT. A report's definition (<state>/reports/definitions/<cadence>.md) may carry `languages: "Indonesian for Dita; Japanese"`:
8
+ * one language per reader, the reader optional. `pmos report language <cadence> "<Language>[ for <reader>]" [--off]` adds or removes one
9
+ * entry (the PM at a terminal, or the chat's agent). A language not in LANGS is skipped.
10
+ *
11
+ * WHEN IT RUNS. After every report draft this process writes (lib/report-draft.js onDraftWritten: Draft now, Redraft, a schedule), one
12
+ * read-only run per language through the design critic's ask path (lib/design-critic.js askVia: the normal `claude -p` session, kind ask).
13
+ * The draft's text is in the prompt. A copy whose `source_sha` is the draft's text already starts no run. Off: the AI switch for job
14
+ * `report-translate` (`pmos ai off report-translate`, or every AI job off), or the design critic's switch.
15
+ *
16
+ * WHAT IT WRITES. <state>/reports/<cadence>/<slot>.<code>.md beside the draft: the draft's frontmatter plus `translation_of`, `language`,
17
+ * `reader` and `source_sha`, then one line saying it is a translation, for whom, and that numbers and names are unchanged, then the
18
+ * translated body. The copy is written ONLY when keeps() finds every number and every name of the original in it: numbers are runs of
19
+ * digits with their decimals (counted), names are initiative ids, note markers, links, and acronyms or codes (two capitals, or a capital
20
+ * and a digit). Otherwise nothing is written and the server log says why. A copy is not a cycle: the report list reads <slot>.md only.
21
+ * Nothing is sent anywhere.
22
+ *
23
+ * LANGS · languagesOf(value) PURE → [{ language, code, reader }]
24
+ * bodyOf(text) PURE → { fm, body } · shaOf(body) PURE
25
+ * namesOf(body) PURE → { numbers: Map<string, count>, names: Set<string> } · keeps(orig, copy) PURE → { ok, why? }
26
+ * promptOf({ body, language, reader }) PURE · answerOf(answer) PURE → markdown | null
27
+ * copyPath(rel, code) PURE · copyText({ fm, body, rel, language, code, reader, sha }) PURE → the file
28
+ * alsoOf(root, rel) → [{ code, language, reader, path }] the copies on disk beside a draft (the ⋯ menu's Also in …)
29
+ * definitionLanguages(root, cadence) → [{ language, code, reader }] · setLanguage(root, cadence, entry, { off }) → { ok, languages, path } | { ok:false, error }
30
+ * translate({ root, rel, ask, runtime?, env?, guard? }) → Promise<{ written, refused, skipped, off? }>
31
+ * attach(ctxFactory) hook onDraftWritten once; ctx: { workspaceList, runtimeDir, spawnScheduled|spawnSession }
32
+ */
33
+ const fs = require('fs');
34
+ const path = require('path');
35
+ const crypto = require('crypto');
36
+
37
+ const JOB = 'report-translate';
38
+ const ORIGIN = 'briefing-ask:report-translate:';
39
+ const MAX_CHARS = 60000;
40
+ const LANGS = Object.freeze({
41
+ en: 'English', id: 'Indonesian', ms: 'Malay', zh: 'Chinese', ja: 'Japanese', ko: 'Korean', th: 'Thai', vi: 'Vietnamese', tl: 'Filipino',
42
+ hi: 'Hindi', ta: 'Tamil', ar: 'Arabic', es: 'Spanish', fr: 'French', de: 'German', pt: 'Portuguese', it: 'Italian', nl: 'Dutch',
43
+ });
44
+ const ALIASES = Object.freeze({ 'bahasa indonesia': 'id', bahasa: 'id', 'bahasa melayu': 'ms', mandarin: 'zh', tagalog: 'tl' });
45
+ const one = (v, n) => String(v == null ? '' : v).replace(/\s+/g, ' ').trim().slice(0, n);
46
+ const shaOf = (s) => crypto.createHash('sha1').update(String(s)).digest('hex').slice(0, 16);
47
+
48
+ /** PURE. One language name or code → its code, or null. */
49
+ function codeOf(word) {
50
+ const w = String(word || '').trim().toLowerCase();
51
+ if (!w) return null;
52
+ if (LANGS[w]) return w;
53
+ if (ALIASES[w]) return ALIASES[w];
54
+ const hit = Object.entries(LANGS).find(([, n]) => n.toLowerCase() === w);
55
+ return hit ? hit[0] : null;
56
+ }
57
+
58
+ /** PURE. `"Indonesian for Dita; Japanese"`, or a list → [{ language, code, reader }], one per code (the first reader wins). */
59
+ function languagesOf(value) {
60
+ const parts = (Array.isArray(value) ? value : String(value == null ? '' : value).split(/[;,]/)).map((x) => String(x).trim()).filter(Boolean);
61
+ const out = [];
62
+ for (const p of parts) {
63
+ const m = /^(.+?)(?:\s+for\s+(.+))?$/i.exec(p);
64
+ const code = m && codeOf(m[1]);
65
+ if (!code || code === 'en' || out.some((x) => x.code === code)) continue;
66
+ out.push({ language: LANGS[code], code, reader: m[2] ? one(m[2], 60) : '' });
67
+ }
68
+ return out;
69
+ }
70
+ const entryOf = (x) => x.language + (x.reader ? ' for ' + x.reader : '');
71
+
72
+ /** PURE. A file's frontmatter block (with its fences) and its body. */
73
+ function bodyOf(text) {
74
+ const t = String(text == null ? '' : text);
75
+ const m = /^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/.exec(t);
76
+ return m ? { fm: m[0], body: t.slice(m[0].length) } : { fm: '', body: t };
77
+ }
78
+ function fmMap(fm) {
79
+ const map = {};
80
+ for (const l of String(fm || '').split(/\r?\n/)) { const kv = /^([A-Za-z_][\w-]*):\s*(.*?)\s*$/.exec(l); if (kv) map[kv[1]] = kv[2].replace(/^["']|["']$/g, ''); }
81
+ return map;
82
+ }
83
+
84
+ /** PURE. What a translation must keep: numbers (counted) and names. */
85
+ function namesOf(body) {
86
+ const t = String(body || '');
87
+ const numbers = new Map();
88
+ for (const m of t.matchAll(/\d+(?:[.,]\d+)*/g)) {
89
+ const k = m[0].replace(/,/g, '.');
90
+ numbers.set(k, (numbers.get(k) || 0) + 1);
91
+ }
92
+ const names = new Set();
93
+ for (const m of t.matchAll(/<!--\s*\/?pmos:[^>]*-->/g)) names.add(m[0].replace(/\s+/g, ' '));
94
+ for (const m of t.matchAll(/^#{2,4}\s+.*\(([A-Za-z0-9._-]{1,80})\)\s*$/gm)) names.add('(' + m[1] + ')');
95
+ for (const m of t.matchAll(/\]\(([^)\s]+)\)/g)) names.add('](' + m[1] + ')');
96
+ for (const m of t.matchAll(/https?:\/\/[^\s)>\]]+/g)) names.add(m[0]);
97
+ for (const m of t.matchAll(/\b(?:[A-Z][A-Za-z0-9-]*[A-Z0-9][A-Za-z0-9-]*)\b/g)) if (/[A-Z].*[A-Z0-9]/.test(m[0]) && !/^\d/.test(m[0])) names.add(m[0]);
98
+ return { numbers, names };
99
+ }
100
+
101
+ /** PURE. Does the copy keep every number and every name of the original? */
102
+ function keeps(orig, copy) {
103
+ const a = namesOf(orig), b = namesOf(copy);
104
+ for (const [n, c] of a.numbers) if ((b.numbers.get(n) || 0) < c) return { ok: false, why: `the number ${n} is not in the copy as often as in the original` };
105
+ const flat = String(copy || '').replace(/\s+/g, ' ');
106
+ for (const n of a.names) if (!flat.includes(n)) return { ok: false, why: `the name ${n} is not in the copy` };
107
+ return { ok: true };
108
+ }
109
+
110
+ /** PURE. The run's prompt. */
111
+ function promptOf({ body, language, reader = '' } = {}) {
112
+ return [
113
+ `Translate this report into ${language}${reader ? ` for ${reader}` : ''}. Do not run any tool and do not read any file: the report is below.`,
114
+ 'Translate the words only. Keep every number, date digit, percentage, initiative id in brackets, person and product name, acronym, link and',
115
+ 'Markdown mark exactly as it is. Keep every line that starts with <!-- exactly as it is. Keep the same headings, lists and table rows, in the same order.',
116
+ 'Answer with the translated report in one fenced block that starts with ```markdown and nothing else.',
117
+ '', '```markdown', String(body || '').slice(0, MAX_CHARS), '```',
118
+ ].join('\n');
119
+ }
120
+
121
+ /** PURE. The translated body from the answer, or null. */
122
+ function answerOf(answer) {
123
+ const t = String(answer == null ? '' : answer);
124
+ const m = /```(?:markdown|md)?[^\n]*\n([\s\S]*?)\n```\s*$/i.exec(t.trim()) || /```(?:markdown|md)[^\n]*\n([\s\S]*?)\n```/i.exec(t);
125
+ const out = m ? m[1] : '';
126
+ return out.trim() ? out.replace(/\s+$/, '') + '\n' : null;
127
+ }
128
+
129
+ /** PURE. reports/<cadence>/<slot>.md → reports/<cadence>/<slot>.<code>.md */
130
+ const copyPath = (rel, code) => String(rel).replace(/\.md$/, '') + '.' + code + '.md';
131
+
132
+ /** PURE. The copy's file. */
133
+ function copyText({ fm = '', body = '', rel = '', language = '', code = '', reader = '', sha = '' } = {}) {
134
+ const q = (v) => `"${String(v).replace(/["\\]/g, "'")}"`;
135
+ const extra = [`translation_of: ${q(rel)}`, `language: ${code}`, ...(reader ? [`reader: ${q(reader)}`] : []), `source_sha: ${sha}`];
136
+ const head = fm
137
+ ? fm.replace(/\r?\n---(\r?\n|$)$/, '\n' + extra.join('\n') + '\n---\n').replace(/^(title:\s*)(["']?)(.*?)\2\s*$/m, (all, k, qt, v) => `${k}${q(v + ' (' + language + ')')}`)
138
+ : ['---', 'type: Reference', `title: ${q(path.basename(rel) + ' (' + language + ')')}`, ...extra, '---', ''].join('\n');
139
+ const note = `> Translation of ${path.basename(rel)} into ${language}${reader ? ' for ' + reader : ''}. PMOS checked that numbers and names are unchanged from the original.`;
140
+ return head + '\n' + note + '\n\n' + String(body).replace(/^\s+/, '');
141
+ }
142
+
143
+ function stateRelOf(rel) { const m = /^(.*)\/reports\/([a-z][a-z0-9-]{0,39})\/(\d{4}-\d{2}-\d{2})\.md$/.exec(String(rel)); return m ? { state: m[1], cadence: m[2], slot: m[3] } : null; }
144
+ function defFile(root, state, cadence) { return path.join(path.resolve(String(root)), state, 'reports', 'definitions', cadence + '.md'); }
145
+
146
+ /** The languages a report's definition names. */
147
+ function definitionLanguages(root, cadence, state = null) {
148
+ let st = state;
149
+ if (!st) { try { st = require('./report-draft.js').stateRel(root); } catch { return []; } }
150
+ let t = ''; try { t = fs.readFileSync(defFile(root, st, cadence), 'utf8'); } catch { return []; }
151
+ return languagesOf(fmMap(bodyOf(t).fm).languages || '');
152
+ }
153
+
154
+ /** Add or remove one `<Language>[ for <reader>]` entry on a definition's `languages:` line. */
155
+ function setLanguage(root, cadence, entry, { off = false, state = null } = {}) {
156
+ if (!/^[a-z][a-z0-9-]{0,39}$/.test(String(cadence || ''))) return { ok: false, error: 'the cadence is a report id, for example weekly' };
157
+ const want = languagesOf(entry || '');
158
+ if (!want.length) return { ok: false, error: `${JSON.stringify(String(entry || ''))} names no language PMOS knows (${Object.values(LANGS).filter((n) => n !== 'English').join(', ')})` };
159
+ let st = state;
160
+ if (!st) { try { st = require('./report-draft.js').stateRel(root); } catch (e) { return { ok: false, error: String((e && e.message) || e).slice(0, 160) }; } }
161
+ const file = defFile(root, st, cadence);
162
+ let t; try { t = fs.readFileSync(file, 'utf8'); } catch { return { ok: false, error: `the report ${cadence} has no definition (${path.relative(path.resolve(String(root)), file)}); set the report up first` }; }
163
+ const { fm, body } = bodyOf(t);
164
+ if (!fm) return { ok: false, error: 'the definition has no frontmatter' };
165
+ const cur = languagesOf(fmMap(fm).languages || '');
166
+ const next = off ? cur.filter((x) => !want.some((w) => w.code === x.code)) : [...cur.filter((x) => !want.some((w) => w.code === x.code)), ...want];
167
+ const line = next.length ? `languages: "${next.map(entryOf).join('; ').replace(/["\\]/g, "'")}"` : '';
168
+ let head = /^languages:.*$/m.test(fm) ? fm.replace(/^languages:.*\r?\n?/m, line ? line + '\n' : '') : (line ? fm.replace(/\r?\n---(\r?\n|$)$/, '\n' + line + '\n---\n') : fm);
169
+ fs.writeFileSync(file, head + body);
170
+ return { ok: true, languages: next, path: path.relative(path.resolve(String(root)), file).split(path.sep).join('/') };
171
+ }
172
+
173
+ /** The translated copies on disk beside a draft. */
174
+ function alsoOf(root, rel) {
175
+ const abs = path.resolve(String(root), String(rel || ''));
176
+ const dir = path.dirname(abs), base = path.basename(abs).replace(/\.md$/, '');
177
+ let names = []; try { names = fs.readdirSync(dir); } catch { return []; }
178
+ const out = [];
179
+ for (const n of names.sort()) {
180
+ const m = /^(.+)\.([a-z]{2})\.md$/.exec(n);
181
+ if (!m || m[1] !== base || !LANGS[m[2]]) continue;
182
+ let fm = {}; try { fm = fmMap(bodyOf(fs.readFileSync(path.join(dir, n), 'utf8')).fm); } catch { continue; }
183
+ if (!fm.translation_of) continue;
184
+ out.push({ code: m[2], language: LANGS[m[2]], reader: fm.reader || '', path: path.posix.join(path.posix.dirname(String(rel)), n) });
185
+ }
186
+ return out;
187
+ }
188
+
189
+ function guardOf() { try { return require('./ai-guard.js'); } catch { return null; } }
190
+
191
+ /** One draft → one copy per language its definition names. */
192
+ async function translate({ root, rel, ask, runtime = null, env = process.env, guard = guardOf(), langs = null } = {}) {
193
+ const res = { written: [], refused: [], skipped: [] };
194
+ try { if (require('./design-critic.js').off(env)) return { ...res, off: 'the critic runs are off' }; } catch { /* no switch */ }
195
+ if (guard) { const stop = guard.off(JOB, { env, settingsDir: runtime || null }); if (stop) return { ...res, off: stop }; }
196
+ const at = stateRelOf(rel);
197
+ if (!at) return { ...res, off: 'not a cadence draft' };
198
+ const list = langs || definitionLanguages(root, at.cadence, at.state);
199
+ if (!list.length) return { ...res, off: 'the definition names no other language' };
200
+ if (typeof ask !== 'function') return { ...res, off: 'no run can start here' };
201
+ let raw; try { raw = fs.readFileSync(path.resolve(String(root), rel), 'utf8'); } catch { return { ...res, off: 'the draft could not be read' }; }
202
+ const { fm, body } = bodyOf(raw);
203
+ const sha = shaOf(body);
204
+ for (const L of list) {
205
+ const out = copyPath(rel, L.code), abs = path.resolve(String(root), out);
206
+ let prev = ''; try { prev = fs.readFileSync(abs, 'utf8'); } catch { prev = ''; }
207
+ if (prev && fmMap(bodyOf(prev).fm).source_sha === sha) { res.skipped.push({ code: L.code, why: 'this text was translated already' }); continue; }
208
+ const answer = await ask(promptOf({ body, language: L.language, reader: L.reader }), { key: at.cadence + '-' + at.slot + '-' + L.code });
209
+ const tr = answerOf(answer);
210
+ if (!tr) { res.refused.push({ code: L.code, why: answer == null ? 'the run did not answer' : 'the answer held no translated report' }); continue; }
211
+ const k = keeps(body, tr);
212
+ if (!k.ok) { res.refused.push({ code: L.code, why: k.why }); continue; }
213
+ fs.writeFileSync(abs, copyText({ fm, body: tr, rel, language: L.language, code: L.code, reader: L.reader, sha }));
214
+ res.written.push({ code: L.code, path: out });
215
+ }
216
+ for (const r of res.refused) console.log(`[report-translate] ${rel} ${r.code}: not written (${r.why})`);
217
+ if (res.written.length) console.log(`[report-translate] ${rel}: ${res.written.map((w) => w.code).join(', ')} written`);
218
+ return res;
219
+ }
220
+
221
+ let attached = false;
222
+ /** server.js calls this once: every draft this process writes is translated for its readers, in the background. */
223
+ function attach(ctxFactory) {
224
+ if (attached || typeof ctxFactory !== 'function') return;
225
+ attached = true;
226
+ require('./report-draft.js').onDraftWritten(({ root, path: rel }) => {
227
+ setImmediate(() => {
228
+ let ctx = null; try { ctx = ctxFactory(); } catch { ctx = null; }
229
+ const spawn = ctx && (ctx.spawnScheduled || ctx.spawnSession);
230
+ if (typeof spawn !== 'function') return;
231
+ const ask = require('./design-critic.js').askVia(spawn, { name: 'report translation', origin: ORIGIN });
232
+ translate({ root: path.resolve(String(root)), rel, ask, runtime: ctx.runtimeDir || null })
233
+ .catch((e) => console.log(`[report-translate] ${rel}: not run (${one(e && e.message, 160)})`));
234
+ });
235
+ });
236
+ }
237
+
238
+ module.exports = { JOB, ORIGIN, LANGS, codeOf, languagesOf, bodyOf, shaOf, namesOf, keeps, promptOf, answerOf, copyPath, copyText, alsoOf, definitionLanguages, setLanguage, translate, attach };
@@ -3,7 +3,8 @@
3
3
  *
4
4
  * GET /api/report?ws= the report files of the repository, drafts and issued, of every cadence,
5
5
  * with the `sig` the page watches (public/pm/sig-watch.js, 10 s)
6
- * GET /api/report/draft?ws=&cadence=&slot= one report file as it is now: its markdown, its note texts, its blob sha
6
+ * GET /api/report/draft?ws=&cadence=&slot= one report file as it is now: its markdown, its note texts, its blob sha, and `also`:
7
+ * the translated copies beside it (lib/report-translate.js alsoOf)
7
8
  * POST /api/report/draft { ws, cadence, slot?, redraft? } Draft now, and Redraft (the notes are kept)
8
9
  * POST /api/report/note { ws, cadence, slot, id, text } one note, by initiative id (or report.headline, report.asks, report.changelog)
9
10
  * POST /api/report/issue { ws, cadence, slot, sha } Issue: the PM's act (R25)
@@ -29,6 +30,8 @@ const actorLib = require('./actor.js');
29
30
  const RD = require('./report-draft.js');
30
31
  const issues = require('./issues.js');
31
32
  const RN = require('./report-needs.js');
33
+ /** The translated copies beside a draft; none when the module is not installed. */
34
+ const alsoOf = (root, rel) => { try { return require('./report-translate.js').alsoOf(root, rel); } catch { return []; } };
32
35
 
33
36
  const CADENCE_RE = /^[a-z][a-z0-9-]{0,39}$/;
34
37
  const SLOT_RE = /^\d{4}-\d{2}-\d{2}$/;
@@ -97,6 +100,7 @@ async function handle(req, res, url, ctx) {
97
100
  ctx.json(res, {
98
101
  ok: true, ws: w.id, sig: list.sig, cadence: cs.cadence, slot: cs.slot, exists: true, path: hit.path, status: hit.status,
99
102
  sha: RN.blobSha(file.buf), markdown: file.text, notes: RD.readNotes(file.text), issued: pageReport(hit).issued, edited: hit.edited, flags: pageFlags(list.flags),
103
+ also: alsoOf(w.root, hit.path),
100
104
  });
101
105
  return true;
102
106
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.817.0",
3
+ "version": "0.818.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.817.0",
9
+ "version": "0.818.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.817.0",
3
+ "version": "0.818.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",
@@ -41,6 +41,13 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
41
41
  try { ({ chromium } = require('playwright-core')); } catch { console.log('✗ playwright-core is not installed'); return finish(1); }
42
42
  srv = spawn(process.execPath, [path.join(__dirname, 'server.js')], { cwd: __dirname, stdio: 'ignore', env: T.env({ PMOS_WS_PORT: String(T.PORT) }) });
43
43
  await T.waitForServer(BASE);
44
+ // Home stays on "Reading your day." until the board's first read lands, and that read scans the real checkout: ~9 s here, more than the
45
+ // 15 s the box gets on a loaded CI runner (ci-dynamic-shards: the pending reads showed only the live stream). Wait for it once, here.
46
+ for (const t0 = Date.now(); Date.now() - t0 < 90000;) {
47
+ const r = await fetch(BASE + '/api/board-premium').then((x) => x.json()).catch(() => null);
48
+ if (r && !(r.state === 'reading' || (r.pending && !r.model))) break;
49
+ await sleep(500);
50
+ }
44
51
  browser = await chromium.launch({ executablePath: exe });
45
52
 
46
53
  const open = async ({ w = 1280, h = 900, scheme = 'light', url = '/premium-chat.html?about=' + encodeURIComponent(KEY) } = {}) => {
@@ -48,13 +55,24 @@ const filesIn = () => { const d = path.join(T.STATE_DIR, 'chat-files'); const ou
48
55
  const page = await ctx.newPage();
49
56
  const errors = [], asks = [], st = { session: null, messages: [] };
50
57
  page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
58
+ const failed = []; page.on('response', (r) => { if (r.status() >= 400) failed.push(`${r.status()} ${new URL(r.url()).pathname}`); });
59
+ // the reads still open when the box never shows: names the slow route rather than only the timeout
60
+ const pending = new Map(); page.on('request', (rq) => pending.set(rq, Date.now()));
61
+ const done = (rq) => pending.delete(rq); page.on('requestfinished', done); page.on('requestfailed', done);
51
62
  if (process.env.ATT_DEBUG) page.on('request', (rq) => { if (/chat-file/.test(rq.url())) console.log('REQ', rq.method(), rq.url()); });
52
63
  await page.route('**/api/briefing-premium/**', (r) => { const rq = r.request(); if (rq.method() !== 'GET') asks.push({ path: new URL(rq.url()).pathname, body: JSON.parse(rq.postData() || '{}') }); r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, turns: [], working: false, ...(st.session ? { session: st.session } : {}) }) }); });
53
64
  await page.route('**/api/sessions/conversation**', (r) => r.fulfill({ json: { ok: true, state: 'conv', turn: 'user', messages: st.messages } }));
54
65
  await page.route('**/api/sessions', (r) => r.fulfill({ json: { ok: true, sessions: [{ id: 's-term', name: 'A terminal session', origin: '', shown: 'quiet' }] } }));
55
66
  await page.goto(BASE + url, { waitUntil: 'domcontentloaded' });
56
67
  // on a desktop the chat the address names opens in the popup (home-page-retire): wait until the box shows, not only exists
57
- await page.waitForFunction(() => { const i = document.querySelector('#hmIn'); return !!i && i.getClientRects().length > 0; }, null, { timeout: 15000 });
68
+ try {
69
+ await page.waitForFunction(() => { const i = document.querySelector('#hmIn'); return !!i && i.getClientRects().length > 0; }, null, { timeout: 15000 });
70
+ } catch (e) {
71
+ // say why the box never showed, so a red run names its cause (ci-dynamic-shards: it timed out on CI only, with nothing logged)
72
+ const seen = await page.evaluate(() => ({ url: location.href, hmIn: !!document.querySelector('#hmIn'), body: (document.body && document.body.innerText || '').slice(0, 400) })).catch((x) => String(x));
73
+ console.log('open: #hmIn never showed —', JSON.stringify({ seen, errors, failed, pending: [...pending].map(([rq, t]) => `${new URL(rq.url()).pathname}${new URL(rq.url()).search} ${Math.round((Date.now() - t) / 1000)}s`) }));
74
+ throw e;
75
+ }
58
76
  return { page, ctx, errors, asks, st };
59
77
  };
60
78
  const chips = (page) => page.$$eval('#hmFiles .hm-att', (xs) => xs.map((x) => ({ name: x.querySelector('b').textContent, meta: (x.querySelector('em') || {}).textContent || '' })));
@@ -292,18 +292,20 @@ function cycPop() {
292
292
  /**
293
293
  * What ⋯ holds (canvas note xvMore; OvReport): only what the card does not already show. The bar has the read-as switch, Edit, Present,
294
294
  * Share and Download; the folds have the cycles and the Brief; the summary has the one primary. So ⋯ holds Schedule, Start the next cycle
295
- * (an issued cycle) and, red and last, Discard this draft or Archive this cycle. Each item is { r, label, note, danger } or { sep }; r is the
295
+ * (an issued cycle), Also in <language> (a translated copy on disk) and, red and last, Discard this draft or Archive this cycle. Each item is { r, label, note, danger } or { sep }; r is the
296
296
  * press, the same one the panel's own buttons send.
297
297
  */
298
298
  export function moreItems(o) {
299
299
  if (o.edit || o.archived) return [];
300
300
  const L = [], sched = o.schedule && o.schedule !== 'Not scheduled' ? o.schedule.replace(/\s\d{2}:\d{2}$/, '') : '';
301
301
  L.push({ r: 'sched', label: 'Schedule', note: sched });
302
+ // a translated copy beside the draft (lib/report-translate.js): one item per language, the reader under it
303
+ for (const a of o.also || []) if (a && a.path && a.language) L.push({ r: 'also|' + a.path, label: 'Also in ' + a.language, note: a.reader ? 'for ' + a.reader : '' });
302
304
  if (o.issued) L.push({ r: 'nextcyc', label: 'Start the next cycle' });
303
305
  L.push({ sep: true }, o.issued ? { r: 'archive', label: 'Archive this cycle', danger: true } : { r: 'discard', label: 'Discard this draft', danger: true });
304
306
  return L;
305
307
  }
306
- const menuOf = () => moreItems({ edit: R.edit, issued: R.issued, archived: R.archived, schedule: R.setup === undefined ? '' : schedLabel(R.setup) });
308
+ const menuOf = () => moreItems({ edit: R.edit, issued: R.issued, archived: R.archived, schedule: R.setup === undefined ? '' : schedLabel(R.setup), also: R.also });
307
309
  /** Shell A's ⋯ (open({ more })) reads the list when it opens, so the list is refilled in place as the cycle changes: one array per report. */
308
310
  function syncMore() {
309
311
  if (!R) return;
@@ -711,6 +713,7 @@ export function fit(root) { root.querySelectorAll('.vz-fr').forEach((c) => { if
711
713
  /* ── the presses ── */
712
714
  const say = (text, tone) => { R.msg = { text, tone }; draw(); const me = R, m = R.msg; if (tone !== 'bad') setTimeout(() => { if (R === me && R.msg === m) { R.msg = null; draw(); } }, 9000); };
713
715
  async function act([k, v], t) {
716
+ if (k === 'also') { const a = (R.also || []).find((x) => x.path === v); return openReport({ path: v, state: 'draft' }, { ws: R.ws, name: R.name + (a ? ' · ' + a.language : ''), cycles: [] }); }
714
717
  if (k === 'rv-do' || k === 'rv-no' || k === 'rv-all') return rvAct(k, v);
715
718
  if (k === 'ord') return ordAct(v, t.dataset.r.split('|').slice(2).join('|'));
716
719
  if (k === 'pop') { R.pop = v || null; return draw(); }
@@ -1118,10 +1121,11 @@ export async function openReport(row, hand = {}) {
1118
1121
  vOpen(head());
1119
1122
  try { R.text = await textOf('/api/doc?' + q({ ws: R.ws, path: row.path })); R.W = wordsOf(R.text, R.name); if (!hand.name && R.W.title) R.name = R.W.title; } catch (x) { R.err = String((x && x.message) || x); R.W = { title: R.name, sections: [] }; }
1120
1123
  if (R !== me) return me;
1121
- if (!R.ws && c.cadence && c.slot) { // opened without a workspace (a /premium-viewer.html link): the report route names the one that holds it
1122
- const d = await Promise.resolve(pmGet('/api/report/draft?' + q({ cadence: c.cadence, slot: c.slot }))).catch(() => null);
1124
+ if (c.cadence && c.slot) { // the report route names the workspace when the page was opened without one, and the translated copies (Also in …)
1125
+ const d = await Promise.resolve(pmGet('/api/report/draft?' + q({ ...(R.ws ? { ws: R.ws } : {}), cadence: c.cadence, slot: c.slot }))).catch(() => null);
1123
1126
  if (R !== me) return me;
1124
- if (d && d.ws) R.ws = d.ws;
1127
+ if (!R.ws && d && d.ws) R.ws = d.ws;
1128
+ R.also = d && Array.isArray(d.also) ? d.also : [];
1125
1129
  }
1126
1130
  await Promise.all([readCycle(), readSetup(), readShares()]);
1127
1131
  if (R !== me) return me;
@@ -2943,6 +2943,8 @@ try { require('./lib/routes-report-design.js').attach(reportDesignCtx); } catch
2943
2943
  // report-reader-review: every report draft this process writes is read once as the CFO, the engineer and the sceptic; their questions go under the
2944
2944
  // ✦ of the initiatives the report covers (lib/report-readers.js, through lib/ai-guard.js). The read runs through spawnScheduled (the capacity governor).
2945
2945
  try { require('./lib/report-readers.js').attach(() => ({ ...reportDesignCtx(), stateDirFor })); } catch { /* a checkout without the module still starts */ }
2946
+ // Each draft in each reader's language: a translated copy beside it when its definition names a `languages:` line (lib/report-translate.js).
2947
+ try { require('./lib/report-translate.js').attach(() => reportDesignCtx()); } catch { /* a checkout without the module still starts */ }
2946
2948
  // report-structure: the structure jobs, the source checks (interactive sessions started like Work's approved steps, STEP_FLAGS) and the draft gate.
2947
2949
  // The tick collects check answers and starts the drafts that waited for a failing source (4 hours, then without it).
2948
2950
  // agent-orchestrator: the checks of a draft the schedule tick fired, and the tick's retries of them, use spawnScheduled (the capacity governor). A press uses spawnSession.
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "Reports in each reader's language (report-reader-language, idea A111, done test planning/done-tests/report-reader-language.md L1-L4, N1-N3): the definition's languages line, the translated copy with numbers and names checked, the ⋯ Also in item and pmos report language. The model's answer is recorded. No server, network, model or browser.",
3
+ "modules": [
4
+ "report-translate.test.js"
5
+ ],
6
+ "seconds": {
7
+ "report-translate.test.js": 2
8
+ }
9
+ }