diff --git a/README.md b/README.md
index ee168b1..be54fa8 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,7 @@ An agent with this skill writes a document on a space while the person watches:
| `docs/references/page.html` | The starter page: no script, light and dark, A4 print |
| `docs/assets/docs.js` | Every command the agent runs, so a person allows one script |
| `docs/assets/blank-live-link*.html` | Spacesheep's working-on-it page, with and without its description: a space showing it counts as blank |
+| `docs/assets/blank-new-space.html` | The empty sheet a space starts as from New space or Start from blank: a space showing it counts as blank |
| `docs/spacesheep.yaml` | The skill's title, emoji and tags on Spacesheep |
| `tests/` | The repo's tests: `node tests/run.js`, no dependencies |
diff --git a/docs/assets/blank-new-space.html b/docs/assets/blank-new-space.html
new file mode 100644
index 0000000..1f54266
--- /dev/null
+++ b/docs/assets/blank-new-space.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+T
+
+
+
+
diff --git a/docs/assets/docs.js b/docs/assets/docs.js
index ddb59fd..ed81f6e 100644
--- a/docs/assets/docs.js
+++ b/docs/assets/docs.js
@@ -32,6 +32,7 @@ const STARTER = path.join(__dirname, "..", "references", "page.html");
const WRITING = path.join(__dirname, "..", "references", "writing.md");
const OUTLINE = path.join(__dirname, "..", "references", "outline.md");
const BLANK_LIVE_LINK = path.join(__dirname, "blank-live-link.html"), BLANK_LIVE_LINK_NODESC = path.join(__dirname, "blank-live-link-nodesc.html");
+const BLANK_NEW_SPACE = path.join(__dirname, "blank-new-space.html");
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
const PLACEHOLDER = "Writing…";
const WORDS_FAR = 600; // words no A4 page of the starter holds
@@ -278,8 +279,9 @@ const spaceOf = (ctx) => { try { return fs.readFileSync(spaceFile(ctx.dir), "utf
// A page that isn't a document from this skill: no ledger, and anything at all in its body. A short note, an image,
// a table, an embed: each is the person's. Only an empty body is blank.
// Blank is a short closed list of whole pages, compared after dropping whitespace: an empty file, this skill's
-// starter before any outline, and staging's "working on it" page (live_link, saved 14 Nov 2026) in its two forms,
-// with a description line and without, whose title and description are plain-text slots. Everything else is the person's page, however empty it looks: a wrong "not
+// starter before any outline, staging's "working on it" page (live_link, saved 14 Nov 2026) in its two forms,
+// with a description line and without, whose title and description are plain-text slots, and the app's empty
+// sheet a space starts as from New space or Start from blank (saved 15 Nov 2026), whose title is a plain-text slot. Everything else is the person's page, however empty it looks: a wrong "not
// blank" costs one question; a wrong "blank" deletes someone's work.
const flat = (t) => String(t).replace(/\s+/g, "");
// Each slot is text only and stays where it is, in its exact tag; nothing is taken out before the comparison.
@@ -292,11 +294,18 @@ function liveLinkSlots(html) {
html = html.replace(/()[^<]*(<\/p>)/, (m, a, b) => a + "D" + b);
return n === 3 ? html : null;
}
+// The new space's sheet has one slot, its title: the one
, text only. Its body is empty, so a block anyone
+// adds, typed or pasted, makes the page the person's.
+function newSpaceSlots(html) {
+ const titles = html.match(/[^<]*<\/title>/.test(html) ? html.replace(/[^<]*<\/title>/, "T") : null;
+}
let BLANKS = null;
function blank(html) {
- BLANKS = BLANKS || [STARTER, BLANK_LIVE_LINK, BLANK_LIVE_LINK_NODESC].map((f) => flat(fs.readFileSync(f, "utf8")));
+ BLANKS = BLANKS || [STARTER, BLANK_LIVE_LINK, BLANK_LIVE_LINK_NODESC, BLANK_NEW_SPACE].map((f) => flat(fs.readFileSync(f, "utf8")));
const h = flat(html), slotted = liveLinkSlots(String(html)), sf = slotted === null ? null : flat(slotted);
- return h === "" || h === BLANKS[0] || sf === BLANKS[1] || sf === BLANKS[2];
+ const ns = newSpaceSlots(String(html)), nf = ns === null ? null : flat(ns);
+ return h === "" || h === BLANKS[0] || sf === BLANKS[1] || sf === BLANKS[2] || nf === BLANKS[3];
}
const foreign = (html) => !ledgerOf(html) && !blank(html);
const isConflict = (e) => e && (e.code === "conflict" || /conflict/i.test(String(e.message)));
@@ -487,7 +496,7 @@ const COMMANDS = {
}
if (foreign(html)) {
ctx.io.push({ status: "Stopped: this space holds another page", stopped: true });
- throw new Error("start: this space holds a page someone made, and it's never written over. Nothing changed. Ask the person: use a new page (start --new, in a new folder), or tell you what to do with theirs");
+ throw new Error("start: this space holds a page someone made, and it's never written over. Nothing changed. Ask the person whether to write it on a new page (start --new, in a new folder). If they say to write on this page anyway, tell them you can't replace a page that has content yet, and write it on a new page all the same. Never save over their page any other way");
}
ctx.log("\n" + fs.readFileSync(OUTLINE, "utf8"));
return 0;
@@ -502,7 +511,7 @@ const COMMANDS = {
if (!title || !headings.length) throw new Error("outline: give the title, then every heading");
const r = ctx.io.read(), html = r.files["index.html"] || "";
if (ledgerOf(html)) throw new Error("outline: this space has its outline already. Write its sections; for another document, start --new in a new folder");
- if (foreign(html)) throw new Error("outline: this space holds a page someone made, and it's never written over. Nothing changed. Ask the person: use a new page (start --new, in a new folder), or tell you what to do with theirs");
+ if (foreign(html)) throw new Error("outline: this space holds a page someone made, and it's never written over. Nothing changed. Ask the person whether to write it on a new page (start --new, in a new folder). If they say to write on this page anyway, tell them you can't replace a page that has content yet, and write it on a new page all the same. Never save over their page any other way");
const page = buildPage(fs.readFileSync(STARTER, "utf8"), title, headings, pages);
const a = ctx.io.push({ html: page });
ctx.io.save({ parent: r.version, label: "Outline", files: [{ path: "index.html", content: page }] });
diff --git a/tests/fixtures/staging-new-space.html b/tests/fixtures/staging-new-space.html
new file mode 100644
index 0000000..4511739
--- /dev/null
+++ b/tests/fixtures/staging-new-space.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+Untitled
+
+
+
+
\ No newline at end of file
diff --git a/tests/ownership.js b/tests/ownership.js
index 3f6f233..0a09703 100644
--- a/tests/ownership.js
+++ b/tests/ownership.js
@@ -141,8 +141,12 @@ module.exports = function ({ test, ROOT }) {
const s = fakeSpace({ "index.html": `xMine
${words}` });
const before = page(s);
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "docs-test-"));
- assert.notStrictEqual(run(s, ["start", s.id], { dir }).code, 0);
- assert.notStrictEqual(run(s, ["outline", "Title", "One"], { dir }).code, 0);
+ const refusals = [run(s, ["start", s.id], { dir }), run(s, ["outline", "Title", "One"], { dir })];
+ for (const r of refusals) {
+ assert.notStrictEqual(r.code, 0);
+ // The refusal says what to do with the answer, so a yes to "this page" never sends the agent around the skill.
+ assert.match(r.out, /If they say to write on this page anyway, tell them you can't replace a page that has content yet, and write it on a new page all the same\. Never save over their page any other way/);
+ }
assert.strictEqual(page(s), before);
assert.strictEqual(s.pushes.filter((p) => p.html || p.edits).length, 0, "nothing drawn over it");
assert.strictEqual(s.saves.length, 0);
diff --git a/tests/review.js b/tests/review.js
index 10149f5..55e2ab1 100644
--- a/tests/review.js
+++ b/tests/review.js
@@ -411,6 +411,38 @@ module.exports = function ({ test, ROOT }) {
}
});
+ test("a space made with New space or Start from blank is blank, whatever its title; one typed line makes it the person's", () => {
+ const sheet = fs.readFileSync(path.join(__dirname, "fixtures", "staging-new-space.html"), "utf8");
+ const titled = (t) => sheet.replace("Untitled", `${t}`);
+ const tryStart = (page) => { const s = fakeSpace({ "index.html": page }), dir = fs.mkdtempSync(path.join(os.tmpdir(), "docs-review-")); return { s, start: go(s, dir, ["start", s.id]), outline: go(s, dir, ["outline", "Letter", "Opening"]).code }; };
+ // The app's sheet, as staging saved it, with any plain-text title: written on at once, with no question.
+ for (const page of [sheet, titled("Untitled document"), titled("Letter to Ms Patel & co"), titled("租房申请 🏠"), titled(""), sheet.replace(/\n/g, "\n ")]) {
+ const r = tryStart(page);
+ assert.strictEqual(r.start.code, 0, `blank: ${/[^<]*/.exec(page)[0]}`);
+ assert.ok(!/never written over/.test(r.start.out));
+ assert.strictEqual(r.outline, 0);
+ assert.ok(r.s.files["index.html"].includes("Letter"), "the outline is on the page");
+ }
+ // Anything a person added, and any other change to the sheet: the page is theirs, refused, and left as it was.
+ const off = [
+ sheet.replace('', 'One typed line.
'),
+ sheet.replace('', 'Untitled
'),
+ sheet.replace('', '
'),
+ sheet.replace("