@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/index.js
CHANGED
|
@@ -924,6 +924,7 @@ function ApplyDirectiveButton({
|
|
|
924
924
|
readsLedger ? { status: "checking" } : { status: "idle" }
|
|
925
925
|
);
|
|
926
926
|
const [elapsed, setElapsed] = useState(0);
|
|
927
|
+
const [askingAgain, setAskingAgain] = useState(false);
|
|
927
928
|
const startedAt = useRef(null);
|
|
928
929
|
const nounText = nounLabel(directive.noun, host.nouns);
|
|
929
930
|
const shellKey = readsLedger ? JSON.stringify([directive.slug, items, conversationId ?? null]) : "";
|
|
@@ -988,7 +989,8 @@ function ApplyDirectiveButton({
|
|
|
988
989
|
if (!confirm) return;
|
|
989
990
|
const before = state;
|
|
990
991
|
if (host.ask) {
|
|
991
|
-
|
|
992
|
+
if (again) setAskingAgain(true);
|
|
993
|
+
else setState({ status: "asking" });
|
|
992
994
|
let ok = false;
|
|
993
995
|
try {
|
|
994
996
|
ok = await host.ask({
|
|
@@ -998,12 +1000,14 @@ function ApplyDirectiveButton({
|
|
|
998
1000
|
...again ? { again: true } : {}
|
|
999
1001
|
});
|
|
1000
1002
|
} catch (error) {
|
|
1003
|
+
setAskingAgain(false);
|
|
1001
1004
|
setState({
|
|
1002
1005
|
status: "error",
|
|
1003
1006
|
message: error instanceof Error && error.message ? error.message : "We could not ask you to confirm this, so nothing was done."
|
|
1004
1007
|
});
|
|
1005
1008
|
return;
|
|
1006
1009
|
}
|
|
1010
|
+
setAskingAgain(false);
|
|
1007
1011
|
if (!ok) {
|
|
1008
1012
|
setState(again ? before : { status: "idle" });
|
|
1009
1013
|
return;
|
|
@@ -1039,13 +1043,15 @@ function ApplyDirectiveButton({
|
|
|
1039
1043
|
return /* @__PURE__ */ jsxs2(
|
|
1040
1044
|
"span",
|
|
1041
1045
|
{
|
|
1042
|
-
className: `
|
|
1046
|
+
className: `flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5 text-xs ${bad ? "text-destructive" : "text-primary"}`,
|
|
1043
1047
|
"data-apply-state": "applied",
|
|
1044
1048
|
children: [
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
+
/* @__PURE__ */ jsxs2("span", { className: "inline-flex min-w-0 items-start gap-1", children: [
|
|
1050
|
+
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" }),
|
|
1051
|
+
/* @__PURE__ */ jsxs2("span", { className: "min-w-0", children: [
|
|
1052
|
+
state.message ?? `Applied ${state.applied}`,
|
|
1053
|
+
bad && !state.message ? ` \xB7 ${state.failed} failed` : ""
|
|
1054
|
+
] })
|
|
1049
1055
|
] }),
|
|
1050
1056
|
records.map((record) => /* @__PURE__ */ jsx4("span", { className: "inline-flex min-w-0 items-center", children: host.renderRecord?.({
|
|
1051
1057
|
...record,
|
|
@@ -1057,8 +1063,9 @@ function ApplyDirectiveButton({
|
|
|
1057
1063
|
"button",
|
|
1058
1064
|
{
|
|
1059
1065
|
type: "button",
|
|
1066
|
+
disabled: askingAgain,
|
|
1060
1067
|
onClick: () => void handleApply(!bad),
|
|
1061
|
-
className: "inline-flex items-center gap-1 rounded px-1 py-0.5 text-muted-foreground hover:bg-accent hover:text-accent-foreground",
|
|
1068
|
+
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",
|
|
1062
1069
|
"data-apply-action": bad ? "retry" : "run-again",
|
|
1063
1070
|
children: [
|
|
1064
1071
|
/* @__PURE__ */ jsx4(RotateCcwIcon, { className: "h-3 w-3" }),
|