@lloyal-labs/ui 0.1.0-alpha.10
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/LICENSE +107 -0
- package/dist/assets.d.ts +18 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +83 -0
- package/dist/assets.js.map +1 -0
- package/dist/fold.d.ts +211 -0
- package/dist/fold.d.ts.map +1 -0
- package/dist/fold.js +320 -0
- package/dist/fold.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/lightbox.d.ts +21 -0
- package/dist/lightbox.d.ts.map +1 -0
- package/dist/lightbox.js +43 -0
- package/dist/lightbox.js.map +1 -0
- package/dist/markdown.d.ts +12 -0
- package/dist/markdown.d.ts.map +1 -0
- package/dist/markdown.js +34 -0
- package/dist/markdown.js.map +1 -0
- package/dist/prose.d.ts +57 -0
- package/dist/prose.d.ts.map +1 -0
- package/dist/prose.js +176 -0
- package/dist/prose.js.map +1 -0
- package/dist/provider.d.ts +43 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +172 -0
- package/dist/provider.js.map +1 -0
- package/package.json +66 -0
package/dist/fold.js
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The generic agent fold: one agent's life on a view, folded from the bus
|
|
3
|
+
* events every pool emits. Framework-free — the Ink view, the desktop shell's
|
|
4
|
+
* own fold and the browser page all fold the same records — and it knows no
|
|
5
|
+
* product: which spawns get a timeline, and what an agent's task is called,
|
|
6
|
+
* are the application's decisions, handed in at `agent:spawn`.
|
|
7
|
+
*
|
|
8
|
+
* What it owns: the per-agent record ({@link AgentRuntime}), the `<think>`
|
|
9
|
+
* boundary machine (a live think block advances until the marker, then closes
|
|
10
|
+
* and seeds the content buffer with the tail), the timeline items — think,
|
|
11
|
+
* tool call, tool result, report — with their summaries, retry state, and the
|
|
12
|
+
* terminal transitions (`return`/`recovered` → done, `failed`, and the
|
|
13
|
+
* stall-break `done` that precedes a forced recovery).
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
* @category UI
|
|
17
|
+
*/
|
|
18
|
+
export const emptyRoster = () => ({ agents: new Map(), nextTimelineId: 0, nextLabelIdx: 0 });
|
|
19
|
+
/** The argument a terminal tool's report is read from unless the application names another. */
|
|
20
|
+
export const DEFAULT_TERMINAL_FIELD = 'result';
|
|
21
|
+
/** Live report markdown from a raw Hermes tool-call buffer
|
|
22
|
+
* (`<tool_call>\n<function=TOOL>\n<parameter=FIELD>\n<markdown>\n</parameter>…`). Null until the open marker
|
|
23
|
+
* arrives, so a half-written call never flashes as prose. A forced recovery streams raw prose with no envelope —
|
|
24
|
+
* callers branch on `recovering` first.
|
|
25
|
+
*
|
|
26
|
+
* Name the terminal `tool` and only ITS call is read: an argument name says nothing about which tool it belongs
|
|
27
|
+
* to, and an ordinary tool may well share one (`write_file(body)` beside `finish(body)`). Without a tool, any
|
|
28
|
+
* call carrying the argument is read. */
|
|
29
|
+
export function extractStreamingReport(buffer, terminal = {}) {
|
|
30
|
+
if (terminal.field === null)
|
|
31
|
+
return null;
|
|
32
|
+
const OPEN = `<parameter=${terminal.field ?? DEFAULT_TERMINAL_FIELD}>`;
|
|
33
|
+
let from = 0;
|
|
34
|
+
if (terminal.tool !== undefined) {
|
|
35
|
+
// The call being written is the last envelope opened, and a call is known by its envelope — the `<function=`
|
|
36
|
+
// that follows `<tool_call>` — never by marker-like text inside a body that is still being written.
|
|
37
|
+
const lastCall = buffer.lastIndexOf('<tool_call>');
|
|
38
|
+
if (lastCall === -1)
|
|
39
|
+
return null;
|
|
40
|
+
const fn = buffer.indexOf('<function=', lastCall);
|
|
41
|
+
if (fn === -1 || !buffer.startsWith(`<function=${terminal.tool}>`, fn))
|
|
42
|
+
return null;
|
|
43
|
+
from = fn;
|
|
44
|
+
}
|
|
45
|
+
const i = buffer.indexOf(OPEN, from);
|
|
46
|
+
if (i === -1)
|
|
47
|
+
return null;
|
|
48
|
+
let body = buffer.slice(i + OPEN.length);
|
|
49
|
+
const c = body.indexOf('</parameter>');
|
|
50
|
+
if (c !== -1)
|
|
51
|
+
body = body.slice(0, c);
|
|
52
|
+
return body.replace(/^\n/, '');
|
|
53
|
+
}
|
|
54
|
+
const THINK_CLOSE = '</think>';
|
|
55
|
+
/** First meaningful line of a think-block body, cleaned up for a title. */
|
|
56
|
+
export function extractTitle(body) {
|
|
57
|
+
const text = body.replace(/^\s*\n/, '').replace(/\*\*/g, '').replace(/^#+\s*/, '').trim();
|
|
58
|
+
if (!text)
|
|
59
|
+
return 'Thinking…';
|
|
60
|
+
const firstLine = text.split('\n')[0].trim();
|
|
61
|
+
return firstLine.length > 72 ? firstLine.slice(0, 72).trimEnd() + '…' : firstLine;
|
|
62
|
+
}
|
|
63
|
+
export function hostOf(url) {
|
|
64
|
+
try {
|
|
65
|
+
return new URL(url).hostname.replace(/^www\./, '');
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return url;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** A one-line summary of a tool call's arguments: the query, pattern, url or filename it named. */
|
|
72
|
+
export function formatArgSummary(_tool, rawArgs) {
|
|
73
|
+
let parsed;
|
|
74
|
+
try {
|
|
75
|
+
parsed = JSON.parse(rawArgs);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
parsed = {};
|
|
79
|
+
}
|
|
80
|
+
const q = typeof parsed.query === 'string' ? parsed.query
|
|
81
|
+
: typeof parsed.pattern === 'string' ? parsed.pattern
|
|
82
|
+
: typeof parsed.url === 'string' ? parsed.url
|
|
83
|
+
: typeof parsed.filename === 'string' ? parsed.filename
|
|
84
|
+
: '';
|
|
85
|
+
return q ? `"${q.length > 48 ? q.slice(0, 48) + '…' : q}"` : '';
|
|
86
|
+
}
|
|
87
|
+
/** A per-tool summary of a result, parsed from the stock abilities' result
|
|
88
|
+
* shapes (web search and fetch, corpus search, grep and read); anything else
|
|
89
|
+
* falls back to the URLs it carries, else its size. */
|
|
90
|
+
export function summarizeResult(tool, raw) {
|
|
91
|
+
try {
|
|
92
|
+
const parsed = JSON.parse(raw);
|
|
93
|
+
if (tool === 'web_search' && Array.isArray(parsed)) {
|
|
94
|
+
const items = parsed;
|
|
95
|
+
const hosts = Array.from(new Set(items.map((i) => (i.url ? hostOf(i.url) : '')).filter(Boolean))).slice(0, 3);
|
|
96
|
+
const sources = items
|
|
97
|
+
.filter((i) => i.url || i.title)
|
|
98
|
+
.slice(0, 8)
|
|
99
|
+
.map((i) => ({ url: i.url, title: i.title, snippet: i.snippet, image: i.image, icon: i.icon, host: i.url ? hostOf(i.url) : undefined }));
|
|
100
|
+
return { summary: `${items.length} results`, hosts, resultCount: items.length, preview: items[0]?.title ?? null, sources: sources.length ? sources : undefined };
|
|
101
|
+
}
|
|
102
|
+
if (tool === 'search' && typeof parsed === 'object' && parsed !== null && Array.isArray(parsed.hits)) {
|
|
103
|
+
const hits = parsed.hits;
|
|
104
|
+
const sources = hits.slice(0, 8).map((h) => ({ title: h.heading || h.file, host: h.file })).filter((s) => s.title || s.host);
|
|
105
|
+
return { summary: `${hits.length} results`, hosts: [], resultCount: hits.length, preview: hits[0]?.heading ?? hits[0]?.file ?? null, sources: sources.length ? sources : undefined };
|
|
106
|
+
}
|
|
107
|
+
if (tool === 'grep' && typeof parsed === 'object' && parsed !== null) {
|
|
108
|
+
const r = parsed;
|
|
109
|
+
const matches = r.matches ?? [];
|
|
110
|
+
const sources = matches.slice(0, 8)
|
|
111
|
+
.map((m) => ({ title: m.file, host: m.line != null ? `line ${m.line}` : undefined, snippet: m.text }))
|
|
112
|
+
.filter((s) => s.title);
|
|
113
|
+
return { summary: `${r.totalMatches ?? 0} matches`, hosts: [], resultCount: r.totalMatches ?? null, preview: matches[0]?.file ?? null, sources: sources.length ? sources : undefined };
|
|
114
|
+
}
|
|
115
|
+
if (tool === 'read_file' && typeof parsed === 'object' && parsed !== null) {
|
|
116
|
+
const r = parsed;
|
|
117
|
+
if (r.error)
|
|
118
|
+
return { summary: r.error, hosts: [], resultCount: null, preview: null };
|
|
119
|
+
const sources = r.file ? [{ title: r.file }] : [];
|
|
120
|
+
return { summary: `${raw.length}b`, hosts: [], resultCount: null, preview: r.file ?? null, sources: sources.length ? sources : undefined };
|
|
121
|
+
}
|
|
122
|
+
if ((tool === 'fetch_page' || tool === 'web_fetch') && typeof parsed === 'object' && parsed !== null) {
|
|
123
|
+
const r = parsed;
|
|
124
|
+
if (r.error)
|
|
125
|
+
return { summary: r.error, hosts: [], resultCount: null, preview: null };
|
|
126
|
+
const hosts = r.url ? [hostOf(r.url)] : [];
|
|
127
|
+
const sources = r.url || r.title
|
|
128
|
+
? [{ url: r.url, title: r.title, snippet: r.excerpt, image: r.image, icon: r.icon, host: r.url ? hostOf(r.url) : undefined }]
|
|
129
|
+
: undefined;
|
|
130
|
+
return { summary: `${raw.length}b`, hosts, resultCount: null, preview: r.title ?? null, sources };
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
/* fall through to the URL scan */
|
|
135
|
+
}
|
|
136
|
+
const urls = Array.from(raw.matchAll(/https?:\/\/[^\s\])>"]+/g)).map((m) => m[0]);
|
|
137
|
+
if (urls.length > 0) {
|
|
138
|
+
return { summary: `${urls.length} links`, hosts: Array.from(new Set(urls.map(hostOf))).slice(0, 3), resultCount: urls.length, preview: null };
|
|
139
|
+
}
|
|
140
|
+
return { summary: `${raw.length}b`, hosts: [], resultCount: null, preview: null };
|
|
141
|
+
}
|
|
142
|
+
// ── immutable helpers over the roster ──────────────────────────────
|
|
143
|
+
function replaceAgent(r, id, patch) {
|
|
144
|
+
const existing = r.agents.get(id);
|
|
145
|
+
if (!existing)
|
|
146
|
+
return r;
|
|
147
|
+
const agents = new Map(r.agents);
|
|
148
|
+
agents.set(id, patch(existing));
|
|
149
|
+
return { ...r, agents };
|
|
150
|
+
}
|
|
151
|
+
function createAgent(r, id, now, patch) {
|
|
152
|
+
if (r.agents.has(id))
|
|
153
|
+
return r;
|
|
154
|
+
const base = {
|
|
155
|
+
id, label: `A${r.nextLabelIdx}`, phase: 'idle', startedAt: now, endedAt: null, tokenCount: 0, toolCallCount: 0,
|
|
156
|
+
taskIndex: null, taskDescription: null, dependencyHint: null, currentThinkId: null, pendingToolCallId: null,
|
|
157
|
+
retry: null, contentBuffer: '', recovering: false, failReason: null, timeline: null,
|
|
158
|
+
...patch,
|
|
159
|
+
};
|
|
160
|
+
const agents = new Map(r.agents);
|
|
161
|
+
agents.set(id, base);
|
|
162
|
+
return { ...r, agents, nextLabelIdx: r.nextLabelIdx + 1 };
|
|
163
|
+
}
|
|
164
|
+
const pushTimeline = (a, item) => ({ ...a, timeline: [...(a.timeline ?? []), item] });
|
|
165
|
+
const updateTimeline = (a, id, update) => ({ ...a, timeline: (a.timeline ?? []).map((it) => (it.id === id ? update(it) : it)) });
|
|
166
|
+
/** Open a new live think block on this agent. */
|
|
167
|
+
function openThink(r, agentId, now) {
|
|
168
|
+
const id = r.nextTimelineId;
|
|
169
|
+
const next = replaceAgent(r, agentId, (a) => pushTimeline({ ...a, currentThinkId: id, phase: 'thinking' }, { kind: 'think', id, title: 'Thinking…', body: '', live: true, openedAt: now, closedAt: null }));
|
|
170
|
+
return { ...next, nextTimelineId: r.nextTimelineId + 1 };
|
|
171
|
+
}
|
|
172
|
+
/** Close the agent's live think block with `finalBody`. */
|
|
173
|
+
function closeThink(r, agentId, finalBody, now) {
|
|
174
|
+
const agent = r.agents.get(agentId);
|
|
175
|
+
if (!agent || agent.currentThinkId === null)
|
|
176
|
+
return r;
|
|
177
|
+
const thinkId = agent.currentThinkId;
|
|
178
|
+
const title = extractTitle(finalBody);
|
|
179
|
+
return replaceAgent(r, agentId, (a) => updateTimeline({ ...a, currentThinkId: null, phase: 'content' }, thinkId, (it) => it.kind === 'think' ? { ...it, body: finalBody, title, live: false, closedAt: now } : it));
|
|
180
|
+
}
|
|
181
|
+
/** Close any live think block, keeping whatever body it holds — the recovery and tool-call paths may reach here without a `</think>`. */
|
|
182
|
+
function closeLiveThink(r, agentId, now) {
|
|
183
|
+
const agent = r.agents.get(agentId);
|
|
184
|
+
if (!agent || agent.currentThinkId === null)
|
|
185
|
+
return r;
|
|
186
|
+
const item = agent.timeline?.find((it) => it.id === agent.currentThinkId);
|
|
187
|
+
return closeThink(r, agentId, item && item.kind === 'think' ? item.body : '', now);
|
|
188
|
+
}
|
|
189
|
+
/** Advance the live think block: append until `</think>`, then close on the marker and seed the content buffer with the tail. */
|
|
190
|
+
function advanceThink(r, agentId, text, tokenCount, now) {
|
|
191
|
+
const agent = r.agents.get(agentId);
|
|
192
|
+
if (!agent || agent.currentThinkId === null)
|
|
193
|
+
return r;
|
|
194
|
+
const thinkId = agent.currentThinkId;
|
|
195
|
+
const item = agent.timeline?.find((it) => it.id === thinkId);
|
|
196
|
+
if (!item || item.kind !== 'think')
|
|
197
|
+
return r;
|
|
198
|
+
const combined = item.body + text;
|
|
199
|
+
const markerIdx = combined.indexOf(THINK_CLOSE);
|
|
200
|
+
if (markerIdx === -1) {
|
|
201
|
+
return replaceAgent(r, agentId, (a) => updateTimeline({ ...a, tokenCount }, thinkId, (it) => (it.kind === 'think' ? { ...it, body: combined } : it)));
|
|
202
|
+
}
|
|
203
|
+
const finalBody = combined.slice(0, markerIdx);
|
|
204
|
+
const tail = combined.slice(markerIdx + THINK_CLOSE.length);
|
|
205
|
+
return replaceAgent(closeThink(r, agentId, finalBody, now), agentId, (a) => ({ ...a, tokenCount, contentBuffer: tail }));
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Fold one agent event into the roster. Returns the same roster when the event
|
|
209
|
+
* changed nothing. An event for an unknown agent is dropped.
|
|
210
|
+
*/
|
|
211
|
+
export function foldAgents(r, ev, opts = {}) {
|
|
212
|
+
const now = (opts.now ?? Date.now)();
|
|
213
|
+
switch (ev.type) {
|
|
214
|
+
case 'agent:spawn': {
|
|
215
|
+
const decision = opts.spawn?.(ev) ?? { timeline: false, taskIndex: null };
|
|
216
|
+
const next = createAgent(r, ev.agentId, now, {
|
|
217
|
+
phase: decision.timeline ? 'thinking' : 'idle',
|
|
218
|
+
timeline: decision.timeline ? [] : null,
|
|
219
|
+
taskIndex: decision.taskIndex,
|
|
220
|
+
taskDescription: decision.taskDescription ?? null,
|
|
221
|
+
dependencyHint: decision.dependencyHint ?? null,
|
|
222
|
+
});
|
|
223
|
+
return decision.timeline ? openThink(next, ev.agentId, now) : next;
|
|
224
|
+
}
|
|
225
|
+
case 'agent:produce': {
|
|
226
|
+
const agent = r.agents.get(ev.agentId);
|
|
227
|
+
if (!agent)
|
|
228
|
+
return r;
|
|
229
|
+
if (agent.timeline === null)
|
|
230
|
+
return replaceAgent(r, ev.agentId, (a) => ({ ...a, tokenCount: ev.tokenCount }));
|
|
231
|
+
// Content-phase tokens (post-</think>, pre-tool_call): the model writing its tool-call JSON — the
|
|
232
|
+
// terminal tool's body lives inside it, so it streams into the buffer a renderer can read live.
|
|
233
|
+
if (agent.phase === 'content' || agent.recovering) {
|
|
234
|
+
return replaceAgent(r, ev.agentId, (a) => ({ ...a, tokenCount: ev.tokenCount, contentBuffer: a.contentBuffer + ev.text }));
|
|
235
|
+
}
|
|
236
|
+
let working = r;
|
|
237
|
+
if (agent.phase !== 'thinking' || agent.currentThinkId === null) {
|
|
238
|
+
if (agent.phase === 'tool' || agent.phase === 'idle')
|
|
239
|
+
working = openThink(working, ev.agentId, now);
|
|
240
|
+
else
|
|
241
|
+
return replaceAgent(working, ev.agentId, (a) => ({ ...a, tokenCount: ev.tokenCount })); // done or failed: count only
|
|
242
|
+
}
|
|
243
|
+
return advanceThink(working, ev.agentId, ev.text, ev.tokenCount, now);
|
|
244
|
+
}
|
|
245
|
+
case 'agent:tool_call': {
|
|
246
|
+
const agent = r.agents.get(ev.agentId);
|
|
247
|
+
if (!agent)
|
|
248
|
+
return r;
|
|
249
|
+
const working = closeLiveThink(r, ev.agentId, now);
|
|
250
|
+
if (agent.timeline === null) {
|
|
251
|
+
return replaceAgent(working, ev.agentId, (a) => ({ ...a, phase: 'tool', toolCallCount: a.toolCallCount + 1 }));
|
|
252
|
+
}
|
|
253
|
+
// The terminal tool fires at the stop token, but its report already streamed as content: no timeline row,
|
|
254
|
+
// the buffer clears, and `agent:return` files the report next.
|
|
255
|
+
const acting = working.agents.get(ev.agentId);
|
|
256
|
+
// A named terminal is recognised by its name and nothing else. Only an application that names none falls
|
|
257
|
+
// back to the shape of what streamed.
|
|
258
|
+
const wasReporting = opts.terminal !== undefined
|
|
259
|
+
? ev.tool === opts.terminal
|
|
260
|
+
: extractStreamingReport(acting?.contentBuffer ?? '', { field: opts.terminalField }) !== null;
|
|
261
|
+
if (wasReporting) {
|
|
262
|
+
return replaceAgent(working, ev.agentId, (a) => ({ ...a, phase: 'tool', toolCallCount: a.toolCallCount + 1, contentBuffer: '' }));
|
|
263
|
+
}
|
|
264
|
+
const id = working.nextTimelineId;
|
|
265
|
+
const next = replaceAgent(working, ev.agentId, (a) => pushTimeline({ ...a, phase: 'tool', toolCallCount: a.toolCallCount + 1, pendingToolCallId: id, contentBuffer: '' }, { kind: 'tool_call', id, tool: ev.tool, argsSummary: formatArgSummary(ev.tool, ev.args) }));
|
|
266
|
+
return { ...next, nextTimelineId: working.nextTimelineId + 1 };
|
|
267
|
+
}
|
|
268
|
+
case 'agent:tool_retry': {
|
|
269
|
+
if (!r.agents.has(ev.agentId))
|
|
270
|
+
return r;
|
|
271
|
+
return replaceAgent(r, ev.agentId, (a) => ({ ...a, retry: { tool: ev.tool, retryAt: now + ev.retryAfterMs, attempt: ev.attempt } }));
|
|
272
|
+
}
|
|
273
|
+
case 'agent:tool_result': {
|
|
274
|
+
const agent = r.agents.get(ev.agentId);
|
|
275
|
+
if (!agent)
|
|
276
|
+
return r;
|
|
277
|
+
if (agent.timeline === null)
|
|
278
|
+
return replaceAgent(r, ev.agentId, (a) => ({ ...a, phase: 'idle', retry: null }));
|
|
279
|
+
const summary = summarizeResult(ev.tool, ev.result);
|
|
280
|
+
const id = r.nextTimelineId;
|
|
281
|
+
const next = replaceAgent(r, ev.agentId, (a) => pushTimeline({ ...a, phase: 'idle', pendingToolCallId: null, retry: null }, {
|
|
282
|
+
kind: 'tool_result', id, tool: ev.tool, callId: agent.pendingToolCallId, byteLength: ev.result.length,
|
|
283
|
+
preview: summary.preview, hosts: Array.from(new Set(summary.hosts)), resultCount: summary.resultCount, sources: summary.sources,
|
|
284
|
+
}));
|
|
285
|
+
return { ...next, nextTimelineId: r.nextTimelineId + 1 };
|
|
286
|
+
}
|
|
287
|
+
case 'agent:return':
|
|
288
|
+
case 'agent:recovered': {
|
|
289
|
+
const agent = r.agents.get(ev.agentId);
|
|
290
|
+
if (!agent)
|
|
291
|
+
return r;
|
|
292
|
+
const working = closeLiveThink(r, ev.agentId, now);
|
|
293
|
+
if (agent.timeline === null) {
|
|
294
|
+
return replaceAgent(working, ev.agentId, (a) => ({ ...a, phase: 'done', endedAt: now, contentBuffer: '', recovering: false }));
|
|
295
|
+
}
|
|
296
|
+
const id = working.nextTimelineId;
|
|
297
|
+
const next = replaceAgent(working, ev.agentId, (a) => pushTimeline({ ...a, phase: 'done', endedAt: now, contentBuffer: '', recovering: false }, { kind: 'report', id, body: ev.result, tokenCount: a.tokenCount }));
|
|
298
|
+
return { ...next, nextTimelineId: working.nextTimelineId + 1 };
|
|
299
|
+
}
|
|
300
|
+
case 'agent:failed': {
|
|
301
|
+
const agent = r.agents.get(ev.agentId);
|
|
302
|
+
if (!agent || agent.phase === 'done' || agent.phase === 'failed')
|
|
303
|
+
return r;
|
|
304
|
+
const working = closeLiveThink(r, ev.agentId, now);
|
|
305
|
+
return replaceAgent(working, ev.agentId, (a) => ({ ...a, phase: 'failed', endedAt: now, contentBuffer: '', recovering: false, failReason: ev.reason }));
|
|
306
|
+
}
|
|
307
|
+
case 'agent:done': {
|
|
308
|
+
// Not `done` yet: in the stall-break path this precedes the forced recovery's produce stream and
|
|
309
|
+
// `agent:recovered`. Close any live think, step back to idle, and route what follows into the buffer.
|
|
310
|
+
const agent = r.agents.get(ev.agentId);
|
|
311
|
+
if (!agent || agent.phase === 'done' || agent.phase === 'failed')
|
|
312
|
+
return r; // terminal either way
|
|
313
|
+
const working = closeLiveThink(r, ev.agentId, now);
|
|
314
|
+
return replaceAgent(working, ev.agentId, (a) => ({ ...a, phase: 'idle', contentBuffer: '', recovering: true }));
|
|
315
|
+
}
|
|
316
|
+
default:
|
|
317
|
+
return r;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=fold.js.map
|
package/dist/fold.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fold.js","sourceRoot":"","sources":["../src/fold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA4EH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAgB,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,GAAG,EAAE,EAAE,cAAc,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAAC,CAAC;AAuC1G,+FAA+F;AAC/F,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAE/C;;;;;;;0CAO0C;AAC1C,MAAM,UAAU,sBAAsB,CAAC,MAAc,EAAE,WAAqD,EAAE;IAC5G,IAAI,QAAQ,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACzC,MAAM,IAAI,GAAG,cAAc,QAAQ,CAAC,KAAK,IAAI,sBAAsB,GAAG,CAAC;IACvE,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,IAAI,QAAQ,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;QAChC,6GAA6G;QAC7G,oGAAoG;QACpG,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;QACnD,IAAI,QAAQ,KAAK,CAAC,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EAAE,GAAG,EAAE,aAAa,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC1J,CAAC;QAED,KAAK,YAAY,CAAC,CAAC,CAAC;YAClB,iGAAiG;YACjG,sGAAsG;YACtG,MAAM,KAAK,GAAG,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;YACvC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ;gBAAE,OAAO,CAAC,CAAC,CAAG,sBAAsB;YACpG,MAAM,OAAO,GAAG,cAAc,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACnD,OAAO,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAClH,CAAC;QAED;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@lloyal-labs/ui` — the view side of a harness, for React.
|
|
3
|
+
*
|
|
4
|
+
* The provider connects a bridge's projection once; the hooks read the fold,
|
|
5
|
+
* the wire's status, the command sink and the content plane's origin. The
|
|
6
|
+
* primitives are the pieces every harness view rebuilt: markdown with math,
|
|
7
|
+
* the one enlarged view of an asset, and what a root is. The generic agent
|
|
8
|
+
* fold is framework-free and lives at `@lloyal-labs/ui/fold`, so a fold that
|
|
9
|
+
* runs where React does not (a terminal, a desktop shell's own process) takes
|
|
10
|
+
* that entry alone; a markdown body's headings, links and heading ids are
|
|
11
|
+
* `@lloyal-labs/ui/prose`, framework-free too.
|
|
12
|
+
*
|
|
13
|
+
* Browser-safe: nothing here imports a Node module.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
* @category UI
|
|
17
|
+
*/
|
|
18
|
+
export { HarnessProvider, projectionFor, useHarness, useProjection, useSend, useConnection, useAvailability, useRecover, useContentOrigin } from './provider.js';
|
|
19
|
+
export type { Harness } from './provider.js';
|
|
20
|
+
export { Markdown } from './markdown.js';
|
|
21
|
+
export type { MarkdownComponents } from './markdown.js';
|
|
22
|
+
export { Lightbox } from './lightbox.js';
|
|
23
|
+
export type { LightboxProps } from './lightbox.js';
|
|
24
|
+
export { resolveAsset, useAssets, pageFacts, pageList } from './assets.js';
|
|
25
|
+
export type { Asset } from './assets.js';
|
|
26
|
+
export * from './fold.js';
|
|
27
|
+
export * from './prose.js';
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjK,YAAY,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@lloyal-labs/ui` — the view side of a harness, for React.
|
|
3
|
+
*
|
|
4
|
+
* The provider connects a bridge's projection once; the hooks read the fold,
|
|
5
|
+
* the wire's status, the command sink and the content plane's origin. The
|
|
6
|
+
* primitives are the pieces every harness view rebuilt: markdown with math,
|
|
7
|
+
* the one enlarged view of an asset, and what a root is. The generic agent
|
|
8
|
+
* fold is framework-free and lives at `@lloyal-labs/ui/fold`, so a fold that
|
|
9
|
+
* runs where React does not (a terminal, a desktop shell's own process) takes
|
|
10
|
+
* that entry alone; a markdown body's headings, links and heading ids are
|
|
11
|
+
* `@lloyal-labs/ui/prose`, framework-free too.
|
|
12
|
+
*
|
|
13
|
+
* Browser-safe: nothing here imports a Node module.
|
|
14
|
+
*
|
|
15
|
+
* @packageDocumentation
|
|
16
|
+
* @category UI
|
|
17
|
+
*/
|
|
18
|
+
export { HarnessProvider, projectionFor, useHarness, useProjection, useSend, useConnection, useAvailability, useRecover, useContentOrigin } from './provider.js';
|
|
19
|
+
export { Markdown } from './markdown.js';
|
|
20
|
+
export { Lightbox } from './lightbox.js';
|
|
21
|
+
export { resolveAsset, useAssets, pageFacts, pageList } from './assets.js';
|
|
22
|
+
export * from './fold.js';
|
|
23
|
+
export * from './prose.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjK,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE3E,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CSSProperties, ReactElement } from 'react';
|
|
2
|
+
export interface LightboxProps {
|
|
3
|
+
/** The root of a single image to show — a photo, a page render. */
|
|
4
|
+
digest?: string;
|
|
5
|
+
/** Or a PDF to open in the browser's own viewer: the URL the content plane serves the original at. */
|
|
6
|
+
pdf?: string;
|
|
7
|
+
/** The representation's true pixel size, when the caller read it off the loaded element. */
|
|
8
|
+
dims?: string;
|
|
9
|
+
/** What is being shown, when it is not simply "the attached image". */
|
|
10
|
+
label?: string;
|
|
11
|
+
onClose: () => void;
|
|
12
|
+
/** The caller's register: the scrim, the image and the caption. */
|
|
13
|
+
styles?: {
|
|
14
|
+
scrim?: CSSProperties;
|
|
15
|
+
full?: CSSProperties;
|
|
16
|
+
pdf?: CSSProperties;
|
|
17
|
+
caption?: CSSProperties;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare function Lightbox({ digest, pdf, dims, label, onClose, styles }: LightboxProps): ReactElement | null;
|
|
21
|
+
//# sourceMappingURL=lightbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightbox.d.ts","sourceRoot":"","sources":["../src/lightbox.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAMzD,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sGAAsG;IACtG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4FAA4F;IAC5F,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,mEAAmE;IACnE,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,aAAa,CAAC;QAAC,IAAI,CAAC,EAAE,aAAa,CAAC;QAAC,GAAG,CAAC,EAAE,aAAa,CAAC;QAAC,OAAO,CAAC,EAAE,aAAa,CAAA;KAAE,CAAC;CACxG;AAYD,wBAAgB,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAW,EAAE,EAAE,aAAa,GAAG,YAAY,GAAG,IAAI,CA6B/G"}
|
package/dist/lightbox.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The full-size view of one asset: a single image by its root, or a PDF in
|
|
4
|
+
* the browser's own viewer. One enlarged view for a whole app — the figure
|
|
5
|
+
* strip, a run bar's marker and a cited page in the prose all open this one,
|
|
6
|
+
* so there is one that cannot drift. Escape and a click on the scrim close it.
|
|
7
|
+
*
|
|
8
|
+
* @category UI
|
|
9
|
+
*/
|
|
10
|
+
import { useEffect } from 'react';
|
|
11
|
+
import { representationUrl } from '@lloyal-labs/media';
|
|
12
|
+
import { useContentOrigin } from './provider.js';
|
|
13
|
+
const short = (digest) => digest.replace(/^sha256:/, '').slice(0, 10);
|
|
14
|
+
const S = {
|
|
15
|
+
scrim: {
|
|
16
|
+
position: 'fixed', inset: 0, zIndex: 50, cursor: 'zoom-out', background: 'rgba(20,20,22,.82)',
|
|
17
|
+
display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'center', gap: 12, padding: 32,
|
|
18
|
+
},
|
|
19
|
+
full: { maxWidth: '100%', maxHeight: 'calc(100vh - 110px)', objectFit: 'contain', borderRadius: 12, background: '#fff' },
|
|
20
|
+
pdf: { width: 'min(1100px, 94vw)', height: 'calc(100vh - 110px)', border: 0, borderRadius: 12, background: '#fff' },
|
|
21
|
+
caption: { font: '12px system-ui, sans-serif', color: '#D8D8D2', margin: 0 },
|
|
22
|
+
};
|
|
23
|
+
export function Lightbox({ digest, pdf, dims, label, onClose, styles = {} }) {
|
|
24
|
+
const origin = useContentOrigin();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const onKey = (e) => {
|
|
27
|
+
if (e.key === 'Escape')
|
|
28
|
+
onClose();
|
|
29
|
+
};
|
|
30
|
+
window.addEventListener('keydown', onKey);
|
|
31
|
+
return () => window.removeEventListener('keydown', onKey);
|
|
32
|
+
}, [onClose]);
|
|
33
|
+
if (origin === null)
|
|
34
|
+
return null;
|
|
35
|
+
const s = { ...S, ...styles };
|
|
36
|
+
if (pdf !== undefined) {
|
|
37
|
+
return (_jsxs("div", { style: s.scrim, role: "dialog", "aria-modal": "true", "aria-label": label ?? 'Attached document', onClick: onClose, children: [_jsx("iframe", { src: pdf, title: label ?? 'Attached document', style: s.pdf, onClick: (e) => e.stopPropagation() }), _jsxs("p", { style: s.caption, children: [label ?? 'the attached document', " \u00B7 the file as attached"] })] }));
|
|
38
|
+
}
|
|
39
|
+
if (digest === undefined)
|
|
40
|
+
return null;
|
|
41
|
+
return (_jsxs("div", { style: s.scrim, role: "dialog", "aria-modal": "true", "aria-label": label ?? 'Attached image, full size', onClick: onClose, children: [_jsx("img", { src: representationUrl(origin, digest), alt: label ?? 'Attached image, as the model received it', style: s.full }), _jsxs("p", { style: s.caption, children: [label ?? 'what the model saw', dims ? ` · ${dims}` : '', " \u00B7 ", short(digest)] })] }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=lightbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lightbox.js","sourceRoot":"","sources":["../src/lightbox.tsx"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE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AK,EAAE,CAAC,CAAC,OAAO,aAChB,KAAK,IAAI,oBAAoB,EAAE,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,cAAK,KAAK,CAAC,MAAM,CAAC,IACxE,IACA,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
import type { Components } from 'react-markdown';
|
|
3
|
+
import 'katex/dist/katex.min.css';
|
|
4
|
+
export type { Components as MarkdownComponents } from 'react-markdown';
|
|
5
|
+
/** Memoized on its props: a settled block keeps its parse while a sibling streams. */
|
|
6
|
+
export declare const Markdown: import("react").NamedExoticComponent<{
|
|
7
|
+
markdown: string;
|
|
8
|
+
/** The caller's renderers — links with citation chips, headings with anchors, the prose's own type. */
|
|
9
|
+
components?: Components;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=markdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.d.ts","sourceRoot":"","sources":["../src/markdown.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAIjD,OAAO,0BAA0B,CAAC;AAGlC,YAAY,EAAE,UAAU,IAAI,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAUvE,sFAAsF;AACtF,eAAO,MAAM,QAAQ;cACT,MAAM;IAChB,uGAAuG;iBAC1F,UAAU;YACf,aAAa;EAerB,CAAC"}
|
package/dist/markdown.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Markdown in a harness view: GitHub-flavoured, with math set by KaTeX, links
|
|
4
|
+
* left to the caller's renderers, and urls admitted by the view's one policy
|
|
5
|
+
* (`admitUrl`, shared with `linksOf`) so a cited page
|
|
6
|
+
* (`attachment://…/page/n`) reaches the caller's link component instead of
|
|
7
|
+
* being stripped as unknown.
|
|
8
|
+
*
|
|
9
|
+
* Math takes the document's own face where that is safe: inline runs inherit
|
|
10
|
+
* the surrounding font, while stacked constructs (fractions, radicals,
|
|
11
|
+
* accents, sized operators and delimiters) keep KaTeX's fonts — its metrics
|
|
12
|
+
* position them, and an inherited face's taller numerals crash into the bar.
|
|
13
|
+
*
|
|
14
|
+
* @category UI
|
|
15
|
+
*/
|
|
16
|
+
import { memo } from 'react';
|
|
17
|
+
import ReactMarkdown from 'react-markdown';
|
|
18
|
+
import remarkGfm from 'remark-gfm';
|
|
19
|
+
import remarkMath from 'remark-math';
|
|
20
|
+
import rehypeKatex from 'rehype-katex';
|
|
21
|
+
import 'katex/dist/katex.min.css';
|
|
22
|
+
import { admitUrl } from './prose.js';
|
|
23
|
+
const MATH = `
|
|
24
|
+
.katex { font-size: 1em !important; }
|
|
25
|
+
.katex, .katex *:not(.delimsizing, .op-symbol) { font-family: inherit !important; }
|
|
26
|
+
.katex :is(.mfrac, .sqrt, .root, .accent) * {
|
|
27
|
+
font-family: KaTeX_Main, "Times New Roman", serif !important;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
/** Memoized on its props: a settled block keeps its parse while a sibling streams. */
|
|
31
|
+
export const Markdown = memo(function Markdown({ markdown, components, style }) {
|
|
32
|
+
return (_jsxs("div", { style: style, children: [_jsx("style", { children: MATH }), _jsx(ReactMarkdown, { remarkPlugins: [remarkGfm, remarkMath], rehypePlugins: [[rehypeKatex, { throwOnError: false }]], urlTransform: admitUrl, components: components, children: markdown })] }));
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"markdown.js","sourceRoot":"","sources":["../src/markdown.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAE3C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,UAAU,MAAM,aAAa,CAAC;AACrC,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,MAAM,IAAI,GAAG;;;;;;CAMZ,CAAC;AAEF,sFAAsF;AACtF,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,QAAQ,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAK3E;IACC,OAAO,CACL,eAAK,KAAK,EAAE,KAAK,aACf,0BAAQ,IAAI,GAAS,EACrB,KAAC,aAAa,IACZ,aAAa,EAAE,CAAC,SAAS,EAAE,UAAU,CAAC,EACtC,aAAa,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,CAAC,EACvD,YAAY,EAAE,QAAQ,EACtB,UAAU,EAAE,UAAU,YAErB,QAAQ,GACK,IACZ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/dist/prose.d.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export interface Heading {
|
|
2
|
+
/** 1–6, the `#` count. */
|
|
3
|
+
depth: number;
|
|
4
|
+
/** The heading as rendered: inline markup resolved to the text it wraps. */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Where the heading starts in the body, in characters. */
|
|
7
|
+
offset: number;
|
|
8
|
+
}
|
|
9
|
+
export interface Link {
|
|
10
|
+
href: string;
|
|
11
|
+
/** The link's text as rendered. */
|
|
12
|
+
text: string;
|
|
13
|
+
/** Where the link starts in the body, in characters. */
|
|
14
|
+
offset: number;
|
|
15
|
+
}
|
|
16
|
+
export interface Anchor {
|
|
17
|
+
/** The element id: `<prefix>-<slug>`, numbered from the second repeat (`-2`, `-3`, …). */
|
|
18
|
+
anchor: string;
|
|
19
|
+
text: string;
|
|
20
|
+
depth: number;
|
|
21
|
+
}
|
|
22
|
+
/** The ONE url policy of a harness view: the content plane's scheme (`attachment://…`) is admitted, a relative
|
|
23
|
+
* url or a safe scheme passes, anything else (`javascript:`, `data:`) is stripped to `''`. `Markdown` renders
|
|
24
|
+
* through it and `linksOf` reports through it, so a citation built from a link carries the href the page
|
|
25
|
+
* carries. */
|
|
26
|
+
export declare function admitUrl(url: string): string;
|
|
27
|
+
/** Every heading in document order. */
|
|
28
|
+
export declare function headingsOf(markdown: string): Heading[];
|
|
29
|
+
/** Every link in document order, as the renderer draws them: inline links, the bare urls GFM links, and
|
|
30
|
+
* reference-style links resolved through their definitions — the FIRST definition of an identifier, as
|
|
31
|
+
* CommonMark resolves it (an unresolved reference renders as text and is not a link). Each href has passed
|
|
32
|
+
* {@link admitUrl}, so a link whose scheme the renderer strips is reported with the same empty href. */
|
|
33
|
+
export declare function linksOf(markdown: string): Link[];
|
|
34
|
+
/** The id each heading is given under `prefix`, in document order — the ONE derivation, so an outline that
|
|
35
|
+
* names an anchor and the prose that carries it cannot disagree. A repeated heading is numbered from its
|
|
36
|
+
* second appearance, and the number is taken against the ids already given out, not the slug's count: `A`,
|
|
37
|
+
* `A`, `A-2` become `a`, `a-2`, `a-2-2`, never two `a-2`s. A renderer assigns these to its heading elements
|
|
38
|
+
* in the same order. */
|
|
39
|
+
export declare function anchorsOf(headings: readonly Heading[], prefix: string): Anchor[];
|
|
40
|
+
/** Where streaming prose stops being finished. Everything up to the last block CommonMark recognises is
|
|
41
|
+
* complete, parsed once and kept while it stands; the last block is the one still being written, parsed per
|
|
42
|
+
* token. The boundaries are marked's — a spec-tested block tokenizer, used here only to find where the last
|
|
43
|
+
* block starts: a loose list is one block, a fence owns its blank lines. A block boundary this misjudges
|
|
44
|
+
* would cost one extra parse of one block, never a wrong document — except for two constructs marked does not
|
|
45
|
+
* see the way the renderer does, where the split is refused and the whole buffer is the tail:
|
|
46
|
+
* - a reference definition (anywhere, a blockquote included) resolves links in EARLIER blocks, so a head
|
|
47
|
+
* rendered without it would show those references as text;
|
|
48
|
+
* - a display equation (`$$…$$`) may span a blank line, which marked reads as a block boundary; cut there,
|
|
49
|
+
* the renderer would draw an equation, a paragraph and an empty equation — and nothing short of the
|
|
50
|
+
* renderer's grammar can say where one opens (a `$$` in inline code is not a delimiter; `$$$$` is).
|
|
51
|
+
* A document that carries either is rendered whole: the split is refused for the document's whole life, and
|
|
52
|
+
* the cost of that is paid only by documents with display math or reference definitions. */
|
|
53
|
+
export declare function splitStreaming(markdown: string): {
|
|
54
|
+
head: string;
|
|
55
|
+
tail: string;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=prose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.d.ts","sourceRoot":"","sources":["../src/prose.ts"],"names":[],"mappings":"AA+BA,MAAM,WAAW,OAAO;IACtB,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,0FAA0F;IAC1F,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAOD;;;eAGe;AACf,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAc5C;AA4CD,uCAAuC;AACvC,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,EAAE,CAMtD;AAED;;;yGAGyG;AACzG,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,EAAE,CAchD;AAKD;;;;yBAIyB;AACzB,wBAAgB,SAAS,CAAC,QAAQ,EAAE,SAAS,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAShF;AAED;;;;;;;;;;;;6FAY6F;AAC7F,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAO/E"}
|