@hachej/boring-ask-user 0.1.31 → 0.1.32
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/dist/front/index.js +16 -6
- package/package.json +5 -5
package/dist/front/index.js
CHANGED
|
@@ -132,13 +132,13 @@ function QuestionFormProvider({
|
|
|
132
132
|
const value = { schema, status, values, touched, errors, submitting: controlledSubmitting ?? submitting, disabled, dirtyHints, setValue, touch, submit, cancel, rendererRegistry, formRef };
|
|
133
133
|
return /* @__PURE__ */ jsx(QuestionFormContext.Provider, { value, children });
|
|
134
134
|
}
|
|
135
|
-
function QuestionForm({ children, "aria-label": ariaLabel = "Question form" }) {
|
|
135
|
+
function QuestionForm({ children, "aria-label": ariaLabel = "Question form", className }) {
|
|
136
136
|
const { submit, cancel, status, formRef } = useQuestionForm();
|
|
137
|
-
return /* @__PURE__ */ jsxs("form", { ref: formRef, "data-question-form": true, "aria-label": ariaLabel, onSubmit: (event) => {
|
|
137
|
+
return /* @__PURE__ */ jsxs("form", { ref: formRef, "data-question-form": true, "aria-label": ariaLabel, className, onSubmit: (event) => {
|
|
138
138
|
event.preventDefault();
|
|
139
139
|
void submit();
|
|
140
140
|
}, onKeyDown: (event) => {
|
|
141
|
-
if (
|
|
141
|
+
if (event.key === "Enter" && shouldSubmitOnEnter(event)) {
|
|
142
142
|
event.preventDefault();
|
|
143
143
|
void submit();
|
|
144
144
|
}
|
|
@@ -151,6 +151,16 @@ function QuestionForm({ children, "aria-label": ariaLabel = "Question form" }) {
|
|
|
151
151
|
children
|
|
152
152
|
] });
|
|
153
153
|
}
|
|
154
|
+
function shouldSubmitOnEnter(event) {
|
|
155
|
+
if (event.metaKey || event.ctrlKey) return true;
|
|
156
|
+
if (event.shiftKey) return false;
|
|
157
|
+
const target = event.target;
|
|
158
|
+
if (!target) return true;
|
|
159
|
+
const tagName = target.tagName.toLowerCase();
|
|
160
|
+
if (tagName === "textarea" || tagName === "button" || tagName === "a") return false;
|
|
161
|
+
if (target.isContentEditable) return false;
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
154
164
|
function QuestionFields() {
|
|
155
165
|
const { schema } = useQuestionForm();
|
|
156
166
|
if (!schema) return null;
|
|
@@ -371,7 +381,7 @@ function AskUserProvider({ apiBaseUrl, authHeaders, children }) {
|
|
|
371
381
|
target: pending.questionId,
|
|
372
382
|
label: "Answer the question in Questions to continue",
|
|
373
383
|
sessionId: sessionScopedBlockerId(pending.sessionId),
|
|
374
|
-
actions: [{ id: "open", label: "Open Questions" }]
|
|
384
|
+
actions: [{ id: "open", label: "Open Questions" }, { id: "cancel", label: "Cancel question" }]
|
|
375
385
|
});
|
|
376
386
|
}
|
|
377
387
|
return () => {
|
|
@@ -441,7 +451,7 @@ function QuestionsPane({ api, params, className }) {
|
|
|
441
451
|
useEffect2(() => {
|
|
442
452
|
if (question && pending === null && !paramQuestion) api.close();
|
|
443
453
|
}, [api, pending, paramQuestion, question]);
|
|
444
|
-
return /* @__PURE__ */ jsx2("div", { className: className
|
|
454
|
+
return /* @__PURE__ */ jsx2("div", { className: className ? `${className} min-h-0 overflow-hidden` : "h-full min-h-0 overflow-hidden", children: /* @__PURE__ */ jsxs2(Pane, { className: "h-full min-h-0 overflow-hidden border-0 bg-background text-sm", children: [
|
|
445
455
|
/* @__PURE__ */ jsx2(PaneHeader, { className: "border-b bg-background/95", children: /* @__PURE__ */ jsx2("div", { children: /* @__PURE__ */ jsxs2(PaneTitle, { className: "flex items-center gap-2", children: [
|
|
446
456
|
/* @__PURE__ */ jsx2(HelpCircle, { className: "h-4 w-4 text-muted-foreground" }),
|
|
447
457
|
" Agent needs input"
|
|
@@ -475,7 +485,7 @@ function QuestionsPane({ api, params, className }) {
|
|
|
475
485
|
} finally {
|
|
476
486
|
setSubmitting(false);
|
|
477
487
|
}
|
|
478
|
-
}, children: /* @__PURE__ */ jsxs2(QuestionForm, { children: [
|
|
488
|
+
}, children: /* @__PURE__ */ jsxs2(QuestionForm, { className: "flex min-h-0 flex-1 flex-col", children: [
|
|
479
489
|
/* @__PURE__ */ jsx2(PaneBody, { className: "overflow-auto p-4", children: /* @__PURE__ */ jsxs2("div", { className: "space-y-4", children: [
|
|
480
490
|
/* @__PURE__ */ jsxs2("section", { className: "rounded-md border border-border/60 bg-muted/30 p-4", children: [
|
|
481
491
|
/* @__PURE__ */ jsx2("div", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Waiting for answer" }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hachej/boring-ask-user",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
@@ -46,12 +46,12 @@
|
|
|
46
46
|
"fastify": "^5.3.3",
|
|
47
47
|
"react": "^18.0.0 || ^19.0.0",
|
|
48
48
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
49
|
-
"@hachej/boring-workspace": "0.1.
|
|
49
|
+
"@hachej/boring-workspace": "0.1.32"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"lucide-react": "^1.8.0",
|
|
53
53
|
"zod": "^3.23.0",
|
|
54
|
-
"@hachej/boring-ui-kit": "0.1.
|
|
54
|
+
"@hachej/boring-ui-kit": "0.1.32"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"tsup": "^8.4.0",
|
|
68
68
|
"typescript": "~5.9.3",
|
|
69
69
|
"vitest": "^3.1.3",
|
|
70
|
-
"@hachej/boring-workspace": "0.1.
|
|
70
|
+
"@hachej/boring-workspace": "0.1.32"
|
|
71
71
|
},
|
|
72
72
|
"peerDependenciesMeta": {
|
|
73
73
|
"fastify": {
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build": "tsup",
|
|
79
79
|
"typecheck": "tsc --noEmit",
|
|
80
|
-
"test": "vitest run",
|
|
80
|
+
"test": "vitest run --no-file-parallelism",
|
|
81
81
|
"lint": "pnpm run typecheck",
|
|
82
82
|
"clean": "rm -rf dist .tsbuildinfo"
|
|
83
83
|
}
|