@abpjs/ui 0.2.0-next.8 → 0.2.0-next.9
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/agent.d.ts +34 -5
- package/dist/agent.js +51 -28
- package/dist/agent.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0-next.9
|
|
4
|
+
|
|
5
|
+
A prerelease under npm's `next` tag, from moving the first host's agent pages onto `agent` with no visible change.
|
|
6
|
+
|
|
7
|
+
- agent: a slot `agent.names` (`{ label, value, onChange, placeholder, fallback, kind }`) for a host's own field for
|
|
8
|
+
names by language; `ToolGroupsProvider` (`ToolGroupOf`) for the host's own groups of tools (its skills, an outside
|
|
9
|
+
server's tools), after the host's and plugins' and before the sandbox's; `agent.tools.extra` gets `listed` and
|
|
10
|
+
`loading`.
|
|
11
|
+
- agent: a read-only opt-in tool is Off/On; `AgentEditor variant="scope"` (a scope's own agent, its settings alone),
|
|
12
|
+
used by `ScopeAgentsScreen`; a scope's key in the agents list sits at the cell's start in right-to-left pages, and
|
|
13
|
+
`ItemLink` keeps the page's direction when it wraps words (a bare key stays left to right).
|
|
14
|
+
|
|
3
15
|
## 0.2.0-next.8
|
|
4
16
|
|
|
5
17
|
A prerelease under npm's `next` tag: the third area, `agent`.
|
package/dist/agent.d.ts
CHANGED
|
@@ -27,13 +27,35 @@ declare function ItemHrefProvider({ value, children }: {
|
|
|
27
27
|
value?: ItemHref | null;
|
|
28
28
|
children: ReactNode;
|
|
29
29
|
}): react.JSX.Element;
|
|
30
|
-
/**
|
|
30
|
+
/**
|
|
31
|
+
* An item's key, or words about it (`children`): a link where the host says where it opens, plain otherwise. A bare key
|
|
32
|
+
* reads left to right; words keep the page's direction.
|
|
33
|
+
*/
|
|
31
34
|
declare function ItemLink({ kind, itemKey, children, textStyle }: {
|
|
32
35
|
kind: string | null | undefined;
|
|
33
36
|
itemKey: string;
|
|
34
37
|
children?: ReactNode;
|
|
35
38
|
textStyle?: string;
|
|
36
39
|
}): react.JSX.Element;
|
|
40
|
+
/**
|
|
41
|
+
* Which of the host's own groups a tool is in, by what the host knows of it (its skills, an outside server's tools, by
|
|
42
|
+
* their names): a group's id and its heading, or nothing for the area's own groups (the host's tools, plugins',
|
|
43
|
+
* sandbox's). A host's groups follow the area's, in the order their first tools come.
|
|
44
|
+
*/
|
|
45
|
+
type ToolGroupOf = (tool: {
|
|
46
|
+
name: string;
|
|
47
|
+
title: string;
|
|
48
|
+
readsOnly: boolean;
|
|
49
|
+
optIn?: boolean;
|
|
50
|
+
}) => {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
} | null | undefined;
|
|
54
|
+
/** Gives the tools tabs inside the host's own groups of tools. */
|
|
55
|
+
declare function ToolGroupsProvider({ value, children }: {
|
|
56
|
+
value: ToolGroupOf;
|
|
57
|
+
children: ReactNode;
|
|
58
|
+
}): react.JSX.Element;
|
|
37
59
|
|
|
38
60
|
/**
|
|
39
61
|
* The site's agents, for its admins: the switch (held by the operator's setting and by safe mode), every agent on the
|
|
@@ -481,11 +503,13 @@ type AgentTarget = {
|
|
|
481
503
|
* permissions people gave it. What's the host's goes in its slots: `agent.picture` (the agent's picture),
|
|
482
504
|
* `agent.connections` (outside servers it may use; `onChanged` makes the tools ask again).
|
|
483
505
|
*/
|
|
484
|
-
declare function AgentEditor({ agent, onSaved, permissions }: {
|
|
506
|
+
declare function AgentEditor({ agent, onSaved, permissions, variant }: {
|
|
485
507
|
agent: AgentInfo;
|
|
486
508
|
onSaved: (agent: AgentInfo) => void;
|
|
487
509
|
/** The standing permissions people gave it (its admins'); off where they're someone else's to see. */
|
|
488
510
|
permissions?: boolean;
|
|
511
|
+
/** `site`: with who it is (key, account, responsible, where it's taken on); `scope`: a scope's own agent, its settings alone. */
|
|
512
|
+
variant?: 'site' | 'scope';
|
|
489
513
|
}): react.JSX.Element;
|
|
490
514
|
|
|
491
515
|
/** An agent's state, as a pill: on, or paused. */
|
|
@@ -698,16 +722,21 @@ declare function useNameOf(): (names: Names | null | undefined, fallback: string
|
|
|
698
722
|
declare const filledIn: (names: Names) => Names;
|
|
699
723
|
/**
|
|
700
724
|
* A name in every language the site offers: the reader's inline, the others behind "Other languages". A host that
|
|
701
|
-
* names no languages gets one field, in the reader's.
|
|
725
|
+
* names no languages gets one field, in the reader's. A host with its own field for names by language puts it in the
|
|
726
|
+
* slot `agent.names` (`{ label, value, onChange, placeholder, fallback, kind }`).
|
|
702
727
|
*/
|
|
703
|
-
declare function NamesField(
|
|
728
|
+
declare function NamesField(props: {
|
|
704
729
|
value: Names;
|
|
705
730
|
onChange: (value: Names) => void;
|
|
706
731
|
label: string;
|
|
707
732
|
placeholder?: string;
|
|
733
|
+
/** What shows where no language has a name (an agent's key). */
|
|
734
|
+
fallback?: string;
|
|
735
|
+
/** Which name it is: an agent's name, or what it does (`title`). */
|
|
736
|
+
kind?: 'name' | 'title';
|
|
708
737
|
}): react.JSX.Element;
|
|
709
738
|
|
|
710
739
|
/** The area's words, in English and Arabic; a host overrides any key through `AbpHost.texts.agent`. */
|
|
711
740
|
declare const useAgentTexts: () => (key: string, values?: Record<string, string | number>) => string;
|
|
712
741
|
|
|
713
|
-
export { AgentBadge, type AgentChange, AgentChatButton, type AgentChatInfo, type AgentChatOpen, AgentChatPanel, type AgentChatPlace, AgentChatProvider, type AgentChatSummary, AgentEditor, AgentForm, AgentGraph, type AgentGraphLink, type AgentGraphNote, type AgentGraphPage, type AgentGraphThing, type AgentInfo, AgentLimitsPanel, AgentMemoriesPanel, type AgentMemoryInfo, AgentPause, type AgentPermissionInfo, AgentPermissionsPanel, type AgentPerson, AgentQuestionCard, type AgentQuestionInfo, AgentQuestionsPanel, type AgentRunInfo, type AgentRunLimits, type AgentRunStepInfo, AgentSelect, AgentState, type AgentSwitch, type AgentTarget, AgentText, type AgentTool, AgentToolsPanel, type AgentTypes, type AgentUsage, type AgentUsagePeriod, AgentsAdmin, AgentsAdminPage, AgentsTable, AskAgentButton, type AskableAgent, GOING, ItemAgentRuns, type ItemHref, ItemHrefProvider, ItemLink, type Names, NamesField, RUN_TONES, type ScopeAgentInfo, ScopeAgentsScreen, agentPages, filledIn, num, useAgentChat, useAgentTexts, useNameOf };
|
|
742
|
+
export { AgentBadge, type AgentChange, AgentChatButton, type AgentChatInfo, type AgentChatOpen, AgentChatPanel, type AgentChatPlace, AgentChatProvider, type AgentChatSummary, AgentEditor, AgentForm, AgentGraph, type AgentGraphLink, type AgentGraphNote, type AgentGraphPage, type AgentGraphThing, type AgentInfo, AgentLimitsPanel, AgentMemoriesPanel, type AgentMemoryInfo, AgentPause, type AgentPermissionInfo, AgentPermissionsPanel, type AgentPerson, AgentQuestionCard, type AgentQuestionInfo, AgentQuestionsPanel, type AgentRunInfo, type AgentRunLimits, type AgentRunStepInfo, AgentSelect, AgentState, type AgentSwitch, type AgentTarget, AgentText, type AgentTool, AgentToolsPanel, type AgentTypes, type AgentUsage, type AgentUsagePeriod, AgentsAdmin, AgentsAdminPage, AgentsTable, AskAgentButton, type AskableAgent, GOING, ItemAgentRuns, type ItemHref, ItemHrefProvider, ItemLink, type Names, NamesField, RUN_TONES, type ScopeAgentInfo, ScopeAgentsScreen, type ToolGroupOf, ToolGroupsProvider, agentPages, filledIn, num, useAgentChat, useAgentTexts, useNameOf };
|
package/dist/agent.js
CHANGED
|
@@ -7,12 +7,12 @@ import { PageHeader } from "@abpjs/ui";
|
|
|
7
7
|
// src/areas/agent/AgentsAdmin.tsx
|
|
8
8
|
import { useState as useState9 } from "react";
|
|
9
9
|
import { Stack as Stack9, Text as Text10 } from "@chakra-ui/react";
|
|
10
|
-
import { Button as Button7, HostSlot as
|
|
10
|
+
import { Button as Button7, HostSlot as HostSlot5, InlineAlert as InlineAlert7, Panel as Panel3, SwitchField as SwitchField3, useApiAction as useApiAction5, useApiQuery as useApiQuery6, useAreaRequest as useAreaRequest6, useSlotSaves as useSlotSaves2 } from "@abpjs/ui";
|
|
11
11
|
|
|
12
12
|
// src/areas/agent/AgentEditor.tsx
|
|
13
13
|
import { useState as useState8 } from "react";
|
|
14
14
|
import { HStack as HStack5, Stack as Stack8, Text as Text9 } from "@chakra-ui/react";
|
|
15
|
-
import { HostSlot as
|
|
15
|
+
import { HostSlot as HostSlot4, Panel as Panel2, PropertyList } from "@abpjs/ui";
|
|
16
16
|
|
|
17
17
|
// src/areas/agent/Agents.tsx
|
|
18
18
|
import { useState as useState2 } from "react";
|
|
@@ -22,7 +22,7 @@ import { Button as Button2, DataTable, Field, InlineAlert, notify, PersonChip, S
|
|
|
22
22
|
// src/areas/agent/names.tsx
|
|
23
23
|
import { useCallback, useState } from "react";
|
|
24
24
|
import { HStack, Input, Stack, Text } from "@chakra-ui/react";
|
|
25
|
-
import { Button, useAbpLocale, useHostLanguages } from "@abpjs/ui";
|
|
25
|
+
import { Button, HostSlot, useAbpLocale, useHostLanguages, useOptionalHost } from "@abpjs/ui";
|
|
26
26
|
|
|
27
27
|
// src/areas/agent/texts.ts
|
|
28
28
|
import { createAreaTexts } from "@abpjs/ui";
|
|
@@ -522,7 +522,11 @@ function useNameOf() {
|
|
|
522
522
|
);
|
|
523
523
|
}
|
|
524
524
|
var filledIn = (names) => Object.fromEntries(Object.entries(names).map(([k, v]) => [k, v.trim()]).filter(([, v]) => v));
|
|
525
|
-
function NamesField(
|
|
525
|
+
function NamesField(props) {
|
|
526
|
+
const own = Boolean(useOptionalHost()?.slots?.["agent.names"]);
|
|
527
|
+
return own ? /* @__PURE__ */ jsx(HostSlot, { name: "agent.names", context: props }) : /* @__PURE__ */ jsx(OwnNamesField, { ...props });
|
|
528
|
+
}
|
|
529
|
+
function OwnNamesField({ value, onChange, label, placeholder }) {
|
|
526
530
|
const t = useAgentTexts();
|
|
527
531
|
const { locale } = useAbpLocale();
|
|
528
532
|
const languages = useHostLanguages();
|
|
@@ -596,7 +600,7 @@ function AgentsTable({ rows, loading, onOpen, selected, extra = [] }) {
|
|
|
596
600
|
] })
|
|
597
601
|
] })
|
|
598
602
|
},
|
|
599
|
-
{ id: "where", header: t("where"), cell: (a) => a.scopeKey ? /* @__PURE__ */ jsx2(Text2, { dir: "ltr", children: a.scopeKey }) : t("site") },
|
|
603
|
+
{ id: "where", header: t("where"), cell: (a) => a.scopeKey ? /* @__PURE__ */ jsx2(Text2, { as: "span", dir: "ltr", children: a.scopeKey }) : t("site") },
|
|
600
604
|
{ id: "responsible", header: t("responsible"), cell: (a) => a.responsible?.displayName ?? "" },
|
|
601
605
|
{ id: "state", header: t("state"), cell: (a) => /* @__PURE__ */ jsx2(AgentState, { agent: a }) },
|
|
602
606
|
...extra
|
|
@@ -643,8 +647,8 @@ function AgentForm({ agent, scope, roles, onSaved }) {
|
|
|
643
647
|
return /* @__PURE__ */ jsx2("form", { onSubmit: (e) => void save(e), noValidate: true, children: /* @__PURE__ */ jsxs2(Stack2, { gap: "field", maxW: "2xl", children: [
|
|
644
648
|
!agent && /* @__PURE__ */ jsx2(Field, { label: t("key"), required: true, helperText: t("keyHint"), children: /* @__PURE__ */ jsx2(Input2, { value: form.key, maxLength: 40, dir: "ltr", placeholder: "triage", onChange: (e) => setForm({ ...form, key: e.target.value }) }) }),
|
|
645
649
|
/* @__PURE__ */ jsxs2(HStack2, { gap: "3", align: "start", wrap: "wrap", children: [
|
|
646
|
-
/* @__PURE__ */ jsx2(Field, { label: t("name"), flex: "1", children: /* @__PURE__ */ jsx2(NamesField, { label: t("name"), value: form.names, placeholder: form.key, onChange: (names) => setForm({ ...form, names }) }) }),
|
|
647
|
-
/* @__PURE__ */ jsx2(Field, { label: t("whatItDoes"), flex: "1", children: /* @__PURE__ */ jsx2(NamesField, { label: t("whatItDoes"), value: form.titles, placeholder: t("whatItDoesPlaceholder"), onChange: (titles) => setForm({ ...form, titles }) }) })
|
|
650
|
+
/* @__PURE__ */ jsx2(Field, { label: t("name"), flex: "1", children: /* @__PURE__ */ jsx2(NamesField, { label: t("name"), value: form.names, placeholder: form.key, fallback: form.key, kind: "name", onChange: (names) => setForm({ ...form, names }) }) }),
|
|
651
|
+
/* @__PURE__ */ jsx2(Field, { label: t("whatItDoes"), flex: "1", children: /* @__PURE__ */ jsx2(NamesField, { label: t("whatItDoes"), value: form.titles, placeholder: t("whatItDoesPlaceholder"), kind: "title", onChange: (titles) => setForm({ ...form, titles }) }) })
|
|
648
652
|
] }),
|
|
649
653
|
/* @__PURE__ */ jsx2(Field, { label: t("instructions"), helperText: t("instructionsHint"), children: /* @__PURE__ */ jsx2(Textarea, { value: form.instructions, rows: 6, maxLength: 2e4, onChange: (e) => setForm({ ...form, instructions: e.target.value }) }) }),
|
|
650
654
|
agent && /* @__PURE__ */ jsxs2(HStack2, { gap: "3", align: "start", wrap: "wrap", children: [
|
|
@@ -692,7 +696,7 @@ function AgentPause({ agent, onChanged }) {
|
|
|
692
696
|
// src/areas/agent/AgentLimits.tsx
|
|
693
697
|
import { useState as useState3 } from "react";
|
|
694
698
|
import { chakra, HStack as HStack3, Input as Input3, Stack as Stack3, Text as Text3 } from "@chakra-ui/react";
|
|
695
|
-
import { Button as Button3, Field as Field2, HostSlot, InlineAlert as InlineAlert2, notify as notify2, useApiAction as useApiAction2, useApiQuery, useAreaRequest as useAreaRequest2, useFormatters, useSlotSaves } from "@abpjs/ui";
|
|
699
|
+
import { Button as Button3, Field as Field2, HostSlot as HostSlot2, InlineAlert as InlineAlert2, notify as notify2, useApiAction as useApiAction2, useApiQuery, useAreaRequest as useAreaRequest2, useFormatters, useSlotSaves } from "@abpjs/ui";
|
|
696
700
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
697
701
|
var numberOrNull = (text) => text.trim() === "" ? null : Number(text);
|
|
698
702
|
function AgentLimitsPanel({ agent, onSaved }) {
|
|
@@ -747,7 +751,7 @@ function AgentLimitsPanel({ agent, onSaved }) {
|
|
|
747
751
|
/* @__PURE__ */ jsx3(Text3, { children: period(usage.data?.month) })
|
|
748
752
|
] })
|
|
749
753
|
] }),
|
|
750
|
-
/* @__PURE__ */ jsx3(
|
|
754
|
+
/* @__PURE__ */ jsx3(HostSlot2, { name: "agent.limits.extra", context: { agent, register: slots.register } }),
|
|
751
755
|
/* @__PURE__ */ jsx3(chakra.div, { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(11rem, 1fr))", gap: "3", maxW: "48rem", children: fields.map((f) => /* @__PURE__ */ jsx3(Field2, { label: f.label, children: /* @__PURE__ */ jsx3(
|
|
752
756
|
Input3,
|
|
753
757
|
{
|
|
@@ -789,7 +793,15 @@ function ItemHrefProvider({ value, children }) {
|
|
|
789
793
|
}
|
|
790
794
|
function ItemLink({ kind, itemKey, children, textStyle }) {
|
|
791
795
|
const href = useContext(ItemHrefContext)?.(kind ?? "", itemKey);
|
|
792
|
-
|
|
796
|
+
const dir = children == null ? "ltr" : void 0;
|
|
797
|
+
return href ? /* @__PURE__ */ jsx4(AppLink, { href, dir, textStyle, children: children ?? itemKey }) : /* @__PURE__ */ jsx4(Text4, { as: "span", dir, textStyle, children: children ?? itemKey });
|
|
798
|
+
}
|
|
799
|
+
var ToolGroupContext = createContext(null);
|
|
800
|
+
function ToolGroupsProvider({ value, children }) {
|
|
801
|
+
return /* @__PURE__ */ jsx4(ToolGroupContext.Provider, { value, children });
|
|
802
|
+
}
|
|
803
|
+
function useToolGroupOf() {
|
|
804
|
+
return useContext(ToolGroupContext);
|
|
793
805
|
}
|
|
794
806
|
function useDebounced(value, ms) {
|
|
795
807
|
const [settled, setSettled] = useState4(value);
|
|
@@ -1175,11 +1187,12 @@ function AgentPermissionsPanel({ agentId }) {
|
|
|
1175
1187
|
// src/areas/agent/AgentTools.tsx
|
|
1176
1188
|
import { useState as useState7 } from "react";
|
|
1177
1189
|
import { Stack as Stack7, Text as Text8 } from "@chakra-ui/react";
|
|
1178
|
-
import { Button as Button6, DataTable as DataTable5, HostSlot as
|
|
1190
|
+
import { Button as Button6, DataTable as DataTable5, HostSlot as HostSlot3, InlineAlert as InlineAlert6, notify as notify5, SelectField as SelectField3, StatusPill as StatusPill4, useApiAction as useApiAction4, useApiQuery as useApiQuery5, useAreaRequest as useAreaRequest5 } from "@abpjs/ui";
|
|
1179
1191
|
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1180
1192
|
var isSandbox = (x) => x.name.startsWith("sandbox_");
|
|
1181
1193
|
function optionsOf(x, t) {
|
|
1182
1194
|
if (x.alwaysAsks) return [{ value: "", label: t(x.optIn ? "tools.defaultOff" : "tools.defaultAsks") }, { value: "ask", label: t("tools.askEveryTime") }, ...x.optIn ? [] : [{ value: "off", label: t("tools.off") }]];
|
|
1195
|
+
if (x.optIn && x.readsOnly) return [{ value: "", label: t("tools.defaultOff") }, { value: "run", label: t("tools.on") }];
|
|
1183
1196
|
if (x.optIn) return [{ value: "", label: t("tools.defaultOff") }, { value: "run", label: t("tools.run") }, { value: "ask", label: t("tools.ask") }];
|
|
1184
1197
|
return [
|
|
1185
1198
|
{ value: "", label: t(x.readsOnly ? "tools.defaultReads" : "tools.defaultAsks") },
|
|
@@ -1195,11 +1208,20 @@ function AgentToolsPanel({ agent, onSaved, version = 0 }) {
|
|
|
1195
1208
|
const action = useApiAction4();
|
|
1196
1209
|
const [settings, setSettings] = useState7(agent.tools ?? {});
|
|
1197
1210
|
const changed = JSON.stringify(settings) !== JSON.stringify(agent.tools ?? {});
|
|
1211
|
+
const groupOf = useToolGroupOf();
|
|
1198
1212
|
const rows = tools.data ?? [];
|
|
1213
|
+
const hostGroups = /* @__PURE__ */ new Map();
|
|
1214
|
+
const own = [];
|
|
1215
|
+
for (const x of rows) {
|
|
1216
|
+
const g = groupOf?.(x);
|
|
1217
|
+
if (!g) own.push(x);
|
|
1218
|
+
else (hostGroups.get(g.id) ?? hostGroups.set(g.id, { ...g, rows: [] }).get(g.id)).rows.push(x);
|
|
1219
|
+
}
|
|
1199
1220
|
const groups = [
|
|
1200
|
-
{ id: "host", title: t("tools.groups.host"), rows:
|
|
1201
|
-
{ id: "plugins", title: t("tools.groups.plugins"), rows:
|
|
1202
|
-
|
|
1221
|
+
{ id: "host", title: t("tools.groups.host"), rows: own.filter((x) => !x.fromPlugin && !isSandbox(x)) },
|
|
1222
|
+
{ id: "plugins", title: t("tools.groups.plugins"), rows: own.filter((x) => x.fromPlugin && !isSandbox(x)) },
|
|
1223
|
+
...[...hostGroups.values()],
|
|
1224
|
+
{ id: "sandbox", title: t("tools.groups.sandbox"), rows: own.filter(isSandbox) }
|
|
1203
1225
|
].filter((g) => g.rows.length > 0 || g.id === "host" && tools.loading);
|
|
1204
1226
|
async function save() {
|
|
1205
1227
|
const saved = await action.run(() => request(`/agents/${agent.id}`, { method: "PUT", body: { tools: settings } }));
|
|
@@ -1248,7 +1270,7 @@ function AgentToolsPanel({ agent, onSaved, version = 0 }) {
|
|
|
1248
1270
|
}
|
|
1249
1271
|
)
|
|
1250
1272
|
] }, g.id)),
|
|
1251
|
-
/* @__PURE__ */ jsx8(
|
|
1273
|
+
/* @__PURE__ */ jsx8(HostSlot3, { name: "agent.tools.extra", context: { agent, settings, set, listed: rows.map((x) => x.name), loading: tools.loading } }),
|
|
1252
1274
|
/* @__PURE__ */ jsx8(InlineAlert6, { tone: "danger", children: action.error ?? tools.error }),
|
|
1253
1275
|
/* @__PURE__ */ jsx8(Button6, { variant: "primary", alignSelf: "flex-start", onClick: () => void save(), loading: action.busy, disabled: !changed, children: t("tools.save") })
|
|
1254
1276
|
] });
|
|
@@ -1256,13 +1278,13 @@ function AgentToolsPanel({ agent, onSaved, version = 0 }) {
|
|
|
1256
1278
|
|
|
1257
1279
|
// src/areas/agent/AgentEditor.tsx
|
|
1258
1280
|
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1259
|
-
function AgentEditor({ agent, onSaved, permissions = true }) {
|
|
1281
|
+
function AgentEditor({ agent, onSaved, permissions = true, variant = "site" }) {
|
|
1260
1282
|
const t = useAgentTexts();
|
|
1261
1283
|
const nameOf = useNameOf();
|
|
1262
1284
|
const [toolsVersion, setToolsVersion] = useState8(0);
|
|
1263
1285
|
return /* @__PURE__ */ jsxs8(Stack8, { gap: "section", children: [
|
|
1264
|
-
/* @__PURE__ */ jsx9(Panel2, { title: t("editTitle", { name: nameOf(agent.names, agent.key) }), actions: /* @__PURE__ */ jsx9(AgentPause, { agent, onChanged: onSaved }), "data-testid": "agent-edit", children: /* @__PURE__ */ jsxs8(Stack8, { gap: "stack", children: [
|
|
1265
|
-
/* @__PURE__ */ jsx9(
|
|
1286
|
+
/* @__PURE__ */ jsx9(Panel2, { title: t("editTitle", { name: nameOf(agent.names, agent.key) }), actions: /* @__PURE__ */ jsx9(AgentPause, { agent, onChanged: onSaved }), "data-testid": "agent-edit", children: /* @__PURE__ */ jsxs8(Stack8, { gap: variant === "scope" ? "section" : "stack", children: [
|
|
1287
|
+
variant === "site" && /* @__PURE__ */ jsx9(
|
|
1266
1288
|
PropertyList,
|
|
1267
1289
|
{
|
|
1268
1290
|
items: [
|
|
@@ -1284,9 +1306,9 @@ function AgentEditor({ agent, onSaved, permissions = true }) {
|
|
|
1284
1306
|
]
|
|
1285
1307
|
}
|
|
1286
1308
|
),
|
|
1287
|
-
/* @__PURE__ */ jsx9(
|
|
1309
|
+
/* @__PURE__ */ jsx9(HostSlot4, { name: "agent.picture", context: { agent, onSaved } }),
|
|
1288
1310
|
/* @__PURE__ */ jsx9(AgentForm, { agent, onSaved }, `form-${agent.id}`),
|
|
1289
|
-
/* @__PURE__ */ jsx9(
|
|
1311
|
+
/* @__PURE__ */ jsx9(HostSlot4, { name: "agent.connections", context: { agent, onChanged: () => setToolsVersion((v) => v + 1) } }),
|
|
1290
1312
|
/* @__PURE__ */ jsx9(AgentToolsPanel, { agent, onSaved, version: toolsVersion }, `tools-${agent.id}`),
|
|
1291
1313
|
/* @__PURE__ */ jsx9(AgentLimitsPanel, { agent, onSaved }, `limits-${agent.id}`),
|
|
1292
1314
|
/* @__PURE__ */ jsx9(AgentMemoriesPanel, { agent, onSaved }, `memories-${agent.id}`)
|
|
@@ -1333,7 +1355,7 @@ function AgentsAdmin({ itemHref }) {
|
|
|
1333
1355
|
}
|
|
1334
1356
|
),
|
|
1335
1357
|
/* @__PURE__ */ jsx10(Text10, { textStyle: "caption", color: "fg.muted", children: t(s && !s.adminsMayEnable ? "operatorOff" : "switchHint") }),
|
|
1336
|
-
s && /* @__PURE__ */ jsx10(
|
|
1358
|
+
s && /* @__PURE__ */ jsx10(HostSlot5, { name: "agent.switch.extra", context: { settings: s, register: slots.register } })
|
|
1337
1359
|
] }) }),
|
|
1338
1360
|
/* @__PURE__ */ jsxs9(
|
|
1339
1361
|
Panel3,
|
|
@@ -1477,7 +1499,7 @@ function ScopeAgentsScreen({ scope, roles, header, itemHref, subtitle }) {
|
|
|
1477
1499
|
}
|
|
1478
1500
|
),
|
|
1479
1501
|
creating && /* @__PURE__ */ jsx12(Panel4, { title: t("newProject"), "data-testid": "scope-agent-new", children: /* @__PURE__ */ jsx12(AgentForm, { scope, roles, onSaved: saved }) }),
|
|
1480
|
-
selected && /* @__PURE__ */ jsx12(AgentEditor, { agent: selected, onSaved: saved, permissions: selected.scopeKey != null }, selected.id)
|
|
1502
|
+
selected && /* @__PURE__ */ jsx12(AgentEditor, { agent: selected, onSaved: saved, permissions: selected.scopeKey != null, variant: "scope" }, selected.id)
|
|
1481
1503
|
] }) });
|
|
1482
1504
|
}
|
|
1483
1505
|
|
|
@@ -1485,11 +1507,11 @@ function ScopeAgentsScreen({ scope, roles, header, itemHref, subtitle }) {
|
|
|
1485
1507
|
import { useEffect as useEffect2, useState as useState11 } from "react";
|
|
1486
1508
|
import { Box as Box2, HStack as HStack7, Stack as Stack12, Text as Text12 } from "@chakra-ui/react";
|
|
1487
1509
|
import { Bot, ChevronDown, ChevronRight, Square } from "lucide-react";
|
|
1488
|
-
import { Button as Button9, DirectionalIcon, HostSlot as
|
|
1510
|
+
import { Button as Button9, DirectionalIcon, HostSlot as HostSlot6, Panel as Panel5, StatusPill as StatusPill5, useApiAction as useApiAction7, useApiQuery as useApiQuery8, useAreaRequest as useAreaRequest8, useFormatters as useFormatters5, useOptionalHost as useOptionalHost2 } from "@abpjs/ui";
|
|
1489
1511
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1490
1512
|
function AgentText({ source, testId }) {
|
|
1491
|
-
const drawn = Boolean(
|
|
1492
|
-
return /* @__PURE__ */ jsx13(Box2, { textStyle: "sm", dir: "auto", "data-testid": testId, children: drawn ? /* @__PURE__ */ jsx13(
|
|
1513
|
+
const drawn = Boolean(useOptionalHost2()?.slots?.["agent.markdown"]);
|
|
1514
|
+
return /* @__PURE__ */ jsx13(Box2, { textStyle: "sm", dir: "auto", "data-testid": testId, children: drawn ? /* @__PURE__ */ jsx13(HostSlot6, { name: "agent.markdown", context: { source } }) : /* @__PURE__ */ jsx13(Text12, { whiteSpace: "pre-wrap", children: source }) });
|
|
1493
1515
|
}
|
|
1494
1516
|
var allowedKey = (allowed) => allowed === "settings" ? "settings" : allowed.startsWith("always:") ? "always" : allowed === "this-run" ? "thisRun" : "answer";
|
|
1495
1517
|
function AgentQuestionCard({ question, onAnswered }) {
|
|
@@ -1555,7 +1577,7 @@ function RunRow({ run, onChanged }) {
|
|
|
1555
1577
|
/* @__PURE__ */ jsx13(Square, {}),
|
|
1556
1578
|
t("runs.stop")
|
|
1557
1579
|
] }),
|
|
1558
|
-
!going && /* @__PURE__ */ jsx13(
|
|
1580
|
+
!going && /* @__PURE__ */ jsx13(HostSlot6, { name: "agent.run.actions", context: { run, onChanged } })
|
|
1559
1581
|
] })
|
|
1560
1582
|
] }),
|
|
1561
1583
|
run.question && /* @__PURE__ */ jsx13(AgentQuestionCard, { question: run.question, onAnswered: onChanged }),
|
|
@@ -1613,7 +1635,7 @@ import {
|
|
|
1613
1635
|
DirectionalIcon as DirectionalIcon2,
|
|
1614
1636
|
EmptyState,
|
|
1615
1637
|
Field as Field3,
|
|
1616
|
-
HostSlot as
|
|
1638
|
+
HostSlot as HostSlot7,
|
|
1617
1639
|
IconButton,
|
|
1618
1640
|
InlineAlert as InlineAlert9,
|
|
1619
1641
|
notify as notify7,
|
|
@@ -2013,7 +2035,7 @@ function Turn({ run, chat, onChat, onChanged, live }) {
|
|
|
2013
2035
|
/* @__PURE__ */ jsx14(Check, { size: 12, "aria-hidden": true }),
|
|
2014
2036
|
/* @__PURE__ */ jsx14(Text13, { as: "span", children: t("chat.posted", { key: itemKey }) })
|
|
2015
2037
|
] }),
|
|
2016
|
-
changed && /* @__PURE__ */ jsx14(
|
|
2038
|
+
changed && /* @__PURE__ */ jsx14(HostSlot7, { name: "agent.run.actions", context: { run, onChanged: itemChanged } })
|
|
2017
2039
|
] })
|
|
2018
2040
|
] })
|
|
2019
2041
|
] }) });
|
|
@@ -2137,6 +2159,7 @@ export {
|
|
|
2137
2159
|
NamesField,
|
|
2138
2160
|
RUN_TONES,
|
|
2139
2161
|
ScopeAgentsScreen,
|
|
2162
|
+
ToolGroupsProvider,
|
|
2140
2163
|
agentPages,
|
|
2141
2164
|
filledIn,
|
|
2142
2165
|
num,
|