@ai-matrx/content-ir-react 0.15.0 → 0.15.2
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/CHANGELOG.md +12 -0
- package/dist/directives.cjs +14 -7
- package/dist/directives.cjs.map +1 -1
- package/dist/directives.js +14 -7
- package/dist/directives.js.map +1 -1
- package/dist/index.cjs +14 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +14 -7
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +14 -7
- package/dist/react.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -305,6 +305,7 @@ function ApplyDirectiveButton({
|
|
|
305
305
|
readsLedger ? { status: "checking" } : { status: "idle" }
|
|
306
306
|
);
|
|
307
307
|
const [elapsed, setElapsed] = (0, import_react4.useState)(0);
|
|
308
|
+
const [askingAgain, setAskingAgain] = (0, import_react4.useState)(false);
|
|
308
309
|
const startedAt = (0, import_react4.useRef)(null);
|
|
309
310
|
const nounText = (0, import_content_ir.nounLabel)(directive.noun, host.nouns);
|
|
310
311
|
const shellKey = readsLedger ? JSON.stringify([directive.slug, items, conversationId ?? null]) : "";
|
|
@@ -369,7 +370,8 @@ function ApplyDirectiveButton({
|
|
|
369
370
|
if (!confirm) return;
|
|
370
371
|
const before = state;
|
|
371
372
|
if (host.ask) {
|
|
372
|
-
|
|
373
|
+
if (again) setAskingAgain(true);
|
|
374
|
+
else setState({ status: "asking" });
|
|
373
375
|
let ok = false;
|
|
374
376
|
try {
|
|
375
377
|
ok = await host.ask({
|
|
@@ -379,12 +381,14 @@ function ApplyDirectiveButton({
|
|
|
379
381
|
...again ? { again: true } : {}
|
|
380
382
|
});
|
|
381
383
|
} catch (error) {
|
|
384
|
+
setAskingAgain(false);
|
|
382
385
|
setState({
|
|
383
386
|
status: "error",
|
|
384
387
|
message: error instanceof Error && error.message ? error.message : "We could not ask you to confirm this, so nothing was done."
|
|
385
388
|
});
|
|
386
389
|
return;
|
|
387
390
|
}
|
|
391
|
+
setAskingAgain(false);
|
|
388
392
|
if (!ok) {
|
|
389
393
|
setState(again ? before : { status: "idle" });
|
|
390
394
|
return;
|
|
@@ -420,13 +424,15 @@ function ApplyDirectiveButton({
|
|
|
420
424
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
421
425
|
"span",
|
|
422
426
|
{
|
|
423
|
-
className: `
|
|
427
|
+
className: `flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-xs ${bad ? "text-destructive" : "text-primary"}`,
|
|
424
428
|
"data-apply-state": "applied",
|
|
425
429
|
children: [
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "inline-flex min-w-0 items-start gap-1", children: [
|
|
431
|
+
bad ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AlertIcon, { className: "mt-px h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CheckCircleIcon, { className: "mt-px h-3.5 w-3.5 shrink-0" }),
|
|
432
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "min-w-0", children: [
|
|
433
|
+
state.message ?? `Applied ${state.applied}`,
|
|
434
|
+
bad && !state.message ? ` \xB7 ${state.failed} failed` : ""
|
|
435
|
+
] })
|
|
430
436
|
] }),
|
|
431
437
|
records.map((record) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
|
|
432
438
|
...record,
|
|
@@ -438,8 +444,9 @@ function ApplyDirectiveButton({
|
|
|
438
444
|
"button",
|
|
439
445
|
{
|
|
440
446
|
type: "button",
|
|
447
|
+
disabled: askingAgain,
|
|
441
448
|
onClick: () => void handleApply(!bad),
|
|
442
|
-
className: "inline-flex items-center gap-1 rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
449
|
+
className: "inline-flex items-center gap-1 rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground disabled:opacity-50",
|
|
443
450
|
"data-apply-action": bad ? "retry" : "run-again",
|
|
444
451
|
children: [
|
|
445
452
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(RotateCcwIcon, { className: "h-3 w-3" }),
|