@mnmal-ai/substrate-tui 1.0.0-alpha.10 → 1.0.0-alpha.12
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.
|
@@ -224,6 +224,7 @@ const KIND = {
|
|
|
224
224
|
recall: "substrate.recall",
|
|
225
225
|
clarify: "substrate.clarify",
|
|
226
226
|
refuse: "substrate.refuse",
|
|
227
|
+
unknown: "substrate.unknown",
|
|
227
228
|
error: "substrate.error"
|
|
228
229
|
};
|
|
229
230
|
const str = (v) => v === void 0 || v === null ? "" : sanitise(String(v));
|
|
@@ -232,9 +233,10 @@ const errorLines = (errors) => (errors ?? []).map((e) => {
|
|
|
232
233
|
const x = e;
|
|
233
234
|
return sanitise(`${x.code ?? "error"}${x.message !== void 0 ? `: ${x.message}` : ""}`);
|
|
234
235
|
});
|
|
236
|
+
const droppedLines = (dropped) => (dropped ?? []).map((d) => sanitise(`dropped "${d.span}": ${d.reason}`));
|
|
235
237
|
function outcomeChips(o) {
|
|
236
238
|
if (o.kind !== "rows") return [];
|
|
237
|
-
const rejected =
|
|
239
|
+
const rejected = o.data === void 0;
|
|
238
240
|
return [
|
|
239
241
|
{
|
|
240
242
|
label: `▸ ${frameKey(o)}`,
|
|
@@ -245,7 +247,7 @@ function outcomeChips(o) {
|
|
|
245
247
|
tone: o.source === "handoff" ? "warn" : "dim"
|
|
246
248
|
},
|
|
247
249
|
{
|
|
248
|
-
label: rejected ? "rejected" : `${o.count ?? o.data.length} rows`,
|
|
250
|
+
label: rejected ? "rejected" : `${o.count ?? (Array.isArray(o.data) ? o.data.length : 0)} rows`,
|
|
249
251
|
tone: rejected ? "error" : "dim"
|
|
250
252
|
}
|
|
251
253
|
];
|
|
@@ -261,6 +263,17 @@ const titleWidth = (columns) => Math.max(COLS.minTitle, columns - (COLS.id + COL
|
|
|
261
263
|
const rows = ({ data, theme, size }) => {
|
|
262
264
|
const titleCols = titleWidth(size.columns);
|
|
263
265
|
const o = data;
|
|
266
|
+
const lost = droppedLines(o.dropped).map((l, i) => /* @__PURE__ */ jsx(Text, {
|
|
267
|
+
color: theme.color.warn,
|
|
268
|
+
children: ` ${l}`
|
|
269
|
+
}, `d${i}`));
|
|
270
|
+
if (!Array.isArray(o.data) && typeof o.count === "number") return /* @__PURE__ */ jsxs(Box, {
|
|
271
|
+
flexDirection: "column",
|
|
272
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
273
|
+
color: theme.color.text,
|
|
274
|
+
children: o.count
|
|
275
|
+
}), lost]
|
|
276
|
+
});
|
|
264
277
|
if (!Array.isArray(o.data)) return /* @__PURE__ */ jsxs(Box, {
|
|
265
278
|
flexDirection: "column",
|
|
266
279
|
children: [/* @__PURE__ */ jsxs(Text, {
|
|
@@ -272,33 +285,53 @@ const rows = ({ data, theme, size }) => {
|
|
|
272
285
|
}, i))]
|
|
273
286
|
});
|
|
274
287
|
const list = o.data;
|
|
275
|
-
if (list.length === 0) return /* @__PURE__ */ jsx(Text, {
|
|
288
|
+
if (list.length === 0 && lost.length === 0) return /* @__PURE__ */ jsx(Text, {
|
|
276
289
|
color: theme.color.dim,
|
|
277
290
|
children: "no rows"
|
|
278
291
|
});
|
|
279
|
-
return /* @__PURE__ */
|
|
292
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
280
293
|
flexDirection: "column",
|
|
281
|
-
children:
|
|
282
|
-
/* @__PURE__ */ jsx(Text, {
|
|
294
|
+
children: [
|
|
295
|
+
list.length === 0 ? /* @__PURE__ */ jsx(Text, {
|
|
283
296
|
color: theme.color.dim,
|
|
284
|
-
children:
|
|
285
|
-
}),
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
297
|
+
children: "no rows"
|
|
298
|
+
}) : null,
|
|
299
|
+
list.map((r, i) => /* @__PURE__ */ jsxs(Text, { children: [
|
|
300
|
+
/* @__PURE__ */ jsx(Text, {
|
|
301
|
+
color: theme.color.dim,
|
|
302
|
+
children: padCells(str(r.shortId ?? r.id), COLS.id, true)
|
|
303
|
+
}),
|
|
304
|
+
" ",
|
|
305
|
+
/* @__PURE__ */ jsx(Text, {
|
|
306
|
+
color: theme.color.text,
|
|
307
|
+
children: padCells(str(r.title ?? r.synopsis ?? r.name ?? r.topic ?? r.subject), titleCols)
|
|
308
|
+
}),
|
|
309
|
+
" ",
|
|
310
|
+
/* @__PURE__ */ jsx(Text, {
|
|
311
|
+
color: theme.color.info,
|
|
312
|
+
children: padCells(str(r.status), COLS.status)
|
|
313
|
+
}),
|
|
314
|
+
" ",
|
|
315
|
+
/* @__PURE__ */ jsx(Text, {
|
|
316
|
+
color: theme.color.dimMid,
|
|
317
|
+
children: padCells(str(r.project), COLS.project)
|
|
318
|
+
})
|
|
319
|
+
] }, i)),
|
|
320
|
+
lost
|
|
321
|
+
]
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
const unknown = ({ data, theme }) => {
|
|
325
|
+
const o = data;
|
|
326
|
+
return /* @__PURE__ */ jsxs(Box, {
|
|
327
|
+
flexDirection: "column",
|
|
328
|
+
children: [/* @__PURE__ */ jsx(Text, {
|
|
329
|
+
color: theme.color.warn,
|
|
330
|
+
children: "? unknown: not answered, because part of it was dropped"
|
|
331
|
+
}), droppedLines(o.dropped).map((l, i) => /* @__PURE__ */ jsx(Text, {
|
|
332
|
+
color: theme.color.warn,
|
|
333
|
+
children: ` ${l}`
|
|
334
|
+
}, i))]
|
|
302
335
|
});
|
|
303
336
|
};
|
|
304
337
|
const recall = ({ data, theme }) => {
|
|
@@ -386,6 +419,7 @@ const renderers = {
|
|
|
386
419
|
[KIND.recall]: recall,
|
|
387
420
|
[KIND.clarify]: clarify,
|
|
388
421
|
[KIND.refuse]: refuse,
|
|
422
|
+
[KIND.unknown]: unknown,
|
|
389
423
|
[KIND.error]: error
|
|
390
424
|
};
|
|
391
425
|
|
|
@@ -525,6 +559,7 @@ function askModule(deps) {
|
|
|
525
559
|
case "recall":
|
|
526
560
|
case "clarify":
|
|
527
561
|
case "refuse":
|
|
562
|
+
case "unknown":
|
|
528
563
|
last = { lines };
|
|
529
564
|
if (ev.event === "clarify" && ev.data.options.length > 0) ctx.open("clarify", ev.data);
|
|
530
565
|
else ctx.close();
|
|
@@ -51,7 +51,7 @@ async function main() {
|
|
|
51
51
|
}
|
|
52
52
|
Object.assign(process.env, colorDepthEnv(process.env));
|
|
53
53
|
const [{ createTui }, { makeDeps }, { prepareTerminal }, { terminalOptions }] = await Promise.all([
|
|
54
|
-
import("../app-
|
|
54
|
+
import("../app-xXFNoDVu.js"),
|
|
55
55
|
import("../deps-WzqsHHiC.js"),
|
|
56
56
|
import("@mnmal-ai/surface-core/pure"),
|
|
57
57
|
import("../terminal-CVX2CKWu.js")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mnmal-ai/substrate-tui",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.12",
|
|
4
4
|
"description": "Terminal UI for Substrate: ask in natural language, browse the schema, see the service status.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"access": "public"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@mnmal-ai/substrate": "1.0.0-alpha.
|
|
24
|
-
"@mnmal-ai/substrate-nl": "1.0.0-alpha.
|
|
25
|
-
"@mnmal-ai/surface-core": "0.
|
|
26
|
-
"@mnmal-ai/surface-kit": "0.
|
|
27
|
-
"@mnmal-ai/surface-theme": "0.
|
|
23
|
+
"@mnmal-ai/substrate": "1.0.0-alpha.12",
|
|
24
|
+
"@mnmal-ai/substrate-nl": "1.0.0-alpha.12",
|
|
25
|
+
"@mnmal-ai/surface-core": "0.15.0",
|
|
26
|
+
"@mnmal-ai/surface-kit": "0.15.0",
|
|
27
|
+
"@mnmal-ai/surface-theme": "0.15.0",
|
|
28
28
|
"ink": "^8.0.0",
|
|
29
29
|
"react": "^19.3.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@biomejs/biome": "2.6.
|
|
33
|
-
"@mnmal-ai/substrate-config": "1.0.0-alpha.
|
|
32
|
+
"@biomejs/biome": "2.6.4",
|
|
33
|
+
"@mnmal-ai/substrate-config": "1.0.0-alpha.12",
|
|
34
34
|
"@types/node": "^26.6.4",
|
|
35
35
|
"@types/react": "^19.2.0",
|
|
36
36
|
"ink-testing-library": "^4.0.0",
|