@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.js
CHANGED
|
@@ -265,6 +265,7 @@ function ApplyDirectiveButton({
|
|
|
265
265
|
readsLedger ? { status: "checking" } : { status: "idle" }
|
|
266
266
|
);
|
|
267
267
|
const [elapsed, setElapsed] = useState(0);
|
|
268
|
+
const [askingAgain, setAskingAgain] = useState(false);
|
|
268
269
|
const startedAt = useRef(null);
|
|
269
270
|
const nounText = nounLabel(directive.noun, host.nouns);
|
|
270
271
|
const shellKey = readsLedger ? JSON.stringify([directive.slug, items, conversationId ?? null]) : "";
|
|
@@ -329,7 +330,8 @@ function ApplyDirectiveButton({
|
|
|
329
330
|
if (!confirm) return;
|
|
330
331
|
const before = state;
|
|
331
332
|
if (host.ask) {
|
|
332
|
-
|
|
333
|
+
if (again) setAskingAgain(true);
|
|
334
|
+
else setState({ status: "asking" });
|
|
333
335
|
let ok = false;
|
|
334
336
|
try {
|
|
335
337
|
ok = await host.ask({
|
|
@@ -339,12 +341,14 @@ function ApplyDirectiveButton({
|
|
|
339
341
|
...again ? { again: true } : {}
|
|
340
342
|
});
|
|
341
343
|
} catch (error) {
|
|
344
|
+
setAskingAgain(false);
|
|
342
345
|
setState({
|
|
343
346
|
status: "error",
|
|
344
347
|
message: error instanceof Error && error.message ? error.message : "We could not ask you to confirm this, so nothing was done."
|
|
345
348
|
});
|
|
346
349
|
return;
|
|
347
350
|
}
|
|
351
|
+
setAskingAgain(false);
|
|
348
352
|
if (!ok) {
|
|
349
353
|
setState(again ? before : { status: "idle" });
|
|
350
354
|
return;
|
|
@@ -380,13 +384,15 @@ function ApplyDirectiveButton({
|
|
|
380
384
|
return /* @__PURE__ */ jsxs2(
|
|
381
385
|
"span",
|
|
382
386
|
{
|
|
383
|
-
className: `
|
|
387
|
+
className: `flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-xs ${bad ? "text-destructive" : "text-primary"}`,
|
|
384
388
|
"data-apply-state": "applied",
|
|
385
389
|
children: [
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
+
/* @__PURE__ */ jsxs2("span", { className: "inline-flex min-w-0 items-start gap-1", children: [
|
|
391
|
+
bad ? /* @__PURE__ */ jsx4(AlertIcon, { className: "mt-px h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ jsx4(CheckCircleIcon, { className: "mt-px h-3.5 w-3.5 shrink-0" }),
|
|
392
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0", children: [
|
|
393
|
+
state.message ?? `Applied ${state.applied}`,
|
|
394
|
+
bad && !state.message ? ` \xB7 ${state.failed} failed` : ""
|
|
395
|
+
] })
|
|
390
396
|
] }),
|
|
391
397
|
records.map((record) => /* @__PURE__ */ jsx4("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
|
|
392
398
|
...record,
|
|
@@ -398,8 +404,9 @@ function ApplyDirectiveButton({
|
|
|
398
404
|
"button",
|
|
399
405
|
{
|
|
400
406
|
type: "button",
|
|
407
|
+
disabled: askingAgain,
|
|
401
408
|
onClick: () => void handleApply(!bad),
|
|
402
|
-
className: "inline-flex items-center gap-1 rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
409
|
+
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",
|
|
403
410
|
"data-apply-action": bad ? "retry" : "run-again",
|
|
404
411
|
children: [
|
|
405
412
|
/* @__PURE__ */ jsx4(RotateCcwIcon, { className: "h-3 w-3" }),
|