create-pmos 0.411.0 → 0.412.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 +13 -13
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-insights-test.js +2 -2
- package/workspace/briefing-premium-test.js +3 -3
- package/workspace/changelog.json +12 -0
- package/workspace/guide/board.md +1 -1
- package/workspace/guide/breakdown.md +6 -13
- package/workspace/guide/index.md +1 -1
- package/workspace/guide/initiative-driver.md +1 -1
- package/workspace/guide/initiatives-screen.md +1 -1
- package/workspace/guide/pm-only-acts.md +23 -24
- package/workspace/guide/today.md +1 -1
- package/workspace/lib/briefing-premium-writes.js +5 -4
- package/workspace/lib/coredoc-cli.js +1 -1
- package/workspace/lib/driver-cli.js +2 -1
- package/workspace/lib/driver-decide.js +3 -2
- package/workspace/lib/driver.js +2 -1
- package/workspace/lib/grant-mint.js +3 -2
- package/workspace/lib/initiative-cli.js +9 -9
- package/workspace/lib/issues.js +5 -4
- package/workspace/lib/people-store.js +1 -1
- package/workspace/lib/people.js +3 -1
- package/workspace/lib/placements.js +13 -15
- package/workspace/lib/plan-items.js +17 -48
- package/workspace/lib/pm-guard.js +18 -5
- package/workspace/lib/pm-lines-needs.js +9 -5
- package/workspace/lib/report-cli.js +2 -2
- package/workspace/lib/routes-board-metric-targets.js +0 -1
- package/workspace/lib/routes-briefing-premium.js +3 -5
- package/workspace/lib/routes-core-docs.js +0 -1
- package/workspace/lib/routes-custom-docs.js +0 -1
- package/workspace/lib/routes-driver.js +0 -1
- package/workspace/lib/routes-home-desk.js +1 -1
- package/workspace/lib/routes-home-review.js +1 -1
- package/workspace/lib/routes-initiative-layout.js +1 -1
- package/workspace/lib/routes-insights-records.js +0 -1
- package/workspace/lib/routes-meeting-material.js +0 -1
- package/workspace/lib/routes-onboarding.js +3 -1
- package/workspace/lib/routes-orchestrator.js +0 -1
- package/workspace/lib/routes-premium-charts.js +0 -1
- package/workspace/lib/routes-premium-dashboards.js +0 -1
- package/workspace/lib/routes-programs.js +1 -1
- package/workspace/lib/routes-records.js +1 -1
- package/workspace/lib/routes-report-design.js +7 -3
- package/workspace/lib/routes-report-setups.js +0 -1
- package/workspace/lib/routes-report-structure.js +0 -1
- package/workspace/lib/routes-runs.js +2 -5
- package/workspace/lib/routes-scan.js +0 -1
- package/workspace/lib/routes-sources.js +1 -1
- package/workspace/lib/run-answers.js +14 -5
- package/workspace/lib/scan-cli.js +2 -1
- package/workspace/lib/scan.js +2 -1
- package/workspace/lib/vendor/scripts/onboarding/proposals.js +7 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-core-doc-issue-test.js +1 -1
- package/workspace/premium-viewer-share-test.js +5 -2
- package/workspace/replaced-tests.json +101 -0
- package/workspace/server.js +8 -9
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
const fs = require('fs');
|
|
12
12
|
const path = require('path');
|
|
13
13
|
const guard = require('./pm-guard.js');
|
|
14
|
-
const actor = require('./actor.js');
|
|
15
14
|
const runAnswers = require('./run-answers.js');
|
|
16
15
|
const { repoScript } = require('./repo-script.js');
|
|
17
16
|
const { groupSessions } = require(repoScript('sessions-list.js'));
|
|
@@ -126,9 +125,7 @@ async function handle(req, res, url, ctx) {
|
|
|
126
125
|
const got = await ctx.readJson(req);
|
|
127
126
|
if (!got.ok) { ctx.json(res, { ok: false, error: 'body must be JSON' }, 400); return true; }
|
|
128
127
|
const body = got.body;
|
|
129
|
-
const
|
|
130
|
-
if (tok) { ctx.json(res, { ok: false, error: 'an agent session cannot answer a run' }, 403); return true; }
|
|
131
|
-
const g = guard.requirePagePress(req, body);
|
|
128
|
+
const g = guard.requirePagePress(req, body); // D98: an agent session may answer too; g.actor names it
|
|
132
129
|
if (!g.ok) { ctx.json(res, { ok: false, error: g.error }, g.status); return true; }
|
|
133
130
|
if (p === '/api/runs/answer') {
|
|
134
131
|
// An answer to the agent's own question must be one of the options it offered (the contract's answerLine).
|
|
@@ -140,7 +137,7 @@ async function handle(req, res, url, ctx) {
|
|
|
140
137
|
if (al.error) { ctx.json(res, { ok: false, error: al.error }, 400); return true; }
|
|
141
138
|
}
|
|
142
139
|
}
|
|
143
|
-
const r = runAnswers.recordAnswer(runAnswers.answersFile(ctx.runtimeDir), body, actor
|
|
140
|
+
const r = runAnswers.recordAnswer(runAnswers.answersFile(ctx.runtimeDir), body, g.actor);
|
|
144
141
|
ctx.json(res, r.ok ? { ok: true } : { ok: false, error: r.error }, r.ok ? 200 : r.status);
|
|
145
142
|
return true;
|
|
146
143
|
}
|
|
@@ -190,7 +190,6 @@ async function handle(req, res, url, ctx) {
|
|
|
190
190
|
const read = await ctx.readJson(req);
|
|
191
191
|
if (!read.ok) return send(bad(400, 'the body is not JSON'));
|
|
192
192
|
const body = read.body;
|
|
193
|
-
if (req.headers && req.headers['x-pmos-session']) return send(bad(403, 'an agent session cannot change the watch list, the scan setting or a proposal, start a scan or stop one'));
|
|
194
193
|
const g = guard.requirePagePress(req, body);
|
|
195
194
|
if (!g.ok) return send(bad(g.status, g.error));
|
|
196
195
|
const w = wsOf(ctx, text(body.ws));
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* Briefing from those reads (briefing-source-flow, slice 3); a press while one runs joins it
|
|
12
12
|
* POST /api/sources/watch { ws, on } → { ok, watch } the change detector on or off for this repository
|
|
13
13
|
*
|
|
14
|
-
* Both POSTs pass pm-guard requirePagePress: the
|
|
14
|
+
* Both POSTs pass pm-guard requirePagePress: the press from the page (an agent session's too, D98), which may start a refresh or
|
|
15
15
|
* switch the detector off. A refresh of `repository` or `initiatives` rebuilds the facts in a child process; a refresh of
|
|
16
16
|
* an external source starts that source's skill as a session in the workspace, with the PM's own connections. The server
|
|
17
17
|
* itself calls nothing outside this machine.
|
|
@@ -29,11 +29,13 @@ function requestIdOf(body) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
function recordAnswer(file, input, who, now = new Date()) {
|
|
32
|
-
|
|
32
|
+
// D98: an agent session answers too; the line keeps its `by`, so the PM sees who answered.
|
|
33
|
+
if (!actor.isPm(who) && !actor.isAgent(who)) return { ok: false, status: 403, error: 'only the PM or an agent session can answer a run' };
|
|
33
34
|
const i = input && typeof input === 'object' ? input : {};
|
|
34
35
|
if (typeof i.run !== 'string' || !RUN_RE.test(i.run)) return { ok: false, status: 400, error: 'run must be a session id' };
|
|
35
36
|
if (typeof i.request !== 'string' || !i.request || i.request.length > 120) return { ok: false, status: 400, error: 'request must be a short id' };
|
|
36
37
|
if (!BEHAVIORS.includes(i.behavior)) return { ok: false, status: 400, error: 'behavior must be one of ' + BEHAVIORS.join(', ') };
|
|
38
|
+
if (ownRun(who.by, i.run)) return { ok: false, status: 403, error: 'a run does not answer its own question or permission request' };
|
|
37
39
|
const message = typeof i.message === 'string' ? i.message.slice(0, 400) : '';
|
|
38
40
|
const line = { type: 'answer', run: i.run, request: i.request, behavior: i.behavior, message, by: who.by };
|
|
39
41
|
appendOutbox(file, line, now);
|
|
@@ -45,20 +47,27 @@ function readAnswers(file) {
|
|
|
45
47
|
catch { return []; }
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
const answerer = (by) => typeof by === 'string' && (by.startsWith('pm:') || by.startsWith('agent:'));
|
|
51
|
+
/** True when `by` is the agent session of run `run` itself. Kept through D98: a run that answered its own permission
|
|
52
|
+
* request would make the request mean nothing. Any other agent session may answer it. */
|
|
53
|
+
const ownRun = (by, run) => typeof by === 'string' && typeof run === 'string' && by.startsWith('agent:' + run + '.');
|
|
54
|
+
const counts = (l, run) => answerer(l.by) && !ownRun(l.by, run);
|
|
55
|
+
|
|
48
56
|
function answerFor(run, requestId, lines = []) {
|
|
49
57
|
let found = null;
|
|
50
58
|
for (const l of lines) {
|
|
51
|
-
if (l && l.type === 'answer' && l.run === run && l.request === requestId &&
|
|
59
|
+
if (l && l.type === 'answer' && l.run === run && l.request === requestId && counts(l, run)) found = l;
|
|
52
60
|
}
|
|
53
61
|
return found;
|
|
54
62
|
}
|
|
55
63
|
|
|
56
|
-
// The
|
|
57
|
-
// permission request.
|
|
64
|
+
// The recorded answers as the contract's own events (reply-contract.js fold): an answer to an ask, a decision on a
|
|
65
|
+
// permission request. Lines written by the PM or another agent session (D98) become events, in the contract's answerer role
|
|
66
|
+
// (`by: 'pm'`); the run-answers line itself keeps who wrote it. The fold then checks the ids against what is open.
|
|
58
67
|
function asEvents(run, lines = []) {
|
|
59
68
|
const out = [];
|
|
60
69
|
for (const l of lines) {
|
|
61
|
-
if (!l || l.type !== 'answer' || l.run !== run.id ||
|
|
70
|
+
if (!l || l.type !== 'answer' || l.run !== run.id || !counts(l, run.id)) continue;
|
|
62
71
|
if (l.behavior === 'answer') out.push({ kind: 'answer', run: run.id, session: run.session, ask_id: l.request, answer: l.message, by: 'pm' });
|
|
63
72
|
else if (l.behavior === 'allow' || l.behavior === 'deny') out.push({ kind: 'decision', run: run.id, session: run.session, perm_id: l.request, decision: l.behavior, by: 'pm', at: l.at });
|
|
64
73
|
}
|
|
@@ -130,7 +130,8 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), isT
|
|
|
130
130
|
if (!file) file = S.ledgerFile(D.stateDirOf(flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd)));
|
|
131
131
|
const noState = () => fail('this repository has no PMOS state folder (pmos/state, state or .pmos), so the scan has nowhere to keep its ledger');
|
|
132
132
|
const actor = actorLib.fromCli(who);
|
|
133
|
-
|
|
133
|
+
// D98: an agent session may do it too; the ledger line carries its own `by`.
|
|
134
|
+
const pmOnly = (act) => (actorLib.isPm(actor) || actorLib.isAgent(actor) ? { ok: true } : { ok: false, error: `only the PM or an agent session can ${act}` });
|
|
134
135
|
const openScan = (state, id, mode) => {
|
|
135
136
|
const sc = id ? state.scans.get(id) : null;
|
|
136
137
|
if (!sc || sc.end || (mode && sc.mode !== mode)) return null;
|
package/workspace/lib/scan.js
CHANGED
|
@@ -88,7 +88,8 @@ const REPORT_RE = /^r-[0-9a-f]{10}$/;
|
|
|
88
88
|
const PROPOSAL_RE = /^p-[0-9a-f]{10}$/;
|
|
89
89
|
const isObj = (v) => !!v && typeof v === 'object' && !Array.isArray(v);
|
|
90
90
|
const oneLine = (v, max) => typeof v === 'string' && v.trim().length >= 1 && v.trim().length <= max && !/[\r\n\x00-\x08\x0b-\x1f]/.test(v);
|
|
91
|
-
|
|
91
|
+
// D98: a press line by the PM or an agent session takes effect; the line keeps who wrote it.
|
|
92
|
+
const pm = (by) => typeof by === 'string' && (by.startsWith('pm:') || by.startsWith('agent:'));
|
|
92
93
|
const newId = (prefix, bytes = 4) => `${prefix}-${crypto.randomBytes(bytes).toString('hex')}`;
|
|
93
94
|
const refuse = (status, error) => ({ ok: false, status, error });
|
|
94
95
|
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* proposed { id, kind:'proposed', proposal_id, scan_id, candidate, at, why } written by the scan process
|
|
9
9
|
* decided { id, kind:'decided', proposal_id, decision: approve|reject|revise, revision?, why, at } by (and via) from the call path
|
|
10
10
|
* fold(lines) gives each proposal its state: open | approved | rejected | revised. The latest decision wins; earlier ones stay in `history`.
|
|
11
|
-
* A decision is a PM press: decide() and approveBulk() take the actor as an argument and
|
|
11
|
+
* A decision is a PM press or an agent session's (D98): decide() and approveBulk() take the actor as an argument and
|
|
12
|
+
* refuse anything that is not 'human:' or 'agent:'.
|
|
12
13
|
*/
|
|
13
14
|
const fs = require('fs');
|
|
14
15
|
const path = require('path');
|
|
@@ -20,10 +21,13 @@ const SCAN_ACTOR = { by: 'process:onboarding-scan', via: 'cli' };
|
|
|
20
21
|
|
|
21
22
|
const inside = (child, parent) => { const r = path.relative(path.resolve(parent), path.resolve(child)); return r === '' || (!r.startsWith('..') && !path.isAbsolute(r)); };
|
|
22
23
|
|
|
23
|
-
/** The actor of a decision as ledger.append wants it ({by, via}). A bare string 'human:wawan' is a PM press;
|
|
24
|
+
/** The actor of a decision as ledger.append wants it ({by, via}). A bare string 'human:wawan' is a PM press; an
|
|
25
|
+
* `agent:…` actor is an agent session deciding (D98), and the line keeps its name. Anything else is refused. */
|
|
24
26
|
function humanActor(actor) {
|
|
25
27
|
const a = typeof actor === 'string' ? { by: actor, via: 'ui' } : actor;
|
|
26
|
-
|
|
28
|
+
// An agent is agent:<session> (the workspace) or claude-code/<skill> (scripts/trust/ledger.js actorFrom).
|
|
29
|
+
const ok = a && typeof a.by === 'string' && ((a.by.startsWith('human:') && a.by.length > 'human:'.length) || /^agent:(?:unknown|sess-\d+\.[0-9a-f]{8})$/.test(a.by) || /^claude-code\/[\w-]+$/.test(a.by));
|
|
30
|
+
if (!ok) throw new Error('a decision is made by the PM (human:<name>) or an agent session (agent:<session>) (got ' + (a && a.by ? a.by : 'none') + ')');
|
|
27
31
|
return { by: a.by, via: a.via || 'ui' };
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.412.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.412.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@xterm/addon-fit": "^0.11.0",
|
package/workspace/package.json
CHANGED
|
@@ -170,7 +170,7 @@ const BODY = '## Purpose\n\nWhy this board exists.\n\n## Scope\n\nWhat it covers
|
|
|
170
170
|
const bare = await fetch(BASE + '/api/core-docs/issue', { method: 'POST', headers: { 'Content-Type': 'application/json', Origin: BASE }, body: JSON.stringify({ ws: B.ws, scope: bscope, key: bkey, slot: d1.slot }) });
|
|
171
171
|
ok('P3 a press without the launch nonce is refused', bare.status === 403);
|
|
172
172
|
const agent = await fetch(BASE + '/api/core-docs/issue', { method: 'POST', headers: { ...H, 'x-pmos-session': 's1' }, body: JSON.stringify({ ws: B.ws, scope: bscope, key: bkey, slot: d1.slot }) });
|
|
173
|
-
ok('P4 an agent session
|
|
173
|
+
ok('P4 D98: an agent session is not refused as an agent (the press is checked like the PM\'s)', agent.status !== 403, String(agent.status));
|
|
174
174
|
ok('P5 no script error on any page', !P.errors.length && !I.errors.length && !J.errors.length, P.errors.concat(I.errors, J.errors).join(' | '));
|
|
175
175
|
await J.ctx.close();
|
|
176
176
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* but I can set password)"). lib/share-store.js keeps the copies, POST /api/shares makes one on a page press, share-server.js serves them.
|
|
5
5
|
* K1 the store: 22-character ids, a scrypt hash and never the password, five wrong tries lock for 15 minutes, a link past its end is deleted,
|
|
6
6
|
* the cookie is signed per link and a changed one fails
|
|
7
|
-
* K2 the routes:
|
|
7
|
+
* K2 the routes: a request without the page's press headers is refused; an agent session makes and turns off a link (D98); a file with a secret is refused and the answer
|
|
8
8
|
* names the rule only; 1, 7 or 30 days only; a made link is listed with its password flag and no hash
|
|
9
9
|
* K3 the share server: the password page names neither the file nor PMOS; a wrong password counts down, five lock, the right one opens; the copy
|
|
10
10
|
* is under a sandbox CSP; Download gives the file's own text; every answer is noindex, no-store, no-referrer; any other path is 404
|
|
@@ -83,7 +83,10 @@ const SHOTS = process.env.PMOS_SHOTS || '';
|
|
|
83
83
|
// K2 the routes
|
|
84
84
|
{
|
|
85
85
|
ok('K2 a POST without the page\'s press headers is refused', (await req(BASE + '/api/shares', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ path: PRD, days: 7 }) })).status === 403);
|
|
86
|
-
|
|
86
|
+
const agentMk = await post('/api/shares', { path: PRD, days: 7 }, { 'x-pmos-session': 'sess-1' });
|
|
87
|
+
const agentId = (JSON.parse(agentMk.text || '{}')).id;
|
|
88
|
+
const agentOff = await post('/api/shares/off', { id: agentId }, { 'x-pmos-session': 'sess-1' });
|
|
89
|
+
ok('K2 D98: an agent session makes a link (the secret scan still runs) and turns it off', agentMk.status === 200 && !!agentId && agentOff.status === 200, agentMk.text);
|
|
87
90
|
fs.writeFileSync(path.join(REPO, SECRET_REL), '# Keys\n\naws ' + 'AKIA' + 'ABCDEFGHIJKLMNOP' + ' here\n');
|
|
88
91
|
const sec = await post('/api/shares', { path: SECRET_REL, days: 7, password: null });
|
|
89
92
|
ok('K2 a file with a secret is refused, naming the rule and not the text', sec.status === 422 && /aws-access-key/.test(sec.text) && !/AKIAABCD/.test(sec.text), sec.status + ' ' + sec.text);
|
|
@@ -3510,6 +3510,107 @@
|
|
|
3510
3510
|
"names": [
|
|
3511
3511
|
"T3: both spawn paths take the launch args — tmux joins plain tokens, the direct PTY passes an argv"
|
|
3512
3512
|
]
|
|
3513
|
+
},
|
|
3514
|
+
{
|
|
3515
|
+
"id": "E76",
|
|
3516
|
+
"group": "E",
|
|
3517
|
+
"file": "workspace/d86-seams.test.js",
|
|
3518
|
+
"section": "4 pm-guard and grant-mint",
|
|
3519
|
+
"change": "replaced",
|
|
3520
|
+
"slice": "agents-finish-work",
|
|
3521
|
+
"reason": "D98 (PM wawan, 2026-10-24): an agent session takes every act that was PM-only and every line names the agent; requirePmCli no longer refuses an agent session or agent:unknown, and grant-mint no longer refuses an agent actor.",
|
|
3522
|
+
"replacement": "The same section asserts that requirePmCli passes an agent session and agent:unknown with their own actor and asks nothing; that a press with an x-pmos-session token is that agent (a malformed one agent:unknown, never the PM); and that grant-mint still allows only release and lifecycle-bulk and does not refuse an agent as an agent.",
|
|
3523
|
+
"pm_approval": null,
|
|
3524
|
+
"names": [
|
|
3525
|
+
"4 pm-guard: a PM-only verb from an agent session is refused with 403, without asking",
|
|
3526
|
+
"4 pm-guard: a PM-only verb with no terminal is refused with 403",
|
|
3527
|
+
"4 grant-mint: a press mints only a release or lifecycle-bulk grant (400 otherwise), and only as the PM (403)"
|
|
3528
|
+
]
|
|
3529
|
+
},
|
|
3530
|
+
{
|
|
3531
|
+
"id": "E77",
|
|
3532
|
+
"group": "E",
|
|
3533
|
+
"file": "workspace/item-cli.test.js",
|
|
3534
|
+
"section": "1 attribution, 3 withdraw",
|
|
3535
|
+
"change": "replaced",
|
|
3536
|
+
"slice": "agents-finish-work",
|
|
3537
|
+
"reason": "D98 (PM wawan, 2026-10-24): an agent session takes every act that was PM-only and every line names the agent; an agent's items are live at once, and an agent withdraws any item, the PM's and another session's included.",
|
|
3538
|
+
"replacement": "C3 asserts the piped item is agent:unknown / cli and live; C23a asserts agent:unknown withdraws another session's item with its own by and list no longer shows it; C23b asserts an agent session withdraws the PM's item with its own by.",
|
|
3539
|
+
"pm_approval": null,
|
|
3540
|
+
"names": [
|
|
3541
|
+
"C3 piped stdio is agent:unknown / cli, and the item is proposed",
|
|
3542
|
+
"C23a an agent withdraws only the items it planned: another session (here agent:unknown) is refused, exit 1, nothing written",
|
|
3543
|
+
"C23b an agent session cannot withdraw an item the PM planned (exit 1)",
|
|
3544
|
+
"C23 the session that planned it withdraws it: withdrawn is written, and list no longer shows the item"
|
|
3545
|
+
]
|
|
3546
|
+
},
|
|
3547
|
+
{
|
|
3548
|
+
"id": "E78",
|
|
3549
|
+
"group": "E",
|
|
3550
|
+
"file": "workspace/plan-items.test.js",
|
|
3551
|
+
"section": "4 attribution, 7 Keep, 8 forged lines, 9 needs-you, 14 named cases, 15 withdraw",
|
|
3552
|
+
"change": "replaced",
|
|
3553
|
+
"slice": "agents-finish-work",
|
|
3554
|
+
"reason": "D98 (PM wawan, 2026-10-24): an agent session takes every act that was PM-only and every line names the agent; an agent's items are live at once (never proposed), so there are no batches, no Keep cards and no kept-not-pm flag; a Keep line from before D98 on a live item is skipped silently; an agent withdraws any item.",
|
|
3555
|
+
"replacement": "P17/P18 assert the agent item is live; P48-P53 assert no batches, progress counts agent items, Keep of live items is 409, an old Keep line is skipped with no flag and the layout carries no token; P63-P65 assert the kept-not-ui flag stays, an agent Keep line is not flagged and a mismatch is flagged once; P71/P84 assert no Keep card; P90 asserts an agent withdraws the PM's and another session's item with its own by.",
|
|
3556
|
+
"pm_approval": null,
|
|
3557
|
+
"names": [
|
|
3558
|
+
"P17 from a bound session: by agent:<token>, via cli, owner agent, and the item is proposed",
|
|
3559
|
+
"P18 a valid PMOS_SESSION wins over a terminal (an agent session runs in a PTY too): agent:<token> via cli, proposed",
|
|
3560
|
+
"P48 two sessions planning on one initiative give two batches, in createdAt order",
|
|
3561
|
+
"P49 proposed items never count in progress, and the label says they wait: \"no breakdown · 4 proposed\"",
|
|
3562
|
+
"P51 Keep of an item that is not in that batch is 409",
|
|
3563
|
+
"P52 Keep from the page: a kept line with no item key; the items are no longer proposed, and count in progress",
|
|
3564
|
+
"P53 Keep twice is 409 (nothing is proposed any more)",
|
|
3565
|
+
"P53b the page names two batches whose actors read the same agent:sess-6 and agent:sess-6#2, with no token anywhere in the layout",
|
|
3566
|
+
"P53c Keep by a page name the items were not proposed under is 409, and nothing is written",
|
|
3567
|
+
"P53d Keep by the page name records the full actor of the batch the items belong to (sess-6#2 is the second run's token)",
|
|
3568
|
+
"P64 a kept line not by the PM: kept-not-pm, ignored",
|
|
3569
|
+
"P65 a kept line naming an item of another batch: kept-mismatch for that id only",
|
|
3570
|
+
"P71 one Keep card per agent batch, with its count, its session label and its items",
|
|
3571
|
+
"P71b no needs row carries an agent's session token: the batch is agent:sess-<n>, as the page shows it",
|
|
3572
|
+
"P84 9 lines from one session give 1 batch, and its Keep card reads \"9 items\"",
|
|
3573
|
+
"P90 an agent cannot withdraw the PM's item or another session's (403); it withdraws its own; the PM withdraws any",
|
|
3574
|
+
"P63 a kept line not from the page: kept-not-ui, ignored (fail closed)",
|
|
3575
|
+
"P73 a Keep line not written from the page is a plan-flag row, and it kept nothing"
|
|
3576
|
+
]
|
|
3577
|
+
},
|
|
3578
|
+
{
|
|
3579
|
+
"id": "E79",
|
|
3580
|
+
"group": "E",
|
|
3581
|
+
"file": "workspace/plan-routes.test.js",
|
|
3582
|
+
"section": "1 GET, 4 needs-you",
|
|
3583
|
+
"change": "replaced",
|
|
3584
|
+
"slice": "agents-finish-work",
|
|
3585
|
+
"reason": "D98 (PM wawan, 2026-10-24): an agent session takes every act that was PM-only and every line names the agent; an agent's items are live at once, so the layout has no batches and needs-you has no Keep card; a Keep from the page of live items is 409.",
|
|
3586
|
+
"replacement": "R1/R1b assert progress counts the agent's items, no batches and no token; R22 asserts no Keep card; R24-R26 assert the forged-Keep plan-flag row, the row shapes and the counts; R27 asserts a page Keep of live items is 409; R51 asserts the lead-tree counting with the remaining plan rows.",
|
|
3587
|
+
"pm_approval": null,
|
|
3588
|
+
"names": [
|
|
3589
|
+
"R22 one Keep card per session: \"9 items\" and \"1 item\"",
|
|
3590
|
+
"R25b needs-you names each batch as agent:sess-<n>, never with its session token",
|
|
3591
|
+
"R27 Keep from the page, by the batch's page name, writes kept / ui / pm:wawan with the agent's full actor, and that card leaves needs-you",
|
|
3592
|
+
"R1 GET answers the layout: ok, ws, initiative, profile, lane, the ladder, sig, now, progress, stages, items, board, batches",
|
|
3593
|
+
"R1b the layout names the agent as agent:sess-3, never with its session token, while the ledger keeps the token",
|
|
3594
|
+
"R24 a forged Keep (via cli) is a plan-flag row and keeps nothing",
|
|
3595
|
+
"R26 the collapsed-row count includes the plan rows",
|
|
3596
|
+
"R51 one repository, two registered trees: its Keep, evidence and check rows are counted once, on the lead tree (not again on the linked worktree)"
|
|
3597
|
+
]
|
|
3598
|
+
},
|
|
3599
|
+
{
|
|
3600
|
+
"id": "E80",
|
|
3601
|
+
"group": "E",
|
|
3602
|
+
"file": "workspace/plan-tree.test.js",
|
|
3603
|
+
"section": "layout counts",
|
|
3604
|
+
"change": "replaced",
|
|
3605
|
+
"slice": "agents-finish-work",
|
|
3606
|
+
"reason": "D98 (PM wawan, 2026-10-24): an agent session takes every act that was PM-only and every line names the agent; an agent's item counts in the stage and the progress at once, and there are no Keep batches.",
|
|
3607
|
+
"replacement": "T20/T21 assert the agent's item counts (0 of 4; 2 of 8; nothing proposed); T25 asserts no batches, another initiative's kept-not-ui stays out and a torn line shows.",
|
|
3608
|
+
"pm_approval": null,
|
|
3609
|
+
"names": [
|
|
3610
|
+
"T20 stage counts leave proposed items out: Build 0 of 3 with 1 proposed",
|
|
3611
|
+
"T21 progress is ledger-only and leaves proposed items out",
|
|
3612
|
+
"T25 batches and flags are this initiative's: another initiative's batch and kept-not-ui stay out; a torn line (no initiative) is shown"
|
|
3613
|
+
]
|
|
3513
3614
|
}
|
|
3514
3615
|
]
|
|
3515
3616
|
}
|
package/workspace/server.js
CHANGED
|
@@ -7729,7 +7729,6 @@ async function handleRequest(req, res) {
|
|
|
7729
7729
|
}
|
|
7730
7730
|
if (p === '/api/shares/password' && req.method === 'GET') return json(res, { ok: true, password: shareStore.newPassword() });
|
|
7731
7731
|
if ((p === '/api/shares' || p === '/api/shares/off') && req.method === 'POST') {
|
|
7732
|
-
if (req.headers['x-pmos-session']) return json(res, { ok: false, error: 'An agent session cannot make or turn off a share link. Only a press on the page does.' }, 403);
|
|
7733
7732
|
let body = {};
|
|
7734
7733
|
try { body = JSON.parse((await readBody(req)) || '{}'); } catch { return json(res, { ok: false, error: 'invalid JSON body' }, 400); }
|
|
7735
7734
|
const g = pmGuard.requirePagePress(req, body);
|
|
@@ -8050,7 +8049,7 @@ async function handleRequest(req, res) {
|
|
|
8050
8049
|
let body = {};
|
|
8051
8050
|
try { body = JSON.parse((await readBody(req)) || '{}'); }
|
|
8052
8051
|
catch { return json(res, { ok: false, error: 'invalid JSON body' }, 400); }
|
|
8053
|
-
// R25
|
|
8052
|
+
// R25, amended by D98: the guard checks Origin and nonce; an agent session may bind, and its actor is what it answers.
|
|
8054
8053
|
const g = pmGuard.requirePmPress(req, body, { act: 'bind' });
|
|
8055
8054
|
if (!g.ok) return json(res, { ok: false, error: g.error }, g.status);
|
|
8056
8055
|
const s = sessions.get(String(body.id || ''));
|
|
@@ -8146,7 +8145,6 @@ async function handleRequest(req, res) {
|
|
|
8146
8145
|
const g = pmGuard.requirePagePress(req, body);
|
|
8147
8146
|
if (!g.ok) return json(res, { ok: false, error: g.error }, g.status);
|
|
8148
8147
|
// It uses the PM's connectors, so an agent session never presses it (the same 403 as create-copy).
|
|
8149
|
-
if (req.headers['x-pmos-session']) return json(res, { ok: false, error: 'an agent session cannot start a read. Only a press on the page does' }, 403);
|
|
8150
8148
|
const w = body.ws ? workspaces.get(String(body.ws)) : getWs(null);
|
|
8151
8149
|
if (!w) return json(res, { ok: false, error: 'no such workspace' }, 404);
|
|
8152
8150
|
const address = String(body.url || '').trim().slice(0, 2000);
|
|
@@ -8186,7 +8184,6 @@ async function handleRequest(req, res) {
|
|
|
8186
8184
|
// the PM pressed (a Doc, Slides, Sheets or Confluence page), links it, and writes the PMOS version to it. It shares nothing and sends nothing.
|
|
8187
8185
|
if (p === '/api/docs/create-copy') {
|
|
8188
8186
|
// It makes a file in the PM's drive, so an agent session never presses it (the same 403 as routes-scan.js).
|
|
8189
|
-
if (req.headers['x-pmos-session']) return json(res, { ok: false, error: 'an agent session cannot create a copy. Only a press on the page does' }, 403);
|
|
8190
8187
|
const rel = String(body.path || '').trim();
|
|
8191
8188
|
const kind = String(body.kind || '');
|
|
8192
8189
|
const docSyncLib = require('./lib/doc-sync.js');
|
|
@@ -8531,8 +8528,10 @@ async function handleRequest(req, res) {
|
|
|
8531
8528
|
// nothing routes the PM to it. So the label is accepted from the client when the PM states
|
|
8532
8529
|
// it, validated against the same closed set, and simply absent when they do not.
|
|
8533
8530
|
accepted: body.action === 'accept' ? true : body.action === 'return' ? false : undefined,
|
|
8534
|
-
|
|
8535
|
-
|
|
8531
|
+
// D98: an agent session may accept or return too. Its line says by agent:…, is not marked pm, and carries no
|
|
8532
|
+
// pm_label: that label is the PM's κ calibration answer (D40), never an agent's.
|
|
8533
|
+
...((body.pm_label === 'pass' || body.pm_label === 'fail') && g.actor.by.startsWith('pm:') ? { pm_label: body.pm_label } : {}),
|
|
8534
|
+
note: body.note || '', workspace: w ? w.name : null, root: w ? w.root : null, pm: g.actor.by.startsWith('pm:'), by: g.actor.by, via: g.actor.via };
|
|
8536
8535
|
// A malformed label is refused rather than dropped. Silently discarding it would put the row in
|
|
8537
8536
|
// the unlabeled pile while the PM believed they had labelled it — the same shape as inferring.
|
|
8538
8537
|
if (body.pm_label !== undefined && body.pm_label !== 'pass' && body.pm_label !== 'fail') {
|
|
@@ -8869,7 +8868,7 @@ async function handleRequest(req, res) {
|
|
|
8869
8868
|
if (!run) return json(res, { ok: false, error: 'that session was not started from a next step' }, 404);
|
|
8870
8869
|
const live = sessions.get(sid);
|
|
8871
8870
|
if (live && live.state !== 'exited') return json(res, { ok: false, error: 'the session is still running — review it when it has ended' }, 409);
|
|
8872
|
-
const rec = { at: nowISO(), initiative_id: run.initiative_id, item_id: run.item_id, key: run.key, session_id: sid, verdict, note, pm: 'wawan', by: g.actor.by, via: g.actor.via };
|
|
8871
|
+
const rec = { at: nowISO(), initiative_id: run.initiative_id, item_id: run.item_id, key: run.key, session_id: sid, verdict, note, pm: g.actor.by.startsWith('pm:') ? 'wawan' : null, by: g.actor.by, via: g.actor.via }; // D98: an agent's verdict names the agent
|
|
8873
8872
|
const wrote = nsAppend(NS_REVIEWS(), rec, 'step review');
|
|
8874
8873
|
if (!wrote.ok) return json(res, { ok: false, error: wrote.error }, 500);
|
|
8875
8874
|
return json(res, { ok: true, recorded: rec });
|
|
@@ -9752,7 +9751,7 @@ async function handleRequest(req, res) {
|
|
|
9752
9751
|
// needs.json and acceptances.jsonl use — a tenant product repo has no workspace/ folder, and
|
|
9753
9752
|
// assuming one is exactly the defect shipped in 0.7.1/0.7.2.
|
|
9754
9753
|
const region = applyChange.changedRegion(body.base, body.text);
|
|
9755
|
-
const rec = { file: String(body.path), at: nowISO(), pm: g.actor.by.slice('pm:'.length), via: g.actor.via,
|
|
9754
|
+
const rec = { file: String(body.path), at: nowISO(), pm: g.actor.by.startsWith('pm:') ? g.actor.by.slice('pm:'.length) : g.actor.by, via: g.actor.via,
|
|
9756
9755
|
note: typeof body.note === 'string' && body.note.trim() ? body.note.trim().slice(0, 400) : null,
|
|
9757
9756
|
at_line: region.at_line, added: region.added, removed: region.removed,
|
|
9758
9757
|
before: region.before, after: region.after };
|
|
@@ -9939,7 +9938,7 @@ async function handleRequest(req, res) {
|
|
|
9939
9938
|
const region = applyChange.changedRegion(body.before, body.after);
|
|
9940
9939
|
const dir = stateDirFor(w, { create: true });
|
|
9941
9940
|
if (dir) {
|
|
9942
|
-
const rec = { file: rel, at: nowISO(), pm: g.actor.by.slice('pm:'.length), via: g.actor.via,
|
|
9941
|
+
const rec = { file: rel, at: nowISO(), pm: g.actor.by.startsWith('pm:') ? g.actor.by.slice('pm:'.length) : g.actor.by, via: g.actor.via,
|
|
9943
9942
|
note: 'aligned with ' + (body.source || 'an earlier change') + (body.why ? ' — ' + String(body.why).slice(0, 200) : ''),
|
|
9944
9943
|
at_line: region.at_line, added: region.added, removed: region.removed,
|
|
9945
9944
|
before: region.before, after: region.after, aligned_from: body.source || null };
|