@stigmer/react-ui 0.0.34
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 +190 -0
- package/README.md +70 -0
- package/execution/components/ApprovalControls.d.ts +10 -0
- package/execution/components/ApprovalControls.d.ts.map +1 -0
- package/execution/components/ApprovalControls.js +19 -0
- package/execution/components/ApprovalControls.js.map +1 -0
- package/execution/components/ExecutionStatus.d.ts +8 -0
- package/execution/components/ExecutionStatus.d.ts.map +1 -0
- package/execution/components/ExecutionStatus.js +13 -0
- package/execution/components/ExecutionStatus.js.map +1 -0
- package/execution/components/ExecutionStream.d.ts +16 -0
- package/execution/components/ExecutionStream.d.ts.map +1 -0
- package/execution/components/ExecutionStream.js +47 -0
- package/execution/components/ExecutionStream.js.map +1 -0
- package/execution/components/MessageEntry.d.ts +17 -0
- package/execution/components/MessageEntry.d.ts.map +1 -0
- package/execution/components/MessageEntry.js +44 -0
- package/execution/components/MessageEntry.js.map +1 -0
- package/execution/components/MessageInput.d.ts +10 -0
- package/execution/components/MessageInput.d.ts.map +1 -0
- package/execution/components/MessageInput.js +28 -0
- package/execution/components/MessageInput.js.map +1 -0
- package/execution/components/OutputBlock.d.ts +9 -0
- package/execution/components/OutputBlock.d.ts.map +1 -0
- package/execution/components/OutputBlock.js +15 -0
- package/execution/components/OutputBlock.js.map +1 -0
- package/execution/components/SubAgentCard.d.ts +11 -0
- package/execution/components/SubAgentCard.d.ts.map +1 -0
- package/execution/components/SubAgentCard.js +19 -0
- package/execution/components/SubAgentCard.js.map +1 -0
- package/execution/components/ToolCallCard.d.ts +12 -0
- package/execution/components/ToolCallCard.d.ts.map +1 -0
- package/execution/components/ToolCallCard.js +26 -0
- package/execution/components/ToolCallCard.js.map +1 -0
- package/execution/helpers.d.ts +34 -0
- package/execution/helpers.d.ts.map +1 -0
- package/execution/helpers.js +163 -0
- package/execution/helpers.js.map +1 -0
- package/execution/hooks/useAgentExecution.d.ts +24 -0
- package/execution/hooks/useAgentExecution.d.ts.map +1 -0
- package/execution/hooks/useAgentExecution.js +112 -0
- package/execution/hooks/useAgentExecution.js.map +1 -0
- package/execution/hooks/useApproval.d.ts +16 -0
- package/execution/hooks/useApproval.d.ts.map +1 -0
- package/execution/hooks/useApproval.js +25 -0
- package/execution/hooks/useApproval.js.map +1 -0
- package/execution/hooks/useExecutionService.d.ts +8 -0
- package/execution/hooks/useExecutionService.d.ts.map +1 -0
- package/execution/hooks/useExecutionService.js +14 -0
- package/execution/hooks/useExecutionService.js.map +1 -0
- package/execution/index.d.ts +17 -0
- package/execution/index.d.ts.map +1 -0
- package/execution/index.js +26 -0
- package/execution/index.js.map +1 -0
- package/execution/services/execution-service.d.ts +23 -0
- package/execution/services/execution-service.d.ts.map +1 -0
- package/execution/services/execution-service.js +70 -0
- package/execution/services/execution-service.js.map +1 -0
- package/index.d.ts +2 -0
- package/index.d.ts.map +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/internal/ui/badge.d.ts +8 -0
- package/internal/ui/badge.d.ts.map +1 -0
- package/internal/ui/badge.js +46 -0
- package/internal/ui/badge.js.map +1 -0
- package/internal/ui/button.d.ts +9 -0
- package/internal/ui/button.d.ts.map +1 -0
- package/internal/ui/button.js +48 -0
- package/internal/ui/button.js.map +1 -0
- package/internal/ui/collapsible.d.ts +6 -0
- package/internal/ui/collapsible.d.ts.map +1 -0
- package/internal/ui/collapsible.js +28 -0
- package/internal/ui/collapsible.js.map +1 -0
- package/internal/ui/textarea.d.ts +4 -0
- package/internal/ui/textarea.d.ts.map +1 -0
- package/internal/ui/textarea.js +19 -0
- package/internal/ui/textarea.js.map +1 -0
- package/package.json +54 -0
- package/src/execution/components/ApprovalControls.tsx +99 -0
- package/src/execution/components/ExecutionStatus.tsx +36 -0
- package/src/execution/components/ExecutionStream.tsx +167 -0
- package/src/execution/components/MessageEntry.tsx +143 -0
- package/src/execution/components/MessageInput.tsx +70 -0
- package/src/execution/components/OutputBlock.tsx +47 -0
- package/src/execution/components/SubAgentCard.tsx +135 -0
- package/src/execution/components/ToolCallCard.tsx +155 -0
- package/src/execution/helpers.ts +199 -0
- package/src/execution/hooks/useAgentExecution.ts +126 -0
- package/src/execution/hooks/useApproval.ts +55 -0
- package/src/execution/hooks/useExecutionService.ts +15 -0
- package/src/execution/index.ts +53 -0
- package/src/execution/services/execution-service.ts +125 -0
- package/src/index.ts +1 -0
- package/src/internal/ui/badge.tsx +52 -0
- package/src/internal/ui/button.tsx +60 -0
- package/src/internal/ui/collapsible.tsx +21 -0
- package/src/internal/ui/textarea.tsx +18 -0
- package/src/styles.css +43 -0
- package/styles.css +2 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Stigmer Contributors
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# @stigmer/react-ui
|
|
2
|
+
|
|
3
|
+
React components for Stigmer agent execution streaming, tool calls, and human-in-the-loop approvals.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @stigmer/react-ui @stigmer/rpc-client @stigmer/protos @stigmer/theme
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { StigmerTransportProvider } from "@stigmer/rpc-client";
|
|
15
|
+
import { ExecutionStream, useAgentExecution } from "@stigmer/react-ui/execution";
|
|
16
|
+
import "@stigmer/react-ui/styles.css";
|
|
17
|
+
|
|
18
|
+
function AgentView({ executionId }: { executionId: string }) {
|
|
19
|
+
const { messages, phase } = useAgentExecution({ executionId });
|
|
20
|
+
return <ExecutionStream messages={messages} phase={phase} />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function App() {
|
|
24
|
+
return (
|
|
25
|
+
<StigmerTransportProvider serverUrl="http://localhost:8090">
|
|
26
|
+
<AgentView executionId="exec-abc123" />
|
|
27
|
+
</StigmerTransportProvider>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Subpath Exports
|
|
33
|
+
|
|
34
|
+
| Import | Contents |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `@stigmer/react-ui/execution` | All execution components, hooks, helpers |
|
|
37
|
+
| `@stigmer/react-ui/styles.css` | Pre-built Tailwind CSS (use without your own Tailwind setup) |
|
|
38
|
+
|
|
39
|
+
## Components
|
|
40
|
+
|
|
41
|
+
- `ExecutionStream` — real-time message stream with auto-scroll
|
|
42
|
+
- `ExecutionStatus` — lifecycle phase badge
|
|
43
|
+
- `MessageEntry` — renders human, AI, tool, and system messages
|
|
44
|
+
- `ToolCallCard` — collapsible tool call with arguments and results
|
|
45
|
+
- `SubAgentCard` — sub-agent delegation card with status
|
|
46
|
+
- `ApprovalControls` — HITL approve/deny UI for tool calls
|
|
47
|
+
- `MessageInput` — text input with send action
|
|
48
|
+
- `OutputBlock` — formatted output (markdown, code, raw)
|
|
49
|
+
|
|
50
|
+
## Hooks
|
|
51
|
+
|
|
52
|
+
- `useAgentExecution({ executionId })` — subscribes to execution events, returns messages and phase
|
|
53
|
+
- `useApproval({ executionId })` — handles HITL approval submissions
|
|
54
|
+
- `useExecutionService()` — access the execution service from context
|
|
55
|
+
|
|
56
|
+
## CSS Strategy
|
|
57
|
+
|
|
58
|
+
**Option A — Pre-built CSS** (no Tailwind required):
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import "@stigmer/react-ui/styles.css";
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Option B — Tailwind integration** (for full customization):
|
|
65
|
+
|
|
66
|
+
Import tokens from `@stigmer/theme` in your own Tailwind setup and let your pipeline process the classes.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
Apache-2.0
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
2
|
+
interface ApprovalControlsProps {
|
|
3
|
+
approvalMessage: string;
|
|
4
|
+
onSubmit: (action: ApprovalAction, comment?: string) => Promise<void>;
|
|
5
|
+
isSubmitting: boolean;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function ApprovalControls({ approvalMessage, onSubmit, isSubmitting, className, }: ApprovalControlsProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=ApprovalControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApprovalControls.d.ts","sourceRoot":"","sources":["../../../src/execution/components/ApprovalControls.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAI9F,UAAU,qBAAqB;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtE,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,SAAS,GACV,EAAE,qBAAqB,2CA6EvB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useState } from "react";
|
|
4
|
+
import { Button } from "../../internal/ui/button";
|
|
5
|
+
import { Textarea } from "../../internal/ui/textarea";
|
|
6
|
+
import { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
7
|
+
import { cn } from "@stigmer/theme";
|
|
8
|
+
import { Check, X, SkipForward, Loader2 } from "lucide-react";
|
|
9
|
+
export function ApprovalControls({ approvalMessage, onSubmit, isSubmitting, className, }) {
|
|
10
|
+
const [showComment, setShowComment] = useState(false);
|
|
11
|
+
const [comment, setComment] = useState("");
|
|
12
|
+
const handleAction = useCallback(async (action) => {
|
|
13
|
+
await onSubmit(action, comment || undefined);
|
|
14
|
+
setComment("");
|
|
15
|
+
setShowComment(false);
|
|
16
|
+
}, [onSubmit, comment]);
|
|
17
|
+
return (_jsxs("div", { className: cn("rounded-lg border-2 border-primary/30 bg-primary/5 p-3 space-y-3", className), children: [_jsx("p", { className: "text-sm font-medium", children: approvalMessage }), showComment && (_jsx(Textarea, { value: comment, onChange: (e) => setComment(e.target.value), placeholder: "Optional comment...", className: "min-h-10 text-sm", disabled: isSubmitting })), _jsxs("div", { className: "flex items-center gap-2", children: [_jsxs(Button, { size: "sm", onClick: () => handleAction(ApprovalAction.APPROVE), disabled: isSubmitting, children: [isSubmitting ? (_jsx(Loader2, { className: "size-3.5 animate-spin" })) : (_jsx(Check, { className: "size-3.5" })), "Approve"] }), _jsxs(Button, { size: "sm", variant: "secondary", onClick: () => handleAction(ApprovalAction.SKIP), disabled: isSubmitting, children: [_jsx(SkipForward, { className: "size-3.5" }), "Skip"] }), _jsxs(Button, { size: "sm", variant: "destructive", onClick: () => handleAction(ApprovalAction.REJECT), disabled: isSubmitting, children: [_jsx(X, { className: "size-3.5" }), "Reject"] }), !showComment && (_jsx(Button, { size: "sm", variant: "ghost", onClick: () => setShowComment(true), disabled: isSubmitting, className: "ml-auto text-xs text-muted-foreground", children: "Add comment" }))] })] }));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=ApprovalControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ApprovalControls.js","sourceRoot":"","sources":["../../../src/execution/components/ApprovalControls.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,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C,OAAO,IAAC,SAAS,EAAC,uBAAuB,GAAG,CAC9C,CAAC,CAAC,CAAC,CACF,KAAC,KAAK,IAAC,SAAS,EAAC,UAAU,GAAG,CAC/B,eAEM,EACT,MAAC,MAAM,IACL,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,EAChD,QAAQ,EAAE,YAAY,aAEtB,KAAC,WAAW,IAAC,SAAS,EAAC,UAAU,GAAG,YAE7B,EACT,MAAC,MAAM,IACL,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,aAAa,EACrB,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC,EAClD,QAAQ,EAAE,YAAY,aAEtB,KAAC,CAAC,IAAC,SAAS,EAAC,UAAU,GAAG,cAEnB,EACR,CAAC,WAAW,IAAI,CACf,KAAC,MAAM,IACL,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,OAAO,EACf,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,EACnC,QAAQ,EAAE,YAAY,EACtB,SAAS,EAAC,uCAAuC,4BAG1C,CACV,IACG,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
2
|
+
interface ExecutionStatusProps {
|
|
3
|
+
phase: ExecutionPhase;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function ExecutionStatus({ phase, className }: ExecutionStatusProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ExecutionStatus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionStatus.d.ts","sourceRoot":"","sources":["../../../src/execution/components/ExecutionStatus.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAI9F,UAAU,oBAAoB;IAC5B,KAAK,EAAE,cAAc,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,oBAAoB,2CAwBzE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from "../../internal/ui/badge";
|
|
3
|
+
import { phaseLabel, phaseVariant, isTerminalPhase } from "../helpers";
|
|
4
|
+
import { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
5
|
+
import { cn } from "@stigmer/theme";
|
|
6
|
+
import { Loader2 } from "lucide-react";
|
|
7
|
+
export function ExecutionStatus({ phase, className }) {
|
|
8
|
+
const isActive = phase === ExecutionPhase.EXECUTION_IN_PROGRESS ||
|
|
9
|
+
phase === ExecutionPhase.EXECUTION_PENDING;
|
|
10
|
+
const isWaiting = phase === ExecutionPhase.EXECUTION_WAITING_FOR_APPROVAL;
|
|
11
|
+
return (_jsxs(Badge, { variant: phaseVariant(phase), className: cn(isWaiting && "animate-pulse", className), children: [isActive && (_jsx(Loader2, { className: "size-3 animate-spin", "data-icon": "inline-start" })), phaseLabel(phase), isTerminalPhase(phase) && phase === ExecutionPhase.EXECUTION_COMPLETED && (_jsx("span", { "data-icon": "inline-end", children: "\u2713" }))] }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=ExecutionStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionStatus.js","sourceRoot":"","sources":["../../../src/execution/components/ExecutionStatus.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAOvC,MAAM,UAAU,eAAe,CAAC,EAAE,KAAK,EAAE,SAAS,EAAwB;IACxE,MAAM,QAAQ,GACZ,KAAK,KAAK,cAAc,CAAC,qBAAqB;QAC9C,KAAK,KAAK,cAAc,CAAC,iBAAiB,CAAC;IAC7C,MAAM,SAAS,GACb,KAAK,KAAK,cAAc,CAAC,8BAA8B,CAAC;IAE1D,OAAO,CACL,MAAC,KAAK,IACJ,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAC5B,SAAS,EAAE,EAAE,CACX,SAAS,IAAI,eAAe,EAC5B,SAAS,CACV,aAEA,QAAQ,IAAI,CACX,KAAC,OAAO,IAAC,SAAS,EAAC,qBAAqB,eAAW,cAAc,GAAG,CACrE,EACA,UAAU,CAAC,KAAK,CAAC,EACjB,eAAe,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,cAAc,CAAC,mBAAmB,IAAI,CACzE,4BAAgB,YAAY,uBAAS,CACtC,IACK,CACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/api_pb";
|
|
2
|
+
import { ExecutionPhase } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
3
|
+
import type { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
4
|
+
interface ExecutionStreamProps {
|
|
5
|
+
execution: AgentExecution | null;
|
|
6
|
+
phase: ExecutionPhase;
|
|
7
|
+
isConnected: boolean;
|
|
8
|
+
error: string | null;
|
|
9
|
+
onApproval?: (toolCallId: string, action: ApprovalAction, comment?: string) => Promise<void>;
|
|
10
|
+
isApprovalSubmitting?: boolean;
|
|
11
|
+
onSendMessage?: (message: string) => void;
|
|
12
|
+
className?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function ExecutionStream(props: ExecutionStreamProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=ExecutionStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionStream.d.ts","sourceRoot":"","sources":["../../../src/execution/components/ExecutionStream.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6DAA6D,CAAC;AAClG,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAiBnG,UAAU,oBAAoB;IAC5B,SAAS,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC,KAAK,EAAE,cAAc,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,UAAU,CAAC,EAAE,CACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,2CA6H1D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { ExecutionStatus } from "./ExecutionStatus";
|
|
5
|
+
import { MessageEntry } from "./MessageEntry";
|
|
6
|
+
import { HumanMessageBubble } from "./MessageEntry";
|
|
7
|
+
import { MessageInput } from "./MessageInput";
|
|
8
|
+
import { buildSubAgentIndex, isTerminalPhase, } from "../helpers";
|
|
9
|
+
import { cn } from "@stigmer/theme";
|
|
10
|
+
import { Button } from "../../internal/ui/button";
|
|
11
|
+
import { ArrowDown, AlertCircle } from "lucide-react";
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Component
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
export function ExecutionStream(props) {
|
|
16
|
+
var _a, _b, _c, _d, _e;
|
|
17
|
+
const { execution, phase, error, onApproval, isApprovalSubmitting = false, onSendMessage, className, } = props;
|
|
18
|
+
const scrollRef = useRef(null);
|
|
19
|
+
const bottomRef = useRef(null);
|
|
20
|
+
const [isAtBottom, setIsAtBottom] = useState(true);
|
|
21
|
+
const messages = (_b = (_a = execution === null || execution === void 0 ? void 0 : execution.status) === null || _a === void 0 ? void 0 : _a.messages) !== null && _b !== void 0 ? _b : [];
|
|
22
|
+
const subAgentIndex = useMemo(() => (execution ? buildSubAgentIndex(execution) : new Map()), [execution]);
|
|
23
|
+
// ── Scroll-lock: auto-scroll when at bottom ──
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
var _a;
|
|
26
|
+
if (isAtBottom) {
|
|
27
|
+
(_a = bottomRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
28
|
+
}
|
|
29
|
+
}, [messages.length, isAtBottom]);
|
|
30
|
+
const handleScroll = useCallback(() => {
|
|
31
|
+
const el = scrollRef.current;
|
|
32
|
+
if (!el)
|
|
33
|
+
return;
|
|
34
|
+
const threshold = 48;
|
|
35
|
+
const atBottom = el.scrollHeight - el.scrollTop - el.clientHeight < threshold;
|
|
36
|
+
setIsAtBottom(atBottom);
|
|
37
|
+
}, []);
|
|
38
|
+
const scrollToBottom = useCallback(() => {
|
|
39
|
+
var _a;
|
|
40
|
+
(_a = bottomRef.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({ behavior: "smooth" });
|
|
41
|
+
setIsAtBottom(true);
|
|
42
|
+
}, []);
|
|
43
|
+
const isTerminal = isTerminalPhase(phase);
|
|
44
|
+
const canSendMessage = isTerminal && !!onSendMessage;
|
|
45
|
+
return (_jsxs("div", { className: cn("flex flex-col", className), children: [_jsxs("div", { className: "flex items-center justify-between border-b px-4 py-2", children: [_jsx(ExecutionStatus, { phase: phase }), ((_c = execution === null || execution === void 0 ? void 0 : execution.status) === null || _c === void 0 ? void 0 : _c.startedAt) && (_jsx("time", { dateTime: execution.status.startedAt, className: "text-xs text-muted-foreground", children: new Date(execution.status.startedAt).toLocaleTimeString() }))] }), _jsxs("div", { ref: scrollRef, onScroll: handleScroll, className: "relative flex-1 overflow-y-auto", children: [_jsxs("div", { className: "space-y-4 p-4", children: [messages.length === 0 && ((_d = execution === null || execution === void 0 ? void 0 : execution.spec) === null || _d === void 0 ? void 0 : _d.message) && (_jsx(HumanMessageBubble, { content: execution.spec.message })), messages.map((msg, index) => (_jsx(MessageEntry, { message: msg, subAgentIndex: subAgentIndex, onApproval: onApproval, isApprovalSubmitting: isApprovalSubmitting }, index))), error && (_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive", children: [_jsx(AlertCircle, { className: "mt-0.5 size-4 shrink-0" }), _jsx("p", { children: error })] })), ((_e = execution === null || execution === void 0 ? void 0 : execution.status) === null || _e === void 0 ? void 0 : _e.error) && isTerminal && (_jsxs("div", { className: "flex items-start gap-2 rounded-lg border border-destructive/30 bg-destructive/5 p-3 text-sm text-destructive", children: [_jsx(AlertCircle, { className: "mt-0.5 size-4 shrink-0" }), _jsx("p", { children: execution.status.error })] })), _jsx("div", { ref: bottomRef })] }), !isAtBottom && (_jsx(Button, { size: "icon", variant: "secondary", onClick: scrollToBottom, className: "absolute bottom-4 right-4 z-10 rounded-full shadow-md", "aria-label": "Scroll to bottom", children: _jsx(ArrowDown, { className: "size-4" }) }))] }), canSendMessage && (_jsx("div", { className: "border-t p-4", children: _jsx(MessageInput, { onSend: onSendMessage, placeholder: "Send a follow-up message..." }) }))] }));
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ExecutionStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutionStream.js","sourceRoot":"","sources":["../../../src/execution/components/ExecutionStream.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI1E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAqBtD,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E,MAAM,UAAU,eAAe,CAAC,KAA2B;;IACzD,MAAM,EACJ,SAAS,EACT,KAAK,EACL,KAAK,EACL,UAAU,EACV,oBAAoB,GAAG,KAAK,EAC5B,aAAa,EACb,SAAS,GACV,GAAG,KAAK,CAAC;IACV,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC/C,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QA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AAS,EAAC,8GAA8G,aAC3H,KAAC,WAAW,IAAC,SAAS,EAAC,wBAAwB,GAAG,EAClD,sBAAI,SAAS,CAAC,MAAM,CAAC,KAAK,GAAK,IAC3B,CACP,EAED,cAAK,GAAG,EAAE,SAAS,GAAI,IACnB,EAGL,CAAC,UAAU,IAAI,CACd,KAAC,MAAM,IACL,IAAI,EAAC,MAAM,EACX,OAAO,EAAC,WAAW,EACnB,OAAO,EAAE,cAAc,EACvB,SAAS,EAAC,uDAAuD,gBACtD,kBAAkB,YAE7B,KAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,GAAG,GACzB,CACV,IACG,EAGL,cAAc,IAAI,CACjB,cAAK,SAAS,EAAC,cAAc,YAC3B,KAAC,YAAY,IACX,MAAM,EAAE,aAAa,EACrB,WAAW,EAAC,6BAA6B,GACzC,GACE,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AgentMessage } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/message_pb";
|
|
2
|
+
import type { SubAgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/subagent_pb";
|
|
3
|
+
import type { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
4
|
+
export interface MessageEntryProps {
|
|
5
|
+
message: AgentMessage;
|
|
6
|
+
subAgentIndex: Map<string, SubAgentExecution>;
|
|
7
|
+
onApproval?: (toolCallId: string, action: ApprovalAction, comment?: string) => Promise<void>;
|
|
8
|
+
isApprovalSubmitting?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function MessageEntry({ message, subAgentIndex, onApproval, isApprovalSubmitting, }: MessageEntryProps): import("react/jsx-runtime").JSX.Element | null;
|
|
11
|
+
export declare function HumanMessageBubble({ content }: {
|
|
12
|
+
content: string;
|
|
13
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function SystemMessageBlock({ content }: {
|
|
15
|
+
content: string;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
//# sourceMappingURL=MessageEntry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageEntry.d.ts","sourceRoot":"","sources":["../../../src/execution/components/MessageEntry.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iEAAiE,CAAC;AACpG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AAC1G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAenG,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,CACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAMD,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,aAAa,EACb,UAAU,EACV,oBAAoB,GACrB,EAAE,iBAAiB,kDAuBnB;AAMD,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,2CAWlE;AAyDD,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,kDAQlE"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { OutputBlock } from "./OutputBlock";
|
|
3
|
+
import { ToolCallCard } from "./ToolCallCard";
|
|
4
|
+
import { SubAgentCard } from "./SubAgentCard";
|
|
5
|
+
import { isHumanMessage, isAiMessage, isSystemMessage, } from "../helpers";
|
|
6
|
+
import { User, BotMessageSquare, Info } from "lucide-react";
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Message dispatcher
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
export function MessageEntry({ message, subAgentIndex, onApproval, isApprovalSubmitting, }) {
|
|
11
|
+
if (isHumanMessage(message.type)) {
|
|
12
|
+
return _jsx(HumanMessageBubble, { content: message.content });
|
|
13
|
+
}
|
|
14
|
+
if (isAiMessage(message.type)) {
|
|
15
|
+
return (_jsx(AiMessageBlock, { message: message, subAgentIndex: subAgentIndex, onApproval: onApproval, isApprovalSubmitting: isApprovalSubmitting }));
|
|
16
|
+
}
|
|
17
|
+
if (isSystemMessage(message.type)) {
|
|
18
|
+
return _jsx(SystemMessageBlock, { content: message.content });
|
|
19
|
+
}
|
|
20
|
+
// MESSAGE_TOOL: tool results are rendered inline with the tool call card,
|
|
21
|
+
// so we don't render a separate block for them.
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
// ---------------------------------------------------------------------------
|
|
25
|
+
// Message type blocks
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
export function HumanMessageBubble({ content }) {
|
|
28
|
+
return (_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "flex size-7 shrink-0 items-center justify-center rounded-full bg-muted", children: _jsx(User, { className: "size-3.5 text-muted-foreground" }) }), _jsx("div", { className: "min-w-0 flex-1 rounded-lg bg-muted px-3 py-2 text-sm", children: _jsx("p", { className: "whitespace-pre-wrap", children: content }) })] }));
|
|
29
|
+
}
|
|
30
|
+
function AiMessageBlock({ message, subAgentIndex, onApproval, isApprovalSubmitting, }) {
|
|
31
|
+
return (_jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "flex size-7 shrink-0 items-center justify-center rounded-full bg-primary/10", children: _jsx(BotMessageSquare, { className: "size-3.5 text-primary" }) }), _jsxs("div", { className: "min-w-0 flex-1 space-y-2", children: [message.content && (_jsx(OutputBlock, { content: message.content, isStreaming: message.isStreaming, model: message.model })), message.toolCalls.map((tc) => {
|
|
32
|
+
const subAgent = subAgentIndex.get(tc.id);
|
|
33
|
+
if (subAgent) {
|
|
34
|
+
return (_jsx(SubAgentCard, { subAgent: subAgent, onApproval: onApproval, isApprovalSubmitting: isApprovalSubmitting }, tc.id));
|
|
35
|
+
}
|
|
36
|
+
return (_jsx(ToolCallCard, { toolCall: tc, onApproval: onApproval, isApprovalSubmitting: isApprovalSubmitting }, tc.id));
|
|
37
|
+
})] })] }));
|
|
38
|
+
}
|
|
39
|
+
export function SystemMessageBlock({ content }) {
|
|
40
|
+
if (!content)
|
|
41
|
+
return null;
|
|
42
|
+
return (_jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [_jsx(Info, { className: "size-3 shrink-0" }), _jsx("p", { children: content })] }));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=MessageEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageEntry.js","sourceRoot":"","sources":["../../../src/execution/components/MessageEntry.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,GAChB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAiB5D,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,MAAM,UAAU,YAAY,CAAC,EAC3B,OAAO,EACP,aAAa,EACb,UAAU,EACV,oBAAoB,GACF;IAClB,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACjC,OAAO,KAAC,kBAAkB,IAAC,OAAO,EAAE,OAAO,C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O,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE;wBAC5B,MAAM,QAAQ,GAAG,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;wBAC1C,IAAI,QAAQ,EAAE,CAAC;4BACb,OAAO,CACL,KAAC,YAAY,IAEX,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,oBAAoB,IAHrC,EAAE,CAAC,EAAE,CAIV,CACH,CAAC;wBACJ,CAAC;wBACD,OAAO,CACL,KAAC,YAAY,IAEX,QAAQ,EAAE,EAAE,EACZ,UAAU,EAAE,UAAU,EACtB,oBAAoB,EAAE,oBAAoB,IAHrC,EAAE,CAAC,EAAE,CAIV,CACH,CAAC;oBACJ,CAAC,CAAC,IACE,IACF,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,EAAE,OAAO,EAAuB;IACjE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,CACL,eAAK,SAAS,EAAC,uDAAuD,aACpE,KAAC,IAAI,IAAC,SAAS,EAAC,iBAAiB,GAAG,EACpC,sBAAI,OAAO,GAAK,IACZ,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface MessageInputProps {
|
|
2
|
+
onSend: (message: string) => void;
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function MessageInput({ onSend, disabled, isLoading, placeholder, className, }: MessageInputProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=MessageInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageInput.d.ts","sourceRoot":"","sources":["../../../src/execution/components/MessageInput.tsx"],"names":[],"mappings":"AAQA,UAAU,iBAAiB;IACzB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,QAAgB,EAChB,SAAiB,EACjB,WAAiC,EACjC,SAAS,GACV,EAAE,iBAAiB,2CA+CnB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useRef } from "react";
|
|
4
|
+
import { Textarea } from "../../internal/ui/textarea";
|
|
5
|
+
import { Button } from "../../internal/ui/button";
|
|
6
|
+
import { cn } from "@stigmer/theme";
|
|
7
|
+
import { SendHorizontal, Loader2 } from "lucide-react";
|
|
8
|
+
export function MessageInput({ onSend, disabled = false, isLoading = false, placeholder = "Send a message...", className, }) {
|
|
9
|
+
const textareaRef = useRef(null);
|
|
10
|
+
const handleSend = useCallback(() => {
|
|
11
|
+
var _a;
|
|
12
|
+
const value = (_a = textareaRef.current) === null || _a === void 0 ? void 0 : _a.value.trim();
|
|
13
|
+
if (!value || disabled || isLoading)
|
|
14
|
+
return;
|
|
15
|
+
onSend(value);
|
|
16
|
+
if (textareaRef.current) {
|
|
17
|
+
textareaRef.current.value = "";
|
|
18
|
+
}
|
|
19
|
+
}, [onSend, disabled, isLoading]);
|
|
20
|
+
const handleKeyDown = useCallback((e) => {
|
|
21
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
handleSend();
|
|
24
|
+
}
|
|
25
|
+
}, [handleSend]);
|
|
26
|
+
return (_jsxs("div", { className: cn("flex items-end gap-2", className), children: [_jsx(Textarea, { ref: textareaRef, placeholder: placeholder, disabled: disabled || isLoading, onKeyDown: handleKeyDown, className: "min-h-10 resize-none", rows: 1 }), _jsx(Button, { size: "icon", onClick: handleSend, disabled: disabled || isLoading, className: "shrink-0", "aria-label": "Send message", children: isLoading ? (_jsx(Loader2, { className: "size-4 animate-spin" })) : (_jsx(SendHorizontal, { className: "size-4" })) })] }));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=MessageInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageInput.js","sourceRoot":"","sources":["../../../src/execution/components/MessageInput.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,EAAsB,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAUvD,MAAM,UAAU,YAAY,CAAC,EAC3B,MAAM,EACN,QAAQ,GAAG,KAAK,EAChB,SAAS,GAAG,KAAK,EACjB,WAAW,GAAG,mBAAmB,EACjC,SAAS,GACS;IAClB,MAAM,WAAW,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;IAEtD,MAAM,UAAU,GAAG,WAAW,CAAC,GAAG,EAAE;;QAClC,MAAM,KAAK,GAAG,MAAA,WAAW,CAAC,OAAO,0CAAE,KAAK,CAAC,IAAI,EAAE,CAAC;QAChD,IAAI,CAAC,KAAK,IAAI,QAAQ,IAAI,SAAS;YAAE,OAAO;QAC5C,MAAM,CAAC,KAAK,CAAC,CAAC;QACd,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACxB,WAAW,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE,CAAC;QACjC,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAElC,MAAM,aAAa,GAAG,WAAW,CAC/B,CAAC,CAAqC,EAAE,EAAE;QACxC,IAAI,CAAC,CAAC,GAAG,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;YACrC,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,UAAU,EAAE,CAAC;QACf,CAAC;IACH,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,SAAS,CAAC,aACnD,KAAC,QAAQ,IACP,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,IAAI,SAAS,EAC/B,SAAS,EAAE,aAAa,EACxB,SAAS,EAAC,sBAAsB,EAChC,IAAI,EAAE,CAAC,GACP,EACF,KAAC,MAAM,IACL,IAAI,EAAC,MAAM,EACX,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,QAAQ,IAAI,SAAS,EAC/B,SAAS,EAAC,UAAU,gBACT,cAAc,YAExB,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,OAAO,IAAC,SAAS,EAAC,qBAAqB,GAAG,CAC5C,CAAC,CAAC,CAAC,CACF,KAAC,cAAc,IAAC,SAAS,EAAC,QAAQ,GAAG,CACtC,GACM,IACL,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface OutputBlockProps {
|
|
2
|
+
content: string;
|
|
3
|
+
isStreaming?: boolean;
|
|
4
|
+
model?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const OutputBlock: import("react").NamedExoticComponent<OutputBlockProps>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=OutputBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutputBlock.d.ts","sourceRoot":"","sources":["../../../src/execution/components/OutputBlock.tsx"],"names":[],"mappings":"AAOA,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,wDAuBtB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { memo } from "react";
|
|
4
|
+
import ReactMarkdown from "react-markdown";
|
|
5
|
+
import remarkGfm from "remark-gfm";
|
|
6
|
+
import { cn } from "@stigmer/theme";
|
|
7
|
+
export const OutputBlock = memo(function OutputBlock({ content, isStreaming = false, model, className, }) {
|
|
8
|
+
if (!content && !isStreaming)
|
|
9
|
+
return null;
|
|
10
|
+
return (_jsxs("div", { className: cn("relative", className), children: [_jsxs("div", { className: "prose prose-sm dark:prose-invert max-w-none break-words [&_pre]:overflow-x-auto [&_pre]:rounded-lg [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:text-xs [&_code]:rounded [&_code]:bg-muted [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-xs [&_code]:before:content-none [&_code]:after:content-none [&_table]:text-xs [&_th]:px-2 [&_th]:py-1 [&_td]:px-2 [&_td]:py-1", children: [_jsx(ReactMarkdown, { remarkPlugins: [remarkGfm], children: content }), isStreaming && _jsx(StreamingCursor, {})] }), model && !isStreaming && (_jsx("p", { className: "mt-1.5 text-[10px] text-muted-foreground/60", children: model }))] }));
|
|
11
|
+
});
|
|
12
|
+
function StreamingCursor() {
|
|
13
|
+
return (_jsx("span", { className: "ml-0.5 inline-block h-4 w-0.5 animate-pulse bg-foreground align-text-bottom", "aria-label": "Generating..." }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=OutputBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OutputBlock.js","sourceRoot":"","sources":["../../../src/execution/components/OutputBlock.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,aAAa,MAAM,gBAAgB,CAAC;AAC3C,OAAO,SAAS,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AASpC,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,WAAW,CAAC,EACnD,OAAO,EACP,WAAW,GAAG,KAAK,EACnB,KAAK,EACL,SAAS,GACQ;IACjB,IAAI,CAAC,OAAO,IAAI,CAAC,WAAW;QAAE,OAAO,IAAI,CAAC;IAE1C,OAAO,CACL,eAAK,SAAS,EAAE,EAAE,CAAC,UAAU,EAAE,SAAS,CAAC,aACvC,eAAK,SAAS,EAAC,gWAAgW,aAC7W,KAAC,aAAa,IAAC,aAAa,EAAE,CAAC,SAAS,CAAC,YACtC,OAAO,GACM,EACf,WAAW,IAAI,KAAC,eAAe,KAAG,IAC/B,EACL,KAAK,IAAI,CAAC,WAAW,IAAI,CACxB,YAAG,SAAS,EAAC,6CAA6C,YACvD,KAAK,GACJ,CACL,IACG,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,SAAS,eAAe;IACtB,OAAO,CACL,eACE,SAAS,EAAC,6EAA6E,gBAC5E,eAAe,GAC1B,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SubAgentExecution } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/subagent_pb";
|
|
2
|
+
import type { ApprovalAction } from "@stigmer/protos/ai/stigmer/agentic/agentexecution/v1/enum_pb";
|
|
3
|
+
interface SubAgentCardProps {
|
|
4
|
+
subAgent: SubAgentExecution;
|
|
5
|
+
onApproval?: (toolCallId: string, action: ApprovalAction, comment?: string) => Promise<void>;
|
|
6
|
+
isApprovalSubmitting?: boolean;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function SubAgentCard({ subAgent, onApproval, isApprovalSubmitting, className, }: SubAgentCardProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=SubAgentCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubAgentCard.d.ts","sourceRoot":"","sources":["../../../src/execution/components/SubAgentCard.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AAC1G,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAKnG,UAAU,iBAAiB;IACzB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,UAAU,CAAC,EAAE,CACX,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,MAAM,KACb,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,UAAU,EACV,oBAA4B,EAC5B,SAAS,GACV,EAAE,iBAAiB,2CA+FnB"}
|