@abpjs/ui 0.2.0-next.3 → 0.2.0-next.31

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/agent.js ADDED
@@ -0,0 +1,2136 @@
1
+ "use client";
2
+
3
+ // src/areas/agent/pages.tsx
4
+ import { Stack as Stack10 } from "@chakra-ui/react";
5
+ import { PageHeader } from "@abpjs/ui";
6
+
7
+ // src/areas/agent/AgentsAdmin.tsx
8
+ import { useState as useState9 } from "react";
9
+ import { Stack as Stack9, Text as Text10 } from "@chakra-ui/react";
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
+
12
+ // src/areas/agent/AgentEditor.tsx
13
+ import { useState as useState8 } from "react";
14
+ import { HStack as HStack5, Stack as Stack8, Text as Text9 } from "@chakra-ui/react";
15
+ import { HostSlot as HostSlot4, Panel as Panel2, PropertyList } from "@abpjs/ui";
16
+
17
+ // src/areas/agent/Agents.tsx
18
+ import { useState as useState2 } from "react";
19
+ import { HStack as HStack2, Input as Input2, Stack as Stack2, Text as Text2, Textarea } from "@chakra-ui/react";
20
+ import { Button as Button2, DataTable, Field, InlineAlert, notify, PersonChip, SelectField, StatusPill, SwitchField, useApiAction, useAreaRequest } from "@abpjs/ui";
21
+
22
+ // src/areas/agent/names.tsx
23
+ import { useCallback, useState } from "react";
24
+ import { HStack, Input, Stack, Text } from "@chakra-ui/react";
25
+ import { Button, HostSlot, useAbpLocale, useHostLanguages, useOptionalHost } from "@abpjs/ui";
26
+
27
+ // src/areas/agent/texts.ts
28
+ import { createAreaTexts } from "@abpjs/ui";
29
+
30
+ // src/areas/agent/texts/ar.json
31
+ var ar_default = {
32
+ modelAlias: "\u0627\u0644\u0646\u0645\u0648\u0630\u062C",
33
+ modelAliasHint: "\u0627\u0633\u0645 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0627\u0644\u0630\u064A \u062A\u0633\u062A\u062E\u062F\u0645\u0647 \u062A\u0634\u063A\u064A\u0644\u0627\u062A\u0647\u060C \u0643\u0645\u0627 \u062A\u0633\u0645\u064A\u0647 \u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A \u0644\u0644\u0645\u0634\u0631\u0648\u0639.",
34
+ transcriptDays: "\u0627\u0644\u0627\u062D\u062A\u0641\u0627\u0638 \u0628\u0627\u0644\u0646\u0635\u0648\u0635 (\u0623\u064A\u0627\u0645)",
35
+ transcriptDaysHint: "\u0627\u062A\u0631\u0643\u0647 \u0641\u0627\u0631\u063A\u064B\u0627 \u0644\u0645\u062F\u0629 \u0627\u0644\u0645\u0648\u0642\u0639.",
36
+ "tools.title": "\u0627\u0644\u0623\u062F\u0648\u0627\u062A",
37
+ "tools.hint": "\u0645\u0627 \u064A\u062D\u0642 \u0644\u0647\u0630\u0627 \u0627\u0644\u0648\u0643\u064A\u0644 \u0641\u0639\u0644\u0647 \u0628\u0643\u0644 \u0623\u062F\u0627\u0629. \u0627\u0644\u0623\u062F\u0627\u0629 \u0627\u0644\u062A\u064A \u062A\u0642\u0631\u0623 \u0641\u0642\u0637 \u062A\u0639\u0645\u0644\u060C \u0648\u0627\u0644\u062A\u064A \u062A\u063A\u064A\u0651\u0631 \u0634\u064A\u0626\u064B\u0627 \u062A\u0633\u0623\u0644 \u0645\u0627 \u0644\u0645 \u062A\u064F\u0636\u0628\u0637 \u0639\u0644\u0649 \u0627\u0644\u062A\u0634\u063A\u064A\u0644\u060C \u0648\u0627\u0644\u062A\u063A\u064A\u064A\u0631 \u0641\u064A \u0646\u0638\u0627\u0645 \u0622\u062E\u0631 \u064A\u0633\u0623\u0644 \u0641\u064A \u0643\u0644 \u0645\u0631\u0629. \u0627\u0644\u0645\u0647\u0627\u0631\u0627\u062A \u0648\u062A\u0644\u0643 \u0627\u0644\u062A\u063A\u064A\u064A\u0631\u0627\u062A \u0645\u0639\u0637\u0644\u0629 \u062D\u062A\u0649 \u062A\u064F\u0641\u0639\u064E\u0651\u0644. \u0648\u0627\u0644\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0630\u064A \u0642\u0631\u0623 \u0645\u062D\u062A\u0648\u0649 \u0645\u0646 \u0627\u0644\u062E\u0627\u0631\u062C \u0623\u0648 \u0645\u0627 \u064A\u062A\u062C\u0627\u0648\u0632 \u0645\u0634\u0631\u0648\u0639\u0647 \u064A\u0633\u0623\u0644 \u0642\u0628\u0644 \u0643\u0644 \u062A\u063A\u064A\u064A\u0631.",
38
+ "tools.tool": "\u0627\u0644\u0623\u062F\u0627\u0629",
39
+ "tools.kind": "\u0627\u0644\u0646\u0648\u0639",
40
+ "tools.setting": "\u0647\u0630\u0627 \u0627\u0644\u0648\u0643\u064A\u0644",
41
+ "tools.reads": "\u062A\u0642\u0631\u0623",
42
+ "tools.changes": "\u062A\u063A\u064A\u0651\u0631",
43
+ "tools.defaultReads": "\u062A\u0639\u0645\u0644 (\u062A\u0642\u0631\u0623 \u0641\u0642\u0637)",
44
+ "tools.defaultAsks": "\u064A\u0633\u0623\u0644 \u0623\u0648\u0644\u064B\u0627",
45
+ "tools.run": "\u062A\u0639\u0645\u0644 \u062F\u0648\u0646 \u0633\u0624\u0627\u0644",
46
+ "tools.ask": "\u064A\u0633\u0623\u0644 \u0623\u0648\u0644\u064B\u0627",
47
+ "tools.off": "\u0645\u0639\u0637\u0651\u0644\u0629",
48
+ "tools.save": "\u0627\u062D\u0641\u0638 \u0627\u0644\u0623\u062F\u0648\u0627\u062A",
49
+ "tools.saved": "\u062D\u064F\u0641\u0638\u062A \u0627\u0644\u0623\u062F\u0648\u0627\u062A.",
50
+ "tools.groups.sandbox": "\u0627\u0644\u0628\u064A\u0626\u0629 \u0627\u0644\u0645\u0639\u0632\u0648\u0644\u0629",
51
+ "tools.defaultOff": "\u0645\u0639\u0637\u0644\u0629 (\u0643\u0645\u0627 \u0647\u064A)",
52
+ "tools.on": "\u0645\u0641\u0639\u0651\u0644\u0629",
53
+ "tools.askEveryTime": "\u062A\u0633\u0623\u0644 \u0641\u064A \u0643\u0644 \u0645\u0631\u0629",
54
+ "tools.asksEveryTime": "\u062A\u063A\u064A\u0651\u0631 \u0646\u0638\u0627\u0645\u064B\u0627 \u0622\u062E\u0631",
55
+ title: "\u0627\u0644\u0648\u0643\u0644\u0627\u0621",
56
+ subtitle: "\u0632\u0645\u0644\u0627\u0621 \u0645\u0646 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A \u0644\u0643\u0644 \u0645\u0646\u0647\u0645 \u062D\u0633\u0627\u0628\u0647. \u064A\u0639\u0645\u0644 \u0643\u0644 \u0648\u0643\u064A\u0644 \u0628\u0635\u0644\u0627\u062D\u064A\u0627\u062A \u0645\u0646 \u064A\u0634\u063A\u0651\u0644\u0647 \u0648\u0628\u0627\u0633\u0645\u0647 \u0647\u0648. \u064A\u062A\u0628\u0646\u0651\u0649 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0648\u0643\u0644\u0627\u0621 \u0627\u0644\u0645\u0648\u0642\u0639 \u0623\u0648 \u064A\u064F\u0646\u0634\u0626 \u0648\u0643\u0644\u0627\u0621\u0647.",
57
+ switchTitle: "\u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u0648\u0642\u0639",
58
+ switchOn: "\u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u0645\u0641\u0639\u0651\u0644\u0648\u0646.",
59
+ switchOff: "\u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u0645\u0639\u0637\u0651\u0644\u0648\u0646: \u0644\u0627 \u064A\u0645\u0643\u0646 \u0625\u0646\u0634\u0627\u0621 \u0623\u064A \u0648\u0643\u064A\u0644\u060C \u0648\u0644\u0627 \u064A\u0639\u0645\u0644 \u0623\u064A \u0645\u0646\u0647\u0645.",
60
+ switchHint: "\u064A\u0637\u0644\u0628 \u0645\u0646\u0643 \u062A\u0641\u0639\u064A\u0644\u0647\u0645 \u062A\u0623\u0643\u064A\u062F \u0647\u0648\u064A\u062A\u0643.",
61
+ operatorOff: "\u0644\u0645 \u064A\u0633\u0645\u062D \u0645\u0634\u063A\u0651\u0644 \u0627\u0644\u0645\u0648\u0642\u0639 \u0628\u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u0647\u0646\u0627. \u064A\u0636\u0628\u0637 \u0645\u0646 \u064A\u062F\u064A\u0631 \u0627\u0644\u062E\u0648\u0627\u062F\u0645 \u0627\u0644\u0625\u0639\u062F\u0627\u062F Agents:AdminsMayEnable.",
62
+ safeMode: "\u0628\u062F\u0623 \u0627\u0644\u0645\u0648\u0642\u0639 \u0641\u064A \u0627\u0644\u0648\u0636\u0639 \u0627\u0644\u0622\u0645\u0646: \u064A\u062A\u0648\u0642\u0641 \u0643\u0644 \u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u062D\u062A\u0649 \u064A\u0628\u062F\u0623 \u0645\u0646 \u062F\u0648\u0646\u0647.",
63
+ list: "\u0627\u0644\u0648\u0643\u0644\u0627\u0621",
64
+ empty: "\u0644\u0627 \u064A\u0648\u062C\u062F \u0648\u0643\u0644\u0627\u0621 \u0628\u0639\u062F.",
65
+ name: "\u0627\u0644\u0627\u0633\u0645",
66
+ where: "\u0627\u0644\u0645\u0643\u0627\u0646",
67
+ site: "\u0627\u0644\u0645\u0648\u0642\u0639",
68
+ responsible: "\u0627\u0644\u0645\u0633\u0624\u0648\u0644",
69
+ state: "\u0627\u0644\u062D\u0627\u0644\u0629",
70
+ on: "\u064A\u0639\u0645\u0644",
71
+ paused: "\u0645\u062A\u0648\u0642\u0641 \u0645\u0624\u0642\u062A\u064B\u0627",
72
+ takenBy: "\u062A\u0628\u0646\u0651\u0627\u0647",
73
+ newSite: "\u0648\u0643\u064A\u0644 \u062C\u062F\u064A\u062F \u0644\u0644\u0645\u0648\u0642\u0639",
74
+ newProject: "\u0648\u0643\u064A\u0644 \u062C\u062F\u064A\u062F \u0644\u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639",
75
+ key: "\u0627\u0644\u0645\u0639\u0631\u0651\u0641",
76
+ keyHint: "\u0623\u062D\u0631\u0641 \u0625\u0646\u062C\u0644\u064A\u0632\u064A\u0629 \u0635\u063A\u064A\u0631\u0629 \u0648\u0623\u0631\u0642\u0627\u0645 \u0648\u0634\u0631\u0637\u0627\u062A. \u064A\u064F\u0633\u0645\u0651\u0649 \u062D\u0633\u0627\u0628\u0647 \u0628\u0647\u060C \u0648\u0644\u0627 \u064A\u0645\u0643\u0646 \u062A\u063A\u064A\u064A\u0631\u0647.",
77
+ whatItDoes: "\u0645\u0627 \u064A\u0642\u0648\u0645 \u0628\u0647",
78
+ whatItDoesPlaceholder: "\u0627\u0644\u0641\u0631\u0632",
79
+ instructions: "\u0627\u0644\u062A\u0639\u0644\u064A\u0645\u0627\u062A",
80
+ instructionsHint: "\u0628\u0635\u064A\u063A\u0629 Markdown: \u0645\u0627 \u064A\u0642\u0648\u0645 \u0628\u0647 \u0648\u0643\u064A\u0641\u060C \u0648\u0645\u0627 \u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0641\u0639\u0644\u0647 \u0623\u0628\u062F\u064B\u0627.",
81
+ offerAll: "\u0625\u062A\u0627\u062D\u062A\u0647 \u0644\u0643\u0644 \u0627\u0644\u0645\u0634\u0627\u0631\u064A\u0639",
82
+ offeredTo: "\u0645\u062A\u0627\u062D \u0644\u0640",
83
+ offeredToHint: "\u0645\u0641\u0627\u062A\u064A\u062D \u0627\u0644\u0645\u0634\u0627\u0631\u064A\u0639\u060C \u062A\u0641\u0635\u0644 \u0628\u064A\u0646\u0647\u0627 \u0641\u0648\u0627\u0635\u0644.",
84
+ role: "\u062F\u0648\u0631\u0647 \u0647\u0646\u0627",
85
+ roleHint: "\u0644\u0644\u062A\u0634\u063A\u064A\u0644\u0627\u062A \u0627\u0644\u062A\u064A \u064A\u0628\u062F\u0624\u0647\u0627 \u0627\u0644\u0646\u0638\u0627\u0645 \u0647\u0646\u0627. \u0627\u0644\u062A\u0634\u063A\u064A\u0644\u0627\u062A \u0627\u0644\u062A\u064A \u064A\u0628\u062F\u0624\u0647\u0627 \u0634\u062E\u0635 \u062A\u0633\u062A\u062E\u062F\u0645 \u0635\u0644\u0627\u062D\u064A\u0627\u062A \u0630\u0644\u0643 \u0627\u0644\u0634\u062E\u0635.",
86
+ create: "\u0625\u0646\u0634\u0627\u0621",
87
+ created: "\u0623\u064F\u0646\u0634\u0626 {name}.",
88
+ save: "\u062D\u0641\u0638",
89
+ saved: "\u062A\u0645 \u0627\u0644\u062D\u0641\u0638.",
90
+ pause: "\u0625\u064A\u0642\u0627\u0641 \u0645\u0624\u0642\u062A",
91
+ resume: "\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u062A\u0634\u063A\u064A\u0644",
92
+ pausedToast: "\u0623\u064F\u0648\u0642\u0641 {name} \u0645\u0624\u0642\u062A\u064B\u0627.",
93
+ resumedToast: "\u0639\u0627\u062F {name} \u0625\u0644\u0649 \u0627\u0644\u0639\u0645\u0644.",
94
+ editTitle: "\u062A\u0639\u062F\u064A\u0644 {name}",
95
+ own: "\u062E\u0627\u0635 \u0628\u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639",
96
+ take: "\u062A\u0628\u0646\u0651\u064A",
97
+ takeOff: "\u0625\u0644\u063A\u0627\u0621 \u0627\u0644\u062A\u0628\u0646\u0651\u064A",
98
+ takenToast: "\u062A\u0645 \u062A\u0628\u0646\u0651\u064A {name}.",
99
+ takenOffToast: "\u0623\u064F\u0644\u063A\u064A \u062A\u0628\u0646\u0651\u064A {name}.",
100
+ projectSubtitle: "\u0648\u0643\u0644\u0627\u0621 \u0647\u0630\u0627 \u0627\u0644\u0645\u0634\u0631\u0648\u0639\u060C \u0648\u0648\u0643\u0644\u0627\u0621 \u0627\u0644\u0645\u0648\u0642\u0639 \u0627\u0644\u0645\u062A\u0627\u062D\u0648\u0646 \u0644\u0647. \u064A\u062A\u0628\u0646\u0651\u0649 \u0627\u0644\u0645\u0634\u0631\u0648\u0639 \u0648\u0643\u064A\u0644\u064B\u0627 \u0648\u064A\u0645\u0646\u062D\u0647 \u062F\u0648\u0631\u064B\u0627 \u0644\u0644\u062A\u0634\u063A\u064A\u0644\u0627\u062A \u0627\u0644\u062A\u064A \u064A\u0628\u062F\u0624\u0647\u0627 \u0627\u0644\u0646\u0638\u0627\u0645 \u0647\u0646\u0627.",
101
+ notTaken: "\u0644\u0645 \u064A\u064F\u062A\u0628\u0646\u064E\u0651",
102
+ account: "\u0627\u0644\u062D\u0633\u0627\u0628",
103
+ "runs.asks": "\u064A\u0637\u0644\u0628 \u062A\u0634\u063A\u064A\u0644 {tool} \u0639\u0644\u0649 {target}.",
104
+ "runs.waitsFor": "\u064A\u0646\u062A\u0638\u0631 \u0625\u062C\u0627\u0628\u0629 {person}.",
105
+ "runs.expires": "\u064A\u064F\u0631\u0641\u0636 \u0625\u0646 \u0644\u0645 \u064A\u064F\u062C\u0628 \u0623\u062D\u062F \u0642\u0628\u0644 {at}.",
106
+ "runs.answers.allow": "\u0627\u0633\u0645\u062D",
107
+ "runs.answers.allow-run": "\u0627\u0633\u0645\u062D \u0644\u0647\u0630\u0627 \u0627\u0644\u062A\u0634\u063A\u064A\u0644",
108
+ "runs.answers.always": "\u0627\u0633\u0645\u062D \u062F\u0627\u0626\u0645\u064B\u0627",
109
+ "runs.answers.refuse": "\u0627\u0631\u0641\u0636",
110
+ "runs.ask": "\u0627\u0633\u0623\u0644 \u0648\u0643\u064A\u0644\u064B\u0627",
111
+ "runs.title": "\u0627\u0644\u0648\u0643\u0644\u0627\u0621",
112
+ "runs.hint": "\u0645\u0627 \u0641\u0639\u0644\u0647 \u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0639\u0646\u0635\u0631: \u0645\u0646 \u0637\u0644\u0628\u060C \u0648\u0643\u064A\u0641 \u0633\u0627\u0631\u060C \u0648\u0643\u0644 \u062E\u0637\u0648\u0629.",
113
+ "runs.outside": "\u0642\u0631\u0623 \u0645\u062D\u062A\u0648\u0649 \u0645\u0646 \u062E\u0627\u0631\u062C \u0627\u0644\u0641\u0631\u064A\u0642",
114
+ "runs.wide": "\u0642\u0631\u0623 \u0645\u0627 \u064A\u062A\u062C\u0627\u0648\u0632 \u0627\u0644\u0645\u0634\u0631\u0648\u0639",
115
+ "runs.stop": "\u0623\u0648\u0642\u0641",
116
+ "runs.steps": "{count, plural, =0 {\u0644\u0627 \u062E\u0637\u0648\u0627\u062A \u0623\u062F\u0648\u0627\u062A} one {\u062E\u0637\u0648\u0629 \u0623\u062F\u0627\u0629 \u0648\u0627\u062D\u062F\u0629} two {\u062E\u0637\u0648\u062A\u0627 \u0623\u062F\u0627\u0629} few {# \u062E\u0637\u0648\u0627\u062A \u0623\u062F\u0648\u0627\u062A} many {# \u062E\u0637\u0648\u0629 \u0623\u062F\u0627\u0629} other {# \u062E\u0637\u0648\u0629 \u0623\u062F\u0627\u0629}}",
117
+ "runs.states.waiting": "\u064A\u0646\u062A\u0638\u0631 \u0625\u062C\u0627\u0628\u0629",
118
+ "runs.states.queued": "\u0641\u064A \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",
119
+ "runs.states.running": "\u064A\u0639\u0645\u0644",
120
+ "runs.states.done": "\u062A\u0645",
121
+ "runs.states.failed": "\u0641\u0634\u0644",
122
+ "runs.states.stopped": "\u0645\u062A\u0648\u0642\u0641",
123
+ "runs.triggers.ask": "\u0637\u064F\u0644\u0628 \u0645\u0646\u0647",
124
+ "runs.triggers.assigned": "\u0643\u064F\u0644\u0650\u0651\u0641 \u0628\u0647",
125
+ "runs.triggers.mentioned": "\u0630\u064F\u0643\u0631",
126
+ "runs.triggers.rule": "\u0642\u0627\u0639\u062F\u0629",
127
+ "runs.triggers.schedule": "\u0645\u062C\u062F\u0648\u0644",
128
+ "runs.triggers.workflow": "\u062E\u0637\u0648\u0629 \u0633\u064A\u0631 \u0639\u0645\u0644",
129
+ "runs.triggers.chat": "\u0645\u062D\u0627\u062F\u062B\u0629",
130
+ "runs.outcomes.asked": "\u0633\u0623\u0644",
131
+ "runs.outcomes.started": "\u0628\u062F\u0623",
132
+ "runs.outcomes.done": "\u062A\u0645",
133
+ "runs.outcomes.failed": "\u0641\u0634\u0644",
134
+ "runs.outcomes.refused": "\u0631\u064F\u0641\u0636",
135
+ "runs.outcomes.unknown": "\u063A\u064A\u0631 \u0645\u0639\u0631\u0648\u0641: \u062A\u0648\u0642\u0641 \u0623\u062B\u0646\u0627\u0621 \u062A\u0646\u0641\u064A\u0630\u0647",
136
+ "runs.allowed.settings": "\u0634\u064F\u063A\u0651\u0644\u062A \u0643\u0645\u0627 \u062A\u0633\u0645\u062D \u0625\u0639\u062F\u0627\u062F\u0627\u062A\u0647",
137
+ "runs.allowed.always": "\u0634\u064F\u063A\u0651\u0644\u062A \u0628\u0625\u0630\u0646 {name} \u0627\u0644\u062F\u0627\u0626\u0645",
138
+ "runs.allowed.thisRun": "\u0645\u0633\u0645\u0648\u062D \u0628\u0647\u0627 \u0644\u0647\u0630\u0627 \u0627\u0644\u062A\u0634\u063A\u064A\u0644",
139
+ "runs.allowed.answer": "\u0633\u064F\u0645\u062D \u0628\u0647\u0627 \u0639\u0646\u062F \u0627\u0644\u0633\u0624\u0627\u0644",
140
+ "limits.title": "\u0627\u0644\u062D\u062F\u0648\u062F",
141
+ "limits.hint": "\u0645\u0627 \u064A\u0645\u0643\u0646 \u0644\u0647\u0630\u0627 \u0627\u0644\u0648\u0643\u064A\u0644 \u0623\u0646 \u064A\u0646\u0641\u0642\u0647 \u0648\u064A\u0641\u0639\u0644\u0647. \u062A\u064E\u0639\u064F\u062F\u0651 \u062D\u062F\u0648\u062F \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A \u0627\u0644\u062E\u0627\u0635\u0629 \u0628\u0647 \u0643\u0644 \u0627\u0633\u062A\u062F\u0639\u0627\u0621 \u062A\u062C\u0631\u064A\u0647 \u062A\u0634\u063A\u064A\u0644\u0627\u062A\u0647\u060C \u0636\u0645\u0646 \u062D\u062F\u0648\u062F \u0627\u0644\u0645\u0648\u0642\u0639 \u0648\u0627\u0644\u0645\u0634\u0627\u0631\u064A\u0639. \u064A\u062A\u0648\u0642\u0641 \u0627\u0644\u062A\u0634\u063A\u064A\u0644 \u0639\u0646\u062F \u0623\u0648\u0644 \u062D\u062F \u064A\u0628\u0644\u063A\u0647\u061B \u0648\u0627\u0644\u062D\u0642\u0644 \u0627\u0644\u0641\u0627\u0631\u063A \u064A\u0639\u0646\u064A \u062D\u062F \u0627\u0644\u0645\u0648\u0642\u0639.",
142
+ "limits.today": "\u0627\u0644\u064A\u0648\u0645",
143
+ "limits.month": "\u0647\u0630\u0627 \u0627\u0644\u0634\u0647\u0631",
144
+ "limits.spent": "{runs, plural, =0 {\u0644\u0627 \u062A\u0634\u063A\u064A\u0644\u0627\u062A} one {\u062A\u0634\u063A\u064A\u0644 \u0648\u0627\u062D\u062F} two {\u062A\u0634\u063A\u064A\u0644\u0627\u0646} few {# \u062A\u0634\u063A\u064A\u0644\u0627\u062A} many {# \u062A\u0634\u063A\u064A\u0644\u064B\u0627} other {# \u062A\u0634\u063A\u064A\u0644}}\u060C \u0641\u0634\u0644 \u0645\u0646\u0647\u0627 {failed}\u060C \u0648\u0623\u064F\u0646\u0641\u0642 {cost}",
145
+ "limits.turns": "\u0627\u0644\u0623\u062F\u0648\u0627\u0631 \u0644\u0643\u0644 \u062A\u0634\u063A\u064A\u0644",
146
+ "limits.toolCalls": "\u0627\u0633\u062A\u062F\u0639\u0627\u0621\u0627\u062A \u0627\u0644\u0623\u062F\u0648\u0627\u062A \u0644\u0643\u0644 \u062A\u0634\u063A\u064A\u0644",
147
+ "limits.minutes": "\u0627\u0644\u062F\u0642\u0627\u0626\u0642 \u0644\u0643\u0644 \u062A\u0634\u063A\u064A\u0644",
148
+ "limits.runCost": "\u0627\u0644\u062A\u0643\u0644\u0641\u0629 \u0644\u0643\u0644 \u062A\u0634\u063A\u064A\u0644",
149
+ "limits.site": "\u062D\u062F \u0627\u0644\u0645\u0648\u0642\u0639: {value}",
150
+ "limits.none": "\u0628\u0644\u0627 \u062D\u062F",
151
+ "limits.save": "\u0627\u062D\u0641\u0638 \u0627\u0644\u062D\u062F\u0648\u062F",
152
+ "limits.saved": "\u062D\u064F\u0641\u0638\u062A \u0627\u0644\u062D\u062F\u0648\u062F",
153
+ "memory.title": "\u0627\u0644\u0630\u0627\u0643\u0631\u0629",
154
+ "memory.hint": "\u0645\u0627 \u062A\u0639\u0644\u0651\u0645\u0647 \u0647\u0630\u0627 \u0627\u0644\u0648\u0643\u064A\u0644 \u0639\u0646 \u0627\u0644\u0639\u0646\u0627\u0635\u0631 \u0641\u064A \u062A\u0634\u063A\u064A\u0644\u0627\u062A\u0647\u060C \u0644\u062A\u0634\u063A\u064A\u0644\u0627\u062A\u0647 \u0627\u0644\u0642\u0627\u062F\u0645\u0629: \u064A\u064F\u0639\u0637\u0649 \u0627\u0644\u062A\u0634\u063A\u064A\u0644 \u0639\u0644\u0649 \u0639\u0646\u0635\u0631 \u0623\u062D\u062F\u062B \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0647 \u0639\u0646\u0647\u060C \u0648\u064A\u062C\u062F \u0627\u0644\u0627\u0633\u062A\u0631\u062C\u0627\u0639 \u0627\u0644\u0645\u0632\u064A\u062F \u0628\u0627\u0644\u0642\u0631\u0628 \u0645\u0646\u0647. \u0644\u0627 \u062A\u0635\u0644 \u0627\u0644\u0645\u0644\u0627\u062D\u0638\u0629 \u0625\u0644\u0627 \u0625\u0644\u0649 \u062A\u0634\u063A\u064A\u0644\u0627\u062A \u064A\u062D\u0642 \u0644\u0635\u0627\u062D\u0628\u0647\u0627 \u0642\u0631\u0627\u0621\u0629 \u0645\u0627 \u062A\u062A\u062D\u062F\u062B \u0639\u0646\u0647. \u0648\u0627\u0644\u0645\u0644\u0627\u062D\u0638\u0629 \u0627\u0644\u0645\u062D\u0641\u0648\u0638\u0629 \u0628\u0639\u062F \u0645\u062D\u062A\u0648\u0649 \u062E\u0627\u0631\u062C\u064A \u062A\u064F\u0639\u0644\u0650\u0651\u0645 \u0627\u0644\u062A\u0634\u063A\u064A\u0644\u0627\u062A \u0627\u0644\u062A\u064A \u062A\u0635\u0644\u0647\u0627\u060C \u0641\u062A\u0633\u0623\u0644 \u0642\u0628\u0644 \u0623\u064A \u062A\u063A\u064A\u064A\u0631.",
155
+ "memory.on": "\u064A\u062D\u062A\u0641\u0638 \u0628\u0627\u0644\u0630\u0627\u0643\u0631\u0629",
156
+ "memory.off": "\u0644\u0627 \u064A\u062D\u062A\u0641\u0638 \u0628\u0627\u0644\u0630\u0627\u0643\u0631\u0629",
157
+ "memory.about": "\u0639\u0646",
158
+ "memory.text": "\u0645\u0627 \u062F\u0648\u0651\u0646\u0647",
159
+ "memory.kept": "\u062D\u064F\u0641\u0638\u062A",
160
+ "memory.uses": "\u0645\u0631\u0627\u062A \u0627\u0644\u0627\u0633\u062A\u062E\u062F\u0627\u0645",
161
+ "memory.outside": "\u062D\u064F\u0641\u0638\u062A \u0628\u0639\u062F \u0645\u062D\u062A\u0648\u0649 \u062E\u0627\u0631\u062C\u064A",
162
+ "memory.forget": "\u0627\u0646\u0633\u064E",
163
+ "memory.forgotten": "\u0646\u064F\u0633\u064A\u062A",
164
+ "memory.none": "\u0644\u0645 \u064A\u064F\u062D\u0641\u0638 \u0634\u064A\u0621 \u0628\u0639\u062F.",
165
+ "memory.view": "\u0627\u0644\u0639\u0631\u0636",
166
+ "memory.notes": "\u0627\u0644\u0645\u0644\u0627\u062D\u0638\u0627\u062A",
167
+ "memory.graph": "\u0627\u0644\u0645\u062E\u0637\u0637",
168
+ "chat.open": "\u0645\u062D\u0627\u062F\u062B\u0629 \u0648\u0643\u064A\u0644",
169
+ "chat.title": "\u0627\u0644\u0648\u0643\u0644\u0627\u0621",
170
+ "chat.private": "\u0645\u062D\u0627\u062F\u062B\u0627\u062A\u0643 \u0644\u0627 \u064A\u0631\u0627\u0647\u0627 \u063A\u064A\u0631\u0643. \u064A\u0628\u0642\u0649 \u0627\u0644\u0631\u062F \u0647\u0646\u0627 \u062D\u062A\u0649 \u062A\u0646\u0634\u0631\u0647.",
171
+ "chat.chats": "\u0645\u062D\u0627\u062F\u062B\u0627\u062A\u0643",
172
+ "chat.new": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062C\u062F\u064A\u062F\u0629",
173
+ "chat.newAbout": "\u0645\u062D\u0627\u062F\u062B\u0629 \u062D\u0648\u0644 {key}",
174
+ "chat.none": "\u0644\u0627 \u0645\u062D\u0627\u062F\u062B\u0627\u062A \u0628\u0639\u062F",
175
+ "chat.noneHint": "\u0627\u0633\u0623\u0644 \u0648\u0643\u064A\u0644\u064B\u0627 \u0639\u0646 \u0639\u0646\u0635\u0631 \u0645\u0646 \u0635\u0641\u062D\u062A\u0647\u060C \u0623\u0648 \u0627\u0628\u062F\u0623 \u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0646 \u0647\u0646\u0627.",
176
+ "chat.noPlaces": "\u0644\u0627 \u064A\u0639\u0645\u0644 \u0623\u064A \u0648\u0643\u064A\u0644 \u0628\u0639\u062F \u0641\u064A \u0645\u0634\u0631\u0648\u0639 \u064A\u0645\u0643\u0646\u0643 \u0642\u0631\u0627\u0621\u062A\u0647.",
177
+ "chat.noAgentsHere": "\u0644\u0627 \u064A\u0639\u0645\u0644 \u0623\u064A \u0648\u0643\u064A\u0644 \u0639\u0644\u0649 {key} \u0628\u0639\u062F.",
178
+ "chat.place": "\u0627\u0644\u0645\u0634\u0631\u0648\u0639",
179
+ "chat.agent": "\u0627\u0644\u0648\u0643\u064A\u0644",
180
+ "chat.first": "\u0645\u0627\u0630\u0627 \u062A\u0631\u064A\u062F \u0623\u0646 \u062A\u0633\u0623\u0644\u061F",
181
+ "chat.message": "\u0627\u0643\u062A\u0628 \u0625\u0644\u0649 {agent}",
182
+ "chat.messages": "\u0627\u0644\u0631\u0633\u0627\u0626\u0644",
183
+ "chat.about": "\u062D\u0648\u0644 {key}",
184
+ "chat.in": "\u0641\u064A {place}",
185
+ "chat.back": "\u0643\u0644 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",
186
+ "chat.send": "\u0625\u0631\u0633\u0627\u0644",
187
+ "chat.keys": "Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644\u060C \u0648Shift+Enter \u0644\u0633\u0637\u0631 \u062C\u062F\u064A\u062F.",
188
+ "chat.busy": "\u0627\u0646\u062A\u0638\u0631 \u0627\u0644\u0631\u062F \u0623\u0648 \u0623\u0648\u0642\u0641\u0647 \u0642\u0628\u0644 \u0623\u0646 \u062A\u0643\u062A\u0628 \u0645\u0646 \u062C\u062F\u064A\u062F.",
189
+ "chat.going": "\u064A\u0639\u0645\u0644",
190
+ "chat.queued": "\u064A\u0646\u062A\u0638\u0631 \u062F\u0648\u0631\u0647",
191
+ "chat.working": "{agent} \u064A\u0639\u0645\u0644{count, plural, =0 {} one { \xB7 \u0623\u062F\u0627\u0629 \u0648\u0627\u062D\u062F\u0629 \u062D\u062A\u0649 \u0627\u0644\u0622\u0646} two { \xB7 \u0623\u062F\u0627\u062A\u0627\u0646 \u062D\u062A\u0649 \u0627\u0644\u0622\u0646} few { \xB7 # \u0623\u062F\u0648\u0627\u062A \u062D\u062A\u0649 \u0627\u0644\u0622\u0646} many { \xB7 # \u0623\u062F\u0627\u0629 \u062D\u062A\u0649 \u0627\u0644\u0622\u0646} other { \xB7 # \u0623\u062F\u0627\u0629 \u062D\u062A\u0649 \u0627\u0644\u0622\u0646}}",
192
+ "chat.you": "\u0623\u0646\u062A",
193
+ "chat.noReply": "\u0644\u0627 \u0631\u062F.",
194
+ "chat.stopped": "\u062A\u0648\u0642\u0641 \u0642\u0628\u0644 \u0623\u0646 \u064A\u0631\u062F.",
195
+ "chat.failed": "\u062A\u0648\u0642\u0641 \u0642\u0628\u0644 \u0623\u0646 \u064A\u0631\u062F: {why}",
196
+ "chat.post": "\u0627\u0646\u0634\u0631\u0647 \u0641\u064A {key}",
197
+ "chat.posted": "\u0646\u064F\u0634\u0631 \u0641\u064A {key}",
198
+ "chat.postedNote": "\u0623\u0635\u0628\u062D \u0631\u062F {agent} \u062A\u0639\u0644\u064A\u0642\u064B\u0627 \u0641\u064A {key}.",
199
+ "chat.delete": "\u0627\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629",
200
+ "chat.deleteTitle": "\u062D\u0630\u0641 \u0647\u0630\u0647 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629\u061F",
201
+ "chat.deleteBody": "\u062A\u064F\u062D\u0630\u0641 \u0631\u0633\u0627\u0626\u0644\u0647\u0627 \u0648\u0631\u062F\u0648\u062F\u0647\u0627 \u0646\u0647\u0627\u0626\u064A\u064B\u0627. \u064A\u0628\u0642\u0649 \u0645\u0627 \u063A\u064A\u0651\u0631\u0647 \u0627\u0644\u0648\u0643\u064A\u0644\u060C \u0648\u064A\u0628\u0642\u0649 \u0633\u062C\u0644 \u0645\u0627 \u0634\u063A\u0651\u0644\u0647.",
202
+ "chat.deleted": "\u062D\u064F\u0630\u0641\u062A \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629.",
203
+ "select.choose": "\u0627\u062E\u062A\u0631 \u0648\u0643\u064A\u0644\u064B\u0627",
204
+ "select.none": "\u0644\u0645 \u064A\u064F\u062A\u0628\u0646\u064E\u0651 \u0623\u064A \u0648\u0643\u064A\u0644 \u0647\u0646\u0627 \u0628\u0639\u062F: \u062A\u0628\u0646\u064E\u0651 \u0648\u0627\u062D\u062F\u064B\u0627 \u0645\u0646 \u0625\u0639\u062F\u0627\u062F\u0627\u062A \u0627\u0644\u0648\u0643\u0644\u0627\u0621.",
205
+ "select.notHere": "{key} (\u0644\u0645 \u064A\u064F\u062A\u0628\u0646\u064E\u0651 \u0647\u0646\u0627)",
206
+ "select.paused": "\u0645\u062A\u0648\u0642\u0641 \u0645\u0624\u0642\u062A\u064B\u0627",
207
+ "select.key": "\u0645\u0641\u062A\u0627\u062D \u0627\u0644\u0648\u0643\u064A\u0644",
208
+ "graph.place": "\u0627\u0644\u0645\u0634\u0631\u0648\u0639",
209
+ "graph.find": "\u0627\u0628\u062D\u062B \u0641\u064A \u0627\u0644\u0623\u0634\u064A\u0627\u0621 \u0623\u0648 \u0627\u0644\u062D\u0642\u0627\u0626\u0642",
210
+ "graph.things": "\u0627\u0644\u0623\u0634\u064A\u0627\u0621",
211
+ "graph.facts": "\u0627\u0644\u062D\u0642\u0627\u0626\u0642",
212
+ "graph.factCount": "{count, plural, zero {\u0644\u0627 \u062D\u0642\u0627\u0626\u0642} one {\u062D\u0642\u064A\u0642\u0629 \u0648\u0627\u062D\u062F\u0629} two {\u062D\u0642\u064A\u0642\u062A\u0627\u0646} few {# \u062D\u0642\u0627\u0626\u0642} other {# \u062D\u0642\u064A\u0642\u0629}}",
213
+ "graph.off": "\u0627\u0644\u0645\u062E\u0637\u0637 \u0645\u062A\u0648\u0642\u0641 \u0639\u0644\u0649 \u0647\u0630\u0627 \u0627\u0644\u0645\u0648\u0642\u0639: {why}",
214
+ "graph.waiting": "{count, plural, one {\u0645\u0644\u0627\u062D\u0638\u0629 \u0648\u0627\u062D\u062F\u0629 \u0644\u0645 \u062A\u064F\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0645\u062E\u0637\u0637 \u0628\u0639\u062F} two {\u0645\u0644\u0627\u062D\u0638\u062A\u0627\u0646 \u0644\u0645 \u062A\u064F\u0636\u0627\u0641\u0627 \u0625\u0644\u0649 \u0627\u0644\u0645\u062E\u0637\u0637 \u0628\u0639\u062F} few {# \u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0644\u0645 \u062A\u064F\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0645\u062E\u0637\u0637 \u0628\u0639\u062F} other {# \u0645\u0644\u0627\u062D\u0638\u0629 \u0644\u0645 \u062A\u064F\u0636\u0641 \u0625\u0644\u0649 \u0627\u0644\u0645\u062E\u0637\u0637 \u0628\u0639\u062F}}: \u062A\u064F\u0642\u0631\u0623 \u0627\u0644\u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0625\u0644\u064A\u0647 \u0628\u0639\u062F \u062A\u0634\u063A\u064A\u0644\u0627\u062A\u0647\u0627.",
215
+ "graph.empty": "\u0644\u0627 \u0634\u064A\u0621 \u0641\u064A \u0627\u0644\u0645\u062E\u0637\u0637 \u0628\u0639\u062F. \u062A\u064F\u0642\u0631\u0623 \u0627\u0644\u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0625\u0644\u064A\u0647 \u0628\u0639\u062F \u062A\u0634\u063A\u064A\u0644\u0627\u062A\u0647\u0627.",
216
+ "graph.nothing": "\u0644\u0627 \u0623\u0634\u064A\u0627\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F.",
217
+ "graph.noMatch": "\u0644\u0627 \u0634\u064A\u0621 \u0648\u0644\u0627 \u062D\u0642\u064A\u0642\u0629 \u0641\u064A\u0647\u0627 \u0647\u0630\u0647 \u0627\u0644\u0643\u0644\u0645\u0627\u062A.",
218
+ "graph.pick": "\u0627\u062E\u062A\u0631 \u0634\u064A\u0626\u064B\u0627 \u0644\u062A\u0631\u0649 \u0645\u0627 \u064A\u0639\u0631\u0641\u0647 \u0627\u0644\u0648\u0643\u064A\u0644 \u0639\u0646\u0647.",
219
+ "graph.picture": "{name} \u0648{count, plural, one {\u0627\u0644\u0634\u064A\u0621 \u0627\u0644\u0630\u064A \u062A\u0635\u0644 \u0625\u0644\u064A\u0647 \u062D\u0642\u0627\u0626\u0642\u0647} two {\u0627\u0644\u0634\u064A\u0626\u0627\u0646 \u0627\u0644\u0644\u0630\u0627\u0646 \u062A\u0635\u0644 \u0625\u0644\u064A\u0647\u0645\u0627 \u062D\u0642\u0627\u0626\u0642\u0647} few {# \u0623\u0634\u064A\u0627\u0621 \u062A\u0635\u0644 \u0625\u0644\u064A\u0647\u0627 \u062D\u0642\u0627\u0626\u0642\u0647} other {# \u0634\u064A\u0626\u064B\u0627 \u062A\u0635\u0644 \u0625\u0644\u064A\u0647\u0627 \u062D\u0642\u0627\u0626\u0642\u0647}}",
220
+ "graph.fact": "\u0627\u0644\u062D\u0642\u064A\u0642\u0629",
221
+ "graph.noFacts": "\u0644\u0627 \u062D\u0642\u0627\u0626\u0642 \u064A\u062D\u0642 \u0644\u0643 \u0642\u0631\u0627\u0621\u062A\u0647\u0627.",
222
+ "graph.with": "\u0645\u0639",
223
+ "graph.since": "\u0635\u062D\u064A\u062D\u0629 \u0645\u0646\u0630",
224
+ "graph.from": "\u0645\u0646 \u0627\u0644\u0645\u0644\u0627\u062D\u0638\u0627\u062A",
225
+ "graph.replaced": "\u0627\u0633\u062A\u064F\u0628\u062F\u0644\u062A \u0641\u064A {date}",
226
+ "graph.outside": "\u062D\u064F\u0641\u0638\u062A \u0628\u0639\u062F \u0645\u062D\u062A\u0648\u0649 \u062E\u0627\u0631\u062C\u064A",
227
+ "graph.hidden": "{count, plural, one {\u062D\u0642\u064A\u0642\u0629 \u0623\u062E\u0631\u0649 \u062A\u0623\u062A\u064A} two {\u062D\u0642\u064A\u0642\u062A\u0627\u0646 \u0623\u062E\u0631\u064A\u0627\u0646 \u062A\u0623\u062A\u064A\u0627\u0646} few {# \u062D\u0642\u0627\u0626\u0642 \u0623\u062E\u0631\u0649 \u062A\u0623\u062A\u064A} other {# \u062D\u0642\u064A\u0642\u0629 \u0623\u062E\u0631\u0649 \u062A\u0623\u062A\u064A}} \u0645\u0646 \u0645\u0644\u0627\u062D\u0638\u0627\u062A \u0644\u0627 \u064A\u062D\u0642 \u0644\u0643 \u0642\u0631\u0627\u0621\u062A\u0647\u0627.",
228
+ "permissions.title": "\u0648\u0643\u0644\u0627\u0621 \u062A\u0633\u0645\u062D \u0644\u0647\u0645 \u062F\u0627\u0626\u0645\u064B\u0627",
229
+ "permissions.hint": "\u0623\u062F\u0648\u0627\u062A \u062A\u0633\u0645\u062D \u0644\u0648\u0643\u064A\u0644 \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0647\u0627 \u062F\u0648\u0646 \u0623\u0646 \u064A\u0633\u0623\u0644\u0643\u060C \u0641\u064A \u0627\u0644\u062A\u0634\u063A\u064A\u0644\u0627\u062A \u0627\u0644\u062A\u064A \u062A\u0628\u062F\u0624\u0647\u0627\u060C \u0644\u0645\u0634\u0631\u0648\u0639 \u0648\u0627\u062D\u062F \u0644\u0643\u0644 \u0645\u0646\u0647\u0627. \u0625\u0646 \u0633\u062D\u0628\u062A \u0625\u062D\u062F\u0627\u0647\u0627 \u0639\u0627\u062F \u0627\u0644\u0648\u0643\u064A\u0644 \u064A\u0633\u0623\u0644\u0643.",
230
+ "permissions.agentTitle": "\u0645\u0633\u0645\u0648\u062D \u0628\u0647\u0627 \u062F\u0627\u0626\u0645\u064B\u0627 \u0645\u0646 \u0623\u0634\u062E\u0627\u0635",
231
+ "permissions.agentHint": "\u0623\u062F\u0648\u0627\u062A \u0633\u0645\u062D \u0623\u0634\u062E\u0627\u0635 \u0644\u0647\u0630\u0627 \u0627\u0644\u0648\u0643\u064A\u0644 \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645\u0647\u0627 \u062F\u0648\u0646 \u0623\u0646 \u064A\u0633\u0623\u0644\u0647\u0645\u060C \u0641\u064A \u0627\u0644\u062A\u0634\u063A\u064A\u0644\u0627\u062A \u0627\u0644\u062A\u064A \u064A\u0628\u062F\u0624\u0648\u0646\u0647\u0627. \u0633\u062D\u0628 \u0625\u062D\u062F\u0627\u0647\u0627 \u064A\u062C\u0639\u0644\u0647 \u064A\u0633\u0623\u0644\u0647\u0645 \u0645\u0646 \u062C\u062F\u064A\u062F.",
232
+ "permissions.empty": "\u0644\u0627 \u0634\u064A\u0621.",
233
+ "permissions.what": "\u0645\u0627\u0630\u0627",
234
+ "permissions.forAgent": "\u064A\u0645\u0643\u0646 \u0644\u0640{agent} \u0627\u0633\u062A\u062E\u062F\u0627\u0645 {tool}",
235
+ "permissions.byPerson": "\u064A\u0633\u0645\u062D \u0644\u0647 {name} \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645 {tool}",
236
+ "permissions.given": "\u0645\u064F\u0646\u062D {at}",
237
+ "permissions.used": "\u0622\u062E\u0631 \u0627\u0633\u062A\u062E\u062F\u0627\u0645 {at}",
238
+ "permissions.unused": "\u0644\u0645 \u064A\u064F\u0633\u062A\u062E\u062F\u0645 \u0628\u0639\u062F",
239
+ "permissions.takeBack": "\u0633\u062D\u0628",
240
+ "permissions.takeBackTitle": "\u0633\u062D\u0628 \u0625\u0630\u0646 {agent} \u0628\u0627\u0633\u062A\u062E\u062F\u0627\u0645 {tool} \u062F\u0648\u0646 \u0633\u0624\u0627\u0644\u061F",
241
+ "tools.groups.host": "{product}",
242
+ "tools.groups.plugins": "\u0627\u0644\u0625\u0636\u0627\u0641\u0627\u062A",
243
+ "chat.close": "\u0625\u063A\u0644\u0627\u0642",
244
+ "mine.title": "\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",
245
+ "mine.hint": "\u0645\u0627 \u062A\u0646\u062A\u0638\u0631 \u062A\u0634\u063A\u064A\u0644\u0627\u062A \u0627\u0644\u0648\u0643\u0644\u0627\u0621 \u0625\u062C\u0627\u0628\u062A\u0643 \u0639\u0646\u0647.",
246
+ "mine.none": "\u0644\u0627 \u0634\u064A\u0621 \u064A\u0646\u062A\u0638\u0631\u0643.",
247
+ "names.others": "\u0644\u063A\u0627\u062A \u0623\u062E\u0631\u0649",
248
+ agentLabel: "\u0648\u0643\u064A\u0644"
249
+ };
250
+
251
+ // src/areas/agent/texts/en.json
252
+ var en_default = {
253
+ modelAlias: "Model",
254
+ modelAliasHint: "The model alias its runs use, as the project's AI settings name them.",
255
+ transcriptDays: "Keep transcripts (days)",
256
+ transcriptDaysHint: "Empty for the site's period.",
257
+ "tools.title": "Tools",
258
+ "tools.hint": "What this agent may do with each tool. A tool that only reads runs; one that changes things asks unless it's set to run; a change in another system asks every time. Skills and such changes are off until turned on. A run that has read outside content or beyond its project asks before every change.",
259
+ "tools.tool": "Tool",
260
+ "tools.kind": "Kind",
261
+ "tools.setting": "This agent",
262
+ "tools.reads": "Reads",
263
+ "tools.changes": "Changes things",
264
+ "tools.defaultReads": "Runs (it only reads)",
265
+ "tools.defaultAsks": "Asks first",
266
+ "tools.run": "Runs without asking",
267
+ "tools.ask": "Asks first",
268
+ "tools.off": "Off",
269
+ "tools.save": "Save tools",
270
+ "tools.saved": "Tools saved.",
271
+ "tools.groups.sandbox": "Sandbox",
272
+ "tools.defaultOff": "Off (as it is)",
273
+ "tools.on": "On",
274
+ "tools.askEveryTime": "Asks every time",
275
+ "tools.asksEveryTime": "Changes another system",
276
+ title: "Agents",
277
+ subtitle: "AI teammates with accounts of their own. Each works with the rights of whoever starts it, under its own name. A project takes the site's agents on, or makes its own.",
278
+ switchTitle: "Agents on this site",
279
+ switchOn: "Agents are on.",
280
+ switchOff: "Agents are off: none can be made, and none works.",
281
+ switchHint: "Turning them on asks you to confirm it's you.",
282
+ operatorOff: "The operator hasn't allowed agents on this site. Whoever runs the servers sets Agents:AdminsMayEnable.",
283
+ safeMode: "The site started in safe mode: every agent is held until it starts without it.",
284
+ list: "Agents",
285
+ empty: "No agents yet.",
286
+ name: "Name",
287
+ where: "Where",
288
+ site: "Site",
289
+ responsible: "Responsible",
290
+ state: "State",
291
+ on: "On",
292
+ paused: "Paused",
293
+ takenBy: "Taken on by",
294
+ newSite: "New site agent",
295
+ newProject: "New agent for this project",
296
+ key: "Key",
297
+ keyHint: "Lowercase letters, digits and dashes. Its account is named after it, and it can't change.",
298
+ whatItDoes: "What it does",
299
+ whatItDoesPlaceholder: "Triage",
300
+ instructions: "Instructions",
301
+ instructionsHint: "In Markdown: what it does, how, and what it must never do.",
302
+ offerAll: "Offer it to every project",
303
+ offeredTo: "Offered to",
304
+ offeredToHint: "Project keys, separated by commas.",
305
+ role: "Its role here",
306
+ roleHint: "For the runs the system starts here. Runs a person starts use that person's rights.",
307
+ create: "Create",
308
+ created: "{name} made.",
309
+ save: "Save",
310
+ saved: "Saved.",
311
+ pause: "Pause",
312
+ resume: "Put back on",
313
+ pausedToast: "{name} paused.",
314
+ resumedToast: "{name} is on again.",
315
+ editTitle: "Edit {name}",
316
+ own: "This project's",
317
+ take: "Take on",
318
+ takeOff: "Take off",
319
+ takenToast: "{name} taken on.",
320
+ takenOffToast: "{name} taken off.",
321
+ projectSubtitle: "This project's own agents, and the site's offered to it. A project takes an agent on with a role for the runs the system starts here.",
322
+ notTaken: "Not taken on",
323
+ account: "Account",
324
+ "runs.asks": "It asks to run {tool} on {target}.",
325
+ "runs.waitsFor": "It waits for {person} to answer.",
326
+ "runs.expires": "Refused if no one answers by {at}.",
327
+ "runs.answers.allow": "Allow",
328
+ "runs.answers.allow-run": "Allow for this run",
329
+ "runs.answers.always": "Always allow",
330
+ "runs.answers.refuse": "Refuse",
331
+ "runs.ask": "Ask an agent",
332
+ "runs.title": "Agents",
333
+ "runs.hint": "What agents did on this item: who asked, how it went, and each step.",
334
+ "runs.outside": "Read outside content",
335
+ "runs.wide": "Read beyond the project",
336
+ "runs.stop": "Stop",
337
+ "runs.steps": "{count, plural, =0 {No tool steps} one {# tool step} other {# tool steps}}",
338
+ "runs.states.waiting": "Waiting for an answer",
339
+ "runs.states.queued": "Queued",
340
+ "runs.states.running": "Working",
341
+ "runs.states.done": "Done",
342
+ "runs.states.failed": "Failed",
343
+ "runs.states.stopped": "Stopped",
344
+ "runs.triggers.ask": "Asked",
345
+ "runs.triggers.assigned": "Assigned",
346
+ "runs.triggers.mentioned": "Mentioned",
347
+ "runs.triggers.rule": "A rule",
348
+ "runs.triggers.schedule": "Scheduled",
349
+ "runs.triggers.workflow": "A workflow step",
350
+ "runs.triggers.chat": "A chat",
351
+ "runs.outcomes.asked": "asked",
352
+ "runs.outcomes.started": "started",
353
+ "runs.outcomes.done": "done",
354
+ "runs.outcomes.failed": "failed",
355
+ "runs.outcomes.refused": "refused",
356
+ "runs.outcomes.unknown": "unknown: it stopped while this ran",
357
+ "runs.allowed.settings": "ran as its settings allow",
358
+ "runs.allowed.always": "ran by {name}'s standing permission",
359
+ "runs.allowed.thisRun": "allowed for this run",
360
+ "runs.allowed.answer": "allowed when asked",
361
+ "limits.title": "Limits",
362
+ "limits.hint": "What this agent may spend and do. Its own AI limits count every call its runs make, inside the site's and the projects' limits. A run stops at whichever limit it reaches first; an empty field is the site's.",
363
+ "limits.today": "Today",
364
+ "limits.month": "This month",
365
+ "limits.spent": "{runs, plural, =0 {No runs} one {# run} other {# runs}}, {failed} failed, {cost} spent",
366
+ "limits.turns": "Turns per run",
367
+ "limits.toolCalls": "Tool calls per run",
368
+ "limits.minutes": "Minutes per run",
369
+ "limits.runCost": "Cost per run",
370
+ "limits.site": "Site's: {value}",
371
+ "limits.none": "No limit",
372
+ "limits.save": "Save limits",
373
+ "limits.saved": "Limits saved",
374
+ "memory.title": "Memory",
375
+ "memory.hint": "What this agent learned about items in its runs, for its next runs: a run on one is given its newest notes, and recall finds more near it. A note reaches only runs whose person may read what it's about. One kept after outside content marks the runs it reaches, so their changes ask first.",
376
+ "memory.on": "It keeps memories",
377
+ "memory.off": "It keeps no memories",
378
+ "memory.about": "About",
379
+ "memory.text": "What it noted",
380
+ "memory.kept": "Kept",
381
+ "memory.uses": "Used",
382
+ "memory.outside": "Kept after outside content",
383
+ "memory.forget": "Forget",
384
+ "memory.forgotten": "Forgotten",
385
+ "memory.none": "Nothing remembered yet.",
386
+ "memory.view": "Show",
387
+ "memory.notes": "Notes",
388
+ "memory.graph": "Graph",
389
+ "chat.open": "Chat with an agent",
390
+ "chat.title": "Agents",
391
+ "chat.private": "Only you see your chats. A reply stays here until you post it.",
392
+ "chat.chats": "Your chats",
393
+ "chat.new": "New chat",
394
+ "chat.newAbout": "A chat about {key}",
395
+ "chat.none": "No chats yet",
396
+ "chat.noneHint": "Ask an agent about an item from its page, or start a chat here.",
397
+ "chat.noPlaces": "No agent works in a project you can read yet.",
398
+ "chat.noAgentsHere": "No agent works on {key} yet.",
399
+ "chat.place": "Project",
400
+ "chat.agent": "Agent",
401
+ "chat.first": "What do you want to ask?",
402
+ "chat.message": "Write to {agent}",
403
+ "chat.messages": "Messages",
404
+ "chat.about": "About {key}",
405
+ "chat.in": "In {place}",
406
+ "chat.back": "All chats",
407
+ "chat.send": "Send",
408
+ "chat.keys": "Enter sends; Shift+Enter starts a new line.",
409
+ "chat.busy": "Wait for the reply, or stop it, before you write again.",
410
+ "chat.going": "Working",
411
+ "chat.queued": "Waiting its turn",
412
+ "chat.working": "{agent} is working{count, plural, =0 {} one { \xB7 # tool so far} other { \xB7 # tools so far}}",
413
+ "chat.you": "You",
414
+ "chat.noReply": "No reply.",
415
+ "chat.stopped": "Stopped before it replied.",
416
+ "chat.failed": "It stopped before it replied: {why}",
417
+ "chat.post": "Post on {key}",
418
+ "chat.posted": "Posted on {key}",
419
+ "chat.postedNote": "{agent}'s reply is now a comment on {key}.",
420
+ "chat.delete": "Delete this chat",
421
+ "chat.deleteTitle": "Delete this chat?",
422
+ "chat.deleteBody": "Its messages and replies go for good. What the agent changed stays, and so does the record of what it ran.",
423
+ "chat.deleted": "Chat deleted.",
424
+ "select.choose": "Choose an agent",
425
+ "select.none": "No agent is taken on here yet: take one on in the Agents settings.",
426
+ "select.notHere": "{key} (not taken on here)",
427
+ "select.paused": "paused",
428
+ "select.key": "The agent's key",
429
+ "graph.place": "Project",
430
+ "graph.find": "Find things or facts",
431
+ "graph.things": "Things",
432
+ "graph.facts": "Facts",
433
+ "graph.factCount": "{count, plural, one {# fact} other {# facts}}",
434
+ "graph.off": "The graph is off on this site: {why}",
435
+ "graph.waiting": "{count, plural, one {# note isn't in the graph yet} other {# notes aren't in the graph yet}}: notes are read in after their runs.",
436
+ "graph.empty": "Nothing in the graph yet. Notes are read into it after their runs.",
437
+ "graph.nothing": "No things here yet.",
438
+ "graph.noMatch": "No thing or fact has those words.",
439
+ "graph.pick": "Pick a thing to see what the agent knows about it.",
440
+ "graph.picture": "{name} and {count, plural, one {the thing its facts reach} other {the # things its facts reach}}",
441
+ "graph.fact": "Fact",
442
+ "graph.noFacts": "No facts you may read.",
443
+ "graph.with": "With",
444
+ "graph.since": "Held from",
445
+ "graph.from": "From notes",
446
+ "graph.replaced": "Replaced {date}",
447
+ "graph.outside": "Kept after outside content",
448
+ "graph.hidden": "{count, plural, one {# more fact comes} other {# more facts come}} from notes you can't read.",
449
+ "permissions.title": "Agents you always allow",
450
+ "permissions.hint": "Tools you let an agent use without asking, in the runs you start, one project each. Take one back and the agent asks you again.",
451
+ "permissions.agentTitle": "Always allowed by people",
452
+ "permissions.agentHint": "Tools people let this agent use without asking, in the runs they start. Taking one back makes it ask them again.",
453
+ "permissions.empty": "None.",
454
+ "permissions.what": "What",
455
+ "permissions.forAgent": "{agent} may use {tool}",
456
+ "permissions.byPerson": "{name} lets it use {tool}",
457
+ "permissions.given": "given {at}",
458
+ "permissions.used": "last used {at}",
459
+ "permissions.unused": "not used yet",
460
+ "permissions.takeBack": "Take back",
461
+ "permissions.takeBackTitle": "Take back {agent}'s use of {tool} without asking?",
462
+ "tools.groups.host": "{product}",
463
+ "tools.groups.plugins": "Plugins",
464
+ "chat.close": "Close",
465
+ "mine.title": "Questions for you",
466
+ "mine.hint": "What agents\u2019 runs wait for you to answer.",
467
+ "mine.none": "Nothing waits for you.",
468
+ "names.others": "Other languages",
469
+ agentLabel: "Agent"
470
+ };
471
+
472
+ // src/areas/agent/texts.ts
473
+ var useAgentTexts = createAreaTexts("agent", { en: en_default, ar: ar_default });
474
+
475
+ // src/areas/agent/names.tsx
476
+ import { jsx, jsxs } from "react/jsx-runtime";
477
+ function useNameOf() {
478
+ const { locale } = useAbpLocale();
479
+ const languages = useHostLanguages();
480
+ const first = languages[0]?.code;
481
+ return useCallback(
482
+ (names, fallback) => {
483
+ if (!names) return fallback;
484
+ const base = locale.split("-")[0];
485
+ return (names[locale] || names[base] || (first ? names[first] : "") || Object.values(names).find((v) => v) || fallback).trim();
486
+ },
487
+ [locale, first]
488
+ );
489
+ }
490
+ var filledIn = (names) => Object.fromEntries(Object.entries(names).map(([k, v]) => [k, v.trim()]).filter(([, v]) => v));
491
+ function NamesField(props) {
492
+ const own = Boolean(useOptionalHost()?.slots?.["agent.names"]);
493
+ return own ? /* @__PURE__ */ jsx(HostSlot, { name: "agent.names", context: props }) : /* @__PURE__ */ jsx(OwnNamesField, { ...props });
494
+ }
495
+ function OwnNamesField({ value, onChange, label, placeholder }) {
496
+ const t = useAgentTexts();
497
+ const { locale } = useAbpLocale();
498
+ const languages = useHostLanguages();
499
+ const base = locale.split("-")[0];
500
+ const mine = languages.find((l) => l.code === locale || l.code === base)?.code ?? languages[0]?.code ?? base;
501
+ const others = languages.filter((l) => l.code !== mine);
502
+ const [open, setOpen] = useState(others.some((l) => value[l.code]));
503
+ const set = (code, text) => onChange({ ...value, [code]: text });
504
+ return /* @__PURE__ */ jsxs(Stack, { gap: "1.5", children: [
505
+ /* @__PURE__ */ jsx(Input, { "aria-label": label, value: value[mine] ?? "", placeholder, dir: "auto", maxLength: 120, onChange: (e) => set(mine, e.target.value) }),
506
+ others.length > 0 && /* @__PURE__ */ jsx(Button, { size: "xs", variant: "link", px: "0", alignSelf: "flex-start", "aria-expanded": open, onClick: () => setOpen(!open), children: t("names.others") }),
507
+ open && others.map((l) => /* @__PURE__ */ jsxs(HStack, { gap: "2", children: [
508
+ /* @__PURE__ */ jsx(Text, { textStyle: "caption", color: "fg.muted", minW: "5rem", children: l.name }),
509
+ /* @__PURE__ */ jsx(
510
+ Input,
511
+ {
512
+ size: "sm",
513
+ "aria-label": `${label} (${l.name})`,
514
+ value: value[l.code] ?? "",
515
+ dir: l.direction ?? "auto",
516
+ maxLength: 120,
517
+ onChange: (e) => set(l.code, e.target.value)
518
+ }
519
+ )
520
+ ] }, l.code))
521
+ ] });
522
+ }
523
+
524
+ // src/areas/agent/types.ts
525
+ var num = (value) => value == null || value === "" ? 0 : typeof value === "number" ? value : Number(value);
526
+ var numOrNull = (value) => value == null || value === "" ? null : typeof value === "number" ? value : Number(value);
527
+ var GOING = /* @__PURE__ */ new Set(["queued", "running", "waiting"]);
528
+ var RUN_TONES = {
529
+ queued: "neutral",
530
+ running: "info",
531
+ waiting: "accent",
532
+ done: "success",
533
+ failed: "danger",
534
+ stopped: "warning"
535
+ };
536
+ var itemPath = (kind, key) => `/items/${encodeURIComponent(kind)}/${encodeURIComponent(key)}`;
537
+
538
+ // src/areas/agent/Agents.tsx
539
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
540
+ function AgentState({ agent }) {
541
+ const t = useAgentTexts();
542
+ return /* @__PURE__ */ jsx2(StatusPill, { tone: agent.state === "paused" ? "warning" : "success", children: t(agent.state === "paused" ? "paused" : "on") });
543
+ }
544
+ function AgentsTable({ rows, loading, onOpen, selected, extra = [] }) {
545
+ const t = useAgentTexts();
546
+ const nameOf = useNameOf();
547
+ return /* @__PURE__ */ jsx2(
548
+ DataTable,
549
+ {
550
+ "aria-label": t("list"),
551
+ rows,
552
+ loading,
553
+ getRowId: (a) => a.id,
554
+ empty: t("empty"),
555
+ interactive: true,
556
+ rowProps: (a) => ({ onClick: () => onOpen(a), cursor: "pointer", "aria-selected": a.id === selected || void 0 }),
557
+ columns: [
558
+ {
559
+ id: "name",
560
+ header: t("name"),
561
+ cell: (a) => /* @__PURE__ */ jsxs2(HStack2, { gap: "3", children: [
562
+ /* @__PURE__ */ jsx2(PersonChip, { id: a.account.id, name: nameOf(a.names, a.key), picture: a.account.picture ?? void 0, size: "md", compact: true }),
563
+ /* @__PURE__ */ jsxs2(Stack2, { gap: "0.5", children: [
564
+ /* @__PURE__ */ jsx2(Text2, { fontWeight: "medium", children: nameOf(a.names, a.key) }),
565
+ /* @__PURE__ */ jsx2(Text2, { textStyle: "caption", color: "fg.muted", children: nameOf(a.titles, "") })
566
+ ] })
567
+ ] })
568
+ },
569
+ { id: "where", header: t("where"), cell: (a) => a.scopeKey ? /* @__PURE__ */ jsx2(Text2, { as: "span", dir: "ltr", children: a.scopeKey }) : t("site") },
570
+ { id: "responsible", header: t("responsible"), cell: (a) => a.responsible?.displayName ?? "" },
571
+ { id: "state", header: t("state"), cell: (a) => /* @__PURE__ */ jsx2(AgentState, { agent: a }) },
572
+ ...extra
573
+ ]
574
+ }
575
+ );
576
+ }
577
+ function AgentForm({ agent, scope, roles, onSaved }) {
578
+ const t = useAgentTexts();
579
+ const nameOf = useNameOf();
580
+ const request = useAreaRequest("agent");
581
+ const action = useApiAction();
582
+ const site = agent ? agent.scopeKey == null : !scope;
583
+ const [form, setForm] = useState2({
584
+ key: agent?.key ?? "",
585
+ names: { ...agent?.names ?? {} },
586
+ titles: { ...agent?.titles ?? {} },
587
+ instructions: agent?.instructions ?? "",
588
+ offerAll: agent?.offerAll ?? false,
589
+ offeredTo: (agent?.offeredTo ?? []).join(", "),
590
+ roleKey: roles?.[0]?.value ?? "",
591
+ modelAlias: agent?.modelAlias ?? "smart",
592
+ transcriptDays: agent?.transcriptDays ? String(num(agent.transcriptDays)) : ""
593
+ });
594
+ async function save(e) {
595
+ e.preventDefault();
596
+ const names = filledIn(form.names);
597
+ const titles = filledIn(form.titles);
598
+ const offers = site ? { offerAll: form.offerAll, offeredTo: form.offeredTo.split(",").map((k) => k.trim()).filter(Boolean) } : {};
599
+ const saved = await action.run(
600
+ () => agent ? request(`/agents/${agent.id}`, {
601
+ method: "PUT",
602
+ body: { names, titles, instructions: form.instructions, modelAlias: form.modelAlias.trim(), transcriptDays: Number(form.transcriptDays) || 0, ...offers }
603
+ }) : request(scope ? `/scopes/${encodeURIComponent(scope)}/agents` : "/agents", {
604
+ method: "POST",
605
+ body: { key: form.key.trim(), names, titles, instructions: form.instructions, ...offers, ...site ? {} : { roleKey: form.roleKey } }
606
+ })
607
+ );
608
+ if (saved) {
609
+ notify.success(agent ? t("saved") : t("created", { name: nameOf(saved.names, saved.key) }));
610
+ onSaved(saved);
611
+ }
612
+ }
613
+ return /* @__PURE__ */ jsx2("form", { onSubmit: (e) => void save(e), noValidate: true, children: /* @__PURE__ */ jsxs2(Stack2, { gap: "field", maxW: "2xl", children: [
614
+ !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 }) }) }),
615
+ /* @__PURE__ */ jsxs2(HStack2, { gap: "3", align: "start", wrap: "wrap", children: [
616
+ /* @__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 }) }) }),
617
+ /* @__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 }) }) })
618
+ ] }),
619
+ /* @__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 }) }) }),
620
+ agent && /* @__PURE__ */ jsxs2(HStack2, { gap: "3", align: "start", wrap: "wrap", children: [
621
+ /* @__PURE__ */ jsx2(Field, { label: t("modelAlias"), helperText: t("modelAliasHint"), flex: "1", children: /* @__PURE__ */ jsx2(Input2, { value: form.modelAlias, maxLength: 40, dir: "ltr", onChange: (e) => setForm({ ...form, modelAlias: e.target.value }) }) }),
622
+ /* @__PURE__ */ jsx2(Field, { label: t("transcriptDays"), helperText: t("transcriptDaysHint"), flex: "1", children: /* @__PURE__ */ jsx2(
623
+ Input2,
624
+ {
625
+ value: form.transcriptDays,
626
+ inputMode: "numeric",
627
+ maxLength: 3,
628
+ dir: "ltr",
629
+ placeholder: "30",
630
+ onChange: (e) => setForm({ ...form, transcriptDays: e.target.value.replace(/\D/g, "") })
631
+ }
632
+ ) })
633
+ ] }),
634
+ site && /* @__PURE__ */ jsxs2(Fragment, { children: [
635
+ /* @__PURE__ */ jsx2(SwitchField, { label: t("offerAll"), checked: form.offerAll, onCheckedChange: (c) => setForm({ ...form, offerAll: c }) }),
636
+ !form.offerAll && /* @__PURE__ */ jsx2(Field, { label: t("offeredTo"), helperText: t("offeredToHint"), children: /* @__PURE__ */ jsx2(Input2, { value: form.offeredTo, dir: "ltr", placeholder: "PAY, OPS", onChange: (e) => setForm({ ...form, offeredTo: e.target.value }) }) })
637
+ ] }),
638
+ !agent && !site && roles && /* @__PURE__ */ jsx2(Field, { label: t("role"), helperText: t("roleHint"), children: /* @__PURE__ */ jsx2(SelectField, { value: form.roleKey, onChange: (e) => setForm({ ...form, roleKey: e.target.value }), options: roles }) }),
639
+ /* @__PURE__ */ jsx2(InlineAlert, { tone: "danger", children: action.error }),
640
+ /* @__PURE__ */ jsx2(Button2, { type: "submit", variant: "primary", alignSelf: "flex-start", loading: action.busy, disabled: !agent && !form.key.trim(), children: agent ? t("save") : t("create") })
641
+ ] }) });
642
+ }
643
+ function AgentPause({ agent, onChanged }) {
644
+ const t = useAgentTexts();
645
+ const nameOf = useNameOf();
646
+ const request = useAreaRequest("agent");
647
+ const action = useApiAction();
648
+ const paused = agent.state === "paused";
649
+ async function toggle() {
650
+ const changed = await action.run(() => request(`/agents/${agent.id}/${paused ? "resume" : "pause"}`, { method: "POST" }));
651
+ if (changed) {
652
+ notify.success(t(paused ? "resumedToast" : "pausedToast", { name: nameOf(changed.names, changed.key) }));
653
+ onChanged(changed);
654
+ }
655
+ }
656
+ return /* @__PURE__ */ jsxs2(Stack2, { gap: "1", children: [
657
+ /* @__PURE__ */ jsx2(Button2, { size: "sm", variant: paused ? "primary" : "secondary", loading: action.busy, onClick: () => void toggle(), "data-testid": "agent-pause", children: t(paused ? "resume" : "pause") }),
658
+ /* @__PURE__ */ jsx2(InlineAlert, { tone: "danger", children: action.error })
659
+ ] });
660
+ }
661
+
662
+ // src/areas/agent/AgentLimits.tsx
663
+ import { useState as useState3 } from "react";
664
+ import { chakra, HStack as HStack3, Input as Input3, Stack as Stack3, Text as Text3 } from "@chakra-ui/react";
665
+ 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";
666
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
667
+ var numberOrNull = (text) => text.trim() === "" ? null : Number(text);
668
+ function AgentLimitsPanel({ agent, onSaved }) {
669
+ const t = useAgentTexts();
670
+ const fmt = useFormatters();
671
+ const request = useAreaRequest2("agent");
672
+ const usage = useApiQuery("agent", `/agents/${agent.id}/usage`);
673
+ const action = useApiAction2();
674
+ const slots = useSlotSaves();
675
+ const site = agent.siteLimits;
676
+ const own = agent.limits;
677
+ const text = (v) => numOrNull(v) == null ? "" : String(numOrNull(v));
678
+ const [run, setRun] = useState3({ maxTurns: text(own?.maxTurns), maxToolCalls: text(own?.maxToolCalls), maxMinutes: text(own?.maxMinutes), maxRunCost: text(own?.maxRunCost) });
679
+ const money = (n) => fmt.number(n, { maximumFractionDigits: 2 });
680
+ async function save() {
681
+ const saved = await action.run(async () => {
682
+ const limits = {
683
+ maxTurns: numberOrNull(run.maxTurns),
684
+ maxToolCalls: numberOrNull(run.maxToolCalls),
685
+ maxMinutes: numberOrNull(run.maxMinutes),
686
+ maxRunCost: numberOrNull(run.maxRunCost)
687
+ };
688
+ const changed = await request(`/agents/${agent.id}`, { method: "PUT", body: { limits } });
689
+ await slots.run();
690
+ return changed;
691
+ });
692
+ if (saved) {
693
+ notify2.success(t("limits.saved"));
694
+ await usage.reload();
695
+ onSaved(saved);
696
+ }
697
+ }
698
+ const fields = [
699
+ { key: "maxTurns", label: t("limits.turns"), site: numOrNull(site?.maxTurns), step: "1" },
700
+ { key: "maxToolCalls", label: t("limits.toolCalls"), site: numOrNull(site?.maxToolCalls), step: "1" },
701
+ { key: "maxMinutes", label: t("limits.minutes"), site: numOrNull(site?.maxMinutes), step: "1" },
702
+ { key: "maxRunCost", label: t("limits.runCost"), site: numOrNull(site?.maxRunCost), step: "0.01" }
703
+ ];
704
+ const period = (p) => p ? t("limits.spent", { runs: num(p.runs), failed: num(p.failed), cost: money(num(p.cost)) }) : "";
705
+ return /* @__PURE__ */ jsxs3(Stack3, { gap: "field", "data-testid": "agent-limits", children: [
706
+ /* @__PURE__ */ jsxs3(Stack3, { gap: "1", children: [
707
+ /* @__PURE__ */ jsx3(Text3, { fontWeight: "medium", children: t("limits.title") }),
708
+ /* @__PURE__ */ jsx3(Text3, { textStyle: "caption", color: "fg.muted", children: t("limits.hint") })
709
+ ] }),
710
+ /* @__PURE__ */ jsxs3(HStack3, { gap: "6", wrap: "wrap", textStyle: "sm", children: [
711
+ /* @__PURE__ */ jsxs3(Stack3, { gap: "0", children: [
712
+ /* @__PURE__ */ jsx3(Text3, { textStyle: "caption", color: "fg.muted", children: t("limits.today") }),
713
+ /* @__PURE__ */ jsx3(Text3, { children: period(usage.data?.today) })
714
+ ] }),
715
+ /* @__PURE__ */ jsxs3(Stack3, { gap: "0", children: [
716
+ /* @__PURE__ */ jsx3(Text3, { textStyle: "caption", color: "fg.muted", children: t("limits.month") }),
717
+ /* @__PURE__ */ jsx3(Text3, { children: period(usage.data?.month) })
718
+ ] })
719
+ ] }),
720
+ /* @__PURE__ */ jsx3(HostSlot2, { name: "agent.limits.extra", context: { agent, register: slots.register } }),
721
+ /* @__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(
722
+ Input3,
723
+ {
724
+ type: "number",
725
+ min: "0",
726
+ step: f.step,
727
+ value: run[f.key],
728
+ placeholder: f.site == null ? t("limits.none") : t("limits.site", { value: f.site }),
729
+ onChange: (e) => setRun({ ...run, [f.key]: e.target.value }),
730
+ "data-testid": `agent-limit-${f.key}`
731
+ }
732
+ ) }, f.key)) }),
733
+ /* @__PURE__ */ jsx3(InlineAlert2, { tone: "danger", children: action.error ?? usage.error }),
734
+ /* @__PURE__ */ jsx3(Button3, { variant: "primary", alignSelf: "flex-start", onClick: () => void save(), loading: action.busy, "data-testid": "agent-limits-save", children: t("limits.save") })
735
+ ] });
736
+ }
737
+
738
+ // src/areas/agent/AgentMemories.tsx
739
+ import { useState as useState6 } from "react";
740
+ import { chakra as chakra3, Stack as Stack5, Text as Text6 } from "@chakra-ui/react";
741
+ import { Button as Button4, DataTable as DataTable3, InlineAlert as InlineAlert4, notify as notify3, SegmentedControl, StatusPill as StatusPill3, SwitchField as SwitchField2, useApiAction as useApiAction3, useApiQuery as useApiQuery3, useAreaRequest as useAreaRequest3, useFormatters as useFormatters3 } from "@abpjs/ui";
742
+
743
+ // src/areas/agent/AgentGraph.tsx
744
+ import { memo, useMemo, useState as useState5 } from "react";
745
+ import dagre from "@dagrejs/dagre";
746
+ import { Background, BackgroundVariant, Handle, MarkerType, Position, ReactFlow } from "@xyflow/react";
747
+ import { Box, chakra as chakra2, Grid, HStack as HStack4, Stack as Stack4, Text as Text5 } from "@chakra-ui/react";
748
+ import { DataTable as DataTable2, InlineAlert as InlineAlert3, SearchInput, SelectField as SelectField2, StatusPill as StatusPill2, useApiQuery as useApiQuery2, useColorMode, useFormatters as useFormatters2, useTokenVar } from "@abpjs/ui";
749
+
750
+ // src/areas/agent/links.tsx
751
+ import { createContext, useContext, useEffect, useState as useState4 } from "react";
752
+ import { Text as Text4 } from "@chakra-ui/react";
753
+ import { AppLink } from "@abpjs/ui";
754
+ import { jsx as jsx4 } from "react/jsx-runtime";
755
+ var ItemHrefContext = createContext(null);
756
+ function ItemHrefProvider({ value, children }) {
757
+ const outer = useContext(ItemHrefContext);
758
+ return /* @__PURE__ */ jsx4(ItemHrefContext.Provider, { value: value ?? outer, children });
759
+ }
760
+ function ItemLink({ kind, itemKey, children, textStyle }) {
761
+ const href = useContext(ItemHrefContext)?.(kind ?? "", itemKey);
762
+ const dir = children == null ? "ltr" : void 0;
763
+ return href ? /* @__PURE__ */ jsx4(AppLink, { href, dir, textStyle, children: children ?? itemKey }) : /* @__PURE__ */ jsx4(Text4, { as: "span", dir, textStyle, children: children ?? itemKey });
764
+ }
765
+ var ToolGroupContext = createContext(null);
766
+ function ToolGroupsProvider({ value, children }) {
767
+ return /* @__PURE__ */ jsx4(ToolGroupContext.Provider, { value, children });
768
+ }
769
+ function useToolGroupOf() {
770
+ return useContext(ToolGroupContext);
771
+ }
772
+ function useDebounced(value, ms) {
773
+ const [settled, setSettled] = useState4(value);
774
+ useEffect(() => {
775
+ const timer = setTimeout(() => setSettled(value), ms);
776
+ return () => clearTimeout(timer);
777
+ }, [value, ms]);
778
+ return settled;
779
+ }
780
+
781
+ // src/areas/agent/AgentGraph.tsx
782
+ import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
783
+ var WIDTH = 168;
784
+ var HEIGHT = 40;
785
+ var LABELLED_EDGES = 8;
786
+ var relationWords = (relation) => relation.toLowerCase().replaceAll("_", " ");
787
+ var ThingNode = memo(function ThingNode2({ data }) {
788
+ const { thing, picked } = data;
789
+ return /* @__PURE__ */ jsxs4(
790
+ Box,
791
+ {
792
+ w: `${WIDTH}px`,
793
+ h: `${HEIGHT}px`,
794
+ display: "flex",
795
+ alignItems: "center",
796
+ px: "3",
797
+ bg: "bg.panel",
798
+ borderWidth: picked ? "2px" : "1px",
799
+ borderColor: picked ? "border.accent" : "border.emphasized",
800
+ rounded: "l2",
801
+ shadow: picked ? "sm" : "xs",
802
+ cursor: picked ? "default" : "pointer",
803
+ "data-graph-thing": thing.name,
804
+ children: [
805
+ /* @__PURE__ */ jsx5(Text5, { textStyle: "body.sm", fontWeight: picked ? "semibold" : "medium", truncate: true, dir: "auto", title: thing.name, children: thing.name }),
806
+ /* @__PURE__ */ jsx5(Handle, { type: "target", position: Position.Left, isConnectable: false, style: { opacity: 0 } }),
807
+ /* @__PURE__ */ jsx5(Handle, { type: "source", position: Position.Right, isConnectable: false, style: { opacity: 0 } })
808
+ ]
809
+ }
810
+ );
811
+ });
812
+ var nodeTypes = { thing: ThingNode };
813
+ function layout(thing, around, facts, color) {
814
+ const g = new dagre.graphlib.Graph({ multigraph: true });
815
+ g.setGraph({ rankdir: "LR", nodesep: 16, ranksep: 110, marginx: 16, marginy: 16 });
816
+ g.setDefaultEdgeLabel(() => ({}));
817
+ const things = [thing, ...around.filter((a) => a.id !== thing.id)];
818
+ const ids = new Set(things.map((x) => x.id));
819
+ for (const x of things) g.setNode(x.id, { width: WIDTH, height: HEIGHT });
820
+ const drawn = facts.filter((f) => ids.has(f.from) && ids.has(f.to) && f.from !== f.to);
821
+ drawn.forEach((f) => g.setEdge(f.from, f.to, {}, f.id));
822
+ dagre.layout(g);
823
+ return {
824
+ nodes: things.map((x) => {
825
+ const placed = g.node(x.id);
826
+ return {
827
+ id: x.id,
828
+ type: "thing",
829
+ position: { x: Math.round(placed.x - WIDTH / 2), y: Math.round(placed.y - HEIGHT / 2) },
830
+ data: { thing: x, picked: x.id === thing.id },
831
+ draggable: false,
832
+ connectable: false
833
+ };
834
+ }),
835
+ edges: drawn.map((f) => ({
836
+ id: f.id,
837
+ source: f.from,
838
+ target: f.to,
839
+ label: drawn.length <= LABELLED_EDGES ? relationWords(f.relation) : void 0,
840
+ markerEnd: { type: MarkerType.ArrowClosed, width: 16, height: 16 },
841
+ style: { stroke: color("colors.border.emphasized"), strokeDasharray: f.invalidAt ? "4 4" : void 0 },
842
+ labelStyle: { fontSize: 11, fill: color("colors.fg.muted") },
843
+ labelBgStyle: { fill: color("colors.bg.panel") }
844
+ }))
845
+ };
846
+ }
847
+ function Picture({ thing, around, facts, onPick }) {
848
+ const t = useAgentTexts();
849
+ const { colorMode } = useColorMode();
850
+ const color = useTokenVar();
851
+ const { nodes, edges } = useMemo(() => layout(thing, around, facts, color), [thing, around, facts, color]);
852
+ return /* @__PURE__ */ jsx5(
853
+ Box,
854
+ {
855
+ h: "16rem",
856
+ dir: "ltr",
857
+ bg: "bg.canvas",
858
+ borderWidth: "1px",
859
+ borderColor: "border",
860
+ rounded: "l2",
861
+ css: { "& .react-flow": { "--xy-background-color": "transparent" } },
862
+ role: "img",
863
+ "aria-label": t("graph.picture", { name: thing.name, count: around.length }),
864
+ "data-testid": "agent-graph-picture",
865
+ children: /* @__PURE__ */ jsx5(
866
+ ReactFlow,
867
+ {
868
+ nodes,
869
+ edges,
870
+ nodeTypes,
871
+ colorMode: colorMode === "dark" ? "dark" : "light",
872
+ onNodeClick: (_, node) => {
873
+ if (node.id !== thing.id) onPick(node.id);
874
+ },
875
+ nodesDraggable: false,
876
+ nodesConnectable: false,
877
+ elementsSelectable: false,
878
+ deleteKeyCode: null,
879
+ minZoom: 0.3,
880
+ maxZoom: 1.5,
881
+ fitView: true,
882
+ fitViewOptions: { padding: 0.2, maxZoom: 1 },
883
+ proOptions: { hideAttribution: true },
884
+ children: /* @__PURE__ */ jsx5(Background, { variant: BackgroundVariant.Dots, gap: 18, size: 1.2, color: color("colors.border.emphasized") })
885
+ }
886
+ )
887
+ }
888
+ );
889
+ }
890
+ function ThingDetail({ page, onPick }) {
891
+ const t = useAgentTexts();
892
+ const fmt = useFormatters2();
893
+ const view = page.view;
894
+ const thing = view.thing;
895
+ const names = useMemo(() => new Map([thing, ...view.around].map((x) => [x.id, x.name])), [thing, view.around]);
896
+ const notes = useMemo(() => new Map(page.notes.map((n) => [n.id, n])), [page.notes]);
897
+ return /* @__PURE__ */ jsxs4(Stack4, { gap: "3", minW: "0", "data-testid": "agent-graph-thing", children: [
898
+ /* @__PURE__ */ jsxs4(Stack4, { gap: "1", children: [
899
+ /* @__PURE__ */ jsxs4(HStack4, { gap: "2", wrap: "wrap", children: [
900
+ /* @__PURE__ */ jsx5(Text5, { fontWeight: "semibold", dir: "auto", children: thing.name }),
901
+ /* @__PURE__ */ jsx5(Text5, { textStyle: "caption", color: "fg.muted", children: t("graph.factCount", { count: num(thing.facts) }) })
902
+ ] }),
903
+ thing.summary && /* @__PURE__ */ jsx5(Text5, { textStyle: "body.sm", color: "fg.muted", dir: "auto", whiteSpace: "pre-wrap", children: thing.summary })
904
+ ] }),
905
+ view.around.length > 0 && /* @__PURE__ */ jsx5(Picture, { thing, around: view.around, facts: view.facts, onPick }, thing.id),
906
+ /* @__PURE__ */ jsx5(
907
+ DataTable2,
908
+ {
909
+ rows: view.facts,
910
+ getRowId: (f) => f.id,
911
+ size: "sm",
912
+ "aria-label": t("graph.facts"),
913
+ empty: t("graph.noFacts"),
914
+ columns: [
915
+ {
916
+ id: "fact",
917
+ header: t("graph.fact"),
918
+ cell: (f) => /* @__PURE__ */ jsxs4(Stack4, { gap: "0.5", alignItems: "flex-start", children: [
919
+ /* @__PURE__ */ jsx5(Text5, { dir: "auto", whiteSpace: "pre-wrap", color: f.invalidAt ? "fg.muted" : void 0, children: f.fact }),
920
+ f.invalidAt && /* @__PURE__ */ jsx5(StatusPill2, { tone: "neutral", dot: false, children: t("graph.replaced", { date: fmt.dateTime(f.invalidAt, { dateStyle: "medium" }) }) })
921
+ ] })
922
+ },
923
+ {
924
+ id: "with",
925
+ header: t("graph.with"),
926
+ cell: (f) => {
927
+ const other = f.from === thing.id ? f.to : f.from;
928
+ const name = names.get(other);
929
+ return name ? /* @__PURE__ */ jsx5(
930
+ chakra2.button,
931
+ {
932
+ type: "button",
933
+ textAlign: "start",
934
+ color: "fg.accent",
935
+ whiteSpace: "nowrap",
936
+ cursor: "pointer",
937
+ _hover: { textDecoration: "underline" },
938
+ dir: "auto",
939
+ onClick: () => onPick(other),
940
+ children: name
941
+ }
942
+ ) : "";
943
+ }
944
+ },
945
+ { id: "since", header: t("graph.since"), cell: (f) => /* @__PURE__ */ jsx5(Text5, { textStyle: "caption", whiteSpace: "nowrap", children: fmt.dateTime(f.validAt ?? f.createdAt, { dateStyle: "medium" }) }) },
946
+ {
947
+ id: "from",
948
+ header: t("graph.from"),
949
+ cell: (f) => /* @__PURE__ */ jsx5(Stack4, { gap: "1", children: f.memories.map((id) => notes.get(id)).filter((n) => !!n).map((n) => /* @__PURE__ */ jsxs4(Stack4, { gap: "0", children: [
950
+ /* @__PURE__ */ jsx5(ItemLink, { kind: n.itemKind, itemKey: n.itemKey, textStyle: "caption" }),
951
+ /* @__PURE__ */ jsx5(Text5, { textStyle: "caption", color: "fg.muted", dir: "auto", lineClamp: 2, title: n.text, children: n.text }),
952
+ n.outside && /* @__PURE__ */ jsx5(StatusPill2, { tone: "warning", dot: false, children: t("graph.outside") })
953
+ ] }, n.id)) })
954
+ }
955
+ ]
956
+ }
957
+ ),
958
+ num(view.hidden) > 0 && /* @__PURE__ */ jsx5(Text5, { textStyle: "caption", color: "fg.muted", children: t("graph.hidden", { count: num(view.hidden) }) })
959
+ ] });
960
+ }
961
+ function AgentGraph({ agentId, scopes }) {
962
+ const t = useAgentTexts();
963
+ const [scope, setScope] = useState5(scopes[0] ?? "");
964
+ const [find, setFind] = useState5("");
965
+ const [thing, setThing] = useState5(null);
966
+ const words = useDebounced(find.trim(), 300);
967
+ const query = new URLSearchParams({ scope });
968
+ if (words) query.set("find", words);
969
+ if (thing) query.set("thing", thing);
970
+ const graph = useApiQuery2("agent", scope ? `/agents/${agentId}/graph?${query}` : null);
971
+ const data = graph.data;
972
+ if (scopes.length === 0) return /* @__PURE__ */ jsx5(Text5, { textStyle: "body.sm", color: "fg.muted", children: t("graph.empty") });
973
+ return /* @__PURE__ */ jsxs4(Stack4, { gap: "3", "data-testid": "agent-graph", children: [
974
+ /* @__PURE__ */ jsxs4(HStack4, { gap: "2", wrap: "wrap", children: [
975
+ scopes.length > 1 && /* @__PURE__ */ jsx5(
976
+ SelectField2,
977
+ {
978
+ size: "sm",
979
+ width: "auto",
980
+ "aria-label": t("graph.place"),
981
+ value: scope,
982
+ options: scopes.map((p) => ({ value: p, label: p })),
983
+ onChange: (e) => {
984
+ setScope(e.target.value);
985
+ setThing(null);
986
+ },
987
+ "data-testid": "agent-graph-place"
988
+ }
989
+ ),
990
+ /* @__PURE__ */ jsx5(SearchInput, { size: "sm", maxW: "20rem", value: find, onChange: (e) => setFind(e.target.value), placeholder: t("graph.find"), "aria-label": t("graph.find"), "data-testid": "agent-graph-find" })
991
+ ] }),
992
+ data && !data.on && /* @__PURE__ */ jsx5(InlineAlert3, { tone: "warning", children: t("graph.off", { why: data.why ?? "" }) }),
993
+ data?.on && num(data.waiting) > 0 && /* @__PURE__ */ jsx5(Text5, { textStyle: "caption", color: "fg.muted", children: t("graph.waiting", { count: num(data.waiting) }) }),
994
+ /* @__PURE__ */ jsx5(InlineAlert3, { tone: "danger", children: graph.error }),
995
+ (!data || data.on) && /* @__PURE__ */ jsxs4(Grid, { templateColumns: { base: "1fr", lg: "minmax(12rem, 16rem) minmax(0, 1fr)" }, gap: "4", alignItems: "start", children: [
996
+ /* @__PURE__ */ jsx5(
997
+ DataTable2,
998
+ {
999
+ rows: data?.view.things,
1000
+ loading: !data && graph.loading,
1001
+ getRowId: (x) => x.id,
1002
+ size: "sm",
1003
+ maxHeight: "28rem",
1004
+ stickyHeader: true,
1005
+ interactive: true,
1006
+ "aria-label": t("graph.things"),
1007
+ empty: words ? t("graph.noMatch") : t("graph.nothing"),
1008
+ selection: { selectedId: thing, onSelect: (x) => setThing(x.id) },
1009
+ columns: [
1010
+ { id: "name", header: t("graph.things"), cell: (x) => /* @__PURE__ */ jsx5(Text5, { dir: "auto", truncate: true, title: x.name, children: x.name }) },
1011
+ { id: "facts", header: t("graph.facts"), numeric: true, cell: (x) => /* @__PURE__ */ jsx5(Text5, { textStyle: "caption", children: num(x.facts) }) }
1012
+ ]
1013
+ }
1014
+ ),
1015
+ data?.view.thing ? /* @__PURE__ */ jsx5(ThingDetail, { page: data, onPick: setThing }) : /* @__PURE__ */ jsx5(Text5, { textStyle: "body.sm", color: "fg.muted", pt: "2", children: t("graph.pick") })
1016
+ ] })
1017
+ ] });
1018
+ }
1019
+
1020
+ // src/areas/agent/AgentMemories.tsx
1021
+ import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
1022
+ function AgentMemoriesPanel({ agent, onSaved }) {
1023
+ const t = useAgentTexts();
1024
+ const fmt = useFormatters3();
1025
+ const request = useAreaRequest3("agent");
1026
+ const memories = useApiQuery3("agent", `/agents/${agent.id}/memories`);
1027
+ const action = useApiAction3();
1028
+ const [view, setView] = useState6("notes");
1029
+ const scopes = [...new Set((memories.data ?? []).map((m) => m.scopeKey).filter((p) => !!p))];
1030
+ async function turn(on) {
1031
+ const saved = await action.run(() => request(`/agents/${agent.id}`, { method: "PUT", body: { memory: on } }));
1032
+ if (saved) onSaved(saved);
1033
+ }
1034
+ async function forget(memory) {
1035
+ const done = await action.run(async () => {
1036
+ await request(`/agents/${agent.id}/memories/${memory.id}`, { method: "DELETE" });
1037
+ return true;
1038
+ });
1039
+ if (done) {
1040
+ notify3.success(t("memory.forgotten"));
1041
+ await memories.reload();
1042
+ }
1043
+ }
1044
+ return /* @__PURE__ */ jsxs5(Stack5, { gap: "field", "data-testid": "agent-memories", children: [
1045
+ /* @__PURE__ */ jsxs5(Stack5, { gap: "1", children: [
1046
+ /* @__PURE__ */ jsx6(Text6, { fontWeight: "medium", children: t("memory.title") }),
1047
+ /* @__PURE__ */ jsx6(Text6, { textStyle: "caption", color: "fg.muted", children: t("memory.hint") })
1048
+ ] }),
1049
+ /* @__PURE__ */ jsx6(SwitchField2, { label: t(agent.memory ?? true ? "memory.on" : "memory.off"), checked: agent.memory ?? true, disabled: action.busy, onCheckedChange: (c) => void turn(c) }),
1050
+ /* @__PURE__ */ jsx6(chakra3.div, { alignSelf: "flex-start", children: /* @__PURE__ */ jsx6(
1051
+ SegmentedControl,
1052
+ {
1053
+ size: "sm",
1054
+ "aria-label": t("memory.view"),
1055
+ value: view,
1056
+ onValueChange: setView,
1057
+ "data-testid": "agent-memory-view",
1058
+ items: [{ value: "notes", label: t("memory.notes"), count: memories.data?.length ?? null }, { value: "graph", label: t("memory.graph") }]
1059
+ }
1060
+ ) }),
1061
+ view === "graph" && !memories.loading && /* @__PURE__ */ jsx6(AgentGraph, { agentId: agent.id, scopes }, scopes.join(",")),
1062
+ view === "notes" && /* @__PURE__ */ jsx6(
1063
+ DataTable3,
1064
+ {
1065
+ rows: memories.data,
1066
+ loading: memories.loading,
1067
+ getRowId: (m) => m.id,
1068
+ size: "sm",
1069
+ "aria-label": t("memory.title"),
1070
+ empty: t("memory.none"),
1071
+ columns: [
1072
+ { id: "about", header: t("memory.about"), cell: (m) => m.itemKey ? /* @__PURE__ */ jsx6(ItemLink, { kind: m.itemKind, itemKey: m.itemKey }) : "" },
1073
+ {
1074
+ id: "text",
1075
+ header: t("memory.text"),
1076
+ cell: (m) => /* @__PURE__ */ jsxs5(Stack5, { gap: "0.5", children: [
1077
+ /* @__PURE__ */ jsx6(Text6, { dir: "auto", whiteSpace: "pre-wrap", children: m.text }),
1078
+ m.outside && /* @__PURE__ */ jsx6(StatusPill3, { tone: "warning", dot: false, children: t("memory.outside") })
1079
+ ] })
1080
+ },
1081
+ {
1082
+ id: "kept",
1083
+ header: t("memory.kept"),
1084
+ cell: (m) => /* @__PURE__ */ jsxs5(Stack5, { gap: "0", children: [
1085
+ /* @__PURE__ */ jsx6(Text6, { textStyle: "caption", children: fmt.dateTime(m.createdAt, { dateStyle: "medium" }) }),
1086
+ m.rememberedBy && /* @__PURE__ */ jsx6(Text6, { textStyle: "caption", color: "fg.muted", children: m.rememberedBy.displayName })
1087
+ ] })
1088
+ },
1089
+ { id: "uses", header: t("memory.uses"), cell: (m) => /* @__PURE__ */ jsx6(Text6, { textStyle: "caption", children: num(m.uses) }) },
1090
+ {
1091
+ id: "forget",
1092
+ header: "",
1093
+ cell: (m) => /* @__PURE__ */ jsx6(Button4, { size: "xs", variant: "ghost", danger: true, onClick: () => void forget(m), loading: action.busy, "data-testid": "agent-memory-forget", children: t("memory.forget") })
1094
+ }
1095
+ ]
1096
+ }
1097
+ ),
1098
+ /* @__PURE__ */ jsx6(InlineAlert4, { tone: "danger", children: action.error ?? memories.error })
1099
+ ] });
1100
+ }
1101
+
1102
+ // src/areas/agent/AgentPermissions.tsx
1103
+ import { Stack as Stack6, Text as Text7 } from "@chakra-ui/react";
1104
+ import { Button as Button5, DataTable as DataTable4, errorText, InlineAlert as InlineAlert5, notify as notify4, Panel, useApiQuery as useApiQuery4, useAreaRequest as useAreaRequest4, useConfirm, useFormatters as useFormatters4 } from "@abpjs/ui";
1105
+ import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
1106
+ function AgentPermissionsPanel({ agentId }) {
1107
+ const t = useAgentTexts();
1108
+ const fmt = useFormatters4();
1109
+ const confirm = useConfirm();
1110
+ const request = useAreaRequest4("agent");
1111
+ const list = useApiQuery4("agent", agentId ? `/agents/${agentId}/permissions` : "/me/permissions");
1112
+ async function takeBack(p) {
1113
+ if (!await confirm({ title: t("permissions.takeBackTitle", { tool: p.tool, agent: p.agent?.displayName ?? p.agentKey }), confirmLabel: t("permissions.takeBack"), danger: true })) return;
1114
+ try {
1115
+ await request("/permissions/remove", { method: "POST", body: { personId: p.personId, agentId: p.agentId, tool: p.tool, scopeId: p.scopeId } });
1116
+ await list.reload();
1117
+ } catch (e) {
1118
+ notify4.error(errorText(e));
1119
+ }
1120
+ }
1121
+ return /* @__PURE__ */ jsxs6(Panel, { title: t(agentId ? "permissions.agentTitle" : "permissions.title"), description: t(agentId ? "permissions.agentHint" : "permissions.hint"), flush: true, "data-testid": "agent-permissions", children: [
1122
+ /* @__PURE__ */ jsx7(InlineAlert5, { tone: "danger", children: list.error }),
1123
+ /* @__PURE__ */ jsx7(
1124
+ DataTable4,
1125
+ {
1126
+ "aria-label": t(agentId ? "permissions.agentTitle" : "permissions.title"),
1127
+ rows: list.data,
1128
+ loading: list.loading,
1129
+ getRowId: (p) => `${p.personId}/${p.agentId}/${p.tool}/${p.scopeId}`,
1130
+ empty: t("permissions.empty"),
1131
+ columns: [
1132
+ {
1133
+ id: "what",
1134
+ header: t("permissions.what"),
1135
+ cell: (p) => /* @__PURE__ */ jsxs6(Stack6, { gap: "0.5", children: [
1136
+ /* @__PURE__ */ jsx7(Text7, { fontWeight: "medium", children: agentId ? t("permissions.byPerson", { name: p.person?.displayName ?? "", tool: p.tool }) : t("permissions.forAgent", { agent: p.agent?.displayName ?? p.agentKey, tool: p.tool }) }),
1137
+ /* @__PURE__ */ jsxs6(Text7, { textStyle: "caption", color: "fg.muted", children: [
1138
+ /* @__PURE__ */ jsx7(Text7, { as: "span", dir: "ltr", children: p.scopeKey ?? "" }),
1139
+ " \xB7 ",
1140
+ t("permissions.given", { at: fmt.dateTime(p.createdAt, { dateStyle: "medium" }) }),
1141
+ " \xB7 ",
1142
+ p.lastUsedAt ? t("permissions.used", { at: fmt.dateTime(p.lastUsedAt, { dateStyle: "medium" }) }) : t("permissions.unused")
1143
+ ] })
1144
+ ] })
1145
+ },
1146
+ { id: "actions", header: "", cell: (p) => /* @__PURE__ */ jsx7(Button5, { size: "sm", variant: "ghost", onClick: () => void takeBack(p), children: t("permissions.takeBack") }) }
1147
+ ]
1148
+ }
1149
+ )
1150
+ ] });
1151
+ }
1152
+
1153
+ // src/areas/agent/AgentTools.tsx
1154
+ import { useState as useState7 } from "react";
1155
+ import { Stack as Stack7, Text as Text8 } from "@chakra-ui/react";
1156
+ 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";
1157
+ import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
1158
+ var isSandbox = (x) => x.name.startsWith("sandbox_");
1159
+ function optionsOf(x, t) {
1160
+ 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") }]];
1161
+ if (x.optIn && x.readsOnly) return [{ value: "", label: t("tools.defaultOff") }, { value: "run", label: t("tools.on") }];
1162
+ if (x.optIn) return [{ value: "", label: t("tools.defaultOff") }, { value: "run", label: t("tools.run") }, { value: "ask", label: t("tools.ask") }];
1163
+ return [
1164
+ { value: "", label: t(x.readsOnly ? "tools.defaultReads" : "tools.defaultAsks") },
1165
+ { value: "run", label: t("tools.run") },
1166
+ { value: "ask", label: t("tools.ask") },
1167
+ { value: "off", label: t("tools.off") }
1168
+ ];
1169
+ }
1170
+ function AgentToolsPanel({ agent, onSaved, version = 0 }) {
1171
+ const t = useAgentTexts();
1172
+ const request = useAreaRequest5("agent");
1173
+ const tools = useApiQuery5("agent", `/agents/${agent.id}/tools?v=${version}`);
1174
+ const action = useApiAction4();
1175
+ const [settings, setSettings] = useState7(agent.tools ?? {});
1176
+ const changed = JSON.stringify(settings) !== JSON.stringify(agent.tools ?? {});
1177
+ const groupOf = useToolGroupOf();
1178
+ const rows = tools.data ?? [];
1179
+ const hostGroups = /* @__PURE__ */ new Map();
1180
+ const own = [];
1181
+ for (const x of rows) {
1182
+ const g = groupOf?.(x);
1183
+ if (!g) own.push(x);
1184
+ else (hostGroups.get(g.id) ?? hostGroups.set(g.id, { ...g, rows: [] }).get(g.id)).rows.push(x);
1185
+ }
1186
+ const groups = [
1187
+ { id: "host", title: t("tools.groups.host"), rows: own.filter((x) => !x.fromPlugin && !isSandbox(x)) },
1188
+ { id: "plugins", title: t("tools.groups.plugins"), rows: own.filter((x) => x.fromPlugin && !isSandbox(x)) },
1189
+ ...[...hostGroups.values()],
1190
+ { id: "sandbox", title: t("tools.groups.sandbox"), rows: own.filter(isSandbox) }
1191
+ ].filter((g) => g.rows.length > 0 || g.id === "host" && tools.loading);
1192
+ async function save() {
1193
+ const saved = await action.run(() => request(`/agents/${agent.id}`, { method: "PUT", body: { tools: settings } }));
1194
+ if (saved) {
1195
+ notify5.success(t("tools.saved"));
1196
+ onSaved(saved);
1197
+ }
1198
+ }
1199
+ function set(name, value) {
1200
+ const next = { ...settings };
1201
+ if (value) next[name] = value;
1202
+ else delete next[name];
1203
+ setSettings(next);
1204
+ }
1205
+ return /* @__PURE__ */ jsxs7(Stack7, { gap: "field", "data-testid": "agent-tools", children: [
1206
+ /* @__PURE__ */ jsxs7(Stack7, { gap: "1", children: [
1207
+ /* @__PURE__ */ jsx8(Text8, { fontWeight: "medium", children: t("tools.title") }),
1208
+ /* @__PURE__ */ jsx8(Text8, { textStyle: "caption", color: "fg.muted", children: t("tools.hint") })
1209
+ ] }),
1210
+ groups.map((g) => /* @__PURE__ */ jsxs7(Stack7, { gap: "2", children: [
1211
+ /* @__PURE__ */ jsx8(Text8, { textStyle: "label", color: "fg.muted", children: g.title }),
1212
+ /* @__PURE__ */ jsx8(
1213
+ DataTable5,
1214
+ {
1215
+ rows: g.rows,
1216
+ loading: tools.loading,
1217
+ getRowId: (x) => x.name,
1218
+ size: "sm",
1219
+ "aria-label": g.title,
1220
+ columns: [
1221
+ { id: "name", header: t("tools.tool"), cell: (x) => /* @__PURE__ */ jsxs7(Stack7, { gap: "0", children: [
1222
+ /* @__PURE__ */ jsx8(Text8, { dir: "ltr", children: x.name }),
1223
+ /* @__PURE__ */ jsx8(Text8, { textStyle: "caption", color: "fg.muted", children: x.title })
1224
+ ] }) },
1225
+ {
1226
+ id: "kind",
1227
+ header: t("tools.kind"),
1228
+ cell: (x) => /* @__PURE__ */ jsx8(StatusPill4, { tone: x.readsOnly ? "neutral" : "warning", children: t(x.alwaysAsks ? "tools.asksEveryTime" : x.readsOnly ? "tools.reads" : "tools.changes") })
1229
+ },
1230
+ {
1231
+ id: "setting",
1232
+ header: t("tools.setting"),
1233
+ cell: (x) => /* @__PURE__ */ jsx8(SelectField3, { size: "sm", value: settings[x.name] ?? "", "aria-label": t("tools.setting"), onChange: (e) => set(x.name, e.target.value), options: optionsOf(x, t) })
1234
+ }
1235
+ ]
1236
+ }
1237
+ )
1238
+ ] }, g.id)),
1239
+ /* @__PURE__ */ jsx8(HostSlot3, { name: "agent.tools.extra", context: { agent, settings, set, listed: rows.map((x) => x.name), loading: tools.loading } }),
1240
+ /* @__PURE__ */ jsx8(InlineAlert6, { tone: "danger", children: action.error ?? tools.error }),
1241
+ /* @__PURE__ */ jsx8(Button6, { variant: "primary", alignSelf: "flex-start", onClick: () => void save(), loading: action.busy, disabled: !changed, children: t("tools.save") })
1242
+ ] });
1243
+ }
1244
+
1245
+ // src/areas/agent/AgentEditor.tsx
1246
+ import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
1247
+ function AgentEditor({ agent, onSaved, permissions = true, variant = "site" }) {
1248
+ const t = useAgentTexts();
1249
+ const nameOf = useNameOf();
1250
+ const [toolsVersion, setToolsVersion] = useState8(0);
1251
+ return /* @__PURE__ */ jsxs8(Stack8, { gap: "section", children: [
1252
+ /* @__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: [
1253
+ variant === "site" && /* @__PURE__ */ jsx9(
1254
+ PropertyList,
1255
+ {
1256
+ items: [
1257
+ { label: t("key"), value: /* @__PURE__ */ jsx9(Text9, { dir: "ltr", children: agent.key }) },
1258
+ { label: t("account"), value: /* @__PURE__ */ jsxs8(Text9, { dir: "ltr", children: [
1259
+ "@",
1260
+ agent.account.username
1261
+ ] }) },
1262
+ { label: t("responsible"), value: agent.responsible?.displayName ?? "" },
1263
+ {
1264
+ label: t("takenBy"),
1265
+ value: /* @__PURE__ */ jsx9(HStack5, { gap: "2", wrap: "wrap", children: agent.scopes.length === 0 ? t("notTaken") : agent.scopes.map((s) => /* @__PURE__ */ jsxs8(Text9, { dir: "ltr", children: [
1266
+ s.scopeKey,
1267
+ " (",
1268
+ s.roleKey,
1269
+ ")"
1270
+ ] }, s.scopeKey)) })
1271
+ }
1272
+ ]
1273
+ }
1274
+ ),
1275
+ /* @__PURE__ */ jsx9(HostSlot4, { name: "agent.picture", context: { agent, onSaved } }),
1276
+ /* @__PURE__ */ jsx9(AgentForm, { agent, onSaved }, `form-${agent.id}`),
1277
+ /* @__PURE__ */ jsx9(HostSlot4, { name: "agent.connections", context: { agent, onChanged: () => setToolsVersion((v) => v + 1) } }),
1278
+ /* @__PURE__ */ jsx9(AgentToolsPanel, { agent, onSaved, version: toolsVersion }, `tools-${agent.id}`),
1279
+ /* @__PURE__ */ jsx9(AgentLimitsPanel, { agent, onSaved }, `limits-${agent.id}`),
1280
+ /* @__PURE__ */ jsx9(AgentMemoriesPanel, { agent, onSaved }, `memories-${agent.id}`)
1281
+ ] }) }),
1282
+ permissions && /* @__PURE__ */ jsx9(AgentPermissionsPanel, { agentId: agent.id }, `permissions-${agent.id}`)
1283
+ ] });
1284
+ }
1285
+
1286
+ // src/areas/agent/AgentsAdmin.tsx
1287
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1288
+ function AgentsAdmin({ itemHref }) {
1289
+ const t = useAgentTexts();
1290
+ const request = useAreaRequest6("agent");
1291
+ const settings = useApiQuery6("agent", "/settings");
1292
+ const agents = useApiQuery6("agent", "/agents");
1293
+ const [selected, setSelected] = useState9(null);
1294
+ const [creating, setCreating] = useState9(false);
1295
+ const toggle = useApiAction5();
1296
+ const slots = useSlotSaves2();
1297
+ async function turn(enabled) {
1298
+ const s2 = await toggle.run(async () => {
1299
+ if (enabled) await slots.run();
1300
+ return request("/settings", { method: "PUT", body: { enabled } });
1301
+ });
1302
+ if (s2) settings.setData(s2);
1303
+ }
1304
+ function saved(agent) {
1305
+ setSelected(agent);
1306
+ setCreating(false);
1307
+ void agents.reload();
1308
+ }
1309
+ const s = settings.data;
1310
+ return /* @__PURE__ */ jsx10(ItemHrefProvider, { value: itemHref, children: /* @__PURE__ */ jsxs9(Stack9, { gap: "section", children: [
1311
+ /* @__PURE__ */ jsx10(Panel3, { title: t("switchTitle"), "data-testid": "agents-switch", children: /* @__PURE__ */ jsxs9(Stack9, { gap: "2", children: [
1312
+ /* @__PURE__ */ jsx10(InlineAlert7, { tone: "danger", children: toggle.error ?? settings.error }),
1313
+ s?.safeMode && /* @__PURE__ */ jsx10(InlineAlert7, { tone: "warning", children: t("safeMode") }),
1314
+ /* @__PURE__ */ jsx10(
1315
+ SwitchField3,
1316
+ {
1317
+ label: t(s?.enabled ? "switchOn" : "switchOff"),
1318
+ checked: s?.enabled ?? false,
1319
+ disabled: !s || toggle.busy || !s.adminsMayEnable && !s.enabled,
1320
+ onCheckedChange: (c) => void turn(c)
1321
+ }
1322
+ ),
1323
+ /* @__PURE__ */ jsx10(Text10, { textStyle: "caption", color: "fg.muted", children: t(s && !s.adminsMayEnable ? "operatorOff" : "switchHint") }),
1324
+ s && /* @__PURE__ */ jsx10(HostSlot5, { name: "agent.switch.extra", context: { settings: s, register: slots.register } })
1325
+ ] }) }),
1326
+ /* @__PURE__ */ jsxs9(
1327
+ Panel3,
1328
+ {
1329
+ title: t("list"),
1330
+ flush: true,
1331
+ "data-testid": "agents-list",
1332
+ actions: /* @__PURE__ */ jsx10(Button7, { size: "sm", disabled: !s?.enabled, onClick: () => {
1333
+ setCreating(true);
1334
+ setSelected(null);
1335
+ }, children: t("newSite") }),
1336
+ children: [
1337
+ /* @__PURE__ */ jsx10(InlineAlert7, { tone: "danger", children: agents.error }),
1338
+ /* @__PURE__ */ jsx10(AgentsTable, { rows: agents.data, loading: agents.loading, selected: selected?.id, onOpen: (a) => {
1339
+ setSelected(a);
1340
+ setCreating(false);
1341
+ } })
1342
+ ]
1343
+ }
1344
+ ),
1345
+ creating && /* @__PURE__ */ jsx10(Panel3, { title: t("newSite"), "data-testid": "agent-new", children: /* @__PURE__ */ jsx10(AgentForm, { onSaved: saved }) }),
1346
+ selected && /* @__PURE__ */ jsx10(AgentEditor, { agent: selected, onSaved: saved }, selected.id)
1347
+ ] }) });
1348
+ }
1349
+
1350
+ // src/areas/agent/pages.tsx
1351
+ import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1352
+ function AgentsAdminPage() {
1353
+ const t = useAgentTexts();
1354
+ return /* @__PURE__ */ jsxs10(Stack10, { gap: "section", children: [
1355
+ /* @__PURE__ */ jsx11(PageHeader, { title: t("title"), description: t("subtitle") }),
1356
+ /* @__PURE__ */ jsx11(AgentsAdmin, {})
1357
+ ] });
1358
+ }
1359
+ function agentPages(options) {
1360
+ return [
1361
+ {
1362
+ id: "agent.admin",
1363
+ section: options.section,
1364
+ weight: options.weight ?? 100,
1365
+ title: options.title ?? "AI agents",
1366
+ href: options.href,
1367
+ about: options.about,
1368
+ plugin: "agent",
1369
+ visible: options.visible ?? (options.host?.can ? () => options.host.can("agent.site.admin") : void 0),
1370
+ component: AgentsAdminPage
1371
+ }
1372
+ ];
1373
+ }
1374
+
1375
+ // src/areas/agent/ScopeAgents.tsx
1376
+ import { useState as useState10 } from "react";
1377
+ import { HStack as HStack6, Stack as Stack11, Text as Text11 } from "@chakra-ui/react";
1378
+ import { Button as Button8, InlineAlert as InlineAlert8, notify as notify6, Panel as Panel4, SelectField as SelectField4, useApiAction as useApiAction6, useApiQuery as useApiQuery7, useAreaRequest as useAreaRequest7 } from "@abpjs/ui";
1379
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1380
+ function ScopeAgentsScreen({ scope, roles, header, itemHref, subtitle }) {
1381
+ const t = useAgentTexts();
1382
+ const nameOf = useNameOf();
1383
+ const request = useAreaRequest7("agent");
1384
+ const base = `/scopes/${encodeURIComponent(scope)}/agents`;
1385
+ const agents = useApiQuery7("agent", base);
1386
+ const [selected, setSelected] = useState10(null);
1387
+ const [creating, setCreating] = useState10(false);
1388
+ const [roleFor, setRoleFor] = useState10({});
1389
+ const action = useApiAction6();
1390
+ const byId = new Map((agents.data ?? []).map((a) => [a.agent.id, a]));
1391
+ async function take(agent, on) {
1392
+ const name = nameOf(agent.names, agent.key);
1393
+ const done = await action.run(async () => {
1394
+ if (on) await request(`${base}/${agent.id}/take`, { method: "PUT", body: { roleKey: roleFor[agent.id] ?? roles[0]?.value ?? "" } });
1395
+ else await request(`${base}/${agent.id}/take`, { method: "DELETE" });
1396
+ return true;
1397
+ });
1398
+ if (done) {
1399
+ notify6.success(t(on ? "takenToast" : "takenOffToast", { name }));
1400
+ await agents.reload();
1401
+ }
1402
+ }
1403
+ function saved(agent) {
1404
+ setSelected(agent);
1405
+ setCreating(false);
1406
+ void agents.reload();
1407
+ }
1408
+ return /* @__PURE__ */ jsx12(ItemHrefProvider, { value: itemHref, children: /* @__PURE__ */ jsxs11(Stack11, { gap: "section", children: [
1409
+ header,
1410
+ /* @__PURE__ */ jsx12(Text11, { color: "fg.muted", children: subtitle ?? t("projectSubtitle") }),
1411
+ /* @__PURE__ */ jsxs11(
1412
+ Panel4,
1413
+ {
1414
+ title: t("list"),
1415
+ flush: true,
1416
+ "data-testid": "scope-agents",
1417
+ actions: /* @__PURE__ */ jsx12(Button8, { size: "sm", onClick: () => {
1418
+ setCreating(true);
1419
+ setSelected(null);
1420
+ }, children: t("newProject") }),
1421
+ children: [
1422
+ /* @__PURE__ */ jsx12(InlineAlert8, { tone: "danger", children: action.error ?? agents.error }),
1423
+ /* @__PURE__ */ jsx12(
1424
+ AgentsTable,
1425
+ {
1426
+ rows: agents.data?.map((a) => a.agent),
1427
+ loading: agents.loading,
1428
+ selected: selected?.id,
1429
+ onOpen: (a) => {
1430
+ if (byId.get(a.id)?.own) {
1431
+ setSelected(a);
1432
+ setCreating(false);
1433
+ }
1434
+ },
1435
+ extra: [
1436
+ {
1437
+ id: "taken",
1438
+ header: t("role"),
1439
+ cell: (a) => {
1440
+ const row = byId.get(a.id);
1441
+ if (!row || row.own) return /* @__PURE__ */ jsx12(Text11, { textStyle: "caption", color: "fg.muted", children: t("own") });
1442
+ return row.roleKey ? /* @__PURE__ */ jsxs11(HStack6, { gap: "2", onClick: (e) => e.stopPropagation(), children: [
1443
+ /* @__PURE__ */ jsx12(Text11, { children: roles.find((r) => r.value === row.roleKey)?.label ?? row.roleKey }),
1444
+ /* @__PURE__ */ jsx12(Button8, { size: "xs", variant: "ghost", disabled: action.busy, onClick: () => void take(a, false), children: t("takeOff") })
1445
+ ] }) : /* @__PURE__ */ jsxs11(HStack6, { gap: "2", onClick: (e) => e.stopPropagation(), children: [
1446
+ /* @__PURE__ */ jsx12(
1447
+ SelectField4,
1448
+ {
1449
+ size: "xs",
1450
+ width: "auto",
1451
+ "aria-label": t("role"),
1452
+ value: roleFor[a.id] ?? roles[0]?.value ?? "",
1453
+ onChange: (e) => setRoleFor({ ...roleFor, [a.id]: e.target.value }),
1454
+ options: roles
1455
+ }
1456
+ ),
1457
+ /* @__PURE__ */ jsx12(Button8, { size: "xs", disabled: action.busy || roles.length === 0, onClick: () => void take(a, true), children: t("take") })
1458
+ ] });
1459
+ }
1460
+ }
1461
+ ]
1462
+ }
1463
+ )
1464
+ ]
1465
+ }
1466
+ ),
1467
+ creating && /* @__PURE__ */ jsx12(Panel4, { title: t("newProject"), "data-testid": "scope-agent-new", children: /* @__PURE__ */ jsx12(AgentForm, { scope, roles, onSaved: saved }) }),
1468
+ selected && /* @__PURE__ */ jsx12(AgentEditor, { agent: selected, onSaved: saved, permissions: selected.scopeKey != null, variant: "scope" }, selected.id)
1469
+ ] }) });
1470
+ }
1471
+
1472
+ // src/areas/agent/AgentRuns.tsx
1473
+ import { useEffect as useEffect2, useState as useState11 } from "react";
1474
+ import { Box as Box2, HStack as HStack7, Stack as Stack12, Text as Text12 } from "@chakra-ui/react";
1475
+ import { Bot, ChevronDown, ChevronRight, Square } from "lucide-react";
1476
+ 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";
1477
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1478
+ function AgentText({ source, testId }) {
1479
+ const drawn = Boolean(useOptionalHost2()?.slots?.["agent.markdown"]);
1480
+ 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 }) });
1481
+ }
1482
+ var allowedKey = (allowed) => allowed === "settings" ? "settings" : allowed.startsWith("always:") ? "always" : allowed === "this-run" ? "thisRun" : "answer";
1483
+ function AgentQuestionCard({ question, onAnswered }) {
1484
+ const t = useAgentTexts();
1485
+ const fmt = useFormatters5();
1486
+ const request = useAreaRequest8("agent");
1487
+ const action = useApiAction7();
1488
+ const answers = ["allow", "allow-run", ...question.canAlways ? ["always"] : [], "refuse"];
1489
+ async function answer(a) {
1490
+ if (await action.run(() => request(`/questions/${question.id}/answer`, { method: "POST", body: { answer: a } }))) await onAnswered();
1491
+ }
1492
+ return /* @__PURE__ */ jsxs12(Stack12, { gap: "1.5", ms: "5", p: "2.5", borderWidth: "1px", borderColor: "border.accent", borderRadius: "l2", "data-testid": "agent-question", children: [
1493
+ /* @__PURE__ */ jsx13(Text12, { textStyle: "sm", fontWeight: "medium", children: t("runs.asks", { tool: question.tool, target: question.target ?? question.itemKey ?? "" }) }),
1494
+ question.why && /* @__PURE__ */ jsx13(Text12, { textStyle: "caption", color: "fg.muted", children: question.why }),
1495
+ question.input && /* @__PURE__ */ jsx13(Text12, { textStyle: "caption", color: "fg.subtle", fontFamily: "mono", whiteSpace: "pre-wrap", lineClamp: 6, dir: "ltr", children: question.input }),
1496
+ question.canAnswer ? /* @__PURE__ */ jsxs12(HStack7, { gap: "1.5", wrap: "wrap", children: [
1497
+ answers.map((a) => /* @__PURE__ */ jsx13(
1498
+ Button9,
1499
+ {
1500
+ size: "xs",
1501
+ variant: a === "refuse" ? "ghost" : a === "allow" ? "primary" : "secondary",
1502
+ danger: a === "refuse",
1503
+ loading: action.busy,
1504
+ onClick: () => void answer(a),
1505
+ "data-testid": `agent-answer-${a}`,
1506
+ children: t(`runs.answers.${a}`)
1507
+ },
1508
+ a
1509
+ )),
1510
+ /* @__PURE__ */ jsx13(Text12, { as: "span", textStyle: "caption", color: "fg.muted", children: t("runs.expires", { at: fmt.dateTime(question.expiresAt) }) })
1511
+ ] }) : /* @__PURE__ */ jsx13(Text12, { textStyle: "caption", color: "fg.muted", children: t("runs.waitsFor", { person: question.askedOf?.displayName ?? "" }) }),
1512
+ action.error && /* @__PURE__ */ jsx13(Text12, { textStyle: "caption", color: "fg.error", children: action.error })
1513
+ ] });
1514
+ }
1515
+ function RunRow({ run, onChanged }) {
1516
+ const t = useAgentTexts();
1517
+ const fmt = useFormatters5();
1518
+ const request = useAreaRequest8("agent");
1519
+ const action = useApiAction7();
1520
+ const [open, setOpen] = useState11(false);
1521
+ const going = GOING.has(run.state);
1522
+ const tools = run.steps.filter((s) => s.kind === "tool");
1523
+ async function stop() {
1524
+ if (await action.run(() => request(`/runs/${run.id}/stop`, { method: "POST" }))) await onChanged();
1525
+ }
1526
+ return /* @__PURE__ */ jsxs12(Stack12, { gap: "1", children: [
1527
+ /* @__PURE__ */ jsxs12(HStack7, { gap: "2", align: "start", children: [
1528
+ /* @__PURE__ */ jsxs12(HStack7, { gap: "2", wrap: "wrap", flex: "1", minW: "0", children: [
1529
+ /* @__PURE__ */ jsx13(Bot, { size: 14, "aria-hidden": true }),
1530
+ /* @__PURE__ */ jsx13(Text12, { as: "span", fontWeight: "medium", children: run.agent?.displayName ?? run.agentKey }),
1531
+ /* @__PURE__ */ jsx13(StatusPill5, { tone: RUN_TONES[run.state] ?? "neutral", children: t(`runs.states.${run.state}`) }),
1532
+ run.outside && /* @__PURE__ */ jsx13(StatusPill5, { tone: "warning", children: t("runs.outside") }),
1533
+ run.wide && /* @__PURE__ */ jsx13(StatusPill5, { tone: "warning", children: t("runs.wide") }),
1534
+ /* @__PURE__ */ jsxs12(Text12, { as: "span", textStyle: "caption", color: "fg.muted", children: [
1535
+ fmt.dateTime(run.createdAt),
1536
+ " \xB7 ",
1537
+ t(`runs.triggers.${run.trigger}`),
1538
+ run.startedBy ? ` \xB7 ${run.startedBy.displayName}` : ""
1539
+ ] })
1540
+ ] }),
1541
+ /* @__PURE__ */ jsxs12(HStack7, { gap: "1", flexShrink: 0, children: [
1542
+ going && /* @__PURE__ */ jsxs12(Button9, { size: "xs", variant: "ghost", onClick: () => void stop(), loading: action.busy, "data-testid": "agent-run-stop", children: [
1543
+ /* @__PURE__ */ jsx13(Square, {}),
1544
+ t("runs.stop")
1545
+ ] }),
1546
+ !going && /* @__PURE__ */ jsx13(HostSlot6, { name: "agent.run.actions", context: { run, onChanged } })
1547
+ ] })
1548
+ ] }),
1549
+ run.question && /* @__PURE__ */ jsx13(AgentQuestionCard, { question: run.question, onAnswered: onChanged }),
1550
+ run.answer && /* @__PURE__ */ jsx13(Box2, { ps: "5", children: /* @__PURE__ */ jsx13(AgentText, { source: run.answer }) }),
1551
+ run.error && /* @__PURE__ */ jsx13(Text12, { ps: "5", textStyle: "caption", color: run.state === "failed" ? "fg.error" : "fg.muted", children: run.error }),
1552
+ tools.length > 0 && /* @__PURE__ */ jsxs12(Box2, { ps: "5", children: [
1553
+ /* @__PURE__ */ jsxs12(Button9, { size: "xs", variant: "link", px: "0", onClick: () => setOpen(!open), "aria-expanded": open, children: [
1554
+ open ? /* @__PURE__ */ jsx13(ChevronDown, {}) : /* @__PURE__ */ jsx13(DirectionalIcon, { children: /* @__PURE__ */ jsx13(ChevronRight, {}) }),
1555
+ t("runs.steps", { count: tools.length })
1556
+ ] }),
1557
+ open && /* @__PURE__ */ jsx13(Stack12, { gap: "1", mt: "1", as: "ol", listStyleType: "none", children: tools.map((s) => /* @__PURE__ */ jsxs12(Box2, { as: "li", children: [
1558
+ /* @__PURE__ */ jsxs12(Text12, { textStyle: "caption", color: s.outcome === "failed" || s.outcome === "refused" ? "fg.error" : "fg.muted", children: [
1559
+ s.name,
1560
+ s.target ? ` \xB7 ${s.target}` : "",
1561
+ ": ",
1562
+ t(`runs.outcomes.${s.outcome}`),
1563
+ s.allowed && ` \xB7 ${allowedKey(s.allowed) === "always" ? t("runs.allowed.always", { name: run.startedBy?.displayName ?? "" }) : t(`runs.allowed.${allowedKey(s.allowed)}`)}`
1564
+ ] }),
1565
+ run.transcript && s.output && /* @__PURE__ */ jsx13(Text12, { textStyle: "caption", color: "fg.subtle", fontFamily: "mono", whiteSpace: "pre-wrap", lineClamp: 4, dir: "ltr", children: s.output })
1566
+ ] }, String(s.number))) })
1567
+ ] })
1568
+ ] });
1569
+ }
1570
+ function ItemAgentRuns({ kind, itemKey, version = 0, onChanged, title, description }) {
1571
+ const t = useAgentTexts();
1572
+ const runs = useApiQuery8("agent", `${itemPath(kind, itemKey)}/runs`);
1573
+ const { reload } = runs;
1574
+ const going = runs.data?.some((r) => GOING.has(r.state)) ?? false;
1575
+ useEffect2(() => {
1576
+ if (version > 0) void reload();
1577
+ }, [version, reload]);
1578
+ useEffect2(() => {
1579
+ if (!going) return;
1580
+ const timer = setInterval(() => void reload(), 2e3);
1581
+ return () => clearInterval(timer);
1582
+ }, [going, reload]);
1583
+ const [wasGoing, setWasGoing] = useState11(false);
1584
+ useEffect2(() => {
1585
+ if (wasGoing && !going) onChanged?.();
1586
+ setWasGoing(going);
1587
+ }, [going]);
1588
+ if (!runs.data?.length) return null;
1589
+ return /* @__PURE__ */ jsx13(Panel5, { title: title ?? t("runs.title"), description: description ?? t("runs.hint"), flush: true, "data-testid": "item-agent-runs", children: /* @__PURE__ */ jsx13(Stack12, { gap: "0", as: "ol", listStyleType: "none", "aria-label": title ?? t("runs.title"), children: runs.data.map((run, i) => /* @__PURE__ */ jsx13(Box2, { as: "li", px: "panel", py: "2.5", borderTopWidth: i === 0 ? "0" : "1px", borderColor: "border.muted", children: /* @__PURE__ */ jsx13(RunRow, { run, onChanged: async () => {
1590
+ await reload();
1591
+ onChanged?.();
1592
+ } }) }, run.id)) }) });
1593
+ }
1594
+
1595
+ // src/areas/agent/AgentChat.tsx
1596
+ import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect3, useMemo as useMemo2, useRef, useState as useState12 } from "react";
1597
+ import { Box as Box3, chakra as chakra4, CloseButton, Drawer, HStack as HStack8, Portal, Stack as Stack13, Text as Text13, Textarea as Textarea2 } from "@chakra-ui/react";
1598
+ import { ArrowLeft, Bot as Bot2, Check, ChevronDown as ChevronDown2, ChevronRight as ChevronRight2, Send, Square as Square2, Trash2 } from "lucide-react";
1599
+ import {
1600
+ Button as Button10,
1601
+ DirectionalIcon as DirectionalIcon2,
1602
+ EmptyState,
1603
+ Field as Field3,
1604
+ HostSlot as HostSlot7,
1605
+ IconButton,
1606
+ InlineAlert as InlineAlert9,
1607
+ notify as notify7,
1608
+ SelectField as SelectField5,
1609
+ StatusPill as StatusPill6,
1610
+ useApiAction as useApiAction8,
1611
+ useApiQuery as useApiQuery9,
1612
+ useAreaEvents,
1613
+ useAreaRequest as useAreaRequest9,
1614
+ useConfirm as useConfirm2,
1615
+ useFormatters as useFormatters6,
1616
+ useNames
1617
+ } from "@abpjs/ui";
1618
+ import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1619
+ var ChatContext = createContext2(null);
1620
+ function AgentChatProvider({ children, onItemChanged }) {
1621
+ const [open, setOpen] = useState12(false);
1622
+ const [view, setView] = useState12({ kind: "list" });
1623
+ const show = useCallback2((target = {}) => {
1624
+ setView(target.chat ? { kind: "chat", id: target.chat, opened: true } : target.item || target.scope || target.agent || target.prompt ? { kind: "new", target } : { kind: "list" });
1625
+ setOpen(true);
1626
+ }, []);
1627
+ const close = useCallback2(() => setOpen(false), []);
1628
+ const value = useMemo2(() => ({ open, view, show, setView, close, onItemChanged }), [open, view, show, close, onItemChanged]);
1629
+ return /* @__PURE__ */ jsx14(ChatContext.Provider, { value, children });
1630
+ }
1631
+ function useAgentChat() {
1632
+ const state = useContext2(ChatContext);
1633
+ if (!state) throw new Error("useAgentChat needs AgentChatProvider around it.");
1634
+ return { open: state.show, close: state.close, isOpen: state.open };
1635
+ }
1636
+ var EVERY_MS = 2e3;
1637
+ var EMPTY_STREAMS = 3;
1638
+ var NO_LIVE = { run: null, texts: {}, steps: [] };
1639
+ function useLiveRun(chatId, going, reload) {
1640
+ const events = useAreaEvents("agent");
1641
+ const [live, setLive] = useState12(NO_LIVE);
1642
+ useEffect3(() => {
1643
+ if (!going) return;
1644
+ const abort = new AbortController();
1645
+ let timer;
1646
+ let last = null;
1647
+ if (!events) {
1648
+ timer = setInterval(() => void reload(), EVERY_MS);
1649
+ return () => clearInterval(timer);
1650
+ }
1651
+ void (async () => {
1652
+ setLive(NO_LIVE);
1653
+ let empty = 0;
1654
+ while (!abort.signal.aborted) {
1655
+ const heard = { any: false };
1656
+ try {
1657
+ last = await events(`/chats/${chatId}/events`, (name, data) => {
1658
+ if (name !== "ping") heard.any = true;
1659
+ const run = typeof data.run === "string" ? data.run : null;
1660
+ const turn = typeof data.turn === "number" ? data.turn : 0;
1661
+ switch (name) {
1662
+ case "turn":
1663
+ setLive((l) => ({ ...l, run, texts: { ...l.texts, [turn]: "" } }));
1664
+ break;
1665
+ case "text":
1666
+ setLive((l) => ({ ...l, run, texts: { ...l.texts, [turn]: (l.texts[turn] ?? "") + String(data.text ?? "") } }));
1667
+ break;
1668
+ case "step": {
1669
+ const step = { step: Number(data.step), tool: String(data.tool ?? ""), target: data.target ?? null, outcome: data.outcome ?? null };
1670
+ setLive((l) => ({ ...l, run, steps: [...l.steps.filter((x) => x.step !== step.step), step].sort((a, b) => a.step - b.step) }));
1671
+ break;
1672
+ }
1673
+ case "question":
1674
+ case "run":
1675
+ void reload();
1676
+ break;
1677
+ }
1678
+ }, { lastEventId: last, signal: abort.signal });
1679
+ } catch {
1680
+ if (abort.signal.aborted) return;
1681
+ timer = setInterval(() => void reload(), EVERY_MS);
1682
+ return;
1683
+ }
1684
+ await reload();
1685
+ empty = heard.any ? 0 : empty + 1;
1686
+ if (empty >= EMPTY_STREAMS) {
1687
+ if (!abort.signal.aborted) timer = setInterval(() => void reload(), EVERY_MS);
1688
+ return;
1689
+ }
1690
+ await new Promise((r) => setTimeout(r, heard.any ? 300 : 1e3 * 2 ** empty));
1691
+ }
1692
+ })();
1693
+ return () => {
1694
+ abort.abort();
1695
+ if (timer) clearInterval(timer);
1696
+ };
1697
+ }, [chatId, going, reload, events]);
1698
+ return going ? live : NO_LIVE;
1699
+ }
1700
+ function AgentChatButton() {
1701
+ const t = useAgentTexts();
1702
+ const { open } = useAgentChat();
1703
+ const places = useApiQuery9("agent", "/chats/places");
1704
+ if (!places.data?.length) return null;
1705
+ return /* @__PURE__ */ jsx14(IconButton, { "aria-label": t("chat.open"), size: "sm", onClick: () => open(), "data-testid": "agent-chat-open", children: /* @__PURE__ */ jsx14(Bot2, { size: 18 }) });
1706
+ }
1707
+ function AskAgentButton({ kind, itemKey }) {
1708
+ const t = useAgentTexts();
1709
+ const { open } = useAgentChat();
1710
+ const agents = useApiQuery9("agent", `${itemPath(kind, itemKey)}/agents`);
1711
+ if (!agents.data?.length) return null;
1712
+ return /* @__PURE__ */ jsxs13(Button10, { size: "sm", variant: "ghost", onClick: () => open({ item: { kind, key: itemKey } }), "data-testid": "ask-agent", children: [
1713
+ /* @__PURE__ */ jsx14(Bot2, {}),
1714
+ t("runs.ask")
1715
+ ] });
1716
+ }
1717
+ function AgentChatPanel({ itemHref }) {
1718
+ const t = useAgentTexts();
1719
+ const state = useContext2(ChatContext);
1720
+ if (!state) throw new Error("AgentChatPanel needs AgentChatProvider around it.");
1721
+ const { open, view, setView, close } = state;
1722
+ if (!open) return null;
1723
+ return /* @__PURE__ */ jsx14(ItemHrefProvider, { value: itemHref, children: /* @__PURE__ */ jsx14(
1724
+ Drawer.Root,
1725
+ {
1726
+ open: true,
1727
+ placement: "end",
1728
+ size: "md",
1729
+ modal: false,
1730
+ closeOnInteractOutside: false,
1731
+ trapFocus: false,
1732
+ preventScroll: false,
1733
+ onOpenChange: (e) => !e.open && close(),
1734
+ children: /* @__PURE__ */ jsx14(Portal, { children: /* @__PURE__ */ jsx14(Drawer.Positioner, { pointerEvents: "none", width: "100%", children: /* @__PURE__ */ jsxs13(Drawer.Content, { pointerEvents: "auto", borderStartWidth: "1px", borderColor: "border.muted", "data-testid": "agent-chat", children: [
1735
+ view.kind === "list" ? /* @__PURE__ */ jsx14(ChatList, { onOpen: (id) => setView({ kind: "chat", id }), onNew: () => setView({ kind: "new", target: {} }) }) : view.kind === "new" ? /* @__PURE__ */ jsx14(NewChat, { target: view.target, onBack: () => setView({ kind: "list" }), onStarted: (id) => setView({ kind: "chat", id }) }) : /* @__PURE__ */ jsx14(ChatView, { id: view.id, onBack: () => setView({ kind: "list" }), onMissing: view.opened ? () => setView({ kind: "list" }) : void 0 }, view.id),
1736
+ /* @__PURE__ */ jsx14(Drawer.CloseTrigger, { asChild: true, children: /* @__PURE__ */ jsx14(CloseButton, { size: "sm", "aria-label": t("chat.close") }) })
1737
+ ] }) }) })
1738
+ }
1739
+ ) });
1740
+ }
1741
+ function Where({ chat }) {
1742
+ const t = useAgentTexts();
1743
+ const names = useNames("scopes", chat.itemKey ? [] : [chat.scopeId]);
1744
+ if (chat.itemKey) return /* @__PURE__ */ jsx14(Fragment2, { children: t("chat.about", { key: chat.itemKey }) });
1745
+ return /* @__PURE__ */ jsx14(Fragment2, { children: t("chat.in", { place: names[chat.scopeId] ?? chat.scopeKey ?? "" }) });
1746
+ }
1747
+ function ChatList({ onOpen, onNew }) {
1748
+ const t = useAgentTexts();
1749
+ const fmt = useFormatters6();
1750
+ const chats = useApiQuery9("agent", "/chats");
1751
+ return /* @__PURE__ */ jsxs13(Fragment2, { children: [
1752
+ /* @__PURE__ */ jsx14(Drawer.Header, { pe: "12", children: /* @__PURE__ */ jsxs13(Stack13, { gap: "0.5", children: [
1753
+ /* @__PURE__ */ jsx14(Drawer.Title, { children: t("chat.title") }),
1754
+ /* @__PURE__ */ jsx14(Text13, { textStyle: "caption", color: "fg.muted", children: t("chat.private") })
1755
+ ] }) }),
1756
+ /* @__PURE__ */ jsxs13(Drawer.Body, { px: "0", children: [
1757
+ /* @__PURE__ */ jsx14(Box3, { px: "5", pb: "3", children: /* @__PURE__ */ jsx14(Button10, { size: "sm", variant: "primary", onClick: onNew, "data-testid": "agent-chat-new", children: t("chat.new") }) }),
1758
+ chats.error && /* @__PURE__ */ jsx14(Box3, { px: "5", children: /* @__PURE__ */ jsx14(InlineAlert9, { tone: "danger", children: chats.error }) }),
1759
+ chats.data?.length === 0 && /* @__PURE__ */ jsx14(EmptyState, { size: "sm", art: "agent", title: t("chat.none"), description: t("chat.noneHint") }),
1760
+ /* @__PURE__ */ jsx14(Stack13, { gap: "0", as: "ul", listStyleType: "none", "aria-label": t("chat.chats"), children: chats.data?.map((c) => /* @__PURE__ */ jsx14(Box3, { as: "li", borderTopWidth: "1px", borderColor: "border.muted", children: /* @__PURE__ */ jsxs13(
1761
+ chakra4.button,
1762
+ {
1763
+ type: "button",
1764
+ w: "full",
1765
+ textAlign: "start",
1766
+ px: "5",
1767
+ py: "2.5",
1768
+ _hover: { bg: "bg.muted" },
1769
+ _focusVisible: { outline: "2px solid", outlineColor: "border.accent", outlineOffset: "-2px" },
1770
+ onClick: () => onOpen(c.id),
1771
+ "data-testid": "agent-chat-row",
1772
+ children: [
1773
+ /* @__PURE__ */ jsxs13(HStack8, { gap: "2", justify: "space-between", align: "start", children: [
1774
+ /* @__PURE__ */ jsx14(Text13, { textStyle: "sm", fontWeight: "medium", truncate: true, dir: "auto", children: c.title }),
1775
+ c.going && /* @__PURE__ */ jsx14(StatusPill6, { tone: "info", children: t("chat.going") })
1776
+ ] }),
1777
+ /* @__PURE__ */ jsxs13(Text13, { textStyle: "caption", color: "fg.muted", truncate: true, children: [
1778
+ c.agent?.displayName ?? c.agentKey,
1779
+ " \xB7 ",
1780
+ /* @__PURE__ */ jsx14(Where, { chat: c }),
1781
+ " \xB7 ",
1782
+ fmt.dateTime(c.lastAt)
1783
+ ] })
1784
+ ]
1785
+ }
1786
+ ) }, c.id)) })
1787
+ ] })
1788
+ ] });
1789
+ }
1790
+ function NewChat({ target, onBack, onStarted }) {
1791
+ const t = useAgentTexts();
1792
+ const nameOf = useNameOf();
1793
+ const request = useAreaRequest9("agent");
1794
+ const action = useApiAction8();
1795
+ const item = target.item ?? null;
1796
+ const places = useApiQuery9("agent", item ? null : "/chats/places");
1797
+ const askable = useApiQuery9("agent", item ? `${itemPath(item.kind, item.key)}/agents` : null);
1798
+ const scopeNames = useNames("scopes", (places.data ?? []).map((p) => p.scope.id));
1799
+ const [place, setPlace] = useState12(target.scope ?? "");
1800
+ const [agentId, setAgentId] = useState12("");
1801
+ const [prompt, setPrompt] = useState12(target.prompt ?? "");
1802
+ const placeKey = places.data?.some((p) => p.scope.key === place) ? place : places.data?.[0]?.scope.key;
1803
+ const agents = item ? askable.data : places.data?.find((p) => p.scope.key === placeKey)?.agents;
1804
+ const chosen = agents?.find((a) => a.id === agentId)?.id ?? agents?.find((a) => a.id === target.agent || a.key === target.agent)?.id ?? agents?.[0]?.id;
1805
+ const agentName = (a) => [nameOf(a.names, a.account.displayName || a.key), nameOf(a.titles, "")].filter(Boolean).join(" \xB7 ");
1806
+ const loaded = item ? askable.data !== void 0 || askable.error : places.data !== void 0 || places.error;
1807
+ async function start() {
1808
+ if (!chosen || !prompt.trim()) return;
1809
+ const chat = await action.run(() => request("/chats", { method: "POST", body: { agentId: chosen, prompt, ...item ? { kind: item.kind, key: item.key } : { scope: placeKey } } }));
1810
+ if (chat) onStarted(chat.chat.id);
1811
+ }
1812
+ return /* @__PURE__ */ jsxs13(Fragment2, { children: [
1813
+ /* @__PURE__ */ jsx14(Drawer.Header, { pe: "12", children: /* @__PURE__ */ jsxs13(HStack8, { gap: "1.5", align: "start", children: [
1814
+ /* @__PURE__ */ jsx14(BackButton, { onBack }),
1815
+ /* @__PURE__ */ jsxs13(Stack13, { gap: "0.5", children: [
1816
+ /* @__PURE__ */ jsx14(Drawer.Title, { children: item ? t("chat.newAbout", { key: item.key }) : t("chat.new") }),
1817
+ /* @__PURE__ */ jsx14(Text13, { textStyle: "caption", color: "fg.muted", children: t("chat.private") })
1818
+ ] })
1819
+ ] }) }),
1820
+ /* @__PURE__ */ jsx14(Drawer.Body, { children: /* @__PURE__ */ jsxs13(Stack13, { gap: "4", children: [
1821
+ loaded && !agents?.length ? /* @__PURE__ */ jsx14(EmptyState, { size: "sm", title: item ? t("chat.noAgentsHere", { key: item.key }) : t("chat.noPlaces") }) : /* @__PURE__ */ jsxs13(Fragment2, { children: [
1822
+ !item && places.data && places.data.length > 1 && /* @__PURE__ */ jsx14(Field3, { label: t("chat.place"), children: /* @__PURE__ */ jsx14(
1823
+ SelectField5,
1824
+ {
1825
+ value: placeKey ?? "",
1826
+ onChange: (e) => {
1827
+ setPlace(e.target.value);
1828
+ setAgentId("");
1829
+ },
1830
+ "data-testid": "agent-chat-place",
1831
+ options: places.data.map((p) => ({ value: p.scope.key, label: scopeNames[p.scope.id] ? `${scopeNames[p.scope.id]} (${p.scope.key})` : p.scope.key }))
1832
+ }
1833
+ ) }),
1834
+ agents && agents.length > 0 && /* @__PURE__ */ jsx14(Field3, { label: t("chat.agent"), children: /* @__PURE__ */ jsx14(SelectField5, { value: chosen ?? "", onChange: (e) => setAgentId(e.target.value), "data-testid": "agent-chat-agent", options: agents.map((a) => ({ value: a.id, label: agentName(a) })) }) })
1835
+ ] }),
1836
+ action.error && /* @__PURE__ */ jsx14(InlineAlert9, { tone: "danger", children: action.error })
1837
+ ] }) }),
1838
+ agents && agents.length > 0 && /* @__PURE__ */ jsx14(Drawer.Footer, { borderTopWidth: "1px", borderColor: "border.muted", children: /* @__PURE__ */ jsx14(Composer, { value: prompt, onChange: setPrompt, onSend: () => void start(), busy: action.busy, label: t("chat.first"), autoFocus: true }) })
1839
+ ] });
1840
+ }
1841
+ function ChatView({ id, onBack, onMissing }) {
1842
+ const t = useAgentTexts();
1843
+ const confirm = useConfirm2();
1844
+ const request = useAreaRequest9("agent");
1845
+ const state = useContext2(ChatContext);
1846
+ const chat = useApiQuery9("agent", `/chats/${id}`);
1847
+ const send = useApiAction8();
1848
+ const [prompt, setPrompt] = useState12("");
1849
+ const end = useRef(null);
1850
+ const { reload, setData } = chat;
1851
+ const c = chat.data;
1852
+ useEffect3(() => {
1853
+ if (onMissing && chat.error && !c) onMissing();
1854
+ }, [onMissing, chat.error, c]);
1855
+ const going = c ? !c.canSend : false;
1856
+ const last = c?.runs.at(-1);
1857
+ const live = useLiveRun(id, going, reload);
1858
+ const liveText = Object.values(live.texts).join("").length;
1859
+ const wasGoing = useRef(false);
1860
+ useEffect3(() => {
1861
+ if (wasGoing.current && !going && c?.chat.itemKey && c.chat.itemKind) state?.onItemChanged?.({ kind: c.chat.itemKind, key: c.chat.itemKey });
1862
+ wasGoing.current = going;
1863
+ }, [going, c, state]);
1864
+ useEffect3(() => {
1865
+ end.current?.scrollIntoView({ block: "end" });
1866
+ }, [c?.runs.length, last?.state, last?.answer, liveText, live.steps.length]);
1867
+ async function say() {
1868
+ if (!prompt.trim() || going) return;
1869
+ const next = await send.run(() => request(`/chats/${id}/messages`, { method: "POST", body: { prompt } }));
1870
+ if (next) {
1871
+ setData(next);
1872
+ setPrompt("");
1873
+ }
1874
+ }
1875
+ async function remove() {
1876
+ if (!await confirm({ title: t("chat.deleteTitle"), description: t("chat.deleteBody"), confirmLabel: t("chat.delete"), danger: true })) return;
1877
+ const done = await send.run(async () => {
1878
+ await request(`/chats/${id}`, { method: "DELETE" });
1879
+ return true;
1880
+ });
1881
+ if (done) {
1882
+ notify7.success(t("chat.deleted"));
1883
+ onBack();
1884
+ }
1885
+ }
1886
+ return /* @__PURE__ */ jsxs13(Fragment2, { children: [
1887
+ /* @__PURE__ */ jsx14(Drawer.Header, { pe: "12", children: /* @__PURE__ */ jsxs13(HStack8, { gap: "1.5", align: "start", w: "full", children: [
1888
+ /* @__PURE__ */ jsx14(BackButton, { onBack }),
1889
+ /* @__PURE__ */ jsxs13(Stack13, { gap: "0.5", flex: "1", minW: "0", children: [
1890
+ /* @__PURE__ */ jsx14(Drawer.Title, { truncate: true, dir: "auto", children: c?.chat.title ?? "" }),
1891
+ c && /* @__PURE__ */ jsxs13(Text13, { textStyle: "caption", color: "fg.muted", truncate: true, children: [
1892
+ c.chat.agent?.displayName ?? c.chat.agentKey,
1893
+ " \xB7",
1894
+ " ",
1895
+ c.chat.itemKey ? /* @__PURE__ */ jsx14(ItemLink, { kind: c.chat.itemKind, itemKey: c.chat.itemKey, children: t("chat.about", { key: c.chat.itemKey }) }) : /* @__PURE__ */ jsx14(Where, { chat: c.chat })
1896
+ ] })
1897
+ ] }),
1898
+ c && !going && /* @__PURE__ */ jsx14(IconButton, { danger: true, "aria-label": t("chat.delete"), size: "sm", onClick: () => void remove(), "data-testid": "agent-chat-delete", children: /* @__PURE__ */ jsx14(Trash2, { size: 16 }) })
1899
+ ] }) }),
1900
+ /* @__PURE__ */ jsxs13(Drawer.Body, { children: [
1901
+ chat.error && /* @__PURE__ */ jsx14(InlineAlert9, { tone: "danger", children: chat.error }),
1902
+ c && /* @__PURE__ */ jsxs13(Stack13, { gap: "5", as: "ol", listStyleType: "none", "aria-label": t("chat.messages"), children: [
1903
+ /* @__PURE__ */ jsx14(Text13, { as: "li", textStyle: "caption", color: "fg.muted", textAlign: "center", children: t("chat.private") }),
1904
+ c.runs.map((run) => /* @__PURE__ */ jsx14(
1905
+ Turn,
1906
+ {
1907
+ run,
1908
+ chat: c,
1909
+ onChat: setData,
1910
+ onChanged: reload,
1911
+ live: GOING.has(run.state) && (live.run === run.id || live.run === null && run.id === last?.id) ? live : void 0
1912
+ },
1913
+ run.id
1914
+ ))
1915
+ ] }),
1916
+ /* @__PURE__ */ jsx14("div", { ref: end })
1917
+ ] }),
1918
+ /* @__PURE__ */ jsx14(Drawer.Footer, { borderTopWidth: "1px", borderColor: "border.muted", children: /* @__PURE__ */ jsxs13(Stack13, { gap: "1.5", w: "full", children: [
1919
+ send.error && /* @__PURE__ */ jsx14(InlineAlert9, { tone: "danger", children: send.error }),
1920
+ /* @__PURE__ */ jsx14(
1921
+ Composer,
1922
+ {
1923
+ value: prompt,
1924
+ onChange: setPrompt,
1925
+ onSend: () => void say(),
1926
+ busy: send.busy,
1927
+ disabled: going,
1928
+ label: t("chat.message", { agent: c?.chat.agent?.displayName ?? c?.chat.agentKey ?? "" }),
1929
+ hint: going ? t("chat.busy") : void 0,
1930
+ autoFocus: true
1931
+ }
1932
+ )
1933
+ ] }) })
1934
+ ] });
1935
+ }
1936
+ function Turn({ run, chat, onChat, onChanged, live }) {
1937
+ const t = useAgentTexts();
1938
+ const fmt = useFormatters6();
1939
+ const request = useAreaRequest9("agent");
1940
+ const state = useContext2(ChatContext);
1941
+ const action = useApiAction8();
1942
+ const [open, setOpen] = useState12(false);
1943
+ const going = GOING.has(run.state);
1944
+ const tools = live && live.steps.length > 0 ? live.steps.map((s) => ({ name: s.tool, target: s.target, outcome: s.outcome ?? "started", number: s.step })) : run.steps.filter((s) => s.kind === "tool");
1945
+ const writing = live ? Object.entries(live.texts).sort(([a], [b]) => Number(b) - Number(a)).find(([, text]) => text.length > 0)?.[1] : void 0;
1946
+ const itemKey = chat.chat.itemKey;
1947
+ const itemKind = chat.chat.itemKind;
1948
+ const postable = chat.postable.includes(run.id);
1949
+ const agent = chat.chat.agent?.displayName ?? chat.chat.agentKey;
1950
+ const changed = tools.some((s) => s.writes && (s.outcome === "done" || s.outcome === "unknown"));
1951
+ const itemChanged = async () => {
1952
+ await onChanged();
1953
+ if (itemKey && itemKind) state?.onItemChanged?.({ kind: itemKind, key: itemKey });
1954
+ };
1955
+ async function stop() {
1956
+ if (await action.run(() => request(`/runs/${run.id}/stop`, { method: "POST" }))) await onChanged();
1957
+ }
1958
+ async function post() {
1959
+ const next = await action.run(() => request(`/chats/${chat.chat.id}/runs/${run.id}/post`, { method: "POST" }));
1960
+ if (next) {
1961
+ onChat(next);
1962
+ notify7.success(t("chat.postedNote", { agent, key: itemKey ?? "" }));
1963
+ if (itemKey && itemKind) state?.onItemChanged?.({ kind: itemKind, key: itemKey });
1964
+ }
1965
+ }
1966
+ return /* @__PURE__ */ jsx14(Box3, { as: "li", "data-testid": "agent-chat-turn", children: /* @__PURE__ */ jsxs13(Stack13, { gap: "2.5", children: [
1967
+ run.prompt && /* @__PURE__ */ jsx14(Box3, { alignSelf: "flex-end", maxW: "85%", bg: "bg.muted", borderRadius: "l3", px: "3", py: "2", textStyle: "sm", whiteSpace: "pre-wrap", dir: "auto", "aria-label": t("chat.you"), children: run.prompt }),
1968
+ /* @__PURE__ */ jsxs13(Stack13, { gap: "1.5", children: [
1969
+ /* @__PURE__ */ jsxs13(HStack8, { gap: "2", wrap: "wrap", children: [
1970
+ /* @__PURE__ */ jsx14(Bot2, { size: 14, "aria-hidden": true }),
1971
+ /* @__PURE__ */ jsx14(Text13, { as: "span", textStyle: "sm", fontWeight: "medium", children: agent }),
1972
+ run.state !== "done" && /* @__PURE__ */ jsx14(StatusPill6, { tone: RUN_TONES[run.state] ?? "neutral", children: t(`runs.states.${run.state}`) }),
1973
+ run.outside && /* @__PURE__ */ jsx14(StatusPill6, { tone: "warning", children: t("runs.outside") }),
1974
+ run.wide && /* @__PURE__ */ jsx14(StatusPill6, { tone: "warning", children: t("runs.wide") }),
1975
+ /* @__PURE__ */ jsx14(Text13, { as: "span", textStyle: "caption", color: "fg.muted", children: fmt.dateTime(run.createdAt) }),
1976
+ going && /* @__PURE__ */ jsxs13(Button10, { size: "xs", variant: "ghost", onClick: () => void stop(), loading: action.busy, "data-testid": "agent-chat-stop", children: [
1977
+ /* @__PURE__ */ jsx14(Square2, {}),
1978
+ t("runs.stop")
1979
+ ] })
1980
+ ] }),
1981
+ going && !run.question && !writing && /* @__PURE__ */ jsx14(Text13, { textStyle: "caption", color: "fg.muted", "aria-live": "polite", children: run.state === "queued" ? t("chat.queued") : t("chat.working", { agent, count: tools.length }) }),
1982
+ going && writing && /* @__PURE__ */ jsx14(Box3, { "aria-busy": "true", children: /* @__PURE__ */ jsx14(AgentText, { source: writing, testId: "agent-chat-writing" }) }),
1983
+ run.question && /* @__PURE__ */ jsx14(AgentQuestionCard, { question: run.question, onAnswered: onChanged }),
1984
+ run.answer && /* @__PURE__ */ jsx14(AgentText, { source: run.answer, testId: "agent-chat-reply" }),
1985
+ !going && !run.answer && /* @__PURE__ */ jsx14(Text13, { textStyle: "caption", color: run.state === "failed" ? "fg.error" : "fg.muted", children: run.state === "stopped" ? t("chat.stopped") : run.state === "failed" ? t("chat.failed", { why: run.error ?? "" }) : t("chat.noReply") }),
1986
+ tools.length > 0 && /* @__PURE__ */ jsxs13(Box3, { children: [
1987
+ /* @__PURE__ */ jsxs13(Button10, { size: "xs", variant: "link", px: "0", onClick: () => setOpen(!open), "aria-expanded": open, children: [
1988
+ open ? /* @__PURE__ */ jsx14(ChevronDown2, {}) : /* @__PURE__ */ jsx14(DirectionalIcon2, { children: /* @__PURE__ */ jsx14(ChevronRight2, {}) }),
1989
+ t("runs.steps", { count: tools.length })
1990
+ ] }),
1991
+ open && /* @__PURE__ */ jsx14(Stack13, { gap: "0.5", mt: "1", as: "ol", listStyleType: "none", children: tools.map((s) => /* @__PURE__ */ jsxs13(Text13, { as: "li", textStyle: "caption", color: s.outcome === "failed" || s.outcome === "refused" ? "fg.error" : "fg.muted", children: [
1992
+ s.name,
1993
+ s.target ? ` \xB7 ${s.target}` : "",
1994
+ ": ",
1995
+ t(`runs.outcomes.${s.outcome}`)
1996
+ ] }, String(s.number))) })
1997
+ ] }),
1998
+ !going && (postable || run.postedAt || changed) && /* @__PURE__ */ jsxs13(HStack8, { gap: "1", wrap: "wrap", children: [
1999
+ postable && itemKey && /* @__PURE__ */ jsx14(Button10, { size: "xs", variant: "secondary", onClick: () => void post(), loading: action.busy, "data-testid": "agent-chat-post", children: t("chat.post", { key: itemKey }) }),
2000
+ run.postedAt && itemKey && /* @__PURE__ */ jsxs13(HStack8, { gap: "1", color: "fg.muted", textStyle: "caption", px: "1", children: [
2001
+ /* @__PURE__ */ jsx14(Check, { size: 12, "aria-hidden": true }),
2002
+ /* @__PURE__ */ jsx14(Text13, { as: "span", children: t("chat.posted", { key: itemKey }) })
2003
+ ] }),
2004
+ changed && /* @__PURE__ */ jsx14(HostSlot7, { name: "agent.run.actions", context: { run, onChanged: itemChanged } })
2005
+ ] })
2006
+ ] })
2007
+ ] }) });
2008
+ }
2009
+ function BackButton({ onBack }) {
2010
+ const t = useAgentTexts();
2011
+ return /* @__PURE__ */ jsx14(IconButton, { "aria-label": t("chat.back"), size: "sm", onClick: onBack, "data-testid": "agent-chat-back", children: /* @__PURE__ */ jsx14(DirectionalIcon2, { children: /* @__PURE__ */ jsx14(ArrowLeft, { size: 16 }) }) });
2012
+ }
2013
+ function Composer({ value, onChange, onSend, busy, disabled, label, hint, autoFocus }) {
2014
+ const t = useAgentTexts();
2015
+ function keyDown(e) {
2016
+ if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
2017
+ e.preventDefault();
2018
+ if (!disabled && !busy) onSend();
2019
+ }
2020
+ }
2021
+ return /* @__PURE__ */ jsxs13(Stack13, { gap: "1.5", w: "full", children: [
2022
+ /* @__PURE__ */ jsx14(
2023
+ Textarea2,
2024
+ {
2025
+ rows: 3,
2026
+ maxLength: 8e3,
2027
+ value,
2028
+ onChange: (e) => onChange(e.target.value),
2029
+ onKeyDown: keyDown,
2030
+ placeholder: label,
2031
+ "aria-label": label,
2032
+ dir: "auto",
2033
+ autoFocus,
2034
+ resize: "none",
2035
+ "data-testid": "agent-chat-composer"
2036
+ }
2037
+ ),
2038
+ /* @__PURE__ */ jsxs13(HStack8, { justify: "space-between", gap: "2", children: [
2039
+ /* @__PURE__ */ jsx14(Text13, { textStyle: "caption", color: "fg.muted", children: hint ?? t("chat.keys") }),
2040
+ /* @__PURE__ */ jsxs13(Button10, { size: "sm", variant: "primary", onClick: onSend, loading: busy, disabled: disabled || !value.trim(), "data-testid": "agent-chat-send", children: [
2041
+ /* @__PURE__ */ jsx14(DirectionalIcon2, { children: /* @__PURE__ */ jsx14(Send, {}) }),
2042
+ t("chat.send")
2043
+ ] })
2044
+ ] })
2045
+ ] });
2046
+ }
2047
+
2048
+ // src/areas/agent/AgentPickers.tsx
2049
+ import { Box as Box4, Input as Input4, Stack as Stack14, Text as Text14 } from "@chakra-ui/react";
2050
+ import { EmptyState as EmptyState2, Panel as Panel6, SelectField as SelectField6, StatusPill as StatusPill7, useApiQuery as useApiQuery10 } from "@abpjs/ui";
2051
+ import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
2052
+ function AgentSelect({ scope, value, onChange, disabled, anyLabel }) {
2053
+ const t = useAgentTexts();
2054
+ const nameOf = useNameOf();
2055
+ const agents = useApiQuery10("agent", `/scopes/${encodeURIComponent(scope)}/agents`);
2056
+ if (agents.error)
2057
+ return /* @__PURE__ */ jsx15(Input4, { size: "sm", dir: "ltr", disabled, defaultValue: value, placeholder: t("select.key"), onBlur: (e) => onChange(e.target.value.trim() || void 0) });
2058
+ const taken = (agents.data ?? []).filter((a) => a.own || a.roleKey).map((a) => a.agent);
2059
+ const options = taken.map((a) => {
2060
+ const name = nameOf(a.names, a.key);
2061
+ return { value: a.key, label: `${name === a.key ? a.key : `${name} (${a.key})`}${a.state === "paused" ? ` \xB7 ${t("select.paused")}` : ""}` };
2062
+ });
2063
+ if (value && !taken.some((a) => a.key === value)) options.push({ value, label: t("select.notHere", { key: value }) });
2064
+ return /* @__PURE__ */ jsxs14(Stack14, { gap: "1", children: [
2065
+ /* @__PURE__ */ jsx15(
2066
+ SelectField6,
2067
+ {
2068
+ size: "sm",
2069
+ disabled,
2070
+ loading: agents.loading && !agents.data,
2071
+ value,
2072
+ onChange: (e) => onChange(e.target.value || void 0),
2073
+ options: [{ value: "", label: anyLabel ?? t("select.choose") }, ...options],
2074
+ "data-testid": "agent-select"
2075
+ }
2076
+ ),
2077
+ agents.data && taken.length === 0 && /* @__PURE__ */ jsx15(Text14, { textStyle: "caption", color: "fg.muted", children: t("select.none") })
2078
+ ] });
2079
+ }
2080
+ function AgentBadge({ person, label }) {
2081
+ const t = useAgentTexts();
2082
+ if (person?.kind !== "agent") return null;
2083
+ return /* @__PURE__ */ jsx15(StatusPill7, { tone: "info", dot: false, "data-testid": "agent-badge", children: label ?? t("agentLabel") });
2084
+ }
2085
+ function AgentQuestionsPanel({ itemHref }) {
2086
+ const t = useAgentTexts();
2087
+ const questions = useApiQuery10("agent", "/questions");
2088
+ return /* @__PURE__ */ jsx15(ItemHrefProvider, { value: itemHref, children: /* @__PURE__ */ jsx15(Panel6, { title: t("mine.title"), description: t("mine.hint"), "data-testid": "agent-questions", children: questions.data?.length === 0 ? /* @__PURE__ */ jsx15(EmptyState2, { size: "sm", art: "agent", title: t("mine.none") }) : /* @__PURE__ */ jsx15(Stack14, { gap: "4", as: "ul", listStyleType: "none", children: (questions.data ?? []).map((q) => /* @__PURE__ */ jsx15(Box4, { as: "li", children: /* @__PURE__ */ jsxs14(Stack14, { gap: "1.5", children: [
2089
+ /* @__PURE__ */ jsxs14(Text14, { textStyle: "sm", fontWeight: "medium", children: [
2090
+ q.agent?.displayName ?? q.agentKey,
2091
+ q.itemKey && /* @__PURE__ */ jsxs14(Fragment3, { children: [
2092
+ " \xB7 ",
2093
+ /* @__PURE__ */ jsx15(ItemLink, { kind: q.itemKind, itemKey: q.itemKey })
2094
+ ] })
2095
+ ] }),
2096
+ /* @__PURE__ */ jsx15(AgentQuestionCard, { question: q, onAnswered: questions.reload })
2097
+ ] }) }, q.id)) }) }) });
2098
+ }
2099
+ export {
2100
+ AgentBadge,
2101
+ AgentChatButton,
2102
+ AgentChatPanel,
2103
+ AgentChatProvider,
2104
+ AgentEditor,
2105
+ AgentForm,
2106
+ AgentGraph,
2107
+ AgentLimitsPanel,
2108
+ AgentMemoriesPanel,
2109
+ AgentPause,
2110
+ AgentPermissionsPanel,
2111
+ AgentQuestionCard,
2112
+ AgentQuestionsPanel,
2113
+ AgentSelect,
2114
+ AgentState,
2115
+ AgentText,
2116
+ AgentToolsPanel,
2117
+ AgentsAdmin,
2118
+ AgentsAdminPage,
2119
+ AgentsTable,
2120
+ AskAgentButton,
2121
+ GOING,
2122
+ ItemAgentRuns,
2123
+ ItemHrefProvider,
2124
+ ItemLink,
2125
+ NamesField,
2126
+ RUN_TONES,
2127
+ ScopeAgentsScreen,
2128
+ ToolGroupsProvider,
2129
+ agentPages,
2130
+ filledIn,
2131
+ num,
2132
+ useAgentChat,
2133
+ useAgentTexts,
2134
+ useNameOf
2135
+ };
2136
+ //# sourceMappingURL=agent.js.map