@graview/tools 0.1.64 → 0.1.66
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/dist/ai.d.ts +56 -1
- package/dist/ai.d.ts.map +1 -1
- package/dist/ai.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +2 -1
- package/dist/cli.js.map +1 -1
- package/dist/design-agent.d.ts +140 -0
- package/dist/design-agent.d.ts.map +1 -0
- package/dist/design-agent.js +234 -0
- package/dist/design-agent.js.map +1 -0
- package/dist/dev-ai.d.ts +4 -0
- package/dist/dev-ai.d.ts.map +1 -1
- package/dist/dev-ai.js +165 -8
- package/dist/dev-ai.js.map +1 -1
- package/dist/draft-check.d.ts +108 -0
- package/dist/draft-check.d.ts.map +1 -0
- package/dist/draft-check.js +296 -0
- package/dist/draft-check.js.map +1 -0
- package/dist/draft.d.ts +1 -0
- package/dist/draft.d.ts.map +1 -1
- package/dist/draft.js +2 -0
- package/dist/draft.js.map +1 -1
- package/dist/facts.d.ts +24 -0
- package/dist/facts.d.ts.map +1 -0
- package/dist/facts.js +48 -0
- package/dist/facts.js.map +1 -0
- package/dist/frame.d.ts +1 -1
- package/dist/frame.d.ts.map +1 -1
- package/dist/graph-plan.d.ts +178 -0
- package/dist/graph-plan.d.ts.map +1 -0
- package/dist/graph-plan.js +570 -0
- package/dist/graph-plan.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/inline-ai.d.ts +41 -2
- package/dist/inline-ai.d.ts.map +1 -1
- package/dist/inline-ai.js +441 -12
- package/dist/inline-ai.js.map +1 -1
- package/dist/page-better.d.ts +240 -0
- package/dist/page-better.d.ts.map +1 -0
- package/dist/page-better.js +383 -0
- package/dist/page-better.js.map +1 -0
- package/dist/providers/structure.d.ts.map +1 -1
- package/dist/providers/structure.js +2 -2
- package/dist/providers/structure.js.map +1 -1
- package/dist/reshape.d.ts +70 -2
- package/dist/reshape.d.ts.map +1 -1
- package/dist/reshape.js +2 -0
- package/dist/reshape.js.map +1 -1
- package/dist/say-change.d.ts +59 -0
- package/dist/say-change.d.ts.map +1 -0
- package/dist/say-change.js +156 -0
- package/dist/say-change.js.map +1 -0
- package/dist/section.d.ts +146 -0
- package/dist/section.d.ts.map +1 -0
- package/dist/section.js +379 -0
- package/dist/section.js.map +1 -0
- package/dist/sentences.d.ts +13 -0
- package/dist/sentences.d.ts.map +1 -0
- package/dist/sentences.js +30 -0
- package/dist/sentences.js.map +1 -0
- package/dist/suggest.js +2 -2
- package/dist/suggest.js.map +1 -1
- package/dist/tidy/blocking.d.ts.map +1 -1
- package/dist/tidy/blocking.js +11 -9
- package/dist/tidy/blocking.js.map +1 -1
- package/dist/tidy/judges.d.ts +19 -0
- package/dist/tidy/judges.d.ts.map +1 -1
- package/dist/tidy/judges.js +46 -8
- package/dist/tidy/judges.js.map +1 -1
- package/dist/tidy/judging.d.ts.map +1 -1
- package/dist/tidy/judging.js +15 -24
- package/dist/tidy/judging.js.map +1 -1
- package/dist/workflows/run-classify.js +4 -4
- package/dist/workflows/run-classify.js.map +1 -1
- package/dist/workflows/run.d.ts.map +1 -1
- package/dist/workflows/run.js +2 -1
- package/dist/workflows/run.js.map +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { thinkingOf } from "./inline-ai.js";
|
|
2
|
+
import { cssFindings, couldNotKeep } from "./draft-check.js";
|
|
3
|
+
/** The Fast slot the host gave, or its `decide`, where AI is not off. */
|
|
4
|
+
const fastOf = (ai) => (ai === undefined || ai.off ? undefined : (ai.fast ?? (ai.decide ? { model: ai.name ?? "decide", decide: ai.decide } : undefined)));
|
|
5
|
+
/** Words that are about how something looks or is laid out, read without a model where there is no Fast slot. */
|
|
6
|
+
const LOOK = /\b(look|looks|looking|nicer|prettier|cleaner|ugly|layout|laid out|lay it out|design|style|styled|theme|colou?rs?|font|bigger|smaller|larger|wider|narrower|taller|shorter|spacing|space|padding|margin|compact|dense|denser|roomier|columns?|grid|cards?|rows?|show (?:the )?\S+ (?:on|in) (?:each|every|the)|sort(?:ed)? by|order(?:ed)? by|group(?:ed)? by|readable|easier to read|at a glance|icons?|badges?|headings?|bold|highlight)\b/i;
|
|
7
|
+
/** Whether words typed in the menu are about how the part looks or about its records, and who said so. */
|
|
8
|
+
export async function aboutTheLook(ai, words, name) {
|
|
9
|
+
const said = words.trim();
|
|
10
|
+
const fast = fastOf(ai);
|
|
11
|
+
if (fast && said) {
|
|
12
|
+
try {
|
|
13
|
+
const decided = await fast.decide({ typed: said, on: name }, {
|
|
14
|
+
about: {
|
|
15
|
+
type: "choice",
|
|
16
|
+
instructions: `Somebody right-clicked “${name}” in an app and typed “${said}”. Is it about how “${name}” looks or is laid out, or about the records in it?`,
|
|
17
|
+
criteria: {
|
|
18
|
+
look: "How it looks or is laid out: making it look better, its style, size or spacing, what each row, card or page shows, its order or grouping",
|
|
19
|
+
records: "The records themselves: changing, closing, assigning, adding, deleting or moving them, or a question about them",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
ai?.meter?.({ tier: "fast", model: fast.model, inputTokens: decided.usage.inputTokens, outputTokens: decided.usage.outputTokens, interaction: "menu" });
|
|
24
|
+
const answer = decided.answers["about"];
|
|
25
|
+
if (answer?.type === "choice" && (answer.choice === "look" || answer.choice === "records"))
|
|
26
|
+
return { about: answer.choice, by: "fast", confidence: answer.confidence };
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// A Fast slot that fails leaves the words to decide.
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return { about: LOOK.test(said) ? "look" : "records", by: "words" };
|
|
33
|
+
}
|
|
34
|
+
/** Words that need drawing the view spec has no word for, read without a model where there is no Fast slot. */
|
|
35
|
+
const DRAWING = /\b(colou?rs?|font|typeface|bigger|smaller|larger|wider|narrower|taller|spacing|padding|margin|border|shadow|rounded|corners?|columns? side by side|side by side|grid|chart|graph|picture of|animation|background|gradient|icons?|css|kanban|calendar)\b/i;
|
|
36
|
+
/**
|
|
37
|
+
* SPEC FIRST, UNLESS THE FAST SLOT IS SURE: a page goes to a view of its
|
|
38
|
+
* own only where it says so with at least this confidence. A vague ask
|
|
39
|
+
* ("make this page look better") is tried over the spec, whose model may
|
|
40
|
+
* still answer that the spec cannot say it.
|
|
41
|
+
*/
|
|
42
|
+
export const OWN_VIEW_WHEN_SURE = 0.6;
|
|
43
|
+
/** Whether the view spec can say what was asked of the page, or it needs a view of its own. */
|
|
44
|
+
export async function specCanSay(ai, words, part) {
|
|
45
|
+
const said = words.trim();
|
|
46
|
+
if (!said)
|
|
47
|
+
return { can: true, by: "words" };
|
|
48
|
+
const fast = fastOf(ai);
|
|
49
|
+
if (fast) {
|
|
50
|
+
try {
|
|
51
|
+
const decided = await fast.decide({ asked: said, on: part.name, page: part.slot }, {
|
|
52
|
+
can: {
|
|
53
|
+
type: "choice",
|
|
54
|
+
instructions: `Somebody asked of the page “${part.name}”: “${said}”. Can the app's view settings do it, or does it need drawing of its own?`,
|
|
55
|
+
criteria: {
|
|
56
|
+
spec: "The view settings can do it: which fields a card, a row or a page shows and in what order, a headline, a badge with a tone, a figure, a progress bar, a list of related records, how a list is sorted, grouped or filtered, a field's label or format",
|
|
57
|
+
drawing: "It needs drawing the settings have no word for: colors, fonts, sizes, spacing, borders or shadows, a layout or columns side by side, a chart, a calendar, a board, or markup and styles of its own",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
ai?.meter?.({ tier: "fast", model: fast.model, inputTokens: decided.usage.inputTokens, outputTokens: decided.usage.outputTokens, interaction: "section" });
|
|
62
|
+
const answer = decided.answers["can"];
|
|
63
|
+
if (answer?.type === "choice" && (answer.choice === "spec" || answer.choice === "drawing"))
|
|
64
|
+
return { can: answer.choice === "spec" || answer.confidence < OWN_VIEW_WHEN_SURE, by: "fast", confidence: answer.confidence };
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// Read from the words.
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return { can: !DRAWING.test(said), by: "words" };
|
|
71
|
+
}
|
|
72
|
+
/** The edit ops a page's look may be changed by: the view spec, and nothing else of the app. */
|
|
73
|
+
export const PAGE_SPEC_OPS = ["set-view", "set-glance", "set-page-fields", "arrange-pages", "set-label", "set-format"];
|
|
74
|
+
const ARRANGING = new Set(["sort", "group", "filters"]);
|
|
75
|
+
/** What in these edits is not the view spec's, in sentences: empty when every one is. */
|
|
76
|
+
export function notTheSpec(edits) {
|
|
77
|
+
const said = [];
|
|
78
|
+
if (edits.length === 0)
|
|
79
|
+
said.push("It changed nothing.");
|
|
80
|
+
for (const edit of edits) {
|
|
81
|
+
const op = edit?.op;
|
|
82
|
+
if (typeof op !== "string" || !PAGE_SPEC_OPS.includes(op)) {
|
|
83
|
+
said.push(`“${String(op)}” is not a change to how a page reads.`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
if (op === "arrange-pages")
|
|
87
|
+
for (const key of Object.keys(edit))
|
|
88
|
+
if (key !== "op" && !ARRANGING.has(key))
|
|
89
|
+
said.push(`arrange-pages may say only sort, group and filters here, not “${key}”.`);
|
|
90
|
+
if (op === "set-label" && edit.field === undefined)
|
|
91
|
+
said.push("set-label may name only a field's label here, not a kind's.");
|
|
92
|
+
}
|
|
93
|
+
return said;
|
|
94
|
+
}
|
|
95
|
+
export const PAGE_SPEC_SYSTEM = [
|
|
96
|
+
"You change how one page of a Graview app reads, by editing its view spec: data that says what a kind's card, row and page show, and how a list opens. Nothing in it is code: no CSS, no markup, no colors or sizes of your own.",
|
|
97
|
+
"You are told the page (a kind's list, one group of it, a record's page, or the home), what was asked, the kind's fields and relations, and its spec as it stands.",
|
|
98
|
+
'Answer with one JSON object and nothing else: {"edits": [...], "said": "<one sentence to the person saying what will change>"}. Or, where the spec has no word for it (colors, fonts, sizes, spacing, layout, a chart), answer {"cannot": "<one sentence saying what it would need>"}.',
|
|
99
|
+
"The edits you may use, and no others:",
|
|
100
|
+
'{"op":"set-view","kind":K,"slot":"card"|"row"|"page","blocks":[...]} — a kind\'s card, its row on a list, the blocks over its record page; {"op":"set-view","slot":"home","blocks":[...]} — the home. Blocks: {"title":"{name}"}, {"headline":"{count(out(\'rel\'))} things"}, {"text":"{field}","lines":2}, {"badge":"{field}","tone":"good"|"warn"|"bad"|"neutral"|"accent"}, {"field":"due","as":"date"|"time"|"datetime"|"relative"|"money"|"percent"|"count","label":"Due"}, {"figure":"expr","as":"number"|"money"|"percent","label":"..."}, {"progress":{"value":"done","max":"total"},"label":"..."}, {"list":"out(\'rel\')" or "all(\'kind\')","as":"row"|"card","sort":{"by":"f","direction":"asc"|"desc"},"limit":5,"group":{"by":"f"},"empty":"None yet."}, {"group":[...blocks],"direction":"row"|"column"}, {"when":"rule expression","show":[...blocks]}, {"divider":true}. Templates say {field}; a row always leads with {"title":"{name}"} or the record\'s label field.',
|
|
101
|
+
'{"op":"set-glance","kind":K,"fields":[...]} — the few facts said beside a record\'s name on a list.',
|
|
102
|
+
'{"op":"set-page-fields","kind":K,"fields":[...],"groups":[{"title":"...","fields":[...]}]} — the order and groups of a record page\'s facts.',
|
|
103
|
+
'{"op":"arrange-pages","sort":{K:{"by":"f","direction":"asc"|"desc"}},"group":{K:{"by":"f"}},"filters":{K:["f"]}} — how a kind\'s list opens. A list sorts by one of its kind\'s fields or computed values, and groups only by a choice or a yes-or-no field of its own: grouping by a relation or by the record that holds it is not the spec\'s to say.',
|
|
104
|
+
'{"op":"set-label","kind":K,"field":F,"label":"..."}, {"op":"set-format","kind":K,"field":F,"format":"money"|"percent"|"duration"|null}.',
|
|
105
|
+
"Name only fields and relations the kind has. Change only what the ask needs, on this page's kind. Keep every fact the page shows now unless asked to drop one.",
|
|
106
|
+
"Do what was asked or answer cannot: never something else in its place (grouping by another field than the one asked for, say).",
|
|
107
|
+
].join("\n");
|
|
108
|
+
/** What the model is told of the page and its spec. */
|
|
109
|
+
export function pageSpecPrompt(ask) {
|
|
110
|
+
const kind = ask.part.kind;
|
|
111
|
+
const doc = ask.document;
|
|
112
|
+
const spec = kind ? doc.kinds[kind] : undefined;
|
|
113
|
+
const asked = ask.mode === "just" ? "Make this page better: easier to read at a glance, the facts a person needs first. Change no data." : (ask.words ?? "").trim();
|
|
114
|
+
return JSON.stringify({
|
|
115
|
+
page: { name: ask.part.name, is: ask.part.slot === "list" ? "a kind's list" : ask.part.slot === "group" ? `one group of a kind's list (“${ask.part.group}”)` : ask.part.slot === "record" ? "a record's page (every record of the kind)" : ask.part.slot === "home" ? "the home" : "a place", ...(kind ? { kind } : {}) },
|
|
116
|
+
asked,
|
|
117
|
+
...(ask.highlighted?.length ? { pointed_at: ask.highlighted } : {}),
|
|
118
|
+
...(spec ? { fields: spec["fields"], relations: spec["edges"] ?? spec["relations"], computed: spec["computed"], glance: spec["glance"], pageFields: spec["pageFields"] } : { kinds: Object.keys(doc.kinds) }),
|
|
119
|
+
now: { ...(kind ? { views: doc.views?.[kind] ?? null, list: doc.pages?.lists?.[kind] ?? null } : { home: doc.views?.["home"] ?? null }) },
|
|
120
|
+
...(ask.shows ? { shows: ask.shows.slice(0, 1500) } : {}),
|
|
121
|
+
...(ask.findings?.length ? { your_last_answer: ask.last, what_broke: ask.findings, repair: "Your last answer was refused as said in what_broke. Answer again, fixing each one — or, where the spec cannot do what was asked, answer cannot." } : {}),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/** The first JSON object in a model's answer. */
|
|
125
|
+
function jsonOf(text) {
|
|
126
|
+
const fenced = /```(?:json|js|javascript)?\s*([\s\S]*?)```/.exec(text)?.[1];
|
|
127
|
+
for (const body of fenced ? [fenced, text] : [text]) {
|
|
128
|
+
const start = body.indexOf("{");
|
|
129
|
+
const end = body.lastIndexOf("}");
|
|
130
|
+
if (start < 0 || end <= start)
|
|
131
|
+
continue;
|
|
132
|
+
try {
|
|
133
|
+
const parsed = JSON.parse(body.slice(start, end + 1));
|
|
134
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
|
|
135
|
+
return parsed;
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
// The next.
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
/** The model's answer read: the edits and the sentence, or what it says the spec cannot do; undefined when it is neither. */
|
|
144
|
+
export function readPageSpecReply(text) {
|
|
145
|
+
const parsed = jsonOf(text);
|
|
146
|
+
if (!parsed)
|
|
147
|
+
return undefined;
|
|
148
|
+
if (typeof parsed["cannot"] === "string" && parsed["cannot"].trim())
|
|
149
|
+
return { cannot: parsed["cannot"].trim() };
|
|
150
|
+
if (!Array.isArray(parsed["edits"]))
|
|
151
|
+
return undefined;
|
|
152
|
+
return { edits: parsed["edits"], said: typeof parsed["said"] === "string" && parsed["said"].trim() ? parsed["said"].trim() : "Changed how this page reads." };
|
|
153
|
+
}
|
|
154
|
+
/** Asks a slot, timed, what it spent kept as a stage. */
|
|
155
|
+
function asker(stages) {
|
|
156
|
+
return async (provider, stage, system, prompt) => {
|
|
157
|
+
const began = Date.now();
|
|
158
|
+
try {
|
|
159
|
+
const reply = await provider.think({ system, prompt, state: {}, catalog: { candidates: [] } });
|
|
160
|
+
stages.push({ stage, model: provider.model, ms: Date.now() - began, ...(reply.usage ? { usage: reply.usage } : {}) });
|
|
161
|
+
return reply.text;
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
stages.push({ stage, model: provider.model, ms: Date.now() - began });
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* THE LEAST EDITS OVER THE VIEW SPEC: the light model first — the full one
|
|
171
|
+
* where its answer cannot be read — held to the spec's ops and judged by
|
|
172
|
+
* the host (its checker); what is refused is handed back once to the full
|
|
173
|
+
* model, and refused in words if it fails again. A model that says the
|
|
174
|
+
* spec cannot do it is answered `cannot`, for the page to offer its own view.
|
|
175
|
+
*/
|
|
176
|
+
export async function draftPageSpec(options) {
|
|
177
|
+
const stages = [];
|
|
178
|
+
const light = options.ai.off ? undefined : options.ai.light;
|
|
179
|
+
const full = thinkingOf(options.ai);
|
|
180
|
+
const first = light ?? full;
|
|
181
|
+
if (!first)
|
|
182
|
+
return { ok: false, refused: options.ai.withoutModel ?? "Changing a page needs AI, and none is on here.", stages };
|
|
183
|
+
const ask = asker(stages);
|
|
184
|
+
const base = { part: options.part, document: options.document, mode: options.mode, ...(options.words ? { words: options.words } : {}), ...(options.highlighted ? { highlighted: options.highlighted } : {}), ...(options.shows ? { shows: options.shows } : {}) };
|
|
185
|
+
const read = async (provider, stage, prompt) => {
|
|
186
|
+
const text = await ask(provider, stage, PAGE_SPEC_SYSTEM, prompt);
|
|
187
|
+
return text === undefined ? undefined : readPageSpecReply(text);
|
|
188
|
+
};
|
|
189
|
+
let answer = await read(first, light ? "light" : "thinking", pageSpecPrompt(base));
|
|
190
|
+
// Unreadable, the light model is asked once more: the full one is never in a loop a person waits on.
|
|
191
|
+
if (!answer && light)
|
|
192
|
+
answer = await read(light, "light", pageSpecPrompt(base));
|
|
193
|
+
if (!answer)
|
|
194
|
+
return { ok: false, refused: "The model did not answer with a change to this page.", stages };
|
|
195
|
+
if ("cannot" in answer)
|
|
196
|
+
return { ok: false, cannot: answer.cannot, refused: answer.cannot, stages };
|
|
197
|
+
const judged = async (edits) => {
|
|
198
|
+
const own = notTheSpec(edits);
|
|
199
|
+
return own.length > 0 ? own : [...(await options.judge(edits))];
|
|
200
|
+
};
|
|
201
|
+
let findings = await judged(answer.edits);
|
|
202
|
+
if (findings.length === 0)
|
|
203
|
+
return { ok: true, edits: answer.edits, said: answer.said, repaired: false, stages };
|
|
204
|
+
const repairer = first;
|
|
205
|
+
options.repairing?.(findings);
|
|
206
|
+
const again = await read(repairer, repairer === light ? "light" : "thinking", pageSpecPrompt({ ...base, findings, last: answer }));
|
|
207
|
+
if (again && "cannot" in again)
|
|
208
|
+
return { ok: false, cannot: again.cannot, refused: again.cannot, stages };
|
|
209
|
+
if (!again)
|
|
210
|
+
return { ok: false, refused: `It could not be changed so: ${findings.join(" ")}`, stages };
|
|
211
|
+
findings = await judged(again.edits);
|
|
212
|
+
if (findings.length > 0)
|
|
213
|
+
return { ok: false, refused: `It could not be changed so: ${findings.join(" ")}`, stages };
|
|
214
|
+
return { ok: true, edits: again.edits, said: again.said, repaired: true, stages };
|
|
215
|
+
}
|
|
216
|
+
const slug = (words) => words.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "page";
|
|
217
|
+
/**
|
|
218
|
+
* THE VIEW A PAGE BECOMES: a kind's list (a group's too) is a view of many
|
|
219
|
+
* that is the list page, a record's page a view of one that is the whole
|
|
220
|
+
* page, the home the home's body — each reading the kinds and the
|
|
221
|
+
* relations the kind is linked by — untitled, so it is that page and not a
|
|
222
|
+
* place of its own beside it. Undefined for a place, which a lens draws.
|
|
223
|
+
*/
|
|
224
|
+
export function forkManifest(part, links, acts = []) {
|
|
225
|
+
const reads = { ...(links.kinds.length ? { kinds: [...links.kinds] } : {}), ...(links.edges.length ? { edges: [...links.edges] } : {}) };
|
|
226
|
+
const read = { ...(Object.keys(reads).length > 0 ? { reads } : {}), ...(acts.length > 0 ? { acts: [...acts] } : {}) };
|
|
227
|
+
if ((part.slot === "list" || part.slot === "group") && part.kind)
|
|
228
|
+
return { name: `${slug(part.kind)}-list`, attach: part.kind, cardinality: "many", replaces: "page", ...read };
|
|
229
|
+
if (part.slot === "record" && part.kind)
|
|
230
|
+
return { name: `${slug(part.kind)}-page`, attach: part.kind, cardinality: "one", replaces: "page", ...read };
|
|
231
|
+
if (part.slot === "home")
|
|
232
|
+
return { name: "home-page", attach: "home", cardinality: "many", ...read };
|
|
233
|
+
return undefined;
|
|
234
|
+
}
|
|
235
|
+
export const PAGE_VIEW_SYSTEM = [
|
|
236
|
+
"You write a Graview worker view: one plain script, no imports and no build, that draws one page of an app through the global `graview`, in place of the page the app drew by itself.",
|
|
237
|
+
"The global: graview.style(css) a stylesheet; graview.onProps((props) => …) on every push of what it is shown; graview.render(graview.html`…`) draws markup, every ${value} escaped; graview.html`` nests: a list is ${items.map((one) => graview.html`<li>…</li>`)}. Never build HTML as a string or with join(): a string is drawn as its words.",
|
|
238
|
+
"props.nodes holds the records a view of many is drawn for and those it reads; props.node the record a view of one is drawn for. A record is plain data: id, kind, label, and each field by name. props.edges are {kind, from, to}. props.choices[kind][field][option] is a choice's label.",
|
|
239
|
+
'Link to a record with <a data-record="${node.id}">…</a>. Give repeated rows data-key="${node.id}". Name each part a person would name with a heading inside a <section aria-labelledby="x-h"> whose heading has id="x-h"; never aria-label.',
|
|
240
|
+
"The page draws its own title above your view: never draw the page's title again. Draw each other heading the page had, with the same words, and every record the page showed: each record still says what its row said (its status, its dates, its counts, in words) and stays under the heading it was under, unless what was asked changes that.",
|
|
241
|
+
"Say things in words a person reads: a date as the page said it (“Sep 3”), never as stored (2026-09-03). A date kept as YYYY-MM-DD is a day, not an instant: read it as new Date(`${value}T00:00`) — new Date(value) alone is midnight in London and the day before here — then .toLocaleDateString(props.locale, { month: \"short\", day: \"numeric\" }); never show a field's own name (order, done, holds), an id, true, false, null or undefined. Leave out a value the page did not show unless asked for it.",
|
|
242
|
+
"CSS the host keeps: plain rules on your own classes and elements, one level, and @media. Give your outer element a class (class=\"pg\") and style that: never :host, ::slotted or ::part, no url(), @import, @font-face, @keyframes or nesting. Colors, type and corners only through var(--graview-ink), var(--graview-ink-muted), var(--graview-panel), var(--graview-edge), var(--graview-accent), var(--graview-ground), var(--graview-radius). position may be static, relative, absolute or sticky. Set no height; lay it out well at a phone's width and at a desk's.",
|
|
243
|
+
"Never write the words import, export or require, nor <script>, <style>, or on…= attributes.",
|
|
244
|
+
'Answer with one JSON object and nothing else: {"source": "<the whole script>", "said": "<a few words on what you changed>"}.',
|
|
245
|
+
].join("\n");
|
|
246
|
+
/** What the model is told of the page it rewrites as a view — or, with `current`, of the draft so far that it changes again. */
|
|
247
|
+
export function pageViewPrompt(ask) {
|
|
248
|
+
const asked = ask.mode === "just" ? "Make this page better: easier to read at a glance, laid out cleanly, in the app's own look. Change no data it shows." : (ask.words ?? "").trim();
|
|
249
|
+
return JSON.stringify({
|
|
250
|
+
page: ask.part.name,
|
|
251
|
+
view: { attach: ask.manifest.attach, cardinality: ask.manifest.cardinality, reads: ask.manifest.reads ?? {} },
|
|
252
|
+
asked,
|
|
253
|
+
...(ask.highlighted?.length ? { pointed_at: ask.highlighted } : {}),
|
|
254
|
+
as_it_stands: ask.outline.slice(0, 4000),
|
|
255
|
+
...(ask.keep ? { the_page_draws_its_title: ask.keep.title, keep_these_headings: ask.keep.headings, show_each_of_these_records: ask.keep.records } : {}),
|
|
256
|
+
...(ask.keep?.says ? { checklist: checklistOf(ask.keep), checklist_rule: CHECKLIST_RULE } : {}),
|
|
257
|
+
...(ask.keep?.grouping ? { grouping: groupingRule(ask.keep.grouping) } : {}),
|
|
258
|
+
...(ask.markup ? { the_page_as_html: ask.markup.slice(0, 6000), start_from_it: "Start from this markup: keep every word it shows and the order of its parts; change how it looks as asked. Draw it from props, not as fixed words." } : {}),
|
|
259
|
+
...(ask.current ? { your_view_so_far: ask.current.slice(0, 8000), change: "Change your view so far as asked; keep everything else of it." } : {}),
|
|
260
|
+
data: ask.data,
|
|
261
|
+
...(ask.findings?.length ? { your_last_answer: ask.last, what_broke: ask.findings, repair: "Your last answer broke as said in what_broke. Answer again, fixing each one." } : {}),
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
/** What the code checks a view for, said to the model as a rule beside the checklist. */
|
|
265
|
+
const CHECKLIST_RULE = "Cover every line of checklist: show each record with each of its must_show words (a date may be said as the page said it, a status in its own words), under its heading where it has one. The code checks every line and refuses a view that misses one.";
|
|
266
|
+
/** THE CHECKLIST a new design must cover, a line per record: what it must show beside its name, and the heading it sits under. */
|
|
267
|
+
export function checklistOf(keep) {
|
|
268
|
+
return keep.records.map((record) => {
|
|
269
|
+
const said = keep.says?.[record];
|
|
270
|
+
return { record, ...(said?.id ? { id: said.id } : {}), ...(said?.shows?.length ? { must_show: said.shows } : {}), ...(said?.under ? { under: said.under } : {}) };
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/** How the page grouped its records, as a rule the model can write: which link names the heading. */
|
|
274
|
+
export function groupingRule(grouping) {
|
|
275
|
+
const [mine, theirs] = grouping.record === "from" ? ["from", "to"] : ["to", "from"];
|
|
276
|
+
return `Group the records as the page did: each record sits under a heading that is the label of the ${grouping.kind} it is linked to — find the edge in props.edges with kind "${grouping.edge}" whose ${mine} is the record's id; the ${grouping.kind} is props.nodes' node whose id is the edge's ${theirs}. Draw the headings in keep_these_headings' order; never guess a record's group from its fields.`;
|
|
277
|
+
}
|
|
278
|
+
/** The model's view read: the script and its few words; undefined when it is not one. */
|
|
279
|
+
export function readPageViewReply(text) {
|
|
280
|
+
const parsed = jsonOf(text);
|
|
281
|
+
const given = parsed?.["source"];
|
|
282
|
+
// A script wrapped as a page would wrap it (`<script>…</script>`, a code fence) is the script inside.
|
|
283
|
+
const source = typeof given === "string" ? given.trim().replace(/^```(?:js|javascript)?\s*/i, "").replace(/\s*```$/, "").replace(/^<script[^>]*>\s*/i, "").replace(/\s*<\/script>\s*$/i, "") : undefined;
|
|
284
|
+
if (typeof source !== "string" || !/graview\.(render|onProps)/.test(source))
|
|
285
|
+
return undefined;
|
|
286
|
+
return { source, said: typeof parsed["said"] === "string" ? parsed["said"].trim() : "" };
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Who is asked, try by try: the light model, then at most two light
|
|
290
|
+
* repairs with what broke — the full model is never in the loop a person
|
|
291
|
+
* waits on, only behind Try harder (`harder`), once. Where only the full
|
|
292
|
+
* model is lent, it is asked once.
|
|
293
|
+
*/
|
|
294
|
+
export function repairTries(light, full, options = {}) {
|
|
295
|
+
if (options.harder)
|
|
296
|
+
return full ? [full] : light ? [light] : [];
|
|
297
|
+
if (light)
|
|
298
|
+
return [light, light, light];
|
|
299
|
+
return full ? [full] : [];
|
|
300
|
+
}
|
|
301
|
+
/** How long a person waits on the light model's tries together before the card says plainly what it could not keep. */
|
|
302
|
+
export const DRAFT_WITHIN_MS = 30_000;
|
|
303
|
+
/** A model's answer, raced against the time left and a cancel: the answer, "late", or "canceled". */
|
|
304
|
+
export async function inTime(answer, ms, signal) {
|
|
305
|
+
if (signal?.aborted)
|
|
306
|
+
return "canceled";
|
|
307
|
+
let timer;
|
|
308
|
+
let cancel;
|
|
309
|
+
const raced = await Promise.race([
|
|
310
|
+
answer.then((value) => ({ value })),
|
|
311
|
+
...(ms !== undefined ? [new Promise((done) => (timer = setTimeout(() => done("late"), Math.max(0, ms))))] : []),
|
|
312
|
+
...(signal ? [new Promise((done) => signal.addEventListener("abort", (cancel = () => done("canceled")), { once: true }))] : []),
|
|
313
|
+
]);
|
|
314
|
+
if (timer)
|
|
315
|
+
clearTimeout(timer);
|
|
316
|
+
if (cancel)
|
|
317
|
+
signal?.removeEventListener("abort", cancel);
|
|
318
|
+
return raced;
|
|
319
|
+
}
|
|
320
|
+
/** What the card says where no version passed: plain, and never the findings. */
|
|
321
|
+
export const COULD_NOT = "I couldn't make a version that looks right.";
|
|
322
|
+
/**
|
|
323
|
+
* THE PAGE AS A VIEW OF ITS OWN, revised as asked: the light model first,
|
|
324
|
+
* judged where nobody sees it; what breaks is handed back to the light
|
|
325
|
+
* model at most twice, with what broke, all within `within` (30 s). A
|
|
326
|
+
* version that never passes stops there and says what it could not keep
|
|
327
|
+
* (`couldNotKeep`), with the last try and its findings for Try harder —
|
|
328
|
+
* the full model once, from there (`harder`, `from`), until it answers or
|
|
329
|
+
* is canceled. Nothing that did not pass is shown.
|
|
330
|
+
*/
|
|
331
|
+
export async function draftPageView(options) {
|
|
332
|
+
const stages = [];
|
|
333
|
+
const light = options.ai.off ? undefined : options.ai.light;
|
|
334
|
+
const full = thinkingOf(options.ai);
|
|
335
|
+
const tries = repairTries(light, full, options.harder ? { harder: true } : {});
|
|
336
|
+
if (tries.length === 0)
|
|
337
|
+
return { ok: false, refused: options.ai.withoutModel ?? "Changing how a page looks needs AI, and none is on here.", findings: [], stages };
|
|
338
|
+
const ask = asker(stages);
|
|
339
|
+
const base = { part: options.part, manifest: options.manifest, mode: options.mode, outline: options.outline, data: options.data, ...(options.words ? { words: options.words } : {}), ...(options.highlighted ? { highlighted: options.highlighted } : {}), ...(options.current ? { current: options.current } : {}), ...(options.keep ? { keep: options.keep } : {}), ...(options.markup ? { markup: options.markup } : {}) };
|
|
340
|
+
/* The light model's tries share one wait (30 s); Try harder has none but the person's Cancel. */
|
|
341
|
+
const began = Date.now();
|
|
342
|
+
const within = options.harder ? undefined : (options.within ?? DRAFT_WITHIN_MS);
|
|
343
|
+
let findings = options.from?.findings ?? [];
|
|
344
|
+
let last = options.from ? { source: options.from.source, said: "" } : undefined;
|
|
345
|
+
const stopped = (extra = {}) => ({ ok: false, refused: couldNotKeep(findings), findings, ...(last ? { last: last.source } : {}), ...extra, stages });
|
|
346
|
+
for (let at = 0; at < tries.length; at++) {
|
|
347
|
+
const provider = tries[at];
|
|
348
|
+
const left = within === undefined ? undefined : within - (Date.now() - began);
|
|
349
|
+
// A repair that could not finish in the time left is not started: the card says what it could not keep now.
|
|
350
|
+
if (left !== undefined && at > 0 && left < 3_000)
|
|
351
|
+
return stopped({ late: true });
|
|
352
|
+
if (at > 0 || options.from)
|
|
353
|
+
options.repairing?.(findings);
|
|
354
|
+
const prompt = pageViewPrompt(findings.length === 0 || !last ? base : { ...base, findings, last: { source: last.source.slice(0, 6000) } });
|
|
355
|
+
const answered = await inTime(ask(provider, provider === light ? "light" : "thinking", PAGE_VIEW_SYSTEM, prompt), left, options.signal);
|
|
356
|
+
if (answered === "canceled")
|
|
357
|
+
return stopped({ canceled: true });
|
|
358
|
+
if (answered === "late")
|
|
359
|
+
return stopped({ late: true });
|
|
360
|
+
const view = answered.value === undefined ? undefined : readPageViewReply(answered.value);
|
|
361
|
+
if (!view) {
|
|
362
|
+
findings = ["The answer was not one JSON object with the whole script in `source`."];
|
|
363
|
+
continue;
|
|
364
|
+
}
|
|
365
|
+
last = view;
|
|
366
|
+
const stripped = cssFindings(view.source);
|
|
367
|
+
if (stripped.length > 0)
|
|
368
|
+
findings = stripped;
|
|
369
|
+
else {
|
|
370
|
+
// Judging draws it where nobody sees it: that, too, is inside the wait.
|
|
371
|
+
const judged = await inTime(options.judge(view.source), within === undefined ? undefined : within - (Date.now() - began), options.signal);
|
|
372
|
+
if (judged === "canceled")
|
|
373
|
+
return stopped({ canceled: true });
|
|
374
|
+
if (judged === "late")
|
|
375
|
+
return stopped({ late: true });
|
|
376
|
+
findings = judged.value;
|
|
377
|
+
}
|
|
378
|
+
if (findings.length === 0)
|
|
379
|
+
return { ok: true, source: view.source, said: view.said, repaired: at > 0 || Boolean(options.from), tries: at + 1, stages };
|
|
380
|
+
}
|
|
381
|
+
return stopped();
|
|
382
|
+
}
|
|
383
|
+
//# sourceMappingURL=page-better.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-better.js","sourceRoot":"","sources":["../src/page-better.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA+B7D,yEAAyE;AACzE,MAAM,MAAM,GAAG,CAAC,EAAsB,EAAmE,EAAE,CAAC,CAAC,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,IAAI,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC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CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;YAC1I,IAAI,MAAM,KAAK,UAAU;gBAAE,OAAO,OAAO,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9D,IAAI,MAAM,KAAK,MAAM;gBAAE,OAAO,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACtD,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC;QAC1B,CAAC;QACD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACzJ,CAAC;IACD,OAAO,OAAO,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/providers/structure.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"structure.d.ts","sourceRoot":"","sources":["../../src/providers/structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkE,KAAK,SAAS,EAAqB,MAAM,eAAe,CAAC;AAClI,OAAO,KAAK,EAAc,kBAAkB,EAAe,MAAM,aAAa,CAAC;AAO/E;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,SAAS,KAAK,kBAAkB,CAAC,CAAC,CAAC,CAwN9E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { actTitle,
|
|
1
|
+
import { actTitle, fieldInPassing, humanizeField, labelOf, nodeRefKinds } from "@graview/core";
|
|
2
2
|
const SHARED_SCORE = 70;
|
|
3
3
|
const ALIGN_SCORE = 80;
|
|
4
4
|
const IGNORED_FIELDS = new Set(["id", "kind"]);
|
|
@@ -135,7 +135,7 @@ export function structureProvider() {
|
|
|
135
135
|
const definitionOf = (kind) => store.schema.definitions.find((definition) => definition.kind === kind);
|
|
136
136
|
for (const field of [...fields].sort()) {
|
|
137
137
|
const definition = definitionOf(nodes[0].kind);
|
|
138
|
-
const words =
|
|
138
|
+
const words = fieldInPassing(definition, field);
|
|
139
139
|
// The value as the card shows it: the declared format, else the stored value quoted.
|
|
140
140
|
const format = definition?.display?.format?.[field];
|
|
141
141
|
const said = (key) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"structure.js","sourceRoot":"","sources":["../../src/providers/structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"structure.js","sourceRoot":"","sources":["../../src/providers/structure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAqC,MAAM,eAAe,CAAC;AAGlI,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;AAE/C;;;;;;;;;GASG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO;QACL,IAAI,EAAE,WAAW;QACjB,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;YACrB,gEAAgE;YAChE,MAAM,KAAK,GAAG,CAAC,IAA4D,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;YACrI,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,EAAE,CAAC;YAChC,MAAM,YAAY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2
3
|
import { type TraitName } from "@graview/core/traits";
|
|
3
4
|
import type { Answer, Decide } from "./fast.js";
|
|
4
5
|
import type { Question } from "./questions.js";
|
|
6
|
+
/** Whether a seat may change the app's declaration — the studio's door's judgment, here for a page that fetched this entry (the quick ask's plan) without the whole of `@graview/tools`. */
|
|
7
|
+
export { mayChangeDeclaration } from "./agent/declaration.js";
|
|
5
8
|
/** One request: the state the model reads and the typed questions over it, keyed so `readReshape` can say each answer back. */
|
|
6
9
|
export interface ReshapeAsk {
|
|
7
10
|
readonly state: Readonly<Record<string, unknown>>;
|
|
@@ -52,6 +55,24 @@ export interface ReshapeProposal {
|
|
|
52
55
|
/** The kinds and traits to drop, by name. */
|
|
53
56
|
readonly drop: readonly string[];
|
|
54
57
|
readonly card: ReshapeCard;
|
|
58
|
+
/**
|
|
59
|
+
* WHAT FINISHES THE ASK ONCE THE APP HAS CHANGED (Roadmap
|
|
60
|
+
* f-menu-type-anything): the records to make and change in the changed
|
|
61
|
+
* app — "add Nick as a person, give each task in This week to him" — as
|
|
62
|
+
* calls of its acts, a record made named by its `mintedHint` in the calls
|
|
63
|
+
* after it. The host applies them with the change to the app, as one
|
|
64
|
+
* change, previewed whole before it lands and taken back with one undo.
|
|
65
|
+
*/
|
|
66
|
+
readonly records?: readonly MutationCall[];
|
|
67
|
+
/** Whose words made the plan, as the records' ops say it: `ai:<name>`. */
|
|
68
|
+
readonly via?: string;
|
|
69
|
+
/**
|
|
70
|
+
* THE CHANGE TO THE APP AS EDITS (Roadmap f-menu-type-anything): the least
|
|
71
|
+
* the ask needs, written by `planEdits` in the edit vocabulary; a host
|
|
72
|
+
* applies these (`composeAppChange({ document, edits })`) in place of
|
|
73
|
+
* composing `add` and `drop`, which a plan leaves empty.
|
|
74
|
+
*/
|
|
75
|
+
readonly edits?: readonly unknown[];
|
|
55
76
|
}
|
|
56
77
|
/** A turn run through the host's model: the proposal (null when the reading changes nothing), the reading, the raw answers to keep, and what the call cost. */
|
|
57
78
|
export interface ReshapeTurn {
|
|
@@ -63,8 +84,16 @@ export interface ReshapeTurn {
|
|
|
63
84
|
readonly outputTokens: number;
|
|
64
85
|
};
|
|
65
86
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
87
|
+
/**
|
|
88
|
+
* What the host says it did with a proposal a person accepted: applied or
|
|
89
|
+
* declined — or applied with the one way back, which the card offers as
|
|
90
|
+
* Undo (the change to the app and the records it made, taken back together).
|
|
91
|
+
*/
|
|
92
|
+
export type ProposeChangeAnswer = "applied" | "declined" | {
|
|
93
|
+
readonly applied: true;
|
|
94
|
+
readonly undo: () => void | Promise<void>; /** What the card says beside it: "Kept until this page reloads." */
|
|
95
|
+
readonly note?: string;
|
|
96
|
+
};
|
|
68
97
|
/**
|
|
69
98
|
* THE HOST THAT APPLIES A CHANGE TO THE APP (`onProposeChange`). Handed the
|
|
70
99
|
* proposal a person accepted — the card they saw and the reading that
|
|
@@ -76,6 +105,45 @@ export type ProposeChangeAnswer = "applied" | "declined";
|
|
|
76
105
|
* never offers the change.
|
|
77
106
|
*/
|
|
78
107
|
export type ProposeChangeHost = (proposal: ReshapeProposal) => ProposeChangeAnswer | Promise<ProposeChangeAnswer>;
|
|
108
|
+
/**
|
|
109
|
+
* A CHANGE TO THE APP SHOWN ON THIS PAGE ONLY, NOT KEPT (Roadmap
|
|
110
|
+
* f-make-any-page-better): "Make “Tasks” better" drafts edits over the
|
|
111
|
+
* view spec, and the page is drawn with them applied before anybody keeps
|
|
112
|
+
* them. The host lays the changed app over this page alone — nothing is
|
|
113
|
+
* written, nobody else sees it — and answers the way to put the page back
|
|
114
|
+
* (`undo`), which the card calls on Discard and before Keep hands the same
|
|
115
|
+
* change to `onProposeChange`. Unsaid, the card says what would change
|
|
116
|
+
* without drawing it.
|
|
117
|
+
*/
|
|
118
|
+
export type DraftChangeHost = (proposal: ReshapeProposal) => {
|
|
119
|
+
readonly undo: () => void | Promise<void>;
|
|
120
|
+
} | Promise<{
|
|
121
|
+
readonly undo: () => void | Promise<void>;
|
|
122
|
+
}>;
|
|
123
|
+
/**
|
|
124
|
+
* THE HOST'S COMPOSER, LENT TO A PAGE (Roadmap f-menu-type-anything): a
|
|
125
|
+
* plan's edits (or a reshape's traits) applied to the app's document and
|
|
126
|
+
* judged by the checker — the changed document, the app it compiles to and
|
|
127
|
+
* what changed in words, or a refusal. `composeAppChange` from `@graview/core/compose` is
|
|
128
|
+
* one; a host hands it (`composeChange`) so the quick ask can offer a
|
|
129
|
+
* whole plan that finishes an ask, rehearsed before it is offered, while
|
|
130
|
+
* the composer and the checker stay off the page. Unsaid, a missing
|
|
131
|
+
* capability is said, and who could add it, without a plan.
|
|
132
|
+
*/
|
|
133
|
+
export type ComposeChangeHost = (change: {
|
|
134
|
+
readonly document: GraviewDocument;
|
|
135
|
+
readonly edits?: readonly unknown[];
|
|
136
|
+
readonly add?: readonly TraitName[];
|
|
137
|
+
readonly drop?: readonly string[];
|
|
138
|
+
}) => {
|
|
139
|
+
readonly ok: true;
|
|
140
|
+
readonly document: GraviewDocument;
|
|
141
|
+
readonly app: object;
|
|
142
|
+
readonly said: readonly string[];
|
|
143
|
+
} | {
|
|
144
|
+
readonly ok: false;
|
|
145
|
+
readonly refused: string;
|
|
146
|
+
};
|
|
79
147
|
/** The seat's tool, as a host's model is told of it: the Roadmap's `propose-change`, spelled as the surface spells its tools. */
|
|
80
148
|
export declare const PROPOSE_CHANGE = "propose_change";
|
|
81
149
|
/**
|