@tetherto/mdk-ui-agent 0.0.0 → 0.12.1
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/LICENSE +202 -0
- package/README.md +310 -0
- package/dist/branding.d.ts +36 -0
- package/dist/branding.d.ts.map +1 -0
- package/dist/branding.js +37 -0
- package/dist/branding.js.map +1 -0
- package/dist/components/approval-card.d.ts +46 -0
- package/dist/components/approval-card.d.ts.map +1 -0
- package/dist/components/approval-card.js +84 -0
- package/dist/components/approval-card.js.map +1 -0
- package/dist/components/assistant-message.d.ts +25 -0
- package/dist/components/assistant-message.d.ts.map +1 -0
- package/dist/components/assistant-message.js +49 -0
- package/dist/components/assistant-message.js.map +1 -0
- package/dist/components/co-pilot-panel.d.ts +17 -0
- package/dist/components/co-pilot-panel.d.ts.map +1 -0
- package/dist/components/co-pilot-panel.js +33 -0
- package/dist/components/co-pilot-panel.js.map +1 -0
- package/dist/components/code-block.d.ts +17 -0
- package/dist/components/code-block.d.ts.map +1 -0
- package/dist/components/code-block.js +40 -0
- package/dist/components/code-block.js.map +1 -0
- package/dist/components/collapsible-answer.d.ts +26 -0
- package/dist/components/collapsible-answer.d.ts.map +1 -0
- package/dist/components/collapsible-answer.js +30 -0
- package/dist/components/collapsible-answer.js.map +1 -0
- package/dist/components/composer.d.ts +31 -0
- package/dist/components/composer.d.ts.map +1 -0
- package/dist/components/composer.js +82 -0
- package/dist/components/composer.js.map +1 -0
- package/dist/components/conversation-list.d.ts +21 -0
- package/dist/components/conversation-list.d.ts.map +1 -0
- package/dist/components/conversation-list.js +42 -0
- package/dist/components/conversation-list.js.map +1 -0
- package/dist/components/icons.d.ts +88 -0
- package/dist/components/icons.d.ts.map +1 -0
- package/dist/components/icons.js +112 -0
- package/dist/components/icons.js.map +1 -0
- package/dist/components/launcher-fab.d.ts +8 -0
- package/dist/components/launcher-fab.d.ts.map +1 -0
- package/dist/components/launcher-fab.js +6 -0
- package/dist/components/launcher-fab.js.map +1 -0
- package/dist/components/leaked-tool-call-notice.d.ts +18 -0
- package/dist/components/leaked-tool-call-notice.d.ts.map +1 -0
- package/dist/components/leaked-tool-call-notice.js +14 -0
- package/dist/components/leaked-tool-call-notice.js.map +1 -0
- package/dist/components/markdown-link.d.ts +17 -0
- package/dist/components/markdown-link.d.ts.map +1 -0
- package/dist/components/markdown-link.js +18 -0
- package/dist/components/markdown-link.js.map +1 -0
- package/dist/components/markdown-text.d.ts +26 -0
- package/dist/components/markdown-text.d.ts.map +1 -0
- package/dist/components/markdown-text.js +32 -0
- package/dist/components/markdown-text.js.map +1 -0
- package/dist/components/message-list.d.ts +24 -0
- package/dist/components/message-list.d.ts.map +1 -0
- package/dist/components/message-list.js +92 -0
- package/dist/components/message-list.js.map +1 -0
- package/dist/components/no-tools-note.d.ts +26 -0
- package/dist/components/no-tools-note.d.ts.map +1 -0
- package/dist/components/no-tools-note.js +27 -0
- package/dist/components/no-tools-note.js.map +1 -0
- package/dist/components/panel-header.d.ts +26 -0
- package/dist/components/panel-header.d.ts.map +1 -0
- package/dist/components/panel-header.js +13 -0
- package/dist/components/panel-header.js.map +1 -0
- package/dist/components/rehype-highlight-subset.d.ts +17 -0
- package/dist/components/rehype-highlight-subset.d.ts.map +1 -0
- package/dist/components/rehype-highlight-subset.js +77 -0
- package/dist/components/rehype-highlight-subset.js.map +1 -0
- package/dist/components/system-message.d.ts +15 -0
- package/dist/components/system-message.d.ts.map +1 -0
- package/dist/components/system-message.js +12 -0
- package/dist/components/system-message.js.map +1 -0
- package/dist/components/tool-chip.d.ts +19 -0
- package/dist/components/tool-chip.d.ts.map +1 -0
- package/dist/components/tool-chip.js +32 -0
- package/dist/components/tool-chip.js.map +1 -0
- package/dist/components/user-message.d.ts +9 -0
- package/dist/components/user-message.d.ts.map +1 -0
- package/dist/components/user-message.js +7 -0
- package/dist/components/user-message.js.map +1 -0
- package/dist/core/conversation-store.d.ts +107 -0
- package/dist/core/conversation-store.d.ts.map +1 -0
- package/dist/core/conversation-store.js +254 -0
- package/dist/core/conversation-store.js.map +1 -0
- package/dist/core/error-text.d.ts +19 -0
- package/dist/core/error-text.d.ts.map +1 -0
- package/dist/core/error-text.js +35 -0
- package/dist/core/error-text.js.map +1 -0
- package/dist/core/events.d.ts +98 -0
- package/dist/core/events.d.ts.map +1 -0
- package/dist/core/events.js +50 -0
- package/dist/core/events.js.map +1 -0
- package/dist/core/format.d.ts +23 -0
- package/dist/core/format.d.ts.map +1 -0
- package/dist/core/format.js +49 -0
- package/dist/core/format.js.map +1 -0
- package/dist/core/index.d.ts +27 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +20 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/markdown.d.ts +26 -0
- package/dist/core/markdown.d.ts.map +1 -0
- package/dist/core/markdown.js +49 -0
- package/dist/core/markdown.js.map +1 -0
- package/dist/core/prose.d.ts +27 -0
- package/dist/core/prose.d.ts.map +1 -0
- package/dist/core/prose.js +79 -0
- package/dist/core/prose.js.map +1 -0
- package/dist/core/small-talk.d.ts +15 -0
- package/dist/core/small-talk.d.ts.map +1 -0
- package/dist/core/small-talk.js +42 -0
- package/dist/core/small-talk.js.map +1 -0
- package/dist/core/sse.d.ts +108 -0
- package/dist/core/sse.d.ts.map +1 -0
- package/dist/core/sse.js +236 -0
- package/dist/core/sse.js.map +1 -0
- package/dist/core/tool-label.d.ts +16 -0
- package/dist/core/tool-label.d.ts.map +1 -0
- package/dist/core/tool-label.js +31 -0
- package/dist/core/tool-label.js.map +1 -0
- package/dist/core/transport.d.ts +71 -0
- package/dist/core/transport.d.ts.map +1 -0
- package/dist/core/transport.js +147 -0
- package/dist/core/transport.js.map +1 -0
- package/dist/core/turn.d.ts +87 -0
- package/dist/core/turn.d.ts.map +1 -0
- package/dist/core/turn.js +232 -0
- package/dist/core/turn.js.map +1 -0
- package/dist/core/uuid.d.ts +21 -0
- package/dist/core/uuid.d.ts.map +1 -0
- package/dist/core/uuid.js +54 -0
- package/dist/core/uuid.js.map +1 -0
- package/dist/entries/chat-page.d.ts +28 -0
- package/dist/entries/chat-page.d.ts.map +1 -0
- package/dist/entries/chat-page.js +25 -0
- package/dist/entries/chat-page.js.map +1 -0
- package/dist/entries/co-pilot.d.ts +41 -0
- package/dist/entries/co-pilot.d.ts.map +1 -0
- package/dist/entries/co-pilot.js +39 -0
- package/dist/entries/co-pilot.js.map +1 -0
- package/dist/entries/lazy-panel.d.ts +15 -0
- package/dist/entries/lazy-panel.d.ts.map +1 -0
- package/dist/entries/lazy-panel.js +19 -0
- package/dist/entries/lazy-panel.js.map +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-agent-chat.d.ts +46 -0
- package/dist/hooks/use-agent-chat.d.ts.map +1 -0
- package/dist/hooks/use-agent-chat.js +288 -0
- package/dist/hooks/use-agent-chat.js.map +1 -0
- package/dist/hooks/use-agent-config.d.ts +29 -0
- package/dist/hooks/use-agent-config.d.ts.map +1 -0
- package/dist/hooks/use-agent-config.js +45 -0
- package/dist/hooks/use-agent-config.js.map +1 -0
- package/dist/hooks/use-conversations.d.ts +19 -0
- package/dist/hooks/use-conversations.d.ts.map +1 -0
- package/dist/hooks/use-conversations.js +19 -0
- package/dist/hooks/use-conversations.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +105 -1
- package/src/branding.ts +40 -0
- package/src/components/approval-card.tsx +141 -0
- package/src/components/assistant-message.tsx +140 -0
- package/src/components/co-pilot-panel.tsx +109 -0
- package/src/components/code-block.tsx +63 -0
- package/src/components/collapsible-answer.tsx +55 -0
- package/src/components/composer.tsx +147 -0
- package/src/components/conversation-list.tsx +141 -0
- package/src/components/icons.tsx +189 -0
- package/src/components/launcher-fab.tsx +16 -0
- package/src/components/leaked-tool-call-notice.tsx +29 -0
- package/src/components/markdown-link.tsx +30 -0
- package/src/components/markdown-text.tsx +58 -0
- package/src/components/message-list.tsx +164 -0
- package/src/components/no-tools-note.tsx +33 -0
- package/src/components/panel-header.tsx +86 -0
- package/src/components/rehype-highlight-subset.ts +84 -0
- package/src/components/system-message.tsx +19 -0
- package/src/components/tool-chip.tsx +58 -0
- package/src/components/user-message.tsx +18 -0
- package/src/core/conversation-store.ts +342 -0
- package/src/core/error-text.ts +36 -0
- package/src/core/events.ts +127 -0
- package/src/core/format.ts +59 -0
- package/src/core/index.ts +115 -0
- package/src/core/markdown.ts +52 -0
- package/src/core/prose.ts +78 -0
- package/src/core/small-talk.ts +45 -0
- package/src/core/sse.ts +269 -0
- package/src/core/tool-label.ts +33 -0
- package/src/core/transport.ts +208 -0
- package/src/core/turn.ts +299 -0
- package/src/core/uuid.ts +59 -0
- package/src/entries/chat-page.tsx +56 -0
- package/src/entries/co-pilot.tsx +84 -0
- package/src/entries/lazy-panel.tsx +19 -0
- package/src/hooks/index.ts +8 -0
- package/src/hooks/use-agent-chat.ts +387 -0
- package/src/hooks/use-agent-config.ts +70 -0
- package/src/hooks/use-conversations.ts +39 -0
- package/src/index.ts +30 -0
- package/src/styles/_approval.scss +68 -0
- package/src/styles/_composer.scss +45 -0
- package/src/styles/_conversations.scss +160 -0
- package/src/styles/_messages.scss +444 -0
- package/src/styles/_mixins.scss +27 -0
- package/src/styles/_panel.scss +147 -0
- package/src/styles/_tokens.scss +30 -0
- package/src/styles.scss +16 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Tether
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# @tetherto/mdk-ui-agent
|
|
2
|
+
|
|
3
|
+
The operator agent chat, as a drop-in for any MDK UI shell. Talks to the agent
|
|
4
|
+
app ([`@tetherto/mdk-app-agent`](../../../backend/apps/agent/README.md)) through the Gateway over SSE and renders its six-event
|
|
5
|
+
contract as a conversation.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
// App.tsx — mounted once, at the app root
|
|
11
|
+
import { CoPilot } from '@tetherto/mdk-ui-agent'
|
|
12
|
+
|
|
13
|
+
<CoPilot />
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
// main.tsx — alongside the devkit stylesheets
|
|
18
|
+
import '@tetherto/mdk-ui-agent/styles.css'
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
That is the whole integration. The shell template ships with both lines already
|
|
22
|
+
in place; delete them to remove it.
|
|
23
|
+
|
|
24
|
+
The backend half is a stack concern: add [`@tetherto/mdk-app-agent`](../../../backend/apps/agent/README.md) to your
|
|
25
|
+
`mdk.yaml` under `spec.apps` with `mount: /`, and point it at an MCP server for the fleet tools:
|
|
26
|
+
|
|
27
|
+
```yaml
|
|
28
|
+
spec:
|
|
29
|
+
apps:
|
|
30
|
+
- name: agent
|
|
31
|
+
package: "@tetherto/mdk-app-agent"
|
|
32
|
+
mount: /
|
|
33
|
+
config:
|
|
34
|
+
agent: { provider: { kind: qvac, model: qwen3-4b, baseURL: http://127.0.0.1:11500/v1 }, mcp: { url: http://127.0.0.1:3101/mcp } }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> [!IMPORTANT]
|
|
38
|
+
> The panel calls `/agent/sessions…` at the Gateway root. The Gateway serves an app under `/apps/<name>` unless its entry sets
|
|
39
|
+
> `mount`, so without `mount: /` every call answers `404`. `mdk onboard` writes `mount: /` for this app.
|
|
40
|
+
|
|
41
|
+
Without the app the panel opens and reports that the agent is not configured. See
|
|
42
|
+
[Running it all locally](#running-it-all-locally) for the whole chain from an
|
|
43
|
+
empty machine.
|
|
44
|
+
|
|
45
|
+
### Dev server
|
|
46
|
+
|
|
47
|
+
The Gateway sends no CORS headers, and its stream route hijacks the reply so a
|
|
48
|
+
CORS hook could not decorate it even if one existed. Proxy `/agent` to the
|
|
49
|
+
Gateway, next to `/auth` and `/api`:
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
server: { proxy: { '/agent': gatewayUrl } }
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
In production, serve the built UI from the Gateway's `staticRootPath` so the
|
|
56
|
+
calls stay same-origin.
|
|
57
|
+
|
|
58
|
+
## Surface
|
|
59
|
+
|
|
60
|
+
| Export | What it is |
|
|
61
|
+
| ------------------ | -------------------------------------------------------------------------------------------------------- |
|
|
62
|
+
| `<CoPilot />` | The docked overlay: a launcher in the corner that opens a 420×640 panel. Mount once at the app root. |
|
|
63
|
+
| `<ChatUIEntry />` | The same conversation as a full-height page. Default export too, so it drops into a lazy route registry. |
|
|
64
|
+
| `useAgentChat()` | The one stateful hook — session, live turn, persistence. Everything below it is presentational. |
|
|
65
|
+
| `useConversations()` | Binds the conversation store to React. |
|
|
66
|
+
| [`@tetherto/mdk-ui-agent/core`](./src/core/index.ts) | The headless half: contract types, SSE reader, transport, turn reducer, conversation store. No React — also reachable from the root package, since `.` re-exports everything here; the subpath just lets a consumer skip the components. |
|
|
67
|
+
| [`@tetherto/mdk-ui-agent/panel`](./src/components/co-pilot-panel.tsx) | `CoPilotPanel`, for building your own launcher around the panel body. |
|
|
68
|
+
|
|
69
|
+
All props are optional. Inside an `MdkProvider` the base URL and bearer token
|
|
70
|
+
come from the provider's auth seam; outside one it falls back to relative URLs
|
|
71
|
+
and no token — which is what a Gateway running without an identity layer serves
|
|
72
|
+
anyway.
|
|
73
|
+
|
|
74
|
+
Useful props: `title`, `status` (the line under the title), `toolLabels`,
|
|
75
|
+
`placeholder`, `defaultOpen`, `position`, `idleTimeoutMs` /
|
|
76
|
+
`approvalIdleTimeoutMs` / `firstEventIdleTimeoutMs`, which override the idle windows
|
|
77
|
+
*Sockets that go quiet* describes.
|
|
78
|
+
|
|
79
|
+
History is per browser, in `localStorage` — the Gateway keeps no transcripts. Two
|
|
80
|
+
tabs on the same app share that key, and each merges the other's writes rather
|
|
81
|
+
than overwriting them, since a lost transcript exists nowhere else.
|
|
82
|
+
|
|
83
|
+
### Tool labels
|
|
84
|
+
|
|
85
|
+
Tools come from whichever MCP server the agent is pointed at, so no tool name is
|
|
86
|
+
hardcoded. Pass labels for the ones you know; anything else is humanized from its
|
|
87
|
+
identifier (`summarize_site` → `Summarize site`).
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
<CoPilot toolLabels={{ summarize_site: 'Site status', act_device: 'Send command' }} />
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## What it handles for you
|
|
94
|
+
|
|
95
|
+
The agent contract has sharp edges that are easy to miss when writing a client
|
|
96
|
+
against it. These are handled here, and each is pinned by a test:
|
|
97
|
+
|
|
98
|
+
- **One turn at a time.** A second message while a turn streams is a
|
|
99
|
+
`409 ERR_AGENT_TURN_ACTIVE`, and a turn *paused on an approval* still holds the
|
|
100
|
+
session busy. The composer stays disabled through both.
|
|
101
|
+
- **Approvals expire.** An approval nobody answers is auto-rejected server-side
|
|
102
|
+
after `agent.approvalTimeoutMs` and the stream resumes on its own. The card
|
|
103
|
+
disappears when the turn moves on, not only when the operator clicks.
|
|
104
|
+
- **Truncated streams.** The stream route hijacks the reply, so a failure after
|
|
105
|
+
the headers are sent just closes the socket — no `error` frame, no `done`. An
|
|
106
|
+
EOF with no terminal event is rendered as a failure rather than a turn that
|
|
107
|
+
never ends.
|
|
108
|
+
- **Sockets that go quiet.** The Gateway sends no heartbeats, so a wedged agent or
|
|
109
|
+
a half-closed proxy looks exactly like a turn still thinking, and the panel
|
|
110
|
+
would stay busy until a reload. Silence past `STREAM_IDLE_TIMEOUT_MS` (30s) ends
|
|
111
|
+
the turn. How much silence is normal is not constant across a turn, so that
|
|
112
|
+
deadline applies *between* events only, and two phases get their own:
|
|
113
|
+
`APPROVAL_IDLE_TIMEOUT_MS` (5min) while an approval is outstanding, where
|
|
114
|
+
waiting on a human is the expected state, and `FIRST_EVENT_IDLE_TIMEOUT_MS`
|
|
115
|
+
(120s) before the first event, where the model is still routing and has emitted
|
|
116
|
+
nothing yet — a local thinking model measured 61s to its first event, so the
|
|
117
|
+
between-events limit would have abandoned a healthy turn. 120s is the
|
|
118
|
+
producer's own per-model-call budget, so the server always gives up first and
|
|
119
|
+
says why. Override all three per host with `idleTimeoutMs` /
|
|
120
|
+
`approvalIdleTimeoutMs` / `firstEventIdleTimeoutMs`.
|
|
121
|
+
- **Stop.** A turn going visibly wrong is interrupted from the composer, and what
|
|
122
|
+
streamed is kept — marked as stopped early, so half an answer never reads back
|
|
123
|
+
as the whole one. A failed turn offers a retry rather than asking for the
|
|
124
|
+
question again.
|
|
125
|
+
- **Unanswered tool calls.** A call the turn ended before hearing back from settles
|
|
126
|
+
as `interrupted`: the outcome is unknown, which is neither the tick nor the
|
|
127
|
+
error state, and a step left `running` would persist as a spinner that never
|
|
128
|
+
resolves.
|
|
129
|
+
- **Two error body shapes.** The streaming route answers `{ statusCode, message }`
|
|
130
|
+
with no `error` key, unlike every other route.
|
|
131
|
+
- **Stale sessions.** Sessions live in the Gateway's memory per process. A stored
|
|
132
|
+
id 404s after a restart; the transcript still reads back and the next message
|
|
133
|
+
mints a fresh session — and says so in the transcript, because the conversation
|
|
134
|
+
that came before it is context the agent no longer has.
|
|
135
|
+
- **Leaked tool calls.** The agent's tool loop is prompt-based and classifies a
|
|
136
|
+
reply as a tool call from its first character being `{`. A model that fences its
|
|
137
|
+
JSON gets classified as prose, and the raw call reaches the operator as the
|
|
138
|
+
answer. That is detected and labelled instead of dumped.
|
|
139
|
+
|
|
140
|
+
## Errors
|
|
141
|
+
|
|
142
|
+
Five codes come from the Gateway route; three are synthesized locally by [`@tetherto/mdk-ui-agent/core`](./src/core/index.ts) when the
|
|
143
|
+
transport itself misbehaves.
|
|
144
|
+
|
|
145
|
+
| Code | Fires when | Fix |
|
|
146
|
+
| ----------------------------- | ------------------------------------ | --------------------------------- |
|
|
147
|
+
| `ERR_AGENT_UNAVAILABLE` | `config.agent` is missing entirely, or the agent failed to construct (`503`) | An operator-facing failure — the Gateway wasn't configured or the agent couldn't start; check the app's own config |
|
|
148
|
+
| `ERR_AGENT_SESSION_NOT_FOUND` | The session id doesn't exist — commonly because the Gateway restarted and its in-memory sessions were lost (`404`) | Start a new session; the transcript still reads back locally |
|
|
149
|
+
| `ERR_AGENT_TURN_ACTIVE` | A message or delete is sent to a session while its previous turn is still streaming or paused on an approval (`409`) | Wait for the current turn to finish, or decide its pending approval |
|
|
150
|
+
| `ERR_AGENT_APPROVAL_NOT_FOUND` | An approval decision is sent for an id that doesn't exist for that session — already decided, or never existed (`404`) | Confirm the approval card is still the current one; a stale one is a decision arriving after the turn already moved on |
|
|
151
|
+
| `ERR_AGENT_MESSAGE_TEXT_REQUIRED` | The message `text` sent to the Gateway is missing, not a string, or empty after trimming (`400`) | Don't send an empty message |
|
|
152
|
+
| `ERR_AGENT_STREAM_IDLE` | No event arrived within the idle window for the current phase (`STREAM_IDLE_TIMEOUT_MS` mid-turn, `FIRST_EVENT_IDLE_TIMEOUT_MS` before the first event, `APPROVAL_IDLE_TIMEOUT_MS` while an approval is outstanding) | Usually a wedged agent or a half-closed proxy; retry the turn |
|
|
153
|
+
| `ERR_AGENT_STREAM_TRUNCATED` | The stream ended with no terminal event and no idle timeout fired — the socket closed on its own (a failure after the SSE headers were already sent, which arrives with no `error` frame and no `done`) | Retry the turn; what already streamed is kept |
|
|
154
|
+
| `ERR_AGENT_STREAM_EMPTY` | The Gateway answered the message request without a readable stream body at all | An environment gap (a `fetch` polyfill without streaming body support) rather than an agent failure; check the runtime |
|
|
155
|
+
|
|
156
|
+
## Rendering
|
|
157
|
+
|
|
158
|
+
Answers render as GitHub-flavoured Markdown once the turn finishes, and as plain
|
|
159
|
+
text while it streams — a half-written fence breaks the parser and re-parsing on
|
|
160
|
+
every token is wasted work. Raw HTML is deliberately not enabled, so untrusted
|
|
161
|
+
model output cannot inject markup. Do not add `rehype-raw`.
|
|
162
|
+
|
|
163
|
+
Everything `remark-gfm` can emit is styled — headings, quotes, rules, images,
|
|
164
|
+
task lists, footnotes — because nothing constrains what the model answers with. A
|
|
165
|
+
link out of the document opens in a new tab rather than navigating the host app
|
|
166
|
+
away mid-conversation; an in-document fragment link (a footnote) stays in the
|
|
167
|
+
panel. An answer wrapped entirely in a ```markdown fence, a common model quirk, is
|
|
168
|
+
unwrapped rather than rendered as one code block. An answer long enough to bury
|
|
169
|
+
the transcript collapses behind a toggle once the turn settles.
|
|
170
|
+
|
|
171
|
+
Fenced code is highlighted for `json`, `bash` and `yaml`, coloured from the same
|
|
172
|
+
`--mdk-agent-*` tokens as the rest of the panel rather than from a highlight.js
|
|
173
|
+
theme. The grammar set is deliberately small: `rehype-highlight` would pull in
|
|
174
|
+
lowlight's 37-grammar `common` set, which measured 179 kB raw / 55 kB gzip against
|
|
175
|
+
the generated shell. Blocks carry a copy button where the Clipboard API is
|
|
176
|
+
available — it needs a secure context, and a Gateway on a site LAN is served over
|
|
177
|
+
plain http.
|
|
178
|
+
|
|
179
|
+
The panel is code-split behind the launcher, so a collapsed co-pilot costs the
|
|
180
|
+
host about 13 kB raw / 4.5 kB gzip; the transcript and its renderer arrive on
|
|
181
|
+
open. Nothing may import [`components/co-pilot-panel`](./src/components/co-pilot-panel.tsx)
|
|
182
|
+
statically from the root barrel — one static edge collapses the split for every consumer.
|
|
183
|
+
|
|
184
|
+
## Naming
|
|
185
|
+
|
|
186
|
+
`Co-pilot` is a placeholder pending a naming decision. Every user-visible string
|
|
187
|
+
derives from `AGENT_NAME` in [`src/branding.ts`](./src/branding.ts), so the rename is a one-line
|
|
188
|
+
change there; [`src/branding.test.ts`](./src/branding.test.ts) fails if a component hardcodes it.
|
|
189
|
+
The CSS prefix (`mdk-agent-*`) and the storage key deliberately do not carry the name, so
|
|
190
|
+
renaming breaks neither consumers' style overrides nor their stored history.
|
|
191
|
+
|
|
192
|
+
Per deployment, pass `title` instead of editing the constant.
|
|
193
|
+
|
|
194
|
+
## Styling
|
|
195
|
+
|
|
196
|
+
SCSS compiled into `@layer mdk`, BEM `mdk-agent-*` classes over `--mdk-color-*`
|
|
197
|
+
tokens. Every value indirects through a `--mdk-agent-*` variable, so the panel can
|
|
198
|
+
be rethemed without forking the stylesheet:
|
|
199
|
+
|
|
200
|
+
```css
|
|
201
|
+
:root { --mdk-agent-accent: #22afff; --mdk-agent-panel-width: 480px; }
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Components do not import their own `.scss` — every partial is reached from
|
|
205
|
+
[`src/styles.scss`](./src/styles.scss), and `npm run check:styles` fails the build if one is not.
|
|
206
|
+
|
|
207
|
+
## Demo
|
|
208
|
+
|
|
209
|
+
[`ui/apps/catalog`](../../apps/catalog/README.md) → **Guides → Agent Co-pilot** drives all five states against a
|
|
210
|
+
stand-in gateway, so it runs with no backend.
|
|
211
|
+
|
|
212
|
+
## Running it all locally
|
|
213
|
+
|
|
214
|
+
Four processes, in order. See the [operator agent guides](../../../docs/guides/agent/index.md) for the topology diagram and
|
|
215
|
+
why order matters here: the agent connects to MCP once, when a session is created, so a panel opened before the tool
|
|
216
|
+
server is up gets a session with no tools and answers from the model alone, with no error to tell you.
|
|
217
|
+
|
|
218
|
+
### 1. A model
|
|
219
|
+
|
|
220
|
+
Anything that speaks the OpenAI `/v1/chat/completions` API. QVAC is the
|
|
221
|
+
supported path — see
|
|
222
|
+
[serving the model](../../../docs/guides/agent/run-standalone.md#serve-the-model-with-qvac).
|
|
223
|
+
Any other local server works too: the provider is pointed at a URL, not at a
|
|
224
|
+
vendor.
|
|
225
|
+
|
|
226
|
+
A 4B is the floor. The tool loop asks the model for JSON on demand, and below
|
|
227
|
+
that size it does not reliably produce it.
|
|
228
|
+
|
|
229
|
+
### 2. The fleet and its tools
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
cd examples/mvp-site
|
|
233
|
+
npm run setup # first time — NOT npm install
|
|
234
|
+
npm run setup:config # first time — writes config/devices.json and config/site.deploy.json
|
|
235
|
+
npm start # kernel + workers + its own gateway :3000 + MCP tools on :3101, under PM2
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
`npm install` alone leaves it unbootable. The repo is a root npm workspace, but
|
|
239
|
+
`setup` also builds the UI toolkit ([`ui/`](../../README.md)) and installs [`examples/mvp-site/ui`](../../../examples/mvp-site/ui/package.json)
|
|
240
|
+
— a plain root `npm install` does not do either of those; `setup` does all of
|
|
241
|
+
that and takes a while.
|
|
242
|
+
|
|
243
|
+
This is the same MCP server the agent CLI uses, exposing `summarize_site`,
|
|
244
|
+
`count_devices`, `list_devices`, `get_device`, `rank_devices` and `act_device`.
|
|
245
|
+
|
|
246
|
+
**Its gateway is not the agent gateway.** `mvp-site` serves a UI of its own on
|
|
247
|
+
`:3000` and carries no agent app; step 3 is a separate stack that reaches
|
|
248
|
+
across to the tool server on `:3101`. Nothing in the repo boots both halves
|
|
249
|
+
together yet.
|
|
250
|
+
|
|
251
|
+
### 3. A gateway carrying the agent app
|
|
252
|
+
|
|
253
|
+
Mount [`@tetherto/mdk-app-agent`](../../../backend/apps/agent/README.md) at `/` behind its own Gateway, against the local model
|
|
254
|
+
and MCP server this walkthrough already served. [Mounting the app](../../../docs/guides/agent/gateway-deployment.md#mount-the-app)
|
|
255
|
+
shows the complete `mdk.yaml` and `mdk run`.
|
|
256
|
+
|
|
257
|
+
### 4. The UI
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
cd <your-app> # or examples/mdk-ui-shell-template
|
|
261
|
+
npm install # first time only; this project isn't a root workspace member
|
|
262
|
+
VITE_GATEWAY_URL=http://127.0.0.1:3847 VITE_AUTH_BYPASS=true npm run dev
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The `npm install` above only needs to cover this project's own dependencies. The `ui/` toolkit it imports via `file:` links
|
|
266
|
+
(`react-devkit`, `ui-foundation`, `react-adapter`, this package) is already built by step 2's `npm run setup`, which chains
|
|
267
|
+
`npm --prefix ../.. run build:ui` — no separate build step here.
|
|
268
|
+
|
|
269
|
+
`<your-app>` can be [`examples/mdk-ui-shell-template`](../../../examples/mdk-ui-shell-template/README.md). Open `:3030` and the launcher is in the corner. `VITE_GATEWAY_URL` feeds the
|
|
270
|
+
`/agent` proxy from [Dev server](#dev-server); leave `VITE_MDK_API_URL` empty so
|
|
271
|
+
calls stay relative and go through it. `VITE_AUTH_BYPASS=true` skips the shell template's `/signin` gate, landing straight on
|
|
272
|
+
the dashboard with a stub session, since this walkthrough has no OAuth backend to sign in against.
|
|
273
|
+
|
|
274
|
+
### Checking it
|
|
275
|
+
|
|
276
|
+
```text
|
|
277
|
+
hey → a greeting, and no tool chip
|
|
278
|
+
list the devices → a chip, then the devices, one per line
|
|
279
|
+
reboot <device-id> → an approval card; nothing runs until you accept
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
A tool chip on the fleet questions is the thing to look for. If they answer
|
|
283
|
+
without one, MCP was not up when the session was created — reload the page to
|
|
284
|
+
mint a new one.
|
|
285
|
+
|
|
286
|
+
Against `mvp-site` with the example `config/devices.json`, the fleet is 8 miners (5 Whatsminer, 3 Antminer), plus a
|
|
287
|
+
powermeter and a pool, so "how many miners are there?" answers 8.
|
|
288
|
+
|
|
289
|
+
Without the UI:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
SESSION=$(curl -sX POST localhost:3847/agent/sessions -H 'content-type: application/json' -d '{}' | jq -r .sessionId)
|
|
293
|
+
curl -N -X POST localhost:3847/agent/sessions/$SESSION/messages \
|
|
294
|
+
-H 'content-type: application/json' -d '{"text":"how many miners are there?"}'
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
### Rough edges worth knowing
|
|
298
|
+
|
|
299
|
+
- **Sessions live in the gateway process.** Restart it and every stored session
|
|
300
|
+
404s; the panel notices and mints a fresh one on the next message, so the
|
|
301
|
+
transcript on screen outlives the conversation the model remembers.
|
|
302
|
+
- **One turn at a time.** A second message while one streams is a `409`, and a
|
|
303
|
+
paused approval still counts as busy — which is why the composer stays
|
|
304
|
+
disabled while a card is up.
|
|
305
|
+
- **Writes need approval**, and an unanswered card auto-rejects after
|
|
306
|
+
`approvalTimeoutMs` (120s by default). The stream then resumes on its own.
|
|
307
|
+
- **No CORS, ever.** The stream route hijacks the reply, so the dev proxy in
|
|
308
|
+
step 4 is not optional if the UI is on another port.
|
|
309
|
+
|
|
310
|
+
Walked end to end on 2026-08-14; the four steps above are what it took.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The product name, in one place.
|
|
3
|
+
*
|
|
4
|
+
* "Co-pilot" is a placeholder — it collides with GitHub Copilot and the final
|
|
5
|
+
* name has not been decided. Every user-visible string in the package derives
|
|
6
|
+
* from `AGENT_NAME` below, so renaming it is a one-line change here.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately kept out of the identifiers: the package is `@tetherto/mdk-ui-agent`,
|
|
9
|
+
* the CSS classes are `mdk-agent-*`, and the storage key is `mdk-ui-agent:*`.
|
|
10
|
+
* None of those need to move when the name does. The exported component names
|
|
11
|
+
* (`CoPilot`, `CoPilotProps`, …) are the only remaining mention, and they are a
|
|
12
|
+
* mechanical rename plus a deprecated alias whenever the decision lands.
|
|
13
|
+
*
|
|
14
|
+
* Hosts that want a different name per deployment do not need to fork this:
|
|
15
|
+
* pass `title` to `CoPilot` / `ChatUIEntry`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const AGENT_NAME = "Co-pilot";
|
|
18
|
+
/** How the operator's own turns are labelled. */
|
|
19
|
+
export declare const OPERATOR_NAME = "Operator";
|
|
20
|
+
/**
|
|
21
|
+
* Accessible names and headings, derived so they stay consistent with
|
|
22
|
+
* {@link AGENT_NAME}.
|
|
23
|
+
*/
|
|
24
|
+
export declare const AGENT_LABELS: {
|
|
25
|
+
readonly name: "Co-pilot";
|
|
26
|
+
readonly operator: "Operator";
|
|
27
|
+
readonly open: `Open ${string}`;
|
|
28
|
+
readonly close: `Close ${string}`;
|
|
29
|
+
readonly composer: `Message the ${string}`;
|
|
30
|
+
readonly conversations: 'Conversations';
|
|
31
|
+
readonly newConversation: 'New conversation';
|
|
32
|
+
readonly backToConversation: 'Back to conversation';
|
|
33
|
+
readonly approvalRequired: 'Approval required';
|
|
34
|
+
readonly placeholder: 'Ask about your fleet...';
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=branding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../src/branding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,UAAU,aAAa,CAAA;AAEpC,iDAAiD;AACjD,eAAO,MAAM,aAAa,aAAa,CAAA;AAIvC;;;GAGG;AACH,eAAO,MAAM,YAAY;aACvB,IAAI;aACJ,QAAQ;aACR,IAAI;aACJ,KAAK;aACL,QAAQ;aACR,aAAa,EAAE,eAAe;aAC9B,eAAe,EAAE,kBAAkB;aACnC,kBAAkB,EAAE,sBAAsB;aAC1C,gBAAgB,EAAE,mBAAmB;aACrC,WAAW,EAAE,yBAAyB;CAC9B,CAAA"}
|
package/dist/branding.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The product name, in one place.
|
|
3
|
+
*
|
|
4
|
+
* "Co-pilot" is a placeholder — it collides with GitHub Copilot and the final
|
|
5
|
+
* name has not been decided. Every user-visible string in the package derives
|
|
6
|
+
* from `AGENT_NAME` below, so renaming it is a one-line change here.
|
|
7
|
+
*
|
|
8
|
+
* Deliberately kept out of the identifiers: the package is `@tetherto/mdk-ui-agent`,
|
|
9
|
+
* the CSS classes are `mdk-agent-*`, and the storage key is `mdk-ui-agent:*`.
|
|
10
|
+
* None of those need to move when the name does. The exported component names
|
|
11
|
+
* (`CoPilot`, `CoPilotProps`, …) are the only remaining mention, and they are a
|
|
12
|
+
* mechanical rename plus a deprecated alias whenever the decision lands.
|
|
13
|
+
*
|
|
14
|
+
* Hosts that want a different name per deployment do not need to fork this:
|
|
15
|
+
* pass `title` to `CoPilot` / `ChatUIEntry`.
|
|
16
|
+
*/
|
|
17
|
+
export const AGENT_NAME = 'Co-pilot';
|
|
18
|
+
/** How the operator's own turns are labelled. */
|
|
19
|
+
export const OPERATOR_NAME = 'Operator';
|
|
20
|
+
const lower = AGENT_NAME.toLowerCase();
|
|
21
|
+
/**
|
|
22
|
+
* Accessible names and headings, derived so they stay consistent with
|
|
23
|
+
* {@link AGENT_NAME}.
|
|
24
|
+
*/
|
|
25
|
+
export const AGENT_LABELS = {
|
|
26
|
+
name: AGENT_NAME,
|
|
27
|
+
operator: OPERATOR_NAME,
|
|
28
|
+
open: `Open ${lower}`,
|
|
29
|
+
close: `Close ${lower}`,
|
|
30
|
+
composer: `Message the ${lower}`,
|
|
31
|
+
conversations: 'Conversations',
|
|
32
|
+
newConversation: 'New conversation',
|
|
33
|
+
backToConversation: 'Back to conversation',
|
|
34
|
+
approvalRequired: 'Approval required',
|
|
35
|
+
placeholder: 'Ask about your fleet...',
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=branding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branding.js","sourceRoot":"","sources":["../src/branding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAAA;AAEpC,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAA;AAEvC,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,EAAE,CAAA;AAEtC;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,UAAU;IAChB,QAAQ,EAAE,aAAa;IACvB,IAAI,EAAE,QAAQ,KAAK,EAAE;IACrB,KAAK,EAAE,SAAS,KAAK,EAAE;IACvB,QAAQ,EAAE,eAAe,KAAK,EAAE;IAChC,aAAa,EAAE,eAAe;IAC9B,eAAe,EAAE,kBAAkB;IACnC,kBAAkB,EAAE,sBAAsB;IAC1C,gBAAgB,EAAE,mBAAmB;IACrC,WAAW,EAAE,yBAAyB;CAC9B,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { JSX } from 'react';
|
|
2
|
+
import type { ToolLabels } from '../core/tool-label';
|
|
3
|
+
import type { PendingApproval } from '../core/turn';
|
|
4
|
+
export type ApprovalRow = {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Flattens the tool args into the Action / Device / Command rows the design
|
|
10
|
+
* shows.
|
|
11
|
+
*
|
|
12
|
+
* Tools are supplied by whichever MCP server the operator points the agent at,
|
|
13
|
+
* so no argument name is guaranteed. The target is looked up across the names
|
|
14
|
+
* the reference tools use and everything else is listed as-is, which degrades to
|
|
15
|
+
* a plain key/value dump for an unknown tool rather than to nothing.
|
|
16
|
+
*/
|
|
17
|
+
export declare function describeApproval(approval: PendingApproval, labels?: ToolLabels): ApprovalRow[];
|
|
18
|
+
/**
|
|
19
|
+
* The one-line "here is what you are about to allow", shown above the card.
|
|
20
|
+
*
|
|
21
|
+
* Synthesized rather than streamed: `pending_approval` arrives between a
|
|
22
|
+
* `tool_call` and its `tool_result`, and the model does not emit a single token
|
|
23
|
+
* until after the tool returns — so at the moment the operator is asked to
|
|
24
|
+
* decide, the agent has said nothing at all. The design shows a sentence there,
|
|
25
|
+
* and it has to be built from the call itself.
|
|
26
|
+
*/
|
|
27
|
+
export declare function describeApprovalIntent(approval: PendingApproval, labels?: ToolLabels): string;
|
|
28
|
+
export type ApprovalCardProps = {
|
|
29
|
+
approval: PendingApproval;
|
|
30
|
+
toolLabels?: ToolLabels;
|
|
31
|
+
/** A decision has been sent; the stream has not resumed yet. */
|
|
32
|
+
pending?: boolean;
|
|
33
|
+
onDecide: (approved: boolean) => void;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* The inline approval prompt. The stream is paused behind this.
|
|
37
|
+
*
|
|
38
|
+
* Rendered in the transcript rather than as a blocking modal, because it is not
|
|
39
|
+
* always the operator who resolves it: an approval left unanswered for
|
|
40
|
+
* `agent.approvalTimeoutMs` is auto-rejected server-side and the stream resumes
|
|
41
|
+
* on its own. The card must be able to disappear because the turn moved on — a
|
|
42
|
+
* modal that only closes on click would strand the operator on a dead prompt.
|
|
43
|
+
* Unmounting is driven by the reducer clearing `pendingApproval`.
|
|
44
|
+
*/
|
|
45
|
+
export declare const ApprovalCard: ({ approval, toolLabels, pending, onDecide, }: ApprovalCardProps) => JSX.Element;
|
|
46
|
+
//# sourceMappingURL=approval-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-card.d.ts","sourceRoot":"","sources":["../../src/components/approval-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AA+BnD,MAAM,MAAM,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,WAAW,EAAE,CAY9F;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM,CAQ7F;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,eAAe,CAAA;IACzB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,gEAAgE;IAChE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;CACtC,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,iDAKtB,iBAAiB,KAAG,GAAG,CAAC,OAqC1B,CAAA"}
|