@klarkxy/dsh-deep-view 0.1.0 → 0.2.0

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core2.js","names":[],"sources":["../src/core/formula.js","../src/core/views.js"],"sourcesContent":["// Adapted from deep-view/src/core/formula.js (deep-view 0.1.0, Apache-2.0).\n// Kept as the same bounded expression interpreter: no eval, property access,\n// assignment or loops. The DSH migration preserves its grammar and error model.\n// It reads names and calls a fixed set of functions without reaching the page.\n\nconst FUNCTIONS = {\n min: { args: [1, Infinity], run: (...values) => Math.min(...values.map(num)) },\n max: { args: [1, Infinity], run: (...values) => Math.max(...values.map(num)) },\n abs: { args: [1, 1], run: value => Math.abs(num(value)) },\n floor: { args: [1, 1], run: value => Math.floor(num(value)) },\n ceil: { args: [1, 1], run: value => Math.ceil(num(value)) },\n sqrt: { args: [1, 1], run: value => Math.sqrt(num(value)) },\n pow: { args: [2, 2], run: (base, power) => num(base) ** num(power) },\n round: { args: [1, 2], run: (value, digits = 0) => roundTo(num(value), digitsOf(digits)) },\n clamp: { args: [3, 3], run: (value, low, high) => Math.min(Math.max(num(value), num(low)), num(high)) },\n fixed: { args: [1, 2], run: (value, digits = 0) => roundTo(num(value), digitsOf(digits)).toFixed(digitsOf(digits)) },\n format: { args: [1, 2], run: (value, digits = 0) => grouped(num(value), digitsOf(digits)) },\n percent: { args: [1, 2], run: (value, digits = 0) => `${grouped(num(value) * 100, digitsOf(digits))}%` },\n}\nexport const FORMULA_FUNCTIONS = Object.keys(FUNCTIONS)\nconst CONSTANTS = new Map([['true', true], ['false', false]])\n// Nesting deeper than this is no calculation a view needs; the parser recurses per level.\nconst MAX_NESTING = 64\n\nclass FormulaError extends Error {}\nconst fail = (message) => { throw new FormulaError(message) }\n\nfunction num(value) {\n if (typeof value === 'number') return value\n if (typeof value === 'boolean') return value ? 1 : 0\n const parsed = Number(value)\n if (typeof value === 'string' && value.trim() !== '' && !Number.isNaN(parsed)) return parsed\n return fail(`${JSON.stringify(value)} is not a number`)\n}\nconst digitsOf = (digits) => {\n const value = num(digits)\n if (!Number.isInteger(value) || value < 0 || value > 10) fail('digits must be a whole number from 0 to 10')\n return value\n}\nconst roundTo = (value, digits) => {\n const scale = 10 ** digits\n return Math.round(value * scale) / scale\n}\nfunction grouped(value, digits) {\n if (!Number.isFinite(value)) return String(value)\n const [whole, part] = Math.abs(roundTo(value, digits)).toFixed(digits).split('.')\n const sign = value < 0 && Number(whole + (part ?? '')) !== 0 ? '-' : ''\n return `${sign}${whole.replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',')}${part ? `.${part}` : ''}`\n}\n\n// -------------------------------------------------------------------------\n// Tokens and parsing\n\nconst IDENT = /^[A-Za-z_][A-Za-z0-9_]*$/\nexport const isName = value => typeof value === 'string' && IDENT.test(value)\nconst OPERATORS = ['==', '!=', '<=', '>=', '&&', '||', '+', '-', '*', '/', '%', '<', '>', '!', '?', ':', '(', ')', ',']\n\nfunction tokenize(source) {\n const tokens = []\n let at = 0\n while (at < source.length) {\n const char = source[at]\n if (/\\s/.test(char)) { at += 1; continue }\n const number = /^(?:\\d+\\.?\\d*|\\.\\d+)(?:[eE][+-]?\\d+)?/.exec(source.slice(at))\n if (number) { tokens.push({ kind: 'number', value: Number(number[0]), at }); at += number[0].length; continue }\n const name = /^[A-Za-z_][A-Za-z0-9_]*/.exec(source.slice(at))\n if (name) { tokens.push({ kind: 'name', value: name[0], at }); at += name[0].length; continue }\n if (char === '\"' || char === '\\'') {\n let end = at + 1\n let text = ''\n while (end < source.length && source[end] !== char) {\n if (source[end] === '\\\\' && end + 1 < source.length) { text += source[end + 1]; end += 2; continue }\n text += source[end]\n end += 1\n }\n if (end >= source.length) fail(`unclosed string at ${at + 1}`)\n tokens.push({ kind: 'string', value: text, at })\n at = end + 1\n continue\n }\n const operator = OPERATORS.find(op => source.startsWith(op, at))\n if (operator === undefined) fail(`unexpected ${JSON.stringify(char)} at ${at + 1}`)\n tokens.push({ kind: 'op', value: operator, at })\n at += operator.length\n }\n return tokens\n}\n\nconst BINARY = [['||'], ['&&'], ['==', '!='], ['<', '<=', '>', '>='], ['+', '-'], ['*', '/', '%']]\n\nfunction parse(source) {\n const tokens = tokenize(source)\n let index = 0\n let depth = 0\n const peek = () => tokens[index]\n const isOp = value => peek()?.kind === 'op' && peek().value === value\n const expect = (value) => {\n if (!isOp(value)) fail(peek() ? `expected \"${value}\" at ${peek().at + 1}` : `expected \"${value}\" at the end`)\n index += 1\n }\n const nest = (read) => {\n depth += 1\n if (depth > MAX_NESTING) fail(`nested more than ${MAX_NESTING} levels`)\n const node = read()\n depth -= 1\n return node\n }\n const ternary = () => nest(() => {\n const test = binary(0)\n if (!isOp('?')) return test\n index += 1\n const yes = ternary()\n expect(':')\n return { type: 'if', test, yes, no: ternary() }\n })\n const binary = (level) => {\n if (level === BINARY.length) return unary()\n let left = binary(level + 1)\n while (peek()?.kind === 'op' && BINARY[level].includes(peek().value)) {\n const op = peek().value\n index += 1\n left = { type: 'binary', op, left, right: binary(level + 1) }\n }\n return left\n }\n const unary = () => {\n if (isOp('-') || isOp('!') || isOp('+')) {\n const op = peek().value\n index += 1\n return nest(() => ({ type: 'unary', op, value: unary() }))\n }\n return primary()\n }\n const primary = () => {\n const token = peek()\n if (token === undefined) fail('the formula ends too early')\n index += 1\n if (token.kind === 'number' || token.kind === 'string') return { type: 'value', value: token.value }\n if (token.kind === 'op' && token.value === '(') {\n const inner = ternary()\n expect(')')\n return inner\n }\n if (token.kind !== 'name') fail(`unexpected \"${token.value}\" at ${token.at + 1}`)\n if (!isOp('(')) return CONSTANTS.has(token.value) ? { type: 'value', value: CONSTANTS.get(token.value) } : { type: 'name', name: token.value }\n const fn = Object.hasOwn(FUNCTIONS, token.value) ? FUNCTIONS[token.value] : undefined\n if (fn === undefined) fail(`unknown function \"${token.value}\"; allowed: ${FORMULA_FUNCTIONS.join(', ')}`)\n index += 1\n const args = []\n if (!isOp(')')) {\n args.push(ternary())\n while (isOp(',')) { index += 1; args.push(ternary()) }\n }\n expect(')')\n if (args.length < fn.args[0] || args.length > fn.args[1]) {\n fail(`${token.value}() takes ${fn.args[0] === fn.args[1] ? fn.args[0] : fn.args[1] === Infinity ? `at least ${fn.args[0]}` : `${fn.args[0]} or ${fn.args[1]}`} argument${fn.args[1] === 1 ? '' : 's'}; got ${args.length}`)\n }\n return { type: 'call', name: token.value, args }\n }\n if (tokens.length === 0) fail('the formula is empty')\n const tree = ternary()\n if (index < tokens.length) fail(`unexpected \"${peek().value}\" at ${peek().at + 1}`)\n return tree\n}\n\nfunction namesIn(node, found = new Set()) {\n if (node.type === 'name') found.add(node.name)\n else if (node.type === 'unary') namesIn(node.value, found)\n else if (node.type === 'binary') { namesIn(node.left, found); namesIn(node.right, found) }\n else if (node.type === 'if') { namesIn(node.test, found); namesIn(node.yes, found); namesIn(node.no, found) }\n else if (node.type === 'call') for (const arg of node.args) namesIn(arg, found)\n return found\n}\n\n// { tree, names } or { error }. `names` are the names the formula reads.\nexport function compileFormula(source) {\n if (typeof source !== 'string') return { error: 'expected a formula string' }\n try {\n const tree = parse(source)\n return { tree, names: [...namesIn(tree)] }\n } catch (error) {\n if (error instanceof FormulaError) return { error: error.message }\n throw error\n }\n}\n\n// -------------------------------------------------------------------------\n// Evaluation. `lookup(name)` returns a name's value or throws.\n\nfunction run(node, lookup) {\n switch (node.type) {\n case 'value': return node.value\n case 'name': return lookup(node.name)\n case 'unary': {\n const value = run(node.value, lookup)\n if (node.op === '!') return !truthy(value)\n return node.op === '-' ? -num(value) : num(value)\n }\n case 'if': return truthy(run(node.test, lookup)) ? run(node.yes, lookup) : run(node.no, lookup)\n case 'call': return FUNCTIONS[node.name].run(...node.args.map(arg => run(arg, lookup)))\n default: return binary(node, lookup)\n }\n}\nconst truthy = value => (typeof value === 'string' ? value !== '' : Boolean(value))\n\nfunction binary(node, lookup) {\n if (node.op === '&&') return truthy(run(node.left, lookup)) ? run(node.right, lookup) : false\n if (node.op === '||') { const left = run(node.left, lookup); return truthy(left) ? left : run(node.right, lookup) }\n const left = run(node.left, lookup)\n const right = run(node.right, lookup)\n switch (node.op) {\n case '+': return typeof left === 'string' || typeof right === 'string' ? `${show(left)}${show(right)}` : num(left) + num(right)\n case '-': return num(left) - num(right)\n case '*': return num(left) * num(right)\n case '/': return num(left) / num(right)\n case '%': return num(left) % num(right)\n case '==': return left === right\n case '!=': return left !== right\n case '<': return num(left) < num(right)\n case '<=': return num(left) <= num(right)\n case '>': return num(left) > num(right)\n default: return num(left) >= num(right)\n }\n}\n\n// A value as text: numbers lose float noise (0.1 + 0.2 shows 0.3).\nexport function show(value) {\n if (typeof value === 'number') return Number.isFinite(value) ? String(Number(value.toPrecision(12))) : String(value)\n return String(value)\n}\n\n// A scope for one view: input values, plus `let` names worked out on demand. A cycle\n// or a missing name fails the formula that reads it.\nexport function createScope(inputs, lets) {\n const done = new Map()\n const busy = new Set()\n const lookup = (name) => {\n if (inputs.has(name)) return inputs.get(name)\n if (done.has(name)) return done.get(name)\n const tree = lets.get(name)\n if (tree === undefined) fail(`unknown name \"${name}\"`)\n if (busy.has(name)) fail(`\"${name}\" refers to itself`)\n busy.add(name)\n try {\n const value = run(tree, lookup)\n done.set(name, value)\n return value\n } finally { busy.delete(name) }\n }\n return lookup\n}\n\n// { value } or { error }.\nexport function evaluate(tree, lookup) {\n try {\n return { value: run(tree, lookup) }\n } catch (error) {\n if (error instanceof FormulaError) return { error: error.message }\n if (error instanceof RangeError) return { error: 'the formula is too deep to work out' }\n throw error\n }\n}\n","// Adapted from deep-view/src/core/views.js (deep-view 0.1.0, Apache-2.0).\n// DSH migration: html is deliberately rejected rather than migrating its frame;\n// validation, formulas and answers retain the original bounded JSON semantics.\n// Pure validation and evaluation of a declarative card, on Host and Client.\n// Formulas use formula.js; model-authored code never enters the DOM.\n\nimport { compileFormula, createScope, evaluate, isName, show } from './formula.js'\n\nconst LAYOUT = ['stack', 'row']\nconst DISPLAY = ['text', 'metric', 'table', 'chart', 'progress', 'callout', 'sources']\nconst INPUT_TYPES = ['slider', 'choice', 'toggle', 'number']\nconst ANSWERS = ['options', 'confirm', 'form', 'submit']\nconst COMPONENTS = [...LAYOUT, ...DISPLAY, ...INPUT_TYPES, ...ANSWERS]\nconst TONES = ['good', 'warn', 'bad']\nconst TEXT_TONES = ['muted']\nconst CALLOUT_TONES = ['info', 'good', 'warn', 'bad']\nexport const CHART_KINDS = ['bar', 'hbar', 'line', 'area', 'donut']\nconst INTERACTIVE = new Set(ANSWERS)\nconst INPUTS = new Set(INPUT_TYPES)\nconst PROPS = {\n stack: ['children', 'let'],\n row: ['children', 'let'],\n text: ['text', 'tone'],\n metric: ['label', 'value', 'tone', 'caption'],\n table: ['columns', 'rows'],\n chart: ['kind', 'categories', 'series', 'unit', 'caption'],\n progress: ['label', 'percent', 'value', 'max', 'valueLabel', 'tone'],\n callout: ['text', 'tone'],\n sources: ['items'],\n slider: ['id', 'label', 'min', 'max', 'step', 'value', 'unit'],\n choice: ['id', 'label', 'options', 'value'],\n toggle: ['id', 'label', 'value'],\n number: ['id', 'label', 'min', 'max', 'step', 'value', 'unit'],\n options: ['id', 'options', 'multi'],\n confirm: ['id', 'confirmLabel', 'cancelLabel'],\n form: ['id', 'fields', 'submitLabel'],\n submit: ['id', 'label'],\n}\nconst MAX_DEPTH = 8\nconst MAX_NODES = 64\nconst MAX_CHILDREN = 16\nconst MAX_TEXT = 2000\nconst MAX_CELL = 200\nconst MAX_COLUMNS = 8\nconst MAX_ROWS = 50\nconst MAX_OPTIONS = 8\nconst MAX_FIELDS = 6\nconst SUMMARY_PART = 40\nconst SUMMARY_COUNT = 8\nconst RESERVED = new Set(['true', 'false'])\n// UTF-8 bytes of the blueprint JSON plus the title. Not a wrapped document:\n// the tool rejects a show_view whose viewBytes() is over this before it\n// normalizes or validates, so the number has to be the bytes the model sent.\nexport const VIEW_BYTE_LIMIT = 8192\n\nconst isRecord = value => value !== null && typeof value === 'object' && !Array.isArray(value)\nconst quoted = value => JSON.stringify(value)\nconst allowed = list => list.join(', ')\nconst isNumber = value => typeof value === 'number' && Number.isFinite(value)\nconst isScalar = value => typeof value === 'string' || typeof value === 'boolean' || isNumber(value)\n\n// `{ \"=\": \"a * b\" }`: a value worked out from the view's inputs.\nexport const isFormula = value => isRecord(value) && Object.keys(value).length === 1 && Object.hasOwn(value, '=')\n\nexport function viewBytes(title, view) {\n return new TextEncoder().encode(`${JSON.stringify(view) ?? ''}${title ?? ''}`).length\n}\n\nconst NUMERIC = ['value', 'percent', 'min', 'max', 'step', 'height']\nconst numeric = value => (typeof value === 'string' && value.trim() !== '' && !Number.isNaN(Number(value)) ? Number(value) : value)\n\n// Some providers serialize nested arrays as `{ item: [...] }` (XML-style) and\n// numbers as strings. Normalize the blueprint before validation so a model is\n// not asked to retry a call whose only fault is the provider's encoding.\n// Arrays are unwrapped; numeric fields and chart values accept a numeric string.\n// Returns a new object; the input is not mutated.\nexport function normalizeView(value) {\n if (Array.isArray(value)) return value.map(normalizeView)\n if (!isRecord(value)) return value\n const keys = Object.keys(value)\n // Unwrap recursively: a provider may nest the wrapper, as { item: { item: [...] } }.\n if (keys.length === 1 && keys[0] === 'item') {\n const inner = normalizeView(value.item)\n if (Array.isArray(inner)) return inner\n }\n // Define own properties: an incoming \"__proto__\" key must become data the\n // validator can reject, not hit the prototype setter and vanish from the JSON.\n const out = {}\n for (const key of keys) Object.defineProperty(out, key, { value: normalizeView(value[key]), writable: true, enumerable: true, configurable: true })\n for (const field of NUMERIC) if (Object.hasOwn(out, field)) out[field] = numeric(out[field])\n if (Array.isArray(out.values)) out.values = out.values.map(numeric)\n return out\n}\n\nexport function validateView(view) {\n const ctx = { ids: new Set(), nodes: 0, interactive: false, inputs: new Map(), lets: new Map(), formulas: [] }\n const error = checkNode(view, 'view', 1, ctx) ?? checkFormulas(ctx)\n return error === undefined ? { ok: true, interactive: ctx.interactive } : { ok: false, error }\n}\n\n// What show_view checks before it shows a view: the same answer on the host and\n// in the client. The bytes are measured as sent, before normalizeView unwraps the\n// provider's encoding, or a wrapped view could shrink under the byte limit. The\n// normalized view and the trimmed title come back; the title may be empty.\nexport function checkShownView(title, sent) {\n let bytes\n try { bytes = viewBytes(title, sent) } catch { return { error: 'The view is not JSON data.' } }\n if (bytes > VIEW_BYTE_LIMIT) return { error: `The view is ${bytes} bytes; the limit is ${VIEW_BYTE_LIMIT}.` }\n if (title !== undefined && title !== null && typeof title !== 'string') return { error: 'title: expected a string' }\n const named = String(title ?? '').trim()\n const view = normalizeView(sent)\n const checked = validateView(view)\n if (!checked.ok) return { error: checked.error }\n return { title: named, view, interactive: checked.interactive }\n}\n\nfunction checkNode(node, path, depth, ctx) {\n if (!isRecord(node)) return `${path}: expected a component object`\n if (depth > MAX_DEPTH) return `${path}: ${depth} levels exceeds the limit of ${MAX_DEPTH}`\n ctx.nodes += 1\n if (ctx.nodes > MAX_NODES) return `${path}: ${ctx.nodes} components exceeds the limit of ${MAX_NODES}`\n const type = node.type\n if (!COMPONENTS.includes(type)) return `${path}.type: unknown component ${quoted(type)}; allowed: ${allowed(COMPONENTS)}`\n const props = PROPS[type]\n for (const key of Object.keys(node)) {\n if (key === 'type' || props.includes(key)) continue\n return `${path}.${key}: unknown property ${quoted(key)}; allowed: ${allowed(props)}`\n }\n if (INTERACTIVE.has(type)) ctx.interactive = true\n switch (type) {\n case 'stack': case 'row': return checkLayout(node, path, depth, ctx)\n case 'text': return checkText(node, path, ctx)\n case 'metric': return checkMetric(node, path, ctx)\n case 'table': return checkTable(node, path, ctx)\n case 'chart': return checkChart(node, path, ctx)\n case 'progress': return checkProgress(node, path, ctx)\n case 'callout': return checkCallout(node, path, ctx)\n case 'sources': return checkSources(node, path)\n case 'slider': case 'number': return checkNumberInput(node, path, ctx)\n case 'choice': return checkChoice(node, path, ctx)\n case 'toggle': return checkToggle(node, path, ctx)\n case 'options': return checkOptions(node, path, ctx)\n case 'confirm': return checkConfirm(node, path, ctx)\n case 'form': return checkForm(node, path, ctx)\n default: return checkSubmit(node, path, ctx)\n }\n}\n\nfunction checkLayout(node, path, depth, ctx) {\n if (node.let !== undefined) {\n if (depth !== 1) return `${path}.let: only the outermost component can define names`\n if (!isRecord(node.let)) return `${path}.let: expected an object of names to formulas`\n for (const [name, source] of Object.entries(node.let)) {\n if (!isName(name) || RESERVED.has(name)) return `${path}.let.${name}: a name is letters, digits and _, and starts with a letter or _`\n if (typeof source !== 'string') return `${path}.let.${name}: expected a formula string`\n ctx.lets.set(name, { source, path: `${path}.let.${name}` })\n }\n }\n if (!Array.isArray(node.children)) return `${path}.children: expected an array of 1 to ${MAX_CHILDREN} components`\n if (node.children.length < 1 || node.children.length > MAX_CHILDREN) return `${path}.children: expected 1 to ${MAX_CHILDREN} children; got ${node.children.length}`\n for (let index = 0; index < node.children.length; index += 1) {\n const error = checkNode(node.children[index], `${path}.children[${index}]`, depth + 1, ctx)\n if (error !== undefined) return error\n }\n return undefined\n}\n\n// A property that may be a literal of `kind` or a formula giving one. Formulas are\n// checked once the whole tree, with every input and name, is known.\nfunction checkValue(node, key, path, ctx, kind, { required = false, max = MAX_TEXT } = {}) {\n const value = node[key]\n const at = `${path}.${key}`\n if (value === undefined) return required ? `${at}: ${expected(kind)}` : undefined\n if (isFormula(value)) {\n ctx.formulas.push({ source: value['='], path: at, kind })\n return undefined\n }\n if (kind === 'number') return isNumber(value) ? undefined : `${at}: ${expected(kind)}`\n if (Array.isArray(kind)) return kind.includes(value) ? undefined : `${at}: unknown tone ${quoted(value)}; allowed: ${allowed(kind)}`\n if (kind === 'string') {\n if (typeof value !== 'string') return `${at}: ${expected(kind)}`\n return value.length > max ? `${at}: ${value.length} characters exceeds the limit of ${max}` : undefined\n }\n if (!isScalar(value)) return `${at}: ${expected(kind)}`\n return undefined\n}\nconst expected = kind => (kind === 'number' ? 'expected a number' : kind === 'string' ? 'expected a string' : Array.isArray(kind) ? `expected one of ${allowed(kind)}` : 'expected a string or a number')\n\nfunction checkText(node, path, ctx) {\n return checkValue(node, 'text', path, ctx, 'string', { required: true })\n ?? checkValue(node, 'tone', path, ctx, TEXT_TONES)\n}\n\nfunction checkMetric(node, path, ctx) {\n if (typeof node.label !== 'string') return `${path}.label: expected a string`\n if (node.value === undefined) return `${path}.value: expected a string or a number`\n if (typeof node.value === 'number' && !Number.isFinite(node.value)) return `${path}.value: expected a finite number`\n return checkValue(node, 'value', path, ctx, 'scalar')\n ?? checkValue(node, 'tone', path, ctx, TONES)\n ?? checkValue(node, 'caption', path, ctx, 'string')\n}\n\nfunction checkTable(node, path, ctx) {\n if (!Array.isArray(node.columns)) return `${path}.columns: expected an array of at most ${MAX_COLUMNS} columns`\n if (node.columns.length > MAX_COLUMNS) return `${path}.columns: ${node.columns.length} columns exceeds the limit of ${MAX_COLUMNS}`\n for (let index = 0; index < node.columns.length; index += 1) {\n const column = node.columns[index]\n const at = `${path}.columns[${index}]`\n if (!isRecord(column)) return `${at}: expected a column object`\n for (const key of Object.keys(column)) {\n if (key !== 'key' && key !== 'label') return `${at}.${key}: unknown property ${quoted(key)}; allowed: key, label`\n }\n if (typeof column.key !== 'string' || column.key === '') return `${at}.key: expected a non-empty string`\n if (typeof column.label !== 'string') return `${at}.label: expected a string`\n }\n if (!Array.isArray(node.rows)) return `${path}.rows: expected an array of at most ${MAX_ROWS} rows`\n if (node.rows.length > MAX_ROWS) return `${path}.rows: ${node.rows.length} rows exceeds the limit of ${MAX_ROWS}`\n for (let row = 0; row < node.rows.length; row += 1) {\n const cells = node.rows[row]\n if (!Array.isArray(cells)) return `${path}.rows[${row}]: expected an array of cells`\n for (let column = 0; column < cells.length; column += 1) {\n const at = `${path}.rows[${row}][${column}]`\n if (isFormula(cells[column])) { ctx.formulas.push({ source: cells[column]['='], path: at, kind: 'scalar' }); continue }\n const text = cellText(cells[column])\n if (text.length > MAX_CELL) return `${at}: ${text.length} characters exceeds the limit of ${MAX_CELL}`\n }\n }\n return undefined\n}\n\nfunction checkChart(node, path, ctx) {\n if (node.kind !== undefined && !CHART_KINDS.includes(node.kind)) return `${path}.kind: unknown chart ${quoted(node.kind)}; allowed: ${allowed(CHART_KINDS)}`\n if (!Array.isArray(node.categories) || node.categories.length === 0) return `${path}.categories: expected a non-empty array of labels`\n for (let index = 0; index < node.categories.length; index += 1) {\n const label = node.categories[index]\n if (typeof label !== 'string' && !isNumber(label)) return `${path}.categories[${index}]: expected a string`\n }\n if (!Array.isArray(node.series) || node.series.length === 0) return `${path}.series: expected a non-empty array of { name?, values }`\n if (node.kind === 'donut' && node.series.length > 1) return `${path}.series: a donut takes one series; got ${node.series.length}`\n for (let index = 0; index < node.series.length; index += 1) {\n const series = node.series[index]\n const at = `${path}.series[${index}]`\n if (!isRecord(series)) return `${at}: expected a series object`\n for (const key of Object.keys(series)) {\n if (key !== 'name' && key !== 'values') return `${at}.${key}: unknown property ${quoted(key)}; allowed: name, values`\n }\n if (series.name !== undefined && typeof series.name !== 'string') return `${at}.name: expected a string`\n if (!Array.isArray(series.values)) return `${at}.values: expected an array of numbers`\n if (series.values.length !== node.categories.length) return `${at}.values: ${series.values.length} values for ${node.categories.length} categories`\n for (let item = 0; item < series.values.length; item += 1) {\n const value = series.values[item]\n if (isFormula(value)) ctx.formulas.push({ source: value['='], path: `${at}.values[${item}]`, kind: 'number' })\n else if (!isNumber(value)) return `${at}.values[${item}]: expected a number`\n }\n }\n if (node.unit !== undefined && typeof node.unit !== 'string') return `${path}.unit: expected a string`\n if (node.caption !== undefined && typeof node.caption !== 'string') return `${path}.caption: expected a string`\n return undefined\n}\n\nfunction checkProgress(node, path, ctx) {\n if (node.label !== undefined && typeof node.label !== 'string') return `${path}.label: expected a string`\n if ((node.percent === undefined) === (node.value === undefined)) return `${path}: give percent (0 to 100), or value with max`\n if (node.percent !== undefined && !isFormula(node.percent)) {\n if (typeof node.percent !== 'number' || !Number.isFinite(node.percent) || node.percent < 0 || node.percent > 100) return `${path}.percent: expected a number from 0 to 100`\n }\n if (node.value !== undefined && node.max === undefined) return `${path}.max: expected a number with value`\n if (node.value === undefined && node.max !== undefined) return `${path}.value: expected a number with max`\n return checkValue(node, 'percent', path, ctx, 'number')\n ?? checkValue(node, 'value', path, ctx, 'number')\n ?? checkValue(node, 'max', path, ctx, 'number')\n ?? checkValue(node, 'valueLabel', path, ctx, 'scalar')\n ?? checkValue(node, 'tone', path, ctx, TONES)\n}\n\nfunction checkCallout(node, path, ctx) {\n return checkValue(node, 'text', path, ctx, 'string', { required: true })\n ?? checkValue(node, 'tone', path, ctx, CALLOUT_TONES)\n}\n\nfunction checkSources(node, path) {\n if (!Array.isArray(node.items) || node.items.length === 0) return `${path}.items: expected a non-empty array of { label, url }`\n for (let index = 0; index < node.items.length; index += 1) {\n const item = node.items[index]\n const at = `${path}.items[${index}]`\n if (!isRecord(item)) return `${at}: expected a { label, url } object`\n for (const key of Object.keys(item)) {\n if (key !== 'label' && key !== 'url') return `${at}.${key}: unknown property ${quoted(key)}; allowed: label, url`\n }\n if (typeof item.label !== 'string' || item.label.trim() === '') return `${at}.label: expected a non-empty string`\n if (typeof item.url !== 'string' || !/^https?:\\/\\/[^\\s]+$/i.test(item.url)) return `${at}.url: expected an http(s) address`\n }\n return undefined\n}\n\nfunction checkInputId(node, path, ctx) {\n if (!isName(node.id) || RESERVED.has(node.id)) return `${path}.id: an input id is letters, digits and _, and starts with a letter or _, so formulas can use it`\n if (ctx.ids.has(node.id)) return `${path}.id: duplicate id ${quoted(node.id)}`\n ctx.ids.add(node.id)\n if (typeof node.label !== 'string') return `${path}.label: expected a string`\n return undefined\n}\n\nfunction checkNumberInput(node, path, ctx) {\n const idError = checkInputId(node, path, ctx)\n if (idError !== undefined) return idError\n for (const key of ['min', 'max', 'step']) {\n if (node[key] !== undefined && !isNumber(node[key])) return `${path}.${key}: expected a number`\n }\n if (node.type === 'slider' && (node.min === undefined || node.max === undefined)) return `${path}: a slider needs min and max`\n if (node.min !== undefined && node.max !== undefined && node.max <= node.min) return `${path}.max: expected more than min (${node.min})`\n if (node.step !== undefined && node.step <= 0) return `${path}.step: expected more than 0`\n if (!isNumber(node.value)) return `${path}.value: expected a number`\n if ((node.min !== undefined && node.value < node.min) || (node.max !== undefined && node.value > node.max)) return `${path}.value: expected a number from ${node.min ?? '-∞'} to ${node.max ?? '∞'}`\n if (node.unit !== undefined && typeof node.unit !== 'string') return `${path}.unit: expected a string`\n ctx.inputs.set(node.id, node.value)\n return undefined\n}\n\nfunction checkChoice(node, path, ctx) {\n const idError = checkInputId(node, path, ctx)\n if (idError !== undefined) return idError\n if (!Array.isArray(node.options) || node.options.length === 0) return `${path}.options: expected a non-empty array of { label, value }`\n const labels = new Set()\n const values = new Set()\n for (let index = 0; index < node.options.length; index += 1) {\n const option = node.options[index]\n const at = `${path}.options[${index}]`\n if (!isRecord(option)) return `${at}: expected a { label, value } object`\n for (const key of Object.keys(option)) {\n if (key !== 'label' && key !== 'value') return `${at}.${key}: unknown property ${quoted(key)}; allowed: label, value`\n }\n if (typeof option.label !== 'string' || option.label.trim() === '') return `${at}.label: expected a non-empty string`\n if (labels.has(option.label)) return `${at}.label: duplicate label ${quoted(option.label)}`\n labels.add(option.label)\n const value = option.value ?? option.label\n if (!isScalar(value)) return `${at}.value: expected a string, a number or true/false`\n if (values.has(value)) return `${at}.value: duplicate value ${quoted(value)}`\n values.add(value)\n }\n const chosen = node.value ?? choiceValue(node.options[0])\n if (!values.has(chosen)) return `${path}.value: expected one of the options' values`\n ctx.inputs.set(node.id, chosen)\n return undefined\n}\n\nfunction checkToggle(node, path, ctx) {\n const idError = checkInputId(node, path, ctx)\n if (idError !== undefined) return idError\n if (node.value !== undefined && typeof node.value !== 'boolean') return `${path}.value: expected true or false`\n ctx.inputs.set(node.id, node.value === true)\n return undefined\n}\n\nfunction checkOptions(node, path, ctx) {\n const idError = checkId(node, path, ctx)\n if (idError !== undefined) return idError\n if (node.multi !== undefined && typeof node.multi !== 'boolean') return `${path}.multi: expected a boolean`\n if (!Array.isArray(node.options)) return `${path}.options: expected an array of 1 to ${MAX_OPTIONS} options`\n if (node.options.length < 1 || node.options.length > MAX_OPTIONS) return `${path}.options: expected 1 to ${MAX_OPTIONS} options; got ${node.options.length}`\n const labels = new Set()\n for (let index = 0; index < node.options.length; index += 1) {\n const option = node.options[index]\n const at = `${path}.options[${index}]`\n if (!isRecord(option)) return `${at}: expected an option object`\n for (const key of Object.keys(option)) {\n if (key !== 'label' && key !== 'description') return `${at}.${key}: unknown property ${quoted(key)}; allowed: label, description`\n }\n if (typeof option.label !== 'string' || option.label.trim() === '') return `${at}.label: expected a non-empty string`\n if (labels.has(option.label)) return `${at}.label: duplicate label ${quoted(option.label)}`\n labels.add(option.label)\n if (option.description !== undefined && typeof option.description !== 'string') return `${at}.description: expected a string`\n }\n return undefined\n}\n\nfunction checkConfirm(node, path, ctx) {\n const idError = checkId(node, path, ctx)\n if (idError !== undefined) return idError\n if (node.confirmLabel !== undefined && typeof node.confirmLabel !== 'string') return `${path}.confirmLabel: expected a string`\n if (node.cancelLabel !== undefined && typeof node.cancelLabel !== 'string') return `${path}.cancelLabel: expected a string`\n return undefined\n}\n\nfunction checkForm(node, path, ctx) {\n const idError = checkId(node, path, ctx)\n if (idError !== undefined) return idError\n if (node.submitLabel !== undefined && typeof node.submitLabel !== 'string') return `${path}.submitLabel: expected a string`\n if (!Array.isArray(node.fields)) return `${path}.fields: expected an array of at most ${MAX_FIELDS} fields`\n if (node.fields.length > MAX_FIELDS) return `${path}.fields: ${node.fields.length} fields exceeds the limit of ${MAX_FIELDS}`\n const seen = new Set()\n for (let index = 0; index < node.fields.length; index += 1) {\n const field = node.fields[index]\n const at = `${path}.fields[${index}]`\n if (!isRecord(field)) return `${at}: expected a field object`\n for (const key of Object.keys(field)) {\n if (key !== 'id' && key !== 'label' && key !== 'placeholder') return `${at}.${key}: unknown property ${quoted(key)}; allowed: id, label, placeholder`\n }\n if (typeof field.id !== 'string' || field.id === '') return `${at}.id: expected a non-empty string`\n if (field.id === '__proto__') return `${at}.id: \"__proto__\" cannot be an id`\n if (seen.has(field.id)) return `${at}.id: duplicate field id ${quoted(field.id)}`\n seen.add(field.id)\n if (typeof field.label !== 'string') return `${at}.label: expected a string`\n if (field.placeholder !== undefined && typeof field.placeholder !== 'string') return `${at}.placeholder: expected a string`\n }\n return undefined\n}\n\nfunction checkSubmit(node, path, ctx) {\n const idError = checkId(node, path, ctx)\n if (idError !== undefined) return idError\n if (node.label !== undefined && typeof node.label !== 'string') return `${path}.label: expected a string`\n return undefined\n}\n\nfunction checkId(node, path, ctx) {\n if (typeof node.id !== 'string' || node.id === '') return `${path}.id: expected a non-empty string`\n // A `__proto__` id would write through to a plain object's prototype where the\n // answer is kept, losing it silently.\n if (node.id === '__proto__') return `${path}.id: \"__proto__\" cannot be an id`\n if (ctx.ids.has(node.id)) return `${path}.id: duplicate id ${quoted(node.id)}`\n ctx.ids.add(node.id)\n return undefined\n}\n\n// Every formula parses, reads only inputs and names the view defines, and gives the\n// right kind of value with the inputs as the Bot set them.\nfunction checkFormulas(ctx) {\n const known = new Set([...ctx.inputs.keys(), ...ctx.lets.keys()])\n const lets = new Map()\n for (const [name, entry] of ctx.lets) {\n if (ctx.inputs.has(name)) return `${entry.path}: ${quoted(name)} is already an input id`\n const compiled = compileFormula(entry.source)\n if (compiled.error !== undefined) return `${entry.path}: ${compiled.error}`\n const unknown = compiled.names.find(item => !known.has(item))\n if (unknown !== undefined) return `${entry.path}: unknown name ${quoted(unknown)}; known: ${allowed([...known]) || '(none)'}`\n lets.set(name, compiled.tree)\n }\n const lookup = createScope(ctx.inputs, lets)\n for (const [name, entry] of ctx.lets) {\n const result = evaluate(lets.get(name), lookup)\n if (result.error !== undefined) return `${entry.path}: ${result.error}`\n }\n for (const formula of ctx.formulas) {\n const compiled = compileFormula(formula.source)\n if (compiled.error !== undefined) return `${formula.path}: ${compiled.error}`\n const unknown = compiled.names.find(item => !known.has(item))\n if (unknown !== undefined) return `${formula.path}: unknown name ${quoted(unknown)}; known: ${allowed([...known]) || '(none)'}`\n const result = evaluate(compiled.tree, lookup)\n if (result.error !== undefined) return `${formula.path}: ${result.error}`\n const problem = kindProblem(result.value, formula.kind)\n if (problem !== undefined) return `${formula.path}: the formula gives ${quoted(result.value)}; ${problem}`\n }\n return undefined\n}\n\nfunction kindProblem(value, kind) {\n if (kind === 'number') return isNumber(value) ? undefined : 'expected a number'\n if (Array.isArray(kind)) return kind.includes(value) ? undefined : `expected one of ${allowed(kind)}`\n if (kind === 'string') return isScalar(value) ? undefined : 'expected text'\n return isScalar(value) ? undefined : 'expected a string or a number'\n}\n\nfunction cellText(value) {\n if (typeof value === 'string') return value\n const text = JSON.stringify(value)\n return typeof text === 'string' ? text : ''\n}\n\n// -------------------------------------------------------------------------\n// Working a blueprint out: the client draws with these, the summary reads them.\n\nconst compiled = new WeakMap()\nconst treeOf = (formula) => {\n let entry = compiled.get(formula)\n if (entry === undefined) {\n entry = compileFormula(formula['='])\n compiled.set(formula, entry)\n }\n return entry\n}\n\nexport const choiceValue = option => option?.value ?? option?.label\n\nfunction walk(node, visit) {\n if (!isRecord(node)) return\n visit(node)\n if (LAYOUT.includes(node.type) && Array.isArray(node.children)) for (const child of node.children) walk(child, visit)\n}\n\nexport function viewInputs(view) {\n const found = []\n walk(view, (node) => { if (INPUTS.has(node.type)) found.push(node) })\n return found\n}\n\nexport function inputDefault(node) {\n if (node.type === 'toggle') return node.value === true\n if (node.type === 'choice') return node.value ?? choiceValue(Array.isArray(node.options) ? node.options[0] : undefined)\n return node.value\n}\n\nexport const hasInputs = view => viewInputs(view).length > 0\n\n// The values a view's formulas read: each input's default unless `values` sets it.\nexport function viewScope(view, values = {}) {\n const inputs = new Map()\n for (const node of viewInputs(view)) inputs.set(node.id, Object.hasOwn(values, node.id) ? values[node.id] : inputDefault(node))\n const lets = new Map()\n for (const [name, source] of Object.entries(isRecord(view?.let) ? view.let : {})) {\n const entry = compileFormula(source)\n if (entry.tree !== undefined) lets.set(name, entry.tree)\n }\n return createScope(inputs, lets)\n}\n\n// A property's value: the literal, or the formula worked out. A formula that fails\n// with these inputs gives `fallback`.\nexport function resolve(value, lookup, fallback = undefined) {\n if (!isFormula(value)) return value\n const entry = treeOf(value)\n if (entry.tree === undefined) return fallback\n const result = evaluate(entry.tree, lookup)\n return result.error === undefined ? result.value : fallback\n}\n\nexport const asText = value => (value === undefined || value === null ? '' : show(value))\n\n// -------------------------------------------------------------------------\n// Summaries\n\nfunction clip(text) {\n const flat = String(text).replace(/\\s+/g, ' ').trim()\n return flat.length <= SUMMARY_PART ? flat : flat.slice(0, SUMMARY_PART)\n}\n\nconst choiceLabel = (node, value) => (Array.isArray(node.options) ? node.options : []).find(option => choiceValue(option) === value)?.label ?? asText(value)\n\nfunction inputText(node, value) {\n if (node.type === 'toggle') return value === true ? 'on' : 'off'\n if (node.type === 'choice') return choiceLabel(node, value)\n return `${asText(value)}${node.unit ? ` ${node.unit}` : ''}`\n}\n\nfunction progressPercent(node, lookup) {\n if (node.percent !== undefined) return Number(resolve(node.percent, lookup, 0))\n const max = Number(resolve(node.max, lookup, 0))\n return max > 0 ? (Number(resolve(node.value, lookup, 0)) / max) * 100 : 0\n}\n\nfunction componentSummary(node, lookup) {\n const value = item => asText(resolve(item, lookup, ''))\n switch (node.type) {\n case 'text': return `text: ${value(node.text)}`\n case 'metric': return `metric: ${node.label}=${value(node.value)}`\n case 'table': return `table: ${(Array.isArray(node.columns) ? node.columns : []).map(column => column?.label ?? column?.key ?? '').filter(Boolean).join('/')}`\n case 'chart': {\n const series = Array.isArray(node.series) ? node.series[0] : undefined\n const values = Array.isArray(series?.values) ? series.values : []\n const unit = node.unit ? ` ${node.unit}` : ''\n return `chart: ${(Array.isArray(node.categories) ? node.categories : []).map((label, index) => `${label}=${value(values[index])}${unit}`).join(', ')}`\n }\n case 'progress': return `progress: ${node.label ? `${node.label} ` : ''}${Math.round(progressPercent(node, lookup))}%`\n case 'callout': return `callout: ${value(node.text)}`\n case 'sources': return `sources: ${(Array.isArray(node.items) ? node.items : []).map(item => item?.label).filter(Boolean).join('/')}`\n case 'slider': case 'number': case 'choice': case 'toggle': return `${node.type}: ${node.label}=${inputText(node, inputDefault(node))}`\n case 'options': return `options: ${(Array.isArray(node.options) ? node.options : []).map(option => option?.label).filter(Boolean).join('/')}`\n case 'confirm': return 'confirm'\n case 'form': return `form: ${(Array.isArray(node.fields) ? node.fields : []).map(field => field?.label ?? field?.id).filter(Boolean).join('/')}`\n case 'submit': return `submit: ${node.label ?? 'Send'}`\n default: return undefined\n }\n}\n\n// One line for a handoff or a checkpoint. Containers add nothing of their own;\n// each component keeps one short phrase, and the line stops after a few. Formulas\n// show what they give with the inputs as the Bot set them.\nexport function viewSummary(view) {\n const parts = []\n const lookup = viewScope(view)\n const visit = (node) => {\n if (parts.length >= SUMMARY_COUNT || !isRecord(node)) return\n const line = componentSummary(node, lookup)\n if (line !== undefined) parts.push(clip(line))\n if (parts.length >= SUMMARY_COUNT || !LAYOUT.includes(node.type) || !Array.isArray(node.children)) return\n for (const child of node.children) visit(child)\n }\n visit(view)\n return parts.join('; ')\n}\n\n// The inputs of an answer as `Label=value` pairs, for the Bot's history.\nexport function inputsSummary(view, inputs) {\n if (!isRecord(inputs)) return ''\n return viewInputs(view)\n .filter(node => Object.hasOwn(inputs, node.id))\n .map(node => `${node.label || node.id}=${inputText(node, inputs[node.id])}`)\n .join('; ')\n}\n\n// -------------------------------------------------------------------------\n// Answers\n\nfunction interactiveNodes(node, found = []) {\n walk(node, (item) => { if (INTERACTIVE.has(item.type)) found.push(item) })\n return found\n}\n\n// `action` is the id of the component the user submitted. One submit settles\n// the whole card, so only that component's values are kept, plus the inputs'\n// values when the view has inputs.\nexport function validateViewAnswer(view, action, values) {\n const nodes = interactiveNodes(view)\n if (typeof action !== 'string' || action === '') return { error: `action: expected an interactive component id; allowed: ${allowed(nodes.map(node => node.id))}` }\n const node = nodes.find(item => item.id === action)\n if (node === undefined) return { error: `action: no interactive component with id ${quoted(action)}; allowed: ${allowed(nodes.map(item => item.id))}` }\n if (!isRecord(values)) return { error: 'values: expected an object' }\n const inputs = validateInputs(view, values.inputs)\n if (inputs.error !== undefined) return inputs\n const extra = inputs.inputs === undefined ? {} : { inputs: inputs.inputs }\n if (node.type === 'submit') return { ...extra }\n const own = node.type === 'options' ? validateOptions(node, values) : node.type === 'confirm' ? validateConfirm(values) : validateForm(node, values)\n return own.error === undefined ? { ...own, ...extra } : own\n}\n\n// Every input of the view, as sent or else as the Bot set it.\nfunction validateInputs(view, sent) {\n const nodes = viewInputs(view)\n if (nodes.length === 0) return sent === undefined ? {} : { error: 'values.inputs: this view has no inputs' }\n if (sent !== undefined && !isRecord(sent)) return { error: 'values.inputs: expected an object of input ids to values' }\n const given = sent ?? {}\n const ids = nodes.map(node => node.id)\n const unknown = Object.keys(given).find(key => !ids.includes(key))\n if (unknown !== undefined) return { error: `values.inputs.${unknown}: unknown input; allowed: ${allowed(ids)}` }\n const inputs = {}\n for (const node of nodes) {\n const value = Object.hasOwn(given, node.id) ? given[node.id] : inputDefault(node)\n const at = `values.inputs.${node.id}`\n if (node.type === 'toggle' && typeof value !== 'boolean') return { error: `${at}: expected true or false` }\n if (node.type === 'choice' && !(Array.isArray(node.options) ? node.options : []).some(option => choiceValue(option) === value)) return { error: `${at}: expected one of the options' values` }\n if (node.type === 'slider' || node.type === 'number') {\n if (!isNumber(value)) return { error: `${at}: expected a number` }\n if ((node.min !== undefined && value < node.min) || (node.max !== undefined && value > node.max)) return { error: `${at}: expected a number from ${node.min ?? '-∞'} to ${node.max ?? '∞'}` }\n }\n inputs[node.id] = value\n }\n return { inputs }\n}\n\nfunction validateOptions(node, values) {\n if (!Array.isArray(values.selected)) return { error: 'values.selected: expected an array of option labels' }\n const labels = new Set((node.options ?? []).map(option => option?.label))\n const picked = values.selected.filter(label => typeof label === 'string' && labels.has(label))\n const selected = node.multi === true ? [...new Set(picked)] : picked.slice(0, 1)\n if (selected.length === 0) return { error: 'values.selected: select at least one option' }\n return { selected }\n}\n\nfunction validateConfirm(values) {\n if (typeof values.confirmed !== 'boolean') return { error: 'values.confirmed: expected a boolean' }\n return { confirmed: values.confirmed }\n}\n\nfunction validateForm(node, values) {\n if (!isRecord(values.fields)) return { error: 'values.fields: expected an object of field ids to strings' }\n const declared = (node.fields ?? []).map(field => field?.id).filter(id => typeof id === 'string')\n const allowedIds = new Set(declared)\n const fields = {}\n for (const [key, value] of Object.entries(values.fields)) {\n if (!allowedIds.has(key)) return { error: `values.fields.${key}: unknown field; allowed: ${allowed(declared)}` }\n if (typeof value !== 'string') return { error: `values.fields.${key}: expected a string` }\n if (value.length > MAX_TEXT) return { error: `values.fields.${key}: ${value.length} characters exceeds the limit of ${MAX_TEXT}` }\n fields[key] = value\n }\n return { fields }\n}\n"],"mappings":";AAKA,MAAM,YAAY;CAChB,KAAK;EAAE,MAAM,CAAC,GAAG,QAAQ;EAAG,MAAM,GAAG,WAAW,KAAK,IAAI,GAAG,OAAO,IAAI,GAAG,CAAC;CAAE;CAC7E,KAAK;EAAE,MAAM,CAAC,GAAG,QAAQ;EAAG,MAAM,GAAG,WAAW,KAAK,IAAI,GAAG,OAAO,IAAI,GAAG,CAAC;CAAE;CAC7E,KAAK;EAAE,MAAM,CAAC,GAAG,CAAC;EAAG,MAAK,UAAS,KAAK,IAAI,IAAI,KAAK,CAAC;CAAE;CACxD,OAAO;EAAE,MAAM,CAAC,GAAG,CAAC;EAAG,MAAK,UAAS,KAAK,MAAM,IAAI,KAAK,CAAC;CAAE;CAC5D,MAAM;EAAE,MAAM,CAAC,GAAG,CAAC;EAAG,MAAK,UAAS,KAAK,KAAK,IAAI,KAAK,CAAC;CAAE;CAC1D,MAAM;EAAE,MAAM,CAAC,GAAG,CAAC;EAAG,MAAK,UAAS,KAAK,KAAK,IAAI,KAAK,CAAC;CAAE;CAC1D,KAAK;EAAE,MAAM,CAAC,GAAG,CAAC;EAAG,MAAM,MAAM,UAAU,IAAI,IAAI,KAAK,IAAI,KAAK;CAAE;CACnE,OAAO;EAAE,MAAM,CAAC,GAAG,CAAC;EAAG,MAAM,OAAO,SA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AAI,IAAI,MAAM,OAAO,mCAAmC,WAAW;EACjI,OAAO,OAAO;CAChB;CACA,OAAO,EAAE,OAAO;AAClB"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PendingView, RpcResult } from "./contracts.js";
1
+ import { c as RpcResult, i as HOST_SERVICE, n as DeepViewHost, o as PendingView } from "./contracts2.js";
2
2
  import { ContextFormed, createUserMessage } from "@deepseek-ai/dsh-llm";
3
3
  import { Context } from "@deepseek-ai/cordis";
4
4
  import { IncomingMessage, ServerResponse } from "node:http";
@@ -19,6 +19,30 @@ declare module '@deepseek-ai/dsh-llm' {
19
19
  }
20
20
  }
21
21
  //#endregion
22
+ //#region ../dsh-plugin-kit/src/log-shared.d.ts
23
+ type PluginLogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fault';
24
+ type PluginLogScalar = string | number | boolean | null;
25
+ type PluginLogContext = Record<string, PluginLogScalar | undefined>;
26
+ interface PluginLogInput {
27
+ level: PluginLogLevel;
28
+ event: string;
29
+ message: string;
30
+ context?: PluginLogContext;
31
+ error?: unknown;
32
+ }
33
+ interface PluginLogger {
34
+ readonly source: string;
35
+ readonly file: string | null;
36
+ readonly lastWriteError: string | null;
37
+ debug(event: string, message: string, context?: PluginLogContext): boolean;
38
+ info(event: string, message: string, context?: PluginLogContext): boolean;
39
+ warn(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean;
40
+ error(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean;
41
+ fault(event: string, message: string, error?: unknown, context?: PluginLogContext): boolean;
42
+ write(input: PluginLogInput): boolean;
43
+ child(context: PluginLogContext): PluginLogger;
44
+ }
45
+ //#endregion
22
46
  //#region ../dsh-plugin-kit/src/host-rpc.d.ts
23
47
  interface HostRpcContext {
24
48
  webServer: {
@@ -36,6 +60,13 @@ interface HostRpcContext {
36
60
  //#region src/index.d.ts
37
61
  declare const name = "deep-view";
38
62
  declare const inject: readonly ["tools", "sessionController", "sessions", "agents", "connection", "webServer"];
63
+ declare module '@deepseek-ai/cordis' {
64
+ interface Context {
65
+ [HOST_SERVICE]: DeepViewHost;
66
+ }
67
+ }
68
+ declare function resolveSessionId(redirects: ReadonlyMap<string, string>, sessionId: string): string;
69
+ declare function handoffPendingSession(pending: Map<string, PendingView>, redirects: Map<string, string>, fromSessionId: string, toSessionId: string): boolean;
39
70
  type AgentLike = {
40
71
  id: string;
41
72
  session: unknown;
@@ -65,9 +96,9 @@ type Host = Context & HostRpcContext & {
65
96
  warn(message: string, ...args: unknown[]): void;
66
97
  };
67
98
  };
68
- declare function createShowViewTool(host: Host, pending: Map<string, PendingView>, makeId?: () => string): Record<string, unknown>;
69
- declare function createRpc(host: Host, pending: Map<string, PendingView>): (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<RpcResult>;
99
+ declare function createShowViewTool(host: Host, pending: Map<string, PendingView>, makeId?: () => string, logger?: PluginLogger): Record<string, unknown>;
100
+ declare function createRpc(host: Host, pending: Map<string, PendingView>, redirects?: ReadonlyMap<string, string>, logger?: PluginLogger): (endpoint: string, payload: unknown, signal: AbortSignal) => Promise<RpcResult>;
70
101
  declare function apply(ctx: Context): Promise<void>;
71
102
  //#endregion
72
- export { apply, createRpc, createShowViewTool, inject, name };
103
+ export { apply, createRpc, createShowViewTool, handoffPendingSession, inject, name, resolveSessionId };
73
104
  //# sourceMappingURL=index.d.ts.map