@soleur/opencode 3.359.19 → 3.360.1
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/agents/product/design/ux-design-lead.md +49 -13
- package/commands/go.md +1 -1
- package/hooks/stop-hook.sh +8 -1
- package/package.json +1 -1
- package/skills/brainstorm/SKILL.md +3 -3
- package/skills/brainstorm/references/brainstorm-brand-workshop.md +17 -10
- package/skills/brainstorm-techniques/references/technical-ruling-delegation.md +2 -0
- package/skills/one-shot/SKILL.md +1 -1
- package/skills/pencil-setup/SKILL.md +77 -27
- package/skills/pencil-setup/scripts/check_deps.sh +597 -132
- package/skills/pencil-setup/scripts/copy_adapter.sh +79 -11
- package/skills/pencil-setup/scripts/engine-contract-probe.sh +1132 -133
- package/skills/pencil-setup/scripts/pen-cli/package-lock.json +4359 -0
- package/skills/pencil-setup/scripts/pen-cli/package.json +13 -0
- package/skills/pencil-setup/scripts/pencil-error-enrichment.mjs +67 -14
- package/skills/pencil-setup/scripts/pencil-mcp-adapter.mjs +1283 -458
- package/skills/pencil-setup/scripts/pencil-repl-surface.mjs +377 -68
- package/skills/pencil-setup/scripts/pencil-response-classify.mjs +53 -12
- package/skills/pencil-setup/scripts/pencil-save-gate.mjs +484 -75
- package/skills/plan/SKILL.md +1 -1
- package/skills/plan/references/plan-sharp-edges.md +1 -0
- package/skills/ship/references/operator-holds.md +2 -0
|
@@ -1,43 +1,31 @@
|
|
|
1
|
-
// pencil-save-gate.mjs — pure decision
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
// disk. The caller saw a successful save but no real content — the
|
|
10
|
-
// "silent drop" that preceded #2630's fabricated "headless stub"
|
|
11
|
-
// narrative.
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Decide whether to SKIP the post-mutation save() call.
|
|
15
|
-
*
|
|
16
|
-
* Returns true only when the last classification explicitly reports
|
|
17
|
-
* isError === truthy. Missing/null/undefined classifications allow
|
|
18
|
-
* the save (preserves existing behavior for first-call and for callers
|
|
19
|
-
* that don't track classifications).
|
|
20
|
-
*/
|
|
21
|
-
export function shouldSkipSave(lastClassification) {
|
|
22
|
-
if (!lastClassification || typeof lastClassification !== "object") {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
return Boolean(lastClassification.isError);
|
|
26
|
-
}
|
|
1
|
+
// pencil-save-gate.mjs — the pure decision logic behind every save the adapter sends
|
|
2
|
+
// (extracted so it can be unit-tested without the MCP SDK): the empty-overwrite sentinel
|
|
3
|
+
// (#11143), the stale-file guard (#11168), the load-fidelity check, the refusal and
|
|
4
|
+
// not-persisted message builders, and the dependency-injected `runGuardedSave` that
|
|
5
|
+
// orders them. The adapter owns I/O (reads, the REPL, the baseline); this module owns
|
|
6
|
+
// every verdict and every user-visible refusal text, so the marker contract (first line
|
|
7
|
+
// `REFUSED save: [reason=<code>] <file> ...` / `NOT PERSISTED: [reason=<code>] <file> ...`)
|
|
8
|
+
// lives in one place.
|
|
27
9
|
|
|
28
|
-
// --- Empty-overwrite sentinel (#11143)
|
|
10
|
+
// --- Empty-overwrite sentinel (#11143) and stale-file guard (#11168) --------
|
|
29
11
|
//
|
|
30
12
|
// The headless engine writes only on `save()`, and a document opened without
|
|
31
|
-
// `--in` is empty, so
|
|
32
|
-
// 96-byte empty document. Every save
|
|
33
|
-
// empty in-memory document is never written over a file that still holds
|
|
34
|
-
// top-level node, and nothing is written over a file that exists but is not
|
|
35
|
-
// recognizable .pen document
|
|
36
|
-
// document, so there is no stored value for an edit to weaken
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
13
|
+
// `--in` is empty (measured), so a save over an existing .pen would replace it with the
|
|
14
|
+
// 96-byte empty document. Every save goes through `runGuardedSave`:
|
|
15
|
+
// 1. an empty in-memory document is never written over a file that still holds
|
|
16
|
+
// a top-level node, and nothing is written over a file that exists but is not
|
|
17
|
+
// a recognizable .pen document (`decideSave`, #11143; compares the live file
|
|
18
|
+
// with the live document, so there is no stored value for an edit to weaken);
|
|
19
|
+
// 2. a save never replaces a file whose content differs from what THIS session
|
|
20
|
+
// last loaded or last saved (`decideStale`, #11168; compares a stored
|
|
21
|
+
// baseline with a fresh read taken after the memory probe, immediately
|
|
22
|
+
// before the engine's `save()`).
|
|
23
|
+
// Limits: a second writer between the fresh read and the engine's write is not
|
|
24
|
+
// caught, and the post-save read adopts whatever is on disk at that instant.
|
|
25
|
+
|
|
26
|
+
import { createHash } from "node:crypto";
|
|
27
|
+
import { parseCountReply } from "./pencil-repl-surface.mjs";
|
|
28
|
+
import { stripAnsi } from "./pencil-response-classify.mjs";
|
|
41
29
|
|
|
42
30
|
/** The file exists with content, but it is not a document the engine can load back. */
|
|
43
31
|
export const DISK_UNRECOGNIZED = "unrecognized";
|
|
@@ -54,7 +42,7 @@ export const DISK_UNRECOGNIZED = "unrecognized";
|
|
|
54
42
|
*/
|
|
55
43
|
export function diskTopLevelCount(text) {
|
|
56
44
|
if (text === null || text === undefined) return null;
|
|
57
|
-
let s = String(text);
|
|
45
|
+
let s = Buffer.isBuffer(text) ? text.toString("utf8") : String(text);
|
|
58
46
|
if (s.charCodeAt(0) === 0xfeff) s = s.slice(1);
|
|
59
47
|
if (s.trim() === "") return null;
|
|
60
48
|
let doc;
|
|
@@ -70,24 +58,15 @@ export function diskTopLevelCount(text) {
|
|
|
70
58
|
}
|
|
71
59
|
|
|
72
60
|
/**
|
|
73
|
-
* Top-level node count of the in-memory document from
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
61
|
+
* Top-level node count of the in-memory document from the reply to the adapter's
|
|
62
|
+
* count snippet (`execute` printing `TOPLEVEL_COUNT:<nonce>:<n>`). Exactly one
|
|
63
|
+
* line carrying THIS call's nonce counts; zero lines, two lines, another nonce or
|
|
64
|
+
* an error reply give null (the caller must treat that as unsafe, not as zero).
|
|
65
|
+
* Pass the UNTRUNCATED reply text.
|
|
77
66
|
*/
|
|
78
|
-
export function memoryTopLevelCount(
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
try {
|
|
82
|
-
parsed = JSON.parse(String(batchGetText));
|
|
83
|
-
} catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
if (Array.isArray(parsed)) return parsed.length;
|
|
87
|
-
if (parsed && typeof parsed === "object" && Array.isArray(parsed.nodes)) {
|
|
88
|
-
return parsed.nodes.length;
|
|
89
|
-
}
|
|
90
|
-
return null;
|
|
67
|
+
export function memoryTopLevelCount(replyText, nonce) {
|
|
68
|
+
if (replyText === null || replyText === undefined) return null;
|
|
69
|
+
return parseCountReply(replyText, nonce);
|
|
91
70
|
}
|
|
92
71
|
|
|
93
72
|
/**
|
|
@@ -121,22 +100,107 @@ export function decideSave({ diskCount, memoryCount }) {
|
|
|
121
100
|
return { allow: true, reason: `in-memory document has ${memoryCount} top-level node(s)` };
|
|
122
101
|
}
|
|
123
102
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
103
|
+
// The reason codes, in the order the prose tables list them. Result text first lines are
|
|
104
|
+
// `REFUSED save: [reason=<code>] ...` for REFUSAL_REASON_CODES and
|
|
105
|
+
// `NOT PERSISTED: [reason=<code>] ...` for NOT_PERSISTED_REASON_CODES. (`recreated` is a
|
|
106
|
+
// stderr-only code: a recreated save succeeds.) The prose test imports these lists.
|
|
107
|
+
export const REFUSAL_REASON_CODES = Object.freeze(["stale", "unknown-baseline", "refusal-pending", "empty", "unrecognized"]);
|
|
108
|
+
export const NOT_PERSISTED_REASON_CODES = Object.freeze(["save-failed", "unconfirmed", "save-incomplete"]);
|
|
109
|
+
export const REASON_CODES = Object.freeze([...REFUSAL_REASON_CODES, ...NOT_PERSISTED_REASON_CODES]);
|
|
110
|
+
|
|
111
|
+
const NEVER_BYPASS = "Do not delete or recreate the file to bypass this check.";
|
|
112
|
+
// Shared text contract: SKILL.md and ux-design-lead.md quote these sentences verbatim.
|
|
113
|
+
// The repo's open guard refuses an untracked path; the agent asks before committing anything.
|
|
114
|
+
export const UNTRACKED_HINT = "(in the Soleur repo the open guard needs the path tracked: ask the user, then commit an empty placeholder)";
|
|
115
|
+
export const REPLAY_SAFETY_SENTENCE =
|
|
116
|
+
"Before replaying, check whether the edit is already present (compare the node count open_document reports, or Get the nodes): this session's own interrupted save may already have written it.";
|
|
117
|
+
export const ONLY_COPY_SENTENCE =
|
|
118
|
+
"If a retry is refused, the in-memory document is the only complete copy: read it out (get_editor_state, or Get/Print inside batch_design) or export it BEFORE calling open_document.";
|
|
119
|
+
const RESTORE_TRACKED = "If the file is tracked, restore it from version control first.";
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Refusal text. Its FIRST line is the marker `REFUSED save: [reason=<code>] <file> was
|
|
123
|
+
* not modified.`; `code` is one of REFUSAL_REASON_CODES (anything else throws).
|
|
124
|
+
* `empty` also covers an unreadable in-memory count (`memoryCount` null); `unknown-baseline`
|
|
125
|
+
* takes a `cause` (and `detail`); `restart` (refusal-pending only) says why the engine was
|
|
126
|
+
* respawned while the refusal was armed: "restart" (it was already armed, or edits were
|
|
127
|
+
* unpersisted at the respawn), "external-change" or "file-missing" (the respawn found the
|
|
128
|
+
* file changed or gone); the same parameter also names the cause that armed it outside a
|
|
129
|
+
* respawn: "failed-write" (a save failed and the file changed during the write).
|
|
130
|
+
* `recreated` (unknown-baseline/recreate-path-changed only, default true) says whether the
|
|
131
|
+
* file had been removed: false for a present file whose path is no longer canonical.
|
|
132
|
+
*/
|
|
133
|
+
export function refusalMessage({ file, source, code, diskCount, memoryCount, memoryReason, cause, detail, restart, recreated = true }) {
|
|
134
|
+
if (!REFUSAL_REASON_CODES.includes(code)) {
|
|
135
|
+
throw new TypeError(`refusalMessage: unknown code '${code}'`);
|
|
136
|
+
}
|
|
137
|
+
const lines = [`REFUSED save: [reason=${code}] ${file} was not modified.`];
|
|
138
|
+
const replay = `then replay the refused operations in order. Keep one writer per file (there is no lock). ${NEVER_BYPASS}`;
|
|
139
|
+
const openFails = "If open_document itself fails on the changed file, stop: do not retry or recreate it, and tell the user the file was changed by another tool.";
|
|
140
|
+
if (code === "stale") {
|
|
141
|
+
lines.push(
|
|
142
|
+
"It changed on disk since this session loaded or last saved it (another session, git, or an editor such as Pencil Desktop). Edits made since are not persisted, and re-opening discards them.",
|
|
143
|
+
`Next step: stop editing, call open_document on ${file} ${UNTRACKED_HINT}, ${replay} ${openFails}`
|
|
144
|
+
);
|
|
145
|
+
} else if (code === "refusal-pending") {
|
|
146
|
+
if (restart === "file-missing") {
|
|
147
|
+
lines.push(
|
|
148
|
+
"The session restarted (a crash or a timeout) and the file no longer exists on disk: the earlier edits lived in the engine that died and are gone. Edits made since are not persisted.",
|
|
149
|
+
`Next step: tell the user the file was removed by another tool. ${RESTORE_TRACKED} Then call open_document on ${file} ${UNTRACKED_HINT} (a new empty document, if the file is still gone) or open_document a different .pen path, and recreate the edits from your context. Keep one writer per file. ${NEVER_BYPASS}`
|
|
150
|
+
);
|
|
151
|
+
} else if (restart === "external-change") {
|
|
152
|
+
lines.push(
|
|
153
|
+
"The session restarted (a crash or a timeout) and the engine reloaded NEW content: the file changed on disk since this session last loaded or saved it, so the earlier unsaved edits were lost with the old engine and any edit made since sits on a picture of the file this session never saw. Nothing on disk was overwritten.",
|
|
154
|
+
`Next step: call open_document on ${file} ${UNTRACKED_HINT}, then replay the refused operations in order. ${REPLAY_SAFETY_SENTENCE} Keep one writer per file (there is no lock). ${NEVER_BYPASS} ${openFails}`
|
|
155
|
+
);
|
|
156
|
+
} else if (restart === "failed-write") {
|
|
157
|
+
lines.push(
|
|
158
|
+
"An earlier save failed and the file changed during a failed write (a partial write), and no open_document has succeeded since: the in-memory document is the only complete copy. Edits made since are not persisted, and re-opening discards them.",
|
|
159
|
+
`Next step: read the in-memory document out first. ${ONLY_COPY_SENTENCE} Then call open_document on ${file} ${UNTRACKED_HINT}, ${replay} ${openFails}`
|
|
160
|
+
);
|
|
161
|
+
} else if (restart) {
|
|
162
|
+
lines.push(
|
|
163
|
+
"The session restarted (a crash or a timeout) while earlier edits were not persisted (a refused, failed or unconfirmed save): the earlier edits were discarded when the engine reloaded the file. Edits made since are not persisted.",
|
|
164
|
+
`Next step: call open_document on ${file} ${UNTRACKED_HINT}, ${replay} ${openFails}`
|
|
165
|
+
);
|
|
166
|
+
} else {
|
|
167
|
+
lines.push(
|
|
168
|
+
"An earlier save was refused because the file changed on disk, and no open_document has succeeded since. Edits made since are not persisted, and re-opening discards them.",
|
|
169
|
+
`Next step: call open_document on ${file} ${UNTRACKED_HINT}, ${replay} ${openFails}`
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
} else if (code === "unknown-baseline") {
|
|
173
|
+
// why the session cannot say what is on disk
|
|
174
|
+
const why =
|
|
175
|
+
cause === "unconfirmed-save"
|
|
176
|
+
? "The last save was not confirmed by the engine (its reply was not `Saved <file>`), so what is on disk is unknown: the edit may or may not have been written."
|
|
177
|
+
: cause === "post-save-read-failed"
|
|
178
|
+
? `The last save was confirmed, but the file could not be read back afterwards${detail ? ` (${detail})` : ""}, so the session cannot tell whether what is on disk is what it saved.`
|
|
179
|
+
: cause === "capture-failed"
|
|
180
|
+
? `The file could not be read to compare it with this session's copy${detail ? ` (${detail})` : ""}: it may have been replaced by a link or a special file.`
|
|
181
|
+
: cause === "recreate-path-changed"
|
|
182
|
+
? recreated
|
|
183
|
+
? "The file was removed from disk and the path to it is no longer the one this session opened (a directory on the way to it is now a link or has moved), so recreating it could write somewhere else."
|
|
184
|
+
: "The path to the file is no longer the one this session opened (a directory on the way to it is now a link or has moved), so a save could write somewhere else."
|
|
185
|
+
: "This session has no record of what it loaded from the file, so it cannot tell whether the file changed.";
|
|
186
|
+
lines.push(
|
|
187
|
+
why,
|
|
188
|
+
`Next step: call open_document on ${file} ${UNTRACKED_HINT} (it reloads what is on disk and re-baselines), then replay the refused operations in order. ${cause === "unconfirmed-save" ? `${REPLAY_SAFETY_SENTENCE} ` : ""}Keep one writer per file. ${NEVER_BYPASS} If open_document itself fails, stop and tell the user.`
|
|
189
|
+
);
|
|
190
|
+
} else if (code === "unrecognized") {
|
|
127
191
|
lines.push(
|
|
128
|
-
|
|
129
|
-
|
|
192
|
+
"It exists but is not a recognizable .pen document: unparseable JSON, git conflict markers, or not a Pencil file. The engine would load it as an empty document and the save would destroy content you may still be able to recover.",
|
|
193
|
+
`Next step: open_document a new file path and continue the design there. ${ONLY_COPY_SENTENCE} ${NEVER_BYPASS}`
|
|
130
194
|
);
|
|
131
195
|
} else if (memoryCount === null || memoryCount === undefined) {
|
|
132
196
|
lines.push(
|
|
133
197
|
`It holds ${diskCount} top-level node(s) on disk, but the in-memory document could not be read${memoryReason ? `: ${memoryReason}` : ""}, so the save could not be checked.`,
|
|
134
|
-
|
|
198
|
+
`Next step: retry the call; if it keeps failing, open_document a new file path. ${NEVER_BYPASS}`
|
|
135
199
|
);
|
|
136
200
|
} else {
|
|
137
201
|
lines.push(
|
|
138
202
|
`It holds ${diskCount} top-level node(s) on disk, but the in-memory document has ${memoryCount}; saving would replace the file with an empty document.`,
|
|
139
|
-
|
|
203
|
+
`Likely cause: the file was never loaded into this session. Next step: call open_document on this file (it now loads the existing content), then re-apply the edit; to start over instead, open_document a new file path. ${NEVER_BYPASS}`
|
|
140
204
|
);
|
|
141
205
|
}
|
|
142
206
|
if (source === "auto-save") {
|
|
@@ -148,29 +212,259 @@ export function refusalMessage({ file, source, diskCount, memoryCount, memoryRea
|
|
|
148
212
|
}
|
|
149
213
|
|
|
150
214
|
/**
|
|
151
|
-
*
|
|
215
|
+
* First line of a not-persisted outcome that is NOT a refusal:
|
|
216
|
+
* `NOT PERSISTED: [reason=<code>] <file> ...`, codes save-failed (a definite
|
|
217
|
+
* `Save failed:` reply), unconfirmed (an ambiguous, timed-out or unmatched reply) and
|
|
218
|
+
* save-incomplete (the edit applied but the save step threw or did not finish).
|
|
219
|
+
* `detail` is already redacted and capped by the caller; `changed` (save-failed only) says
|
|
220
|
+
* the file's content differs from the baseline after the failed write.
|
|
221
|
+
*/
|
|
222
|
+
export function notPersistedMessage({ code, file, detail, changed }) {
|
|
223
|
+
const why = detail ? ` (${detail})` : "";
|
|
224
|
+
if (code === "save-failed") {
|
|
225
|
+
if (changed) {
|
|
226
|
+
return [
|
|
227
|
+
`NOT PERSISTED: [reason=save-failed] ${file} was not written cleanly: the engine reported a failed save${why}.`,
|
|
228
|
+
`The edit is applied in memory only, and the file changed during the failed write; the in-memory document is the only complete copy: read it out (get_editor_state, or Get/Print inside batch_design) or export it, then call open_document on ${file}. Further saves are refused until you do.`,
|
|
229
|
+
].join("\n");
|
|
230
|
+
}
|
|
231
|
+
return [
|
|
232
|
+
`NOT PERSISTED: [reason=save-failed] ${file} was not written: the engine reported a failed save${why}.`,
|
|
233
|
+
`The edit is applied in memory only. Fix the cause (permissions, disk space, path) and call save again. Do NOT call open_document: it discards the edit. ${ONLY_COPY_SENTENCE}`,
|
|
234
|
+
].join("\n");
|
|
235
|
+
}
|
|
236
|
+
if (code === "unconfirmed") {
|
|
237
|
+
return [
|
|
238
|
+
`NOT PERSISTED: [reason=unconfirmed] ${file} may or may not have been written: the engine's reply was not \`Saved <file>\`${why}.`,
|
|
239
|
+
`Next step: call open_document on ${file} before saving again (it reloads what is on disk and re-baselines) ${UNTRACKED_HINT}, then replay the edit. ${REPLAY_SAFETY_SENTENCE}`,
|
|
240
|
+
].join("\n");
|
|
241
|
+
}
|
|
242
|
+
if (code === "save-incomplete") {
|
|
243
|
+
return [
|
|
244
|
+
`NOT PERSISTED: [reason=save-incomplete] ${file}: the edit was applied in memory but the save did not complete${why}; it is not persisted.`,
|
|
245
|
+
`The engine was stopped, so the edit in memory is gone with it, and saves are refused until the document is reopened. Next step: call open_document on ${file} ${UNTRACKED_HINT}, then replay the edit. ${REPLAY_SAFETY_SENTENCE}`,
|
|
246
|
+
].join("\n");
|
|
247
|
+
}
|
|
248
|
+
throw new TypeError(`notPersistedMessage: unknown code '${code}'`);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** The note that prefixes the result of a save that recreated a file removed behind a live session. */
|
|
252
|
+
export function recreatedNote(file) {
|
|
253
|
+
return `NOTE: ${file} had been removed from disk (a branch switch, a move or a delete); this save recreated it from the session's copy - tell the user and check that the file belongs at that path`;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Load fidelity: at load nothing has been edited, so fewer top-level nodes in memory than
|
|
258
|
+
* in the file the engine loaded means it dropped content, and the next save would write
|
|
259
|
+
* the smaller set over the customer's file. Returns the error text, or null when the load
|
|
260
|
+
* is faithful (or there was nothing on disk to compare). `diskCount` is
|
|
261
|
+
* diskTopLevelCount() of the bytes read BEFORE the engine started; `memoryCount` is the
|
|
262
|
+
* engine's count (null = unreadable). A count cannot see nested nodes that were dropped.
|
|
263
|
+
*/
|
|
264
|
+
export function loadFidelityFailure({ file, diskCount, memoryCount }) {
|
|
265
|
+
if (diskCount === DISK_UNRECOGNIZED) {
|
|
266
|
+
return `${file} exists but is not a recognizable .pen document (the engine loads such a file as empty); it was not modified`;
|
|
267
|
+
}
|
|
268
|
+
if (typeof diskCount !== "number" || diskCount <= 0) return null;
|
|
269
|
+
if (typeof memoryCount === "number" && memoryCount >= diskCount) return null;
|
|
270
|
+
const loaded = memoryCount === null || memoryCount === undefined ? "unreadable" : memoryCount === 0 ? "empty" : String(memoryCount);
|
|
271
|
+
return `${file} holds ${diskCount} top-level node(s) on disk but loaded ${loaded}; it was not modified`;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* A definite failed save: the reply has a `Save failed:` line, no `Saved` line, and is not
|
|
276
|
+
* the confirmation (callers ask isConfirmed first). Empty, timed-out, wrong-path and
|
|
277
|
+
* otherwise unmatched replies are not definite.
|
|
278
|
+
*/
|
|
279
|
+
export function isDefiniteSaveFailure(raw) {
|
|
280
|
+
if (typeof raw !== "string") return false;
|
|
281
|
+
const lines = stripAnsi(raw).split(/\r?\n/);
|
|
282
|
+
return lines.some((l) => /^Save failed:/.test(l)) && !lines.some((l) => /^Saved\b/.test(l));
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** The `Save failed:` line of a reply (ANSI stripped, trimmed), else "". */
|
|
286
|
+
export function saveFailureLine(raw) {
|
|
287
|
+
const line = stripAnsi(String(raw ?? "")).split(/\r?\n/).find((l) => /^Save failed:/.test(l));
|
|
288
|
+
return line ? line.trim() : "";
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// --- The stale-file guard (#11168) -------------------------------------------
|
|
292
|
+
//
|
|
293
|
+
// The session keeps ONE baseline of the file it is bound to, as a tagged value:
|
|
294
|
+
// { tag: "none" } no target bound
|
|
295
|
+
// { tag: "missing" } the file was absent when captured
|
|
296
|
+
// { tag: "hash", hash } SHA-256 of the canonical document
|
|
297
|
+
// { tag: "unknown", cause, detail? } a capture, a read-back or a save reply failed
|
|
298
|
+
// A present blank file is a `hash` (of the empty bytes), not `missing`.
|
|
299
|
+
|
|
300
|
+
// Recursive sorted-key JSON: object key order carries no meaning in a .pen document, so a
|
|
301
|
+
// formatter that reorders keys must not make every save refuse. Arrays keep their order.
|
|
302
|
+
function canonicalJson(value) {
|
|
303
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
304
|
+
if (value !== null && typeof value === "object") {
|
|
305
|
+
return `{${Object.keys(value)
|
|
306
|
+
.sort()
|
|
307
|
+
.map((k) => `${JSON.stringify(k)}:${canonicalJson(value[k])}`)
|
|
308
|
+
.join(",")}}`;
|
|
309
|
+
}
|
|
310
|
+
return JSON.stringify(value);
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* SHA-256 (hex) of the canonical JSON of the document: BOM stripped, keys sorted
|
|
315
|
+
* recursively, so line endings, indentation, key order and a formatter cannot make every
|
|
316
|
+
* save refuse. Text that does not parse is hashed as the raw bytes (any change to it is a
|
|
317
|
+
* change).
|
|
318
|
+
*/
|
|
319
|
+
export function fingerprintBytes(bytes) {
|
|
320
|
+
const buf = Buffer.isBuffer(bytes) ? bytes : Buffer.from(String(bytes ?? ""), "utf8");
|
|
321
|
+
let text = buf.toString("utf8");
|
|
322
|
+
if (text.charCodeAt(0) === 0xfeff) text = text.slice(1);
|
|
323
|
+
let material = buf;
|
|
324
|
+
try {
|
|
325
|
+
material = Buffer.from(canonicalJson(JSON.parse(text)), "utf8");
|
|
326
|
+
} catch {
|
|
327
|
+
// not a JSON document: the raw bytes are the fingerprint
|
|
328
|
+
}
|
|
329
|
+
return createHash("sha256").update(material).digest("hex");
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** Bytes (Buffer|string) or null (the file does not exist) -> a baseline state. */
|
|
333
|
+
export function fingerprintState(bytes) {
|
|
334
|
+
if (bytes === null || bytes === undefined) return { tag: "missing" };
|
|
335
|
+
return { tag: "hash", hash: fingerprintBytes(bytes) };
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
/** First 8 hex characters of a hash, for log lines (never the full value). */
|
|
339
|
+
export function hash8(hash) {
|
|
340
|
+
return typeof hash === "string" && /^[0-9a-f]{8,}$/.test(hash) ? hash.slice(0, 8) : "-";
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* The stale check: a pure function of the stored baseline, the file as it is now and the
|
|
345
|
+
* refusalPending flag. Only an exact `missing`/`hash` match allows, plus ONE amendment: a
|
|
346
|
+
* `hash` baseline whose file is now missing allows with `recreated: true` (a live engine's
|
|
347
|
+
* in-memory document is then the only copy of the session's saved edits and nothing on
|
|
348
|
+
* disk can be overwritten; the respawn case is refused by the adapter before it gets here).
|
|
349
|
+
*
|
|
350
|
+
* @returns {{ allow: true, recreated?: true } | { allow: false, code: "stale"|"unknown-baseline"|"refusal-pending",
|
|
351
|
+
* arm: boolean, cause?: string, detail?: string, baselineHash?: string, diskHash?: string, reason: string }}
|
|
352
|
+
*/
|
|
353
|
+
export function decideStale({ baseline, current, refusalPending }) {
|
|
354
|
+
const baselineHash = baseline?.tag === "hash" ? baseline.hash : undefined;
|
|
355
|
+
const diskHash = current?.tag === "hash" ? current.hash : undefined;
|
|
356
|
+
const refuse = (code, reason, extra = {}) => ({ allow: false, code, reason, arm: false, baselineHash, diskHash, ...extra });
|
|
357
|
+
if (refusalPending) {
|
|
358
|
+
return refuse("refusal-pending", "an earlier save was refused as stale and no open_document has succeeded since");
|
|
359
|
+
}
|
|
360
|
+
if (!baseline || (baseline.tag !== "missing" && baseline.tag !== "hash" && baseline.tag !== "unknown")) {
|
|
361
|
+
return refuse("unknown-baseline", "no baseline: the session has no record of what it loaded", { cause: "no-baseline" });
|
|
362
|
+
}
|
|
363
|
+
if (baseline.tag === "unknown") {
|
|
364
|
+
return refuse("unknown-baseline", "the session cannot tell what is on disk", { cause: baseline.cause ?? "unknown", detail: baseline.detail });
|
|
365
|
+
}
|
|
366
|
+
if (!current || current.tag === "unknown") {
|
|
367
|
+
return refuse("unknown-baseline", "the file could not be read to compare it", {
|
|
368
|
+
cause: current?.cause ?? "capture-failed",
|
|
369
|
+
detail: current?.detail,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
if (baseline.tag === "missing") {
|
|
373
|
+
return current.tag === "missing"
|
|
374
|
+
? { allow: true }
|
|
375
|
+
: refuse("stale", "the file appeared on disk after this session started on a missing path", { arm: true });
|
|
376
|
+
}
|
|
377
|
+
// baseline.tag === "hash"
|
|
378
|
+
if (current.tag === "missing") return { allow: true, recreated: true };
|
|
379
|
+
if (current.hash === baseline.hash) return { allow: true };
|
|
380
|
+
return refuse("stale", "the file changed on disk since this session loaded or last saved it", { arm: true });
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/** The path of exactly one `Saved <path>` line (ANSI stripped, trimmed), else null. */
|
|
384
|
+
export function savedReplyPath(raw) {
|
|
385
|
+
if (typeof raw !== "string") return null;
|
|
386
|
+
const text = stripAnsi(raw).trim();
|
|
387
|
+
const m = /^Saved ([^\n]+)$/.exec(text);
|
|
388
|
+
return m ? m[1].trim() : null;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const sleepMs = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
392
|
+
|
|
393
|
+
function requireDeps(deps, names) {
|
|
394
|
+
for (const name of names) {
|
|
395
|
+
if (typeof deps[name] !== "function") {
|
|
396
|
+
throw new TypeError(`runGuardedSave: dependency '${name}' is required (an unguarded save path is not allowed)`);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* The only save path. Dependencies are injected so the ordering (checks before
|
|
152
403
|
* save, no save sent on refusal) is unit-testable without the MCP SDK.
|
|
153
|
-
* `readDisk` and `probeMemory` may throw: a throw is an UNKNOWN state, never a
|
|
154
|
-
* clean one, and its message is carried into the refusal.
|
|
155
404
|
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
405
|
+
* readDisk() bytes (Buffer|string) or null when the file does not exist; may throw
|
|
406
|
+
* probeMemory() { text, nonce }: the count-snippet reply and the nonce it carried; may throw
|
|
407
|
+
* readFresh() like readDisk, called AFTER the probe, immediately before the save
|
|
408
|
+
* getBaseline() the stored baseline state
|
|
409
|
+
* isRefusalPending() the refusalPending flag
|
|
410
|
+
* send() emits the engine's save and returns its reply (the adapter's one emission site)
|
|
411
|
+
* isConfirmed(raw) true only for `Saved <this file>`
|
|
412
|
+
* isDefiniteFailure(raw) optional (default false): true for a definite `Save failed:` reply
|
|
413
|
+
* readAfterSave() bytes after a confirmed save; retried 3 times
|
|
414
|
+
* adoptBaseline(s) stores a new baseline state (called once per save, after `send`, except
|
|
415
|
+
* on a definite failure, which keeps the previous baseline)
|
|
416
|
+
* canRecreate() optional: called when the decision is `recreated` and on every save whose
|
|
417
|
+
* baseline is a hash; false (or a throw) when the path to the file is no
|
|
418
|
+
* longer its canonical one (a directory swapped for a link), which refuses
|
|
419
|
+
* as unknown-baseline/recreate-path-changed
|
|
420
|
+
* wasRestarted() optional: why the engine was respawned while a refusal was armed
|
|
421
|
+
* (false | "restart" | "external-change" | "file-missing" | "failed-write"; wording only)
|
|
422
|
+
*
|
|
423
|
+
* Order: readDisk, probeMemory (only when the file holds nodes), decideSave
|
|
424
|
+
* (empty / unrecognized), readFresh, decideStale, send, readAfterSave, adoptBaseline.
|
|
425
|
+
* Results: `refused` (never sent), `failed` (definite `Save failed:`, baseline kept; the file
|
|
426
|
+
* is read once more and `changedDuringFailedWrite`/`arm` say it no longer matches the baseline),
|
|
427
|
+
* `unconfirmed` (baseline now unknown), `saved`. `recreated: true` marks a decision that
|
|
428
|
+
* allowed a save over a file removed behind a live session.
|
|
158
429
|
*/
|
|
159
|
-
export async function runGuardedSave(
|
|
430
|
+
export async function runGuardedSave(deps) {
|
|
431
|
+
requireDeps(deps, [
|
|
432
|
+
"readDisk",
|
|
433
|
+
"probeMemory",
|
|
434
|
+
"readFresh",
|
|
435
|
+
"getBaseline",
|
|
436
|
+
"isRefusalPending",
|
|
437
|
+
"send",
|
|
438
|
+
"isConfirmed",
|
|
439
|
+
"readAfterSave",
|
|
440
|
+
"adoptBaseline",
|
|
441
|
+
]);
|
|
442
|
+
const { file, source, readDisk, probeMemory, readFresh, getBaseline, isRefusalPending, send, isConfirmed, readAfterSave, adoptBaseline } = deps;
|
|
443
|
+
const retryDelayMs = deps.retryDelayMs ?? 100;
|
|
444
|
+
|
|
160
445
|
let diskCount;
|
|
161
|
-
let diskReason;
|
|
162
446
|
try {
|
|
163
447
|
diskCount = diskTopLevelCount(await readDisk());
|
|
164
448
|
} catch (err) {
|
|
165
|
-
|
|
166
|
-
|
|
449
|
+
const reason = String(err?.message ?? err);
|
|
450
|
+
return {
|
|
451
|
+
saved: false,
|
|
452
|
+
refused: true,
|
|
453
|
+
code: "unknown-baseline",
|
|
454
|
+
cause: "capture-failed",
|
|
455
|
+
detail: err?.code,
|
|
456
|
+
reason: `the file could not be read: ${reason}`,
|
|
457
|
+
message: refusalMessage({ file, source, code: "unknown-baseline", cause: "capture-failed", detail: reason }),
|
|
458
|
+
};
|
|
167
459
|
}
|
|
460
|
+
|
|
168
461
|
let memoryCount = null;
|
|
169
462
|
let memoryReason;
|
|
170
463
|
if (typeof diskCount === "number" && diskCount > 0) {
|
|
171
464
|
try {
|
|
172
|
-
|
|
173
|
-
|
|
465
|
+
const { text, nonce } = await probeMemory();
|
|
466
|
+
memoryCount = memoryTopLevelCount(text, nonce);
|
|
467
|
+
if (memoryCount === null) memoryReason = "the count probe reply carried no single count line with this call's nonce";
|
|
174
468
|
} catch (err) {
|
|
175
469
|
memoryReason = String(err?.message ?? err);
|
|
176
470
|
}
|
|
@@ -180,10 +474,125 @@ export async function runGuardedSave({ file, source, readDisk, probeMemory, send
|
|
|
180
474
|
return {
|
|
181
475
|
saved: false,
|
|
182
476
|
refused: true,
|
|
477
|
+
code: diskCount === DISK_UNRECOGNIZED ? "unrecognized" : "empty",
|
|
183
478
|
reason: decision.reason,
|
|
184
|
-
message: refusalMessage({
|
|
479
|
+
message: refusalMessage({
|
|
480
|
+
file,
|
|
481
|
+
source,
|
|
482
|
+
code: diskCount === DISK_UNRECOGNIZED ? "unrecognized" : "empty",
|
|
483
|
+
diskCount,
|
|
484
|
+
memoryCount,
|
|
485
|
+
memoryReason,
|
|
486
|
+
}),
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
// The stale decision uses a read taken NOW (after the probe), not the first one.
|
|
491
|
+
let current;
|
|
492
|
+
try {
|
|
493
|
+
current = fingerprintState(await readFresh());
|
|
494
|
+
} catch (err) {
|
|
495
|
+
current = { tag: "unknown", cause: "capture-failed", detail: String(err?.code ?? err?.message ?? err) };
|
|
496
|
+
}
|
|
497
|
+
const stale = decideStale({ baseline: getBaseline(), current, refusalPending: isRefusalPending() });
|
|
498
|
+
if (!stale.allow) {
|
|
499
|
+
return {
|
|
500
|
+
saved: false,
|
|
501
|
+
refused: true,
|
|
502
|
+
code: stale.code,
|
|
503
|
+
reason: stale.reason,
|
|
504
|
+
arm: stale.arm,
|
|
505
|
+
cause: stale.cause,
|
|
506
|
+
detail: stale.detail,
|
|
507
|
+
baselineHash: stale.baselineHash,
|
|
508
|
+
diskHash: stale.diskHash,
|
|
509
|
+
message: refusalMessage({
|
|
510
|
+
file,
|
|
511
|
+
source,
|
|
512
|
+
code: stale.code,
|
|
513
|
+
cause: stale.cause,
|
|
514
|
+
detail: stale.detail,
|
|
515
|
+
restart: typeof deps.wasRestarted === "function" ? deps.wasRestarted() : false,
|
|
516
|
+
}),
|
|
185
517
|
};
|
|
186
518
|
}
|
|
519
|
+
const recreated = stale.recreated === true;
|
|
520
|
+
const baselineHash = getBaseline()?.tag === "hash" ? getBaseline().hash : undefined;
|
|
521
|
+
// The path the engine writes to must still be the canonical one this session opened: a
|
|
522
|
+
// recreate (the file is gone) and every save over a hashed baseline (a directory swapped
|
|
523
|
+
// for a link to a byte-identical copy matches the hash and would be written through).
|
|
524
|
+
if ((recreated || getBaseline()?.tag === "hash") && typeof deps.canRecreate === "function") {
|
|
525
|
+
let canonical = false;
|
|
526
|
+
try {
|
|
527
|
+
canonical = (await deps.canRecreate()) === true;
|
|
528
|
+
} catch {
|
|
529
|
+
// an unanswerable check is a refusal
|
|
530
|
+
}
|
|
531
|
+
if (!canonical) {
|
|
532
|
+
return {
|
|
533
|
+
saved: false,
|
|
534
|
+
refused: true,
|
|
535
|
+
code: "unknown-baseline",
|
|
536
|
+
cause: "recreate-path-changed",
|
|
537
|
+
reason: recreated
|
|
538
|
+
? "the file was removed and the path to it is no longer the canonical one"
|
|
539
|
+
: "the path to the file is no longer the canonical one",
|
|
540
|
+
baselineHash,
|
|
541
|
+
message: refusalMessage({ file, source, code: "unknown-baseline", cause: "recreate-path-changed", recreated }),
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
187
546
|
const raw = await send();
|
|
188
|
-
|
|
547
|
+
if (!isConfirmed(raw)) {
|
|
548
|
+
if (typeof deps.isDefiniteFailure === "function" && deps.isDefiniteFailure(raw)) {
|
|
549
|
+
// A definite failure wrote nothing the session cannot detect: the previous baseline
|
|
550
|
+
// stays, so a retry after the cause is fixed is not blocked (a partial write shows up
|
|
551
|
+
// as a changed hash and refuses as stale, the safe direction). The file is read once:
|
|
552
|
+
// a partial write leaves content the baseline does not match, and then the in-memory
|
|
553
|
+
// document is the only complete copy (the caller arms the refusal).
|
|
554
|
+
let changedDuringFailedWrite = false;
|
|
555
|
+
try {
|
|
556
|
+
const now = fingerprintState(await readFresh());
|
|
557
|
+
const expected = recreated ? { tag: "missing" } : getBaseline();
|
|
558
|
+
changedDuringFailedWrite = now.tag !== expected?.tag || (now.tag === "hash" && now.hash !== expected.hash);
|
|
559
|
+
} catch {
|
|
560
|
+
// an unreadable file after the failure makes no claim
|
|
561
|
+
}
|
|
562
|
+
return { saved: false, refused: false, failed: true, recreated, baselineHash, raw, changedDuringFailedWrite, arm: changedDuringFailedWrite };
|
|
563
|
+
}
|
|
564
|
+
adoptBaseline({ tag: "unknown", cause: "unconfirmed-save" });
|
|
565
|
+
return { saved: false, refused: false, unconfirmed: true, recreated, baselineHash, raw };
|
|
566
|
+
}
|
|
567
|
+
let after = null;
|
|
568
|
+
let lastErr = null;
|
|
569
|
+
for (let attempt = 0; attempt < 3 && after === null; attempt++) {
|
|
570
|
+
if (attempt > 0) await sleepMs(retryDelayMs);
|
|
571
|
+
try {
|
|
572
|
+
after = fingerprintState(await readAfterSave());
|
|
573
|
+
if (after.tag === "missing") {
|
|
574
|
+
lastErr = new Error("the file is missing right after a confirmed save");
|
|
575
|
+
lastErr.code = "ENOENT";
|
|
576
|
+
after = null;
|
|
577
|
+
}
|
|
578
|
+
} catch (err) {
|
|
579
|
+
lastErr = err;
|
|
580
|
+
after = null;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
if (after === null) {
|
|
584
|
+
adoptBaseline({ tag: "unknown", cause: "post-save-read-failed" });
|
|
585
|
+
return {
|
|
586
|
+
saved: true,
|
|
587
|
+
refused: false,
|
|
588
|
+
confirmed: true,
|
|
589
|
+
recreated,
|
|
590
|
+
baselineHash,
|
|
591
|
+
raw,
|
|
592
|
+
detail: String(lastErr?.code ?? lastErr?.message ?? lastErr),
|
|
593
|
+
warning: `The save was confirmed, but the file could not be read back (${String(lastErr?.code ?? lastErr?.message ?? lastErr)}); the next save is refused until open_document is called on it.`,
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
adoptBaseline(after);
|
|
597
|
+
return { saved: true, refused: false, confirmed: true, recreated, baselineHash, raw };
|
|
189
598
|
}
|
package/skills/plan/SKILL.md
CHANGED
|
@@ -500,7 +500,7 @@ A plan that *discusses* UI concepts but *implements* orchestration changes (e.g.
|
|
|
500
500
|
1. Run soleur:product:spec-flow-analyzer via Task with UI-flow-aware prompt: "Analyze the user flows in this plan. Map each screen, identify entry/exit points, dead ends, missing error states, and flows that drop the user. Focus on user journey completeness, not technical implementation."
|
|
501
501
|
2. Run CPO via Task with scoped prompt: "Assess the product implications of this plan: {plan summary}. Cross-reference against brand-guide.md and constitution.md. Identify product strategy concerns, flow gaps, and positioning issues. Output a structured advisory — do not use AskUserQuestion."
|
|
502
502
|
3. **Brainstorm carry-forward check.** Before invoking soleur:product:design:ux-design-lead, check the UX signal source. If the only UX validation is brainstorm carry-forward (brainstorm assessed the *idea*, not the *page design*), reject it: "Brainstorm validated the idea, not the page design. Proceeding to wireframes." Then continue to step 4. This check applies to BLOCKING tier only — ADVISORY and NONE tiers may still carry forward brainstorm UX findings.
|
|
503
|
-
4. Invoke soleur:product:design:ux-design-lead via Task with scoped prompt: "Create wireframes for these user flows: {flow list}. Platform: desktop. Fidelity: wireframe." **On the one-shot/pipeline path (no brainstorm ran), plan Phase 2.5 is the SOLE PRODUCER of wireframes — it must GENERATE the `.pen`, not defer.** If the agent self-stops because Pencil is unavailable, do NOT record a skip: run `bash "${CLAUDE_PLUGIN_ROOT}/skills/pencil-setup/scripts/check_deps.sh" --auto` (
|
|
503
|
+
4. Invoke soleur:product:design:ux-design-lead via Task with scoped prompt: "Create wireframes for these user flows: {flow list}. Platform: desktop. Fidelity: wireframe." **On the one-shot/pipeline path (no brainstorm ran), plan Phase 2.5 is the SOLE PRODUCER of wireframes — it must GENERATE the `.pen`, not defer.** If the agent self-stops because Pencil is unavailable, do NOT record a skip: run `bash "${CLAUDE_PLUGIN_ROOT}/skills/pencil-setup/scripts/check_deps.sh" --auto` (package and key names: `pencil-setup/SKILL.md`) and re-invoke. **Hard-block** (do not proceed, do not write to `Skipped specialists:`) only if auth is genuinely unsatisfiable or Node < 22.19.0, with a single instruction: "Provision the Pencil key per pencil-setup/SKILL.md, or install Node ≥ 22.19.0, then re-run plan." The two permitted outcomes are a committed `.pen` or this hard-block — `soleur:product:design:ux-design-lead` may never appear in `Skipped specialists:` for a UI feature (`wg-ui-feature-requires-pen-wireframe`). **Verifier asserts the invariant, not the proxy:** confirm the `.pen` exists on disk (non-empty) under `knowledge-base/product/design/{domain}/` and is referenced in the spec FRs — not "specialist reported done"; set `Pencil available: yes`.
|
|
504
504
|
4b. **Wireframe review pause.** soleur:product:design:ux-design-lead ends by running `xdg-open <screenshots-directory>`, so the wireframes are already open when it returns here. A Task subagent cannot collect operator input (`2026-05-12-task-subagent-prompt-text-only.md`), so the review pause lives in this orchestrator, right after the step-4 invocation. Mode-branch gate (`2026-03-27-skill-defense-in-depth-gate-pattern.md`): always run, branch on mode.
|
|
505
505
|
- **Interactive arm** (interactive plan session): `AskUserQuestion` — "Wireframes are open for review at `<screenshots-dir>`. Approve and continue, or request changes?" Options: **Approve** → **record the approved design's aesthetic direction to the taste-profile** (the agent surface's write path — `soleur:product:design:ux-design-lead` never writes taste itself; #5990/ADR-090): `bash "${CLAUDE_PLUGIN_ROOT}/scripts/taste-profile-update.sh" knowledge-base/product/design/taste-profile.md <context> aesthetic-direction <approved-direction> "$(date -u +%F)"` (`<context>` = the design's surface enum, `<approved-direction>` = a sanitized lowercase-hyphen token); then continue to step 5 (Content Review Gate). **Request changes** → collect a free-text note, re-invoke `soleur:product:design:ux-design-lead` with `feedback: <note>` plus the existing `.pen` path, let it re-export + re-open, then re-ask. **Loop until Approve** — the Approve branch is the only exit (no dead end).
|
|
506
506
|
- **Headless / pipeline arm:** mirror the auto-accept in the `On ADVISORY:` block below (step 1 — "If in pipeline/subagent context … auto-accept … proceed silently"). When plan runs in any non-interactive context — `HEADLESS_MODE=true`, no TTY, `soleur:one-shot`, `soleur:go --headless`, OR invoked with a plan-file-path argument (the one-shot path chains plan inside a Task subagent, `one-shot/SKILL.md:70`) — **do NOT pause.** Record `wireframes ready for async review at <dir>` and continue to step 5. **Load-bearing:** the subagent / file-path context is inherently non-interactive — the headless arm MUST fire there or the autonomous pipeline hangs on `AskUserQuestion`.
|