@krak-stack/registry 0.1.4 → 0.1.6
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/components/ui/effect-form.js +2 -2
- package/dist/services/agent/client/index.js +14 -15
- package/dist/services/agent/client/widget.d.ts +0 -1
- package/dist/services/agent/index.d.ts +2 -2
- package/dist/services/agent/index.js +0 -9
- package/dist/services/agent/schema.d.ts +3 -3
- package/dist/services/agent/schema.js +1 -6
- package/package.json +1 -1
|
@@ -1733,7 +1733,7 @@ var SubmitButton = ({
|
|
|
1733
1733
|
const isDirty = useAtomValue(form.isDirty);
|
|
1734
1734
|
const hasChangedSinceSubmit = useAtomValue(form.hasChangedSinceSubmit);
|
|
1735
1735
|
const lastSubmittedValues = useAtomValue(form.lastSubmittedValues);
|
|
1736
|
-
const hasPendingChanges =
|
|
1736
|
+
const hasPendingChanges = Option.isNone(lastSubmittedValues) ? isDirty : hasChangedSinceSubmit;
|
|
1737
1737
|
return /* @__PURE__ */ jsxs6(Button, {
|
|
1738
1738
|
type: "button",
|
|
1739
1739
|
disabled: !hasPendingChanges || submitResult.waiting,
|
|
@@ -2409,7 +2409,7 @@ var FormBlockNavigation = ({ form }) => {
|
|
|
2409
2409
|
const isDirty = useAtomValue(form.isDirty);
|
|
2410
2410
|
const hasChangedSinceSubmit = useAtomValue(form.hasChangedSinceSubmit);
|
|
2411
2411
|
const lastSubmittedValues = useAtomValue(form.lastSubmittedValues);
|
|
2412
|
-
const shouldBlock = !submitResult.waiting &&
|
|
2412
|
+
const shouldBlock = !submitResult.waiting && (Option.isNone(lastSubmittedValues) ? isDirty : hasChangedSinceSubmit);
|
|
2413
2413
|
return /* @__PURE__ */ jsx14(NavigationBlock, {
|
|
2414
2414
|
shouldBlock
|
|
2415
2415
|
});
|
|
@@ -1394,12 +1394,7 @@ var AgentEvent = Schema.Union([
|
|
|
1394
1394
|
Schema.Struct({ type: Schema.Literal("finish") }),
|
|
1395
1395
|
Schema.Struct({
|
|
1396
1396
|
type: Schema.Literal("error"),
|
|
1397
|
-
code: Schema.Literals([
|
|
1398
|
-
"unavailable",
|
|
1399
|
-
"invalid-request",
|
|
1400
|
-
"round-limit",
|
|
1401
|
-
"stream-failed"
|
|
1402
|
-
])
|
|
1397
|
+
code: Schema.Literals(["unavailable", "invalid-request", "stream-failed"])
|
|
1403
1398
|
})
|
|
1404
1399
|
]).annotate({
|
|
1405
1400
|
identifier: "AgentEvent",
|
|
@@ -1428,7 +1423,6 @@ var messages = {
|
|
|
1428
1423
|
copy: "Copy",
|
|
1429
1424
|
description: "Ask questions and use available tools to get things done.",
|
|
1430
1425
|
errorInvalidRequest: "The request could not be processed. Start a new conversation and try again.",
|
|
1431
|
-
errorRoundLimit: "The assistant stopped after too many API steps. Try a more specific request.",
|
|
1432
1426
|
errorStreamFailed: "The response was interrupted. Please try again.",
|
|
1433
1427
|
errorUnavailable: "The assistant is currently unavailable.",
|
|
1434
1428
|
maximize: "Maximize assistant",
|
|
@@ -1462,7 +1456,6 @@ var messages = {
|
|
|
1462
1456
|
copy: "Copier",
|
|
1463
1457
|
description: "Posez des questions et utilisez les outils disponibles pour accomplir vos tâches.",
|
|
1464
1458
|
errorInvalidRequest: "La demande n'a pas pu être traitée. Commencez une nouvelle conversation et réessayez.",
|
|
1465
|
-
errorRoundLimit: "L'assistant s'est arrêté après trop d'étapes d'API. Essayez une demande plus précise.",
|
|
1466
1459
|
errorStreamFailed: "La réponse a été interrompue. Veuillez réessayer.",
|
|
1467
1460
|
errorUnavailable: "L'assistant est actuellement indisponible.",
|
|
1468
1461
|
maximize: "Agrandir l'assistant",
|
|
@@ -1494,8 +1487,6 @@ var errorMessage = (code2, labels) => {
|
|
|
1494
1487
|
switch (code2) {
|
|
1495
1488
|
case "invalid-request":
|
|
1496
1489
|
return labels.errorInvalidRequest;
|
|
1497
|
-
case "round-limit":
|
|
1498
|
-
return labels.errorRoundLimit;
|
|
1499
1490
|
case "stream-failed":
|
|
1500
1491
|
return labels.errorStreamFailed;
|
|
1501
1492
|
case "unavailable":
|
|
@@ -1520,7 +1511,7 @@ var highlightedInput = (input, references) => {
|
|
|
1520
1511
|
const mentionPattern = new RegExp(`(${mentions.map(escapeRegExp).join("|")})(?![\\p{L}\\p{N}_-])`, "gu");
|
|
1521
1512
|
const mentionSet = new Set(mentions);
|
|
1522
1513
|
return input.split(mentionPattern).map((part, index) => mentionSet.has(part) ? /* @__PURE__ */ jsx17("span", {
|
|
1523
|
-
className: "text-primary",
|
|
1514
|
+
className: "bg-primary text-primary-foreground rounded-sm [box-shadow:2px_0_0_var(--primary),-2px_0_0_var(--primary)]",
|
|
1524
1515
|
children: part
|
|
1525
1516
|
}, `${part}:${index}`) : part);
|
|
1526
1517
|
};
|
|
@@ -1871,6 +1862,7 @@ function AgentWidget({
|
|
|
1871
1862
|
const [referencePickerOpen, setReferencePickerOpen] = useState(false);
|
|
1872
1863
|
const [activeReferenceKey, setActiveReferenceKey] = useState("");
|
|
1873
1864
|
const [input, setInput] = useState("");
|
|
1865
|
+
const inputOverlayRef = useRef(null);
|
|
1874
1866
|
const [references, setReferences] = useState([]);
|
|
1875
1867
|
const activeContext = state.contextLocked ? state.context ? {
|
|
1876
1868
|
...state.context,
|
|
@@ -1961,7 +1953,7 @@ function AgentWidget({
|
|
|
1961
1953
|
className: "flex items-center gap-1",
|
|
1962
1954
|
children: [
|
|
1963
1955
|
/* @__PURE__ */ jsx17(DialogTitle, {
|
|
1964
|
-
className: "min-w-0 flex-1 truncate",
|
|
1956
|
+
className: "min-w-0 flex-1 truncate text-sm leading-none font-medium",
|
|
1965
1957
|
children: labels.title
|
|
1966
1958
|
}),
|
|
1967
1959
|
/* @__PURE__ */ jsxs5(Button, {
|
|
@@ -2005,7 +1997,7 @@ function AgentWidget({
|
|
|
2005
1997
|
})
|
|
2006
1998
|
}),
|
|
2007
1999
|
/* @__PURE__ */ jsx17("div", {
|
|
2008
|
-
className: "min-h-0 flex-1",
|
|
2000
|
+
className: "min-h-0 flex-1 overflow-hidden",
|
|
2009
2001
|
children: state.messages.length === 0 && !state.error ? /* @__PURE__ */ jsx17(Empty, {
|
|
2010
2002
|
className: "h-full",
|
|
2011
2003
|
children: /* @__PURE__ */ jsxs5(EmptyHeader, {
|
|
@@ -2028,6 +2020,7 @@ function AgentWidget({
|
|
|
2028
2020
|
children: [
|
|
2029
2021
|
/* @__PURE__ */ jsx17(MessageScrollerViewport, {
|
|
2030
2022
|
"aria-label": labels.title,
|
|
2023
|
+
className: "[scrollbar-width:thin] [scrollbar-color:var(--border)_transparent]",
|
|
2031
2024
|
children: /* @__PURE__ */ jsxs5(MessageScrollerContent, {
|
|
2032
2025
|
"aria-busy": state.pending,
|
|
2033
2026
|
className: "p-4",
|
|
@@ -2102,8 +2095,9 @@ function AgentWidget({
|
|
|
2102
2095
|
className: "relative w-full min-w-0 self-stretch text-left",
|
|
2103
2096
|
children: [
|
|
2104
2097
|
/* @__PURE__ */ jsx17("div", {
|
|
2098
|
+
ref: inputOverlayRef,
|
|
2105
2099
|
"aria-hidden": "true",
|
|
2106
|
-
className: "text-foreground pointer-events-none absolute inset-0 overflow-hidden px-2.5 py-2 text-left font-[inherit] text-base break-words whitespace-pre-wrap md:text-sm",
|
|
2100
|
+
className: "text-foreground pointer-events-none absolute inset-0 [scrollbar-width:thin] [scrollbar-gutter:stable] overflow-hidden px-2.5 py-2 text-left font-[inherit] text-base break-words whitespace-pre-wrap md:text-sm",
|
|
2107
2101
|
children: highlightedInput(input, references)
|
|
2108
2102
|
}),
|
|
2109
2103
|
/* @__PURE__ */ jsxs5(Popover, {
|
|
@@ -2113,7 +2107,7 @@ function AgentWidget({
|
|
|
2113
2107
|
/* @__PURE__ */ jsx17(PopoverTrigger, {
|
|
2114
2108
|
id: referenceInputId,
|
|
2115
2109
|
render: /* @__PURE__ */ jsx17(InputGroupTextarea, {
|
|
2116
|
-
className: "caret-foreground selection:bg-primary selection:text-primary-foreground relative w-full text-left text-transparent",
|
|
2110
|
+
className: "caret-foreground selection:bg-primary selection:text-primary-foreground relative max-h-32 w-full [scrollbar-width:thin] [scrollbar-color:var(--border)_transparent] [scrollbar-gutter:stable] overflow-y-auto overscroll-contain text-left text-transparent",
|
|
2117
2111
|
value: input,
|
|
2118
2112
|
placeholder: labels.placeholder,
|
|
2119
2113
|
"aria-label": labels.placeholder,
|
|
@@ -2124,6 +2118,11 @@ function AgentWidget({
|
|
|
2124
2118
|
disabled: state.pending || hasPendingApproval,
|
|
2125
2119
|
role: "combobox",
|
|
2126
2120
|
rows: 2,
|
|
2121
|
+
onScroll: (event) => {
|
|
2122
|
+
if (inputOverlayRef.current) {
|
|
2123
|
+
inputOverlayRef.current.scrollTop = event.currentTarget.scrollTop;
|
|
2124
|
+
}
|
|
2125
|
+
},
|
|
2127
2126
|
onChange: (event) => {
|
|
2128
2127
|
const value = event.target.value;
|
|
2129
2128
|
setInput(value);
|
|
@@ -47,7 +47,7 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
|
|
|
47
47
|
readonly type: import("effect/Schema").Literal<"finish">;
|
|
48
48
|
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
49
49
|
readonly type: import("effect/Schema").Literal<"error">;
|
|
50
|
-
readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "
|
|
50
|
+
readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
51
51
|
}, "Type"> | {
|
|
52
52
|
type: "history";
|
|
53
53
|
value: string;
|
|
@@ -93,7 +93,7 @@ declare const AgentService_base: Context.ServiceClass<AgentService, "AgentServic
|
|
|
93
93
|
readonly type: import("effect/Schema").Literal<"finish">;
|
|
94
94
|
}, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
|
|
95
95
|
readonly type: import("effect/Schema").Literal<"error">;
|
|
96
|
-
readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "
|
|
96
|
+
readonly code: import("effect/Schema").Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
97
97
|
}, "Type"> | {
|
|
98
98
|
type: "history";
|
|
99
99
|
value: string;
|
|
@@ -80,7 +80,6 @@ class AgentService extends Context.Service()("AgentService", {
|
|
|
80
80
|
conversation,
|
|
81
81
|
messageId,
|
|
82
82
|
prompt,
|
|
83
|
-
round,
|
|
84
83
|
toolkit
|
|
85
84
|
}) => Stream.suspend(() => {
|
|
86
85
|
let hasApproval = false;
|
|
@@ -105,17 +104,10 @@ class AgentService extends Context.Service()("AgentService", {
|
|
|
105
104
|
code: "stream-failed"
|
|
106
105
|
});
|
|
107
106
|
}
|
|
108
|
-
if (round >= 5) {
|
|
109
|
-
return Stream.succeed({
|
|
110
|
-
type: "error",
|
|
111
|
-
code: "round-limit"
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
107
|
return agentRounds({
|
|
115
108
|
conversation,
|
|
116
109
|
messageId,
|
|
117
110
|
prompt: [],
|
|
118
|
-
round: round + 1,
|
|
119
111
|
toolkit
|
|
120
112
|
});
|
|
121
113
|
});
|
|
@@ -167,7 +159,6 @@ class AgentService extends Context.Service()("AgentService", {
|
|
|
167
159
|
conversation,
|
|
168
160
|
messageId,
|
|
169
161
|
prompt: action.type === "message" ? action.text : [],
|
|
170
|
-
round: 1,
|
|
171
162
|
toolkit
|
|
172
163
|
});
|
|
173
164
|
const complete = Stream.fromEffect(Effect.gen(function* () {
|
|
@@ -57,7 +57,7 @@ export declare const AgentEvent: Schema.Union<readonly [Schema.Struct<{
|
|
|
57
57
|
readonly type: Schema.Literal<"finish">;
|
|
58
58
|
}>, Schema.Struct<{
|
|
59
59
|
readonly type: Schema.Literal<"error">;
|
|
60
|
-
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "
|
|
60
|
+
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
61
61
|
}>]>;
|
|
62
62
|
export type AgentEvent = typeof AgentEvent.Type;
|
|
63
63
|
export type AgentErrorCode = Extract<AgentEvent, {
|
|
@@ -120,7 +120,7 @@ export declare const makeAgentApiGroup: <const Resource extends Schema.Top>(reso
|
|
|
120
120
|
readonly type: Schema.Literal<"finish">;
|
|
121
121
|
}>, Schema.Struct<{
|
|
122
122
|
readonly type: Schema.Literal<"error">;
|
|
123
|
-
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "
|
|
123
|
+
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
124
124
|
}>]>>, Schema.Struct<{
|
|
125
125
|
readonly code: Schema.Literals<readonly ["unavailable", "stream-failed"]>;
|
|
126
126
|
}>, Schema.Struct.ReadonlySide<{
|
|
@@ -157,5 +157,5 @@ export declare const makeAgentApiGroup: <const Resource extends Schema.Top>(reso
|
|
|
157
157
|
readonly type: Schema.Literal<"finish">;
|
|
158
158
|
}, "Type"> | Schema.Struct.ReadonlySide<{
|
|
159
159
|
readonly type: Schema.Literal<"error">;
|
|
160
|
-
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "
|
|
160
|
+
readonly code: Schema.Literals<readonly ["unavailable", "invalid-request", "stream-failed"]>;
|
|
161
161
|
}, "Type">>, Schema.toCodecJson<typeof HttpApiError.BadRequest | typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never>, false>;
|
|
@@ -79,12 +79,7 @@ var AgentEvent = Schema.Union([
|
|
|
79
79
|
Schema.Struct({ type: Schema.Literal("finish") }),
|
|
80
80
|
Schema.Struct({
|
|
81
81
|
type: Schema.Literal("error"),
|
|
82
|
-
code: Schema.Literals([
|
|
83
|
-
"unavailable",
|
|
84
|
-
"invalid-request",
|
|
85
|
-
"round-limit",
|
|
86
|
-
"stream-failed"
|
|
87
|
-
])
|
|
82
|
+
code: Schema.Literals(["unavailable", "invalid-request", "stream-failed"])
|
|
88
83
|
})
|
|
89
84
|
]).annotate({
|
|
90
85
|
identifier: "AgentEvent",
|