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