@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,234 @@
|
|
|
1
|
+
import { cssFindings } from "./draft-check.js";
|
|
2
|
+
import { thinkingOf } from "./inline-ai.js";
|
|
3
|
+
import { checklistOf, groupingRule, PAGE_VIEW_SYSTEM, readPageViewReply } from "./page-better.js";
|
|
4
|
+
/** The most requests one turn of the agent makes. */
|
|
5
|
+
export const DESIGN_AGENT_STEPS = 12;
|
|
6
|
+
export const DESIGN_AGENT_SYSTEM = [
|
|
7
|
+
PAGE_VIEW_SYSTEM.split("\n").filter((line) => !line.startsWith("Answer with one JSON object")).join("\n"),
|
|
8
|
+
"",
|
|
9
|
+
"You are Graview, redesigning one page of an app with the person who is looking at it. You work in steps, and each answer is ONE JSON object and nothing else:",
|
|
10
|
+
'{"say": "<one short plain sentence the person reads: what you are doing or what you found>", "do": "look" | "read" | "draft" | "done" | "ask", "source": "<the whole script, only with draft>"}',
|
|
11
|
+
"You are shown, before your first step, what the page draws now (what_the_page_draws: its headings, each record's words and the heading it sits under, how they stand) and the records your view is handed (records_it_is_handed): draft first.",
|
|
12
|
+
"- look: see what the page draws now again, as it stands.",
|
|
13
|
+
"- read: the records and fields your view is handed, again.",
|
|
14
|
+
"- draft: your whole script, drawn where only you see it, with \"say\" one sentence of what it does, as the person will read it once it is on the page (\"Tasks are cards now, side by side, each with its status and date.\"). You are told what the checks found (records, headings, dates, statuses or groups it lost; words it shows as the computer keeps them; styles the page will not keep) and what it drew. A draft the checks pass is shown to the person on the page, and your turn ends there.",
|
|
15
|
+
"- done: you have finished this request; say in one sentence what you changed. Only once a draft passed, unless you must ask.",
|
|
16
|
+
"- ask: ask the person one short question, and wait for their answer.",
|
|
17
|
+
"A control that changes a record is a press bound to one of the app's acts (acts_a_press_may_ask_for): <button data-act=\"finish\" data-record=\"${task.id}\">Done</button> — the host runs the act for that record when it is pressed. A field the person types into is named for the act's argument, inside a fieldset with the press; data-prefill=\"field\" fills it with the record's own text; data-save on a field saves it as it is typed. Never a checkbox, a toggle or a button bound to nothing, and never graview.act from your own click handler: it is refused. Every control on a record the page let a person press (marking it done, opening it) is kept, bound to the same act. A press that marks a record (an act with `marks`) shows what it marked from the record's own field: a record already marked says so and offers the act that undoes it (reopen), so a person sees the press land. The code presses every control headless and tells you what each one did.",
|
|
18
|
+
"Keep everything the page showed unless the person asked otherwise: every record, every heading, each record's words (its status, its dates, its counts) and its group. Fix what the checks found and draft again; keep going until a draft passes. Write to a person, never about code: no words like view, script, spec, host, CSS or stylesheet in what you say.",
|
|
19
|
+
].join("\n");
|
|
20
|
+
/** What one request tells the agent: the page, the conversation, the steps it took this turn and what came of each. */
|
|
21
|
+
export function designAgentPrompt(options, steps) {
|
|
22
|
+
const keep = options.keep;
|
|
23
|
+
return JSON.stringify({
|
|
24
|
+
page: options.part.name,
|
|
25
|
+
view: { attach: options.manifest.attach, cardinality: options.manifest.cardinality, reads: options.manifest.reads ?? {} },
|
|
26
|
+
conversation: options.talk.map((one) => ({ [one.who === "person" ? "person" : "you"]: one.said })),
|
|
27
|
+
...(options.about && options.about.name !== options.part.name ? { about: options.about.name, ...(options.about.lines?.length ? { pointed_at: options.about.lines } : {}) } : {}),
|
|
28
|
+
...(options.acts?.length ? { acts_a_press_may_ask_for: options.acts.map((one) => ({ act: one.act, title: one.title, record_goes_in: one.record, ...(one.toggle ? { marks: one.toggle } : {}) })) } : {}),
|
|
29
|
+
...(options.pressed?.length ? { the_controls_as_pressed: options.pressed, then: "The person says something does not work. This is what pressing every control of your draft found: fix what failed, with controls bound to acts." } : {}),
|
|
30
|
+
...(options.section ? { only_change: `Change only the part “${options.section}” of your_draft_on_the_page; keep every other part of the script as it is, byte for byte.` } : {}),
|
|
31
|
+
...(keep ? { ...(keep.title ? { the_page_draws_its_title: keep.title } : {}), keep_these_headings: keep.headings, records: checklistOf(keep), ...(keep.grouping ? { grouping: groupingRule(keep.grouping) } : {}) } : {}),
|
|
32
|
+
...(options.markup && !options.current ? { the_page_as_html: options.markup.slice(0, 5000) } : {}),
|
|
33
|
+
...(options.current ? { your_draft_on_the_page: options.current.slice(0, 9000) } : {}),
|
|
34
|
+
// The steps so far this turn, each with what came of it; only the last draft's script whole, the earlier ones said by what came of them.
|
|
35
|
+
your_steps: steps.map((one, at) => ({ said: one.said, did: one.did, ...(one.result !== undefined ? { result: one.result } : {}), ...(at < steps.length - 1 && one.did === "draft" ? { note: "an earlier draft" } : {}) })),
|
|
36
|
+
...(steps.length === 0 && options.seen ? { what_the_page_draws: options.seen.look, records_it_is_handed: options.seen.read } : {}),
|
|
37
|
+
next: steps.length === 0 ? "Draft first, as one JSON object." : "Your next step, as one JSON object.",
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/** One answer of the agent read: what it said and did, with its script for a draft; undefined where it is not one. */
|
|
41
|
+
export function readAgentReply(text) {
|
|
42
|
+
const start = text.indexOf("{");
|
|
43
|
+
const end = text.lastIndexOf("}");
|
|
44
|
+
if (start < 0 || end <= start)
|
|
45
|
+
return undefined;
|
|
46
|
+
let parsed;
|
|
47
|
+
try {
|
|
48
|
+
parsed = JSON.parse(text.slice(start, end + 1));
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
const move = parsed["do"];
|
|
54
|
+
if (move !== "look" && move !== "read" && move !== "draft" && move !== "done" && move !== "ask")
|
|
55
|
+
return undefined;
|
|
56
|
+
const say = typeof parsed["say"] === "string" ? parsed["say"].trim() : "";
|
|
57
|
+
if (move !== "draft")
|
|
58
|
+
return { say, do: move };
|
|
59
|
+
const view = readPageViewReply(JSON.stringify({ source: parsed["source"], said: say }));
|
|
60
|
+
return view ? { say, do: "draft", source: view.source } : undefined;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* WHAT THE CHECKS FOUND, IN A FEW WORDS for the panel: "dates lost on 3
|
|
64
|
+
* tasks", "2 tasks missing", "a task moved to another group". The agent
|
|
65
|
+
* is told the findings whole; the person sees this.
|
|
66
|
+
*/
|
|
67
|
+
export function checkSaid(findings, noun = "records") {
|
|
68
|
+
const said = [];
|
|
69
|
+
for (const finding of findings) {
|
|
70
|
+
const facts = /no longer says what it said: (.*?)(?: and (\d+) more)?\. Show/.exec(finding);
|
|
71
|
+
if (facts) {
|
|
72
|
+
const on = new Set([...facts[1].matchAll(/” on “([^”]+)”/g)].map((one) => one[1]));
|
|
73
|
+
const days = [...facts[1].matchAll(/“([^”]+)” on “/g)].some((one) => /\b(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)[a-z]*\.?\s+\d|\d{1,2}\s+(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i.test(one[1]));
|
|
74
|
+
const count = on.size + Number(facts[2] ?? 0);
|
|
75
|
+
said.push(`${days ? "dates" : "details"} lost on ${count === 1 ? `one of the ${noun}` : `${count} ${noun}`}`);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
const lost = /^It no longer shows (.*?)(?: and (\d+) more)?: show every record/.exec(finding);
|
|
79
|
+
if (lost) {
|
|
80
|
+
const count = [...lost[1].matchAll(/“/g)].length + Number(lost[2] ?? 0);
|
|
81
|
+
said.push(`${count === 1 ? `one of the ${noun}` : `${count} ${noun}`} missing`);
|
|
82
|
+
}
|
|
83
|
+
else if (/no longer shows the heading/.test(finding))
|
|
84
|
+
said.push("headings missing");
|
|
85
|
+
else if (/moved to another group|more often than the page did/.test(finding))
|
|
86
|
+
said.push(`${noun} in the wrong group`);
|
|
87
|
+
else if (/drawn twice/.test(finding))
|
|
88
|
+
said.push("the title drawn twice");
|
|
89
|
+
else if (/markup as words|a date as “|as the computer keeps it|a field's name/.test(finding))
|
|
90
|
+
said.push("words shown as the computer keeps them");
|
|
91
|
+
else if (/did not draw|not drawn|threw/.test(finding))
|
|
92
|
+
said.push("it didn't draw");
|
|
93
|
+
else if (/not allowed|removed|reaches outside/.test(finding))
|
|
94
|
+
said.push("styles the page won't keep");
|
|
95
|
+
}
|
|
96
|
+
const unique = [...new Set(said)];
|
|
97
|
+
return unique.length > 0 ? unique.slice(0, 3).join(", ") : "something didn't draw right";
|
|
98
|
+
}
|
|
99
|
+
/** A model's answer, or "stopped" the moment the signal says so — or "late" past `ms`. */
|
|
100
|
+
async function unlessStopped(answer, signal, ms) {
|
|
101
|
+
if (signal?.aborted)
|
|
102
|
+
return "stopped";
|
|
103
|
+
let stop;
|
|
104
|
+
let timer;
|
|
105
|
+
const raced = await Promise.race([
|
|
106
|
+
answer.then((value) => ({ value })),
|
|
107
|
+
...(signal ? [new Promise((done) => signal.addEventListener("abort", (stop = () => done("stopped")), { once: true }))] : []),
|
|
108
|
+
...(ms !== undefined ? [new Promise((done) => (timer = setTimeout(() => done("late"), ms)))] : []),
|
|
109
|
+
]);
|
|
110
|
+
if (stop)
|
|
111
|
+
signal?.removeEventListener("abort", stop);
|
|
112
|
+
if (timer)
|
|
113
|
+
clearTimeout(timer);
|
|
114
|
+
return raced;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* ONE TURN OF THE AGENT: from the person's last words, step by step — it
|
|
118
|
+
* looks, reads, drafts, is told what the checks found and what it drew,
|
|
119
|
+
* and drafts again — until it says it is done, asks, runs out of steps or
|
|
120
|
+
* is stopped. Each step is told (`onEvent`) for the panel. Nothing is kept
|
|
121
|
+
* here: a draft that passed is the host's to show, and the person's to keep.
|
|
122
|
+
*/
|
|
123
|
+
export async function runDesignAgent(options) {
|
|
124
|
+
const stages = [];
|
|
125
|
+
const steps = [];
|
|
126
|
+
const model = options.ai.off ? undefined : (options.ai.design ?? thinkingOf(options.ai) ?? options.ai.light);
|
|
127
|
+
if (!model)
|
|
128
|
+
return { ended: "no-model", said: options.ai.withoutModel ?? "Changing how a page looks needs AI, and none is on here.", steps, stages };
|
|
129
|
+
const tell = (event) => options.onEvent?.(event);
|
|
130
|
+
const noun = options.noun ?? (options.part.slot === "record" ? "parts" : "records");
|
|
131
|
+
let passed;
|
|
132
|
+
let last;
|
|
133
|
+
let unreadable = 0;
|
|
134
|
+
const most = Math.max(2, options.steps ?? DESIGN_AGENT_STEPS);
|
|
135
|
+
/* What the page draws and what the view is handed, looked at once before the first request: one request less for the person to wait on. */
|
|
136
|
+
tell({ kind: "look", text: `Looking at ${options.part.name}` });
|
|
137
|
+
const seen = { look: options.host.look(), read: options.host.read() };
|
|
138
|
+
for (let at = 0; at < most; at++) {
|
|
139
|
+
const began = Date.now();
|
|
140
|
+
const asked = await unlessStopped((model.stream
|
|
141
|
+
? model.stream({ system: DESIGN_AGENT_SYSTEM, prompt: designAgentPrompt({ ...options, seen }, steps), state: {}, catalog: { candidates: [] } }, (soFar) => tell({ kind: "streaming", text: writingSaid(soFar) }), options.signal)
|
|
142
|
+
: model.think({ system: DESIGN_AGENT_SYSTEM, prompt: designAgentPrompt({ ...options, seen }, steps), state: {}, catalog: { candidates: [] } })).then((reply) => {
|
|
143
|
+
stages.push({ stage: "thinking", model: model.model, ms: Date.now() - began, ...(reply.usage ? { usage: reply.usage } : {}) });
|
|
144
|
+
return reply.text;
|
|
145
|
+
}, () => {
|
|
146
|
+
stages.push({ stage: "thinking", model: model.model, ms: Date.now() - began });
|
|
147
|
+
return undefined;
|
|
148
|
+
}), options.signal, options.stepMs ?? 10 * 60_000);
|
|
149
|
+
if (asked === "late")
|
|
150
|
+
return { ended: "steps", said: passed ? "The model stopped answering; here is where it got to." : "The model didn't answer in time. Ask again, or say it another way.", ...(passed ? { passed } : {}), ...(last ? { last } : {}), steps, stages };
|
|
151
|
+
if (asked === "stopped")
|
|
152
|
+
return { ended: "stopped", said: "Stopped.", ...(passed ? { passed } : {}), ...(last ? { last } : {}), steps, stages };
|
|
153
|
+
const move = asked.value === undefined ? undefined : readAgentReply(asked.value);
|
|
154
|
+
if (!move) {
|
|
155
|
+
unreadable += 1;
|
|
156
|
+
if (unreadable >= 3)
|
|
157
|
+
break;
|
|
158
|
+
steps.push({ said: "", did: "look", result: { error: "Your answer was not one JSON object with say and do (and the whole script in source for a draft). Answer again." } });
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (move.do === "look") {
|
|
162
|
+
tell({ kind: "look", text: `Looking at ${options.part.name}` });
|
|
163
|
+
steps.push({ said: move.say, did: "look", result: options.host.look() });
|
|
164
|
+
}
|
|
165
|
+
else if (move.do === "read") {
|
|
166
|
+
tell({ kind: "read", text: `Reading what ${options.part.name} shows` });
|
|
167
|
+
steps.push({ said: move.say, did: "read", result: options.host.read() });
|
|
168
|
+
}
|
|
169
|
+
else if (move.do === "draft") {
|
|
170
|
+
tell({ kind: "draft", text: move.say ? `Drafting: ${move.say.replace(/\.$/, "")}` : "Drafting" });
|
|
171
|
+
const stripped = cssFindings(move.source);
|
|
172
|
+
const drawn = stripped.length > 0 ? { findings: stripped, drew: undefined } : await unlessStopped(options.host.draft(move.source), options.signal).then((one) => (typeof one === "string" ? undefined : one.value));
|
|
173
|
+
if (!drawn)
|
|
174
|
+
return { ended: "stopped", said: "Stopped.", ...(passed ? { passed } : {}), ...(last ? { last } : {}), steps, stages };
|
|
175
|
+
last = { source: move.source, findings: drawn.findings };
|
|
176
|
+
if (drawn.findings.length === 0) {
|
|
177
|
+
passed = { source: move.source };
|
|
178
|
+
tell({ kind: "passed", text: "Check: nothing lost — it's on the page" });
|
|
179
|
+
steps.push({ said: move.say, did: "draft", result: { findings: [], drew: drawn.drew, shown: "It passed and is on the page now." } });
|
|
180
|
+
// A draft that passed ends the turn: the person sees it, and says what next.
|
|
181
|
+
return { ended: "done", said: move.say || "Here it is.", passed, last, steps, stages };
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
tell({ kind: "check", text: `Check: ${checkSaid(drawn.findings, noun)} — fixing` });
|
|
185
|
+
steps.push({ said: move.say, did: "draft", result: { findings: drawn.findings, drew: drawn.drew } });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
else if (move.do === "ask") {
|
|
189
|
+
return { ended: "ask", said: move.say || "What would you like it to look like?", ...(passed ? { passed } : {}), ...(last ? { last } : {}), steps, stages };
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
if (!passed && last && last.findings.length > 0 && at < most - 2) {
|
|
193
|
+
// Done is only done once a draft passed: told so once, it fixes what is left or asks.
|
|
194
|
+
steps.push({ said: move.say, did: "done", result: { not_yet: "No draft has passed the checks yet. Fix what the last check found and draft again, or ask the person." } });
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
return { ended: "done", said: move.say || (passed ? "Done." : "I stopped here."), ...(passed ? { passed } : {}), ...(last ? { last } : {}), steps, stages };
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return { ended: "steps", said: passed ? "Here is where it got to." : "I haven't got it right yet. Tell me more, or ask me to keep going.", ...(passed ? { passed } : {}), ...(last ? { last } : {}), steps, stages };
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* WHAT THE AGENT IS WRITING, SAID AS IT WRITES IT: the sentence it is
|
|
204
|
+
* saying (its `say`, as far as it has got), then how far into the design
|
|
205
|
+
* it is — never its code.
|
|
206
|
+
*/
|
|
207
|
+
export function writingSaid(soFar) {
|
|
208
|
+
const said = /"say"\s*:\s*"((?:[^"\\]|\\.)*)/.exec(soFar)?.[1];
|
|
209
|
+
let say = "";
|
|
210
|
+
if (said !== undefined) {
|
|
211
|
+
try {
|
|
212
|
+
say = JSON.parse(`"${said.replace(/\\$/, "")}"`);
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
say = said;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
const source = soFar.indexOf('"source"');
|
|
219
|
+
const lines = source >= 0 ? soFar.slice(source).split("\\n").length : 0;
|
|
220
|
+
const writing = lines > 1 ? `writing it, ${lines} lines so far` : "";
|
|
221
|
+
if (say && writing)
|
|
222
|
+
return `${say.replace(/\.$/, "")} — ${writing}`;
|
|
223
|
+
if (say)
|
|
224
|
+
return say;
|
|
225
|
+
return writing ? `Writing the design, ${lines} lines so far` : "Thinking…";
|
|
226
|
+
}
|
|
227
|
+
/** What the page draws, read for the agent: headings, and each record with what it says, where it sits and how it stands. */
|
|
228
|
+
export function lookOf(read) {
|
|
229
|
+
return {
|
|
230
|
+
headings: read.headings,
|
|
231
|
+
records: read.records.map((one) => ({ record: one.label, says: one.facts ?? [], ...(one.under ? { under: one.under } : {}), at: { top: one.top, left: one.left }, type_px: one.size })),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=design-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-agent.js","sourceRoot":"","sources":["../src/design-agent.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAkB,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,U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ACxL,CAAC;AACJ,CAAC"}
|
package/dist/dev-ai.d.ts
CHANGED
|
@@ -25,7 +25,11 @@ type Fetch = (input: string, init?: {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function aiThroughDevServer(options?: {
|
|
27
27
|
readonly path?: string;
|
|
28
|
+
readonly decidePath?: string;
|
|
29
|
+
readonly toldPath?: string;
|
|
28
30
|
readonly fetch?: Fetch;
|
|
29
31
|
}): Promise<HostAi>;
|
|
32
|
+
/** Where the dev server keeps what people tell Graview (`devTold`, `@graview/ship/dev`): `/__graview/told`. */
|
|
33
|
+
export declare const DEV_TOLD_DOOR = "/__graview/told";
|
|
30
34
|
export {};
|
|
31
35
|
//# sourceMappingURL=dev-ai.d.ts.map
|
package/dist/dev-ai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-ai.d.ts","sourceRoot":"","sources":["../src/dev-ai.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dev-ai.d.ts","sourceRoot":"","sources":["../src/dev-ai.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAS7C,KAAK,KAAK,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAAK,OAAO,CAAC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;CAAE,CAAC,CAAC;AAEtM;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAIpL;AAED,+GAA+G;AAC/G,eAAO,MAAM,aAAa,oBAAoB,CAAC"}
|
package/dist/dev-ai.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { AI_BRIDGE_PATH } from "@graview/core";
|
|
1
|
+
import { AI_BRIDGE_PATH, DECISION_BRIDGE_PATH } from "@graview/core";
|
|
2
|
+
import { toldOver } from "@graview/core/told";
|
|
2
3
|
import { NO_AI } from "./ai.js";
|
|
4
|
+
import { completionDecide } from "./decide.js";
|
|
5
|
+
import { JEV_INPUT_USD_PER_MILLION, JEV_MODEL, jevDecide } from "./providers/jev.js";
|
|
3
6
|
import { turnThroughMessages } from "./turn.js";
|
|
4
7
|
/** What the seat says in a dev build whose server holds no key. */
|
|
5
8
|
const NOTHING_HERE = "I can answer about what's in this app. Open questions need AI.";
|
|
@@ -18,6 +21,62 @@ const NOTHING_HERE = "I can answer about what's in this app. Open questions need
|
|
|
18
21
|
* the seat says what any product's says.
|
|
19
22
|
*/
|
|
20
23
|
export async function aiThroughDevServer(options = {}) {
|
|
24
|
+
const [ai, jev, told] = await Promise.all([throughTheModelDoor(options), jevThroughTheDecisionDoor(options), toldThroughTheDevServer(options)]);
|
|
25
|
+
const lent = jev ? { ...ai, fast: jev } : ai;
|
|
26
|
+
return told && !lent.off ? { ...lent, told } : lent;
|
|
27
|
+
}
|
|
28
|
+
/** Where the dev server keeps what people tell Graview (`devTold`, `@graview/ship/dev`): `/__graview/told`. */
|
|
29
|
+
export const DEV_TOLD_DOOR = "/__graview/told";
|
|
30
|
+
/*
|
|
31
|
+
* WHAT PEOPLE TELL GRAVIEW, KEPT BY THE DEV SERVER (Roadmap f-menu-learns):
|
|
32
|
+
* where it answers `/__graview/told`, the page keeps its tellings there —
|
|
33
|
+
* the answer card's ratings, the menu's suggestions, the Studio's list.
|
|
34
|
+
*/
|
|
35
|
+
async function toldThroughTheDevServer(options) {
|
|
36
|
+
const path = options.toldPath ?? DEV_TOLD_DOOR;
|
|
37
|
+
const call = options.fetch ?? globalThis.fetch;
|
|
38
|
+
if (!call)
|
|
39
|
+
return undefined;
|
|
40
|
+
try {
|
|
41
|
+
const probe = await call(path, { method: "GET" });
|
|
42
|
+
if (!probe.ok)
|
|
43
|
+
return undefined;
|
|
44
|
+
const body = (await probe.json());
|
|
45
|
+
if (!Array.isArray(body?.tellings))
|
|
46
|
+
return undefined;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
return toldOver("", { path, ...(options.fetch ? { fetch: options.fetch } : {}) });
|
|
52
|
+
}
|
|
53
|
+
/*
|
|
54
|
+
* JEV IN THE FAST SLOT IN DEVELOPMENT (Roadmap f-menu-type-anything): where
|
|
55
|
+
* the dev server holds a TypeSafe key (`decisionBridge`, TYPESAFE_API_KEY or
|
|
56
|
+
* JEV_API_KEY), the page's Fast slot is Jev itself, its typed questions
|
|
57
|
+
* posted through that door with the key on the server's side — in place of
|
|
58
|
+
* the small model the model door lends when no key for Jev is set.
|
|
59
|
+
*/
|
|
60
|
+
async function jevThroughTheDecisionDoor(options) {
|
|
61
|
+
const path = options.decidePath ?? DECISION_BRIDGE_PATH;
|
|
62
|
+
const call = options.fetch ?? globalThis.fetch;
|
|
63
|
+
if (!call)
|
|
64
|
+
return undefined;
|
|
65
|
+
try {
|
|
66
|
+
const probe = await call(path, { method: "GET" });
|
|
67
|
+
if (!probe.ok)
|
|
68
|
+
return undefined;
|
|
69
|
+
const status = (await probe.json());
|
|
70
|
+
if (status?.available !== true)
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return { model: JEV_MODEL, decide: jevDecide({ baseUrl: path, ...(options.fetch ? { fetch: options.fetch } : {}) }), price: { inputPerMillion: JEV_INPUT_USD_PER_MILLION } };
|
|
77
|
+
}
|
|
78
|
+
/** The host's model through the dev server's model door, and its small quick model as the Fast slot's stand-in. */
|
|
79
|
+
async function throughTheModelDoor(options) {
|
|
21
80
|
const path = options.path ?? AI_BRIDGE_PATH;
|
|
22
81
|
const call = options.fetch ?? globalThis.fetch;
|
|
23
82
|
if (!call)
|
|
@@ -41,8 +100,102 @@ export async function aiThroughDevServer(options = {}) {
|
|
|
41
100
|
throw new Error(typeof body.error === "string" ? body.error : `The model door answered ${answer.status}.`);
|
|
42
101
|
return body;
|
|
43
102
|
};
|
|
103
|
+
/*
|
|
104
|
+
* A FAST SLOT IN DEVELOPMENT (Roadmap f-menu-type-anything): where the
|
|
105
|
+
* door names a small quick model, the page's Fast slot asks it each
|
|
106
|
+
* typed question through the same door (`tier: "fast"`), answered as a
|
|
107
|
+
* decision provider would (`completionDecide`) — a stand-in for Jev, in
|
|
108
|
+
* a dev server only, since a build has no door.
|
|
109
|
+
*/
|
|
110
|
+
const fastModel = typeof status.fast === "string" && status.fast.length > 0 ? status.fast : undefined;
|
|
111
|
+
const designModel = typeof status.design === "string" && status.design.length > 0 ? status.design : undefined;
|
|
112
|
+
const usageOf = (usage) => {
|
|
113
|
+
const used = usage;
|
|
114
|
+
return typeof used?.inputTokens === "number" && typeof used.outputTokens === "number" ? { usage: { inputTokens: used.inputTokens, outputTokens: used.outputTokens } } : {};
|
|
115
|
+
};
|
|
116
|
+
/*
|
|
117
|
+
* THE DESIGN SLOT, STREAMED (Roadmap f-make-any-page-better): Better UI's
|
|
118
|
+
* agent asks the door's design model (`tier: "design"`), and where the door
|
|
119
|
+
* streams, reads its answer a line at a time, telling the page the text so
|
|
120
|
+
* far — so a person sees its words as it writes them.
|
|
121
|
+
*/
|
|
122
|
+
const streams = status.streams === true && !options.fetch && typeof globalThis.fetch === "function";
|
|
123
|
+
const design = designModel
|
|
124
|
+
? {
|
|
125
|
+
model: designModel,
|
|
126
|
+
think: async ({ system, prompt }) => {
|
|
127
|
+
const body = await post({ prompt, ...(system ? { system } : {}), tier: "design" });
|
|
128
|
+
if (typeof body.text !== "string")
|
|
129
|
+
throw new Error("The model door answered with no text.");
|
|
130
|
+
return { text: body.text, ...usageOf(body.usage) };
|
|
131
|
+
},
|
|
132
|
+
...(streams
|
|
133
|
+
? {
|
|
134
|
+
stream: async ({ system, prompt }, onText, signal) => {
|
|
135
|
+
const answer = await globalThis.fetch(path, { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ prompt, ...(system ? { system } : {}), tier: "design", stream: true }), ...(signal ? { signal } : {}) });
|
|
136
|
+
if (!answer.ok || !answer.body) {
|
|
137
|
+
const failed = (await answer.json().catch(() => ({})));
|
|
138
|
+
throw new Error(typeof failed.error === "string" ? failed.error : `The model door answered ${answer.status}.`);
|
|
139
|
+
}
|
|
140
|
+
const reader = answer.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
141
|
+
let soFar = "";
|
|
142
|
+
let buffer = "";
|
|
143
|
+
let whole;
|
|
144
|
+
for (;;) {
|
|
145
|
+
const { value, done } = await reader.read();
|
|
146
|
+
if (done)
|
|
147
|
+
break;
|
|
148
|
+
buffer += value;
|
|
149
|
+
for (let at = buffer.indexOf("\n"); at >= 0; at = buffer.indexOf("\n")) {
|
|
150
|
+
const line = buffer.slice(0, at).trim();
|
|
151
|
+
buffer = buffer.slice(at + 1);
|
|
152
|
+
if (!line)
|
|
153
|
+
continue;
|
|
154
|
+
const piece = JSON.parse(line);
|
|
155
|
+
if (typeof piece.delta === "string") {
|
|
156
|
+
soFar += piece.delta;
|
|
157
|
+
onText(soFar);
|
|
158
|
+
}
|
|
159
|
+
else
|
|
160
|
+
whole = piece;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (whole && typeof whole.error === "string")
|
|
164
|
+
throw new Error(whole.error);
|
|
165
|
+
return { text: typeof whole?.text === "string" ? whole.text : soFar, ...usageOf(whole?.usage) };
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
: {}),
|
|
169
|
+
}
|
|
170
|
+
: undefined;
|
|
44
171
|
return {
|
|
45
172
|
name: typeof status.name === "string" ? status.name : "model",
|
|
173
|
+
...(design ? { design } : {}),
|
|
174
|
+
...(fastModel
|
|
175
|
+
? {
|
|
176
|
+
/* The light model: the same quick one, writing the few words a plan over the graph could not decide. */
|
|
177
|
+
light: {
|
|
178
|
+
model: fastModel,
|
|
179
|
+
think: async ({ system, prompt }) => {
|
|
180
|
+
const body = await post({ prompt, ...(system ? { system } : {}), tier: "fast" });
|
|
181
|
+
if (typeof body.text !== "string")
|
|
182
|
+
throw new Error("The model door answered with no text.");
|
|
183
|
+
const usage = body.usage;
|
|
184
|
+
return { text: body.text, ...(typeof usage?.inputTokens === "number" && typeof usage.outputTokens === "number" ? { usage: { inputTokens: usage.inputTokens, outputTokens: usage.outputTokens } } : {}) };
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
fast: {
|
|
188
|
+
model: fastModel,
|
|
189
|
+
decide: completionDecide(async ({ prompt }) => {
|
|
190
|
+
const body = await post({ prompt, tier: "fast" });
|
|
191
|
+
if (typeof body.text !== "string")
|
|
192
|
+
throw new Error("The model door answered with no text.");
|
|
193
|
+
const usage = body.usage;
|
|
194
|
+
return { text: body.text, ...(typeof usage?.inputTokens === "number" && typeof usage.outputTokens === "number" ? { usage: { inputTokens: usage.inputTokens, outputTokens: usage.outputTokens } } : {}) };
|
|
195
|
+
}),
|
|
196
|
+
},
|
|
197
|
+
}
|
|
198
|
+
: {}),
|
|
46
199
|
complete: async ({ prompt, system, images, signal }) => {
|
|
47
200
|
const asked = { prompt, ...(system ? { system } : {}), ...(images?.length ? { images } : {}) };
|
|
48
201
|
const body = await post(asked, signal);
|
|
@@ -51,13 +204,17 @@ export async function aiThroughDevServer(options = {}) {
|
|
|
51
204
|
const usage = body.usage;
|
|
52
205
|
return { text: body.text, ...(typeof usage?.inputTokens === "number" && typeof usage.outputTokens === "number" ? { usage: { inputTokens: usage.inputTokens, outputTokens: usage.outputTokens } } : {}) };
|
|
53
206
|
},
|
|
54
|
-
/* The seat's turn (FR-160): the loop runs here, under the person's sight; the door makes each request with the key
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
207
|
+
/* The seat's turn (FR-160): the loop runs here, under the person's sight; the door makes each request with the key — where its provider takes a turn's tools (Anthropic), else the seat answers from `complete`. */
|
|
208
|
+
...(status.turns === false
|
|
209
|
+
? {}
|
|
210
|
+
: {
|
|
211
|
+
turn: turnThroughMessages(async (request) => {
|
|
212
|
+
const body = await post(request);
|
|
213
|
+
if (!Array.isArray(body.content))
|
|
214
|
+
throw new Error("The model door answered with no content.");
|
|
215
|
+
return { content: body.content, stop_reason: typeof body.stop_reason === "string" ? body.stop_reason : null };
|
|
216
|
+
}),
|
|
217
|
+
}),
|
|
61
218
|
};
|
|
62
219
|
}
|
|
63
220
|
if (status?.configured === false && typeof status.howTo === "string")
|
package/dist/dev-ai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-ai.js","sourceRoot":"","sources":["../src/dev-ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAoB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"dev-ai.js","sourceRoot":"","sources":["../src/dev-ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAoB,MAAM,eAAe,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAkB,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,KAAK,EAAe,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,SAAS,EAAE,SAAS,EAAE,MAA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I,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,YAAY,EAAE,GAAG,YAAY,IAAI,MAAM,CAAC,KAAK,EAAE,EAAE,CAAC;IACjI,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A drawing read for judging: its headings in order, the records it shows
|
|
3
|
+
* in order with where and how big, and all its words. Each record carries
|
|
4
|
+
* what its row or card says beside its name (`facts`: "Todo", "Sep 3,
|
|
5
|
+
* 2026", "3 tasks"), the words of that row or card whole (`row`), and the
|
|
6
|
+
* heading it sits under (`under`).
|
|
7
|
+
*/
|
|
8
|
+
export interface DrawnRead {
|
|
9
|
+
readonly headings: readonly string[];
|
|
10
|
+
readonly records: readonly {
|
|
11
|
+
readonly label: string;
|
|
12
|
+
readonly top: number;
|
|
13
|
+
readonly left: number;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly facts?: readonly string[];
|
|
16
|
+
readonly row?: string;
|
|
17
|
+
readonly under?: string;
|
|
18
|
+
/** Whether its row offered a control to press (a circle that finishes it, a toggle), and whether its name opened it. */
|
|
19
|
+
readonly presses?: boolean;
|
|
20
|
+
readonly opens?: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
readonly text: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* WHAT THE HOST WOULD STRIP FROM A SCRIPT'S STYLESHEETS, before it is
|
|
26
|
+
* drawn: each `graview.style` string read by the framework's own
|
|
27
|
+
* sanitizer, and what it refuses said as what to do instead.
|
|
28
|
+
*/
|
|
29
|
+
export declare function cssFindings(source: string): string[];
|
|
30
|
+
/**
|
|
31
|
+
* WHETHER A ROW STILL SAYS A FACT IT SAID, in other words if it likes: the
|
|
32
|
+
* same words, or the same day of the same month ("Sep 3, 2026" as "3
|
|
33
|
+
* September" or "Sep 3"), or the same number where the fact was one.
|
|
34
|
+
*/
|
|
35
|
+
export declare function rowSays(row: string, fact: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* WHAT A DRAFT BROKE, against what the page showed: a record or a heading
|
|
38
|
+
* it no longer shows, a fact a record's row said that its card no longer
|
|
39
|
+
* says (its status, its date, a count), a record moved under another
|
|
40
|
+
* heading, a heading drawn twice, and words no person was shown before — a
|
|
41
|
+
* field's own name, a date as the computer keeps it, `true`, `undefined`.
|
|
42
|
+
* A fact or a group the person asked to change (`asked`: "hide the dates",
|
|
43
|
+
* "group by status") is theirs to change. Empty when the draft may be shown.
|
|
44
|
+
*/
|
|
45
|
+
export declare function drawnFindings(before: DrawnRead, after: DrawnRead, options?: {
|
|
46
|
+
readonly fields?: readonly string[];
|
|
47
|
+
readonly asked?: string;
|
|
48
|
+
}): string[];
|
|
49
|
+
/**
|
|
50
|
+
* WHAT A NEW DESIGN COULD NOT KEEP, said plainly from what broke: "I
|
|
51
|
+
* couldn't keep the dates and statuses in a new design." — the facts by
|
|
52
|
+
* what they are (a day is a date, a number a count, other words a
|
|
53
|
+
* status), a record or a heading lost, a record moved out of its group,
|
|
54
|
+
* words shown as the computer keeps them. Plain `COULD_NOT` where what
|
|
55
|
+
* broke is none of those (the view did not draw, the answer was not one).
|
|
56
|
+
*/
|
|
57
|
+
export declare function couldNotKeep(findings: readonly string[]): string;
|
|
58
|
+
/**
|
|
59
|
+
* WHAT CHANGED, SAID BY CODE from the two readings: how the records stand
|
|
60
|
+
* (side by side, how many to a line), how big they are, their order, and
|
|
61
|
+
* headings it adds. Undefined where nothing measurable moved, for the card
|
|
62
|
+
* to say so plainly rather than echo the model.
|
|
63
|
+
*/
|
|
64
|
+
export declare function describeChange(name: string, before: DrawnRead, after: DrawnRead): string | undefined;
|
|
65
|
+
/** One control a press check pressed, and what came of it. */
|
|
66
|
+
export interface PressSaid {
|
|
67
|
+
readonly control: string;
|
|
68
|
+
readonly element: string;
|
|
69
|
+
readonly does: string;
|
|
70
|
+
readonly ok: boolean;
|
|
71
|
+
readonly says: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* WHAT A PERSON CAN DO ON EACH RECORD, KEPT (Roadmap f-make-any-page-better):
|
|
75
|
+
* every control the draft drew, pressed headless with nothing applied —
|
|
76
|
+
* one that does nothing, throws, or is refused is a finding in its own
|
|
77
|
+
* words — and each record whose row the page let a person press (a circle
|
|
78
|
+
* that finishes it) or open by its name must still be: a press bound to
|
|
79
|
+
* one of the toggles (`data-act`, `data-record` its id) that the check
|
|
80
|
+
* found the app accepts, and a link to it.
|
|
81
|
+
*/
|
|
82
|
+
export declare function pressFindings(presses: {
|
|
83
|
+
readonly controls: readonly PressSaid[];
|
|
84
|
+
readonly problems: readonly PressSaid[];
|
|
85
|
+
}, wanted: readonly {
|
|
86
|
+
readonly label: string;
|
|
87
|
+
readonly id: string;
|
|
88
|
+
readonly presses?: boolean;
|
|
89
|
+
readonly opens?: boolean;
|
|
90
|
+
}[], toggles: readonly string[], noun?: string): string[];
|
|
91
|
+
/**
|
|
92
|
+
* WHAT THE CONTROLS DO, SAID BY THE PRESS CHECK: "Pressing it checked:
|
|
93
|
+
* “Done” marks each of the 3 tasks done, and each opens its page." Only
|
|
94
|
+
* what was pressed and accepted is said; undefined where it found nothing
|
|
95
|
+
* to say. The agent's own account of its controls is never said for it.
|
|
96
|
+
*/
|
|
97
|
+
export declare function pressSaid(presses: {
|
|
98
|
+
readonly controls: readonly PressSaid[];
|
|
99
|
+
}, acts: readonly {
|
|
100
|
+
readonly act: string;
|
|
101
|
+
readonly title: string;
|
|
102
|
+
readonly toggle?: string;
|
|
103
|
+
}[], noun?: string): string | undefined;
|
|
104
|
+
/** Words that say what a control does: a sentence of the model's with one is not said for it — the press check says what was checked. */
|
|
105
|
+
export declare const CONTROL_WORDS: RegExp;
|
|
106
|
+
/** Words of a person who says a control does not work. */
|
|
107
|
+
export declare const IT_DOES_NOT_WORK: RegExp;
|
|
108
|
+
//# sourceMappingURL=draft-check.d.ts.map
|