@pikku/assistant-ui 0.12.6 → 0.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +1 -2
- package/dist/cjs/pikku-agent-chat.js +26 -11
- package/dist/cjs/use-pikku-agent-runtime.d.ts +12 -11
- package/dist/cjs/use-pikku-agent-runtime.js +160 -615
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/pikku-agent-chat.js +11 -8
- package/dist/esm/use-pikku-agent-runtime.d.ts +12 -11
- package/dist/esm/use-pikku-agent-runtime.js +181 -595
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -3
- package/src/index.ts +0 -1
- package/src/pikku-agent-chat.tsx +14 -8
- package/src/use-pikku-agent-runtime.ts +219 -803
- package/tsconfig.cjs.json +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/model-capabilities.ts","../src/use-file-attachment.ts","../src/use-pikku-agent-runtime.ts","../src/pikku-agent-chat.tsx"],"version":"
|
|
1
|
+
{"root":["../src/index.ts","../src/model-capabilities.ts","../src/use-file-attachment.ts","../src/use-pikku-agent-runtime.ts","../src/pikku-agent-chat.tsx"],"version":"6.0.3"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/model-capabilities.ts","../src/use-file-attachment.ts","../src/use-pikku-agent-runtime.ts","../src/pikku-agent-chat.tsx"],"version":"
|
|
1
|
+
{"root":["../src/index.ts","../src/model-capabilities.ts","../src/use-file-attachment.ts","../src/use-pikku-agent-runtime.ts","../src/pikku-agent-chat.tsx"],"version":"6.0.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pikku/assistant-ui",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.8",
|
|
4
4
|
"author": "yasser.fadl@gmail.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,7 +20,9 @@
|
|
|
20
20
|
"prepublishOnly": "yarn build"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@
|
|
23
|
+
"@ag-ui/client": "^0.0.57",
|
|
24
|
+
"@assistant-ui/react": "^0.14.24",
|
|
25
|
+
"@assistant-ui/react-ag-ui": "^0.0.43",
|
|
24
26
|
"react-markdown": "^10.1.0"
|
|
25
27
|
},
|
|
26
28
|
"peerDependencies": {
|
|
@@ -30,6 +32,8 @@
|
|
|
30
32
|
"devDependencies": {
|
|
31
33
|
"@types/react": "^19",
|
|
32
34
|
"@types/react-dom": "^19",
|
|
33
|
-
"
|
|
35
|
+
"react": "^19",
|
|
36
|
+
"react-dom": "^19",
|
|
37
|
+
"typescript": "^6.0.3"
|
|
34
38
|
}
|
|
35
39
|
}
|
package/src/index.ts
CHANGED
package/src/pikku-agent-chat.tsx
CHANGED
|
@@ -149,10 +149,14 @@ const ToolCallDisplay: FunctionComponent<{
|
|
|
149
149
|
}> = ({ toolCallId, toolName, args, result, status, addResult }) => {
|
|
150
150
|
const colors = useContext(ColorsContext)
|
|
151
151
|
const hideToolCalls = useContext(HideToolCallsContext)
|
|
152
|
-
const { handleApproval } = usePikkuApproval()
|
|
152
|
+
const { handleApproval, pendingApprovals } = usePikkuApproval()
|
|
153
153
|
const [expanded, setExpanded] = useState(false)
|
|
154
154
|
const isApproval = status.type === 'requires-action'
|
|
155
|
-
const approvalReason =
|
|
155
|
+
const approvalReason =
|
|
156
|
+
(args as any)?.__approvalReason ??
|
|
157
|
+
pendingApprovals.find(
|
|
158
|
+
(a) => a.toolCallId === toolCallId && a.type !== 'credential-request'
|
|
159
|
+
)?.reason
|
|
156
160
|
const displayArgs = { ...args }
|
|
157
161
|
delete (displayArgs as any).__approvalReason
|
|
158
162
|
const [responded, setResponded] = useState<'approved' | 'denied' | null>(null)
|
|
@@ -214,10 +218,11 @@ const ToolCallDisplay: FunctionComponent<{
|
|
|
214
218
|
</pre>
|
|
215
219
|
<div style={{ display: 'flex', gap: 8 }}>
|
|
216
220
|
<button
|
|
217
|
-
onClick={() => {
|
|
221
|
+
onClick={async () => {
|
|
218
222
|
setResponded('approved')
|
|
219
|
-
handleApproval(toolCallId, true)
|
|
220
|
-
|
|
223
|
+
if (await handleApproval(toolCallId, true)) {
|
|
224
|
+
addResult?.({ approved: true })
|
|
225
|
+
}
|
|
221
226
|
}}
|
|
222
227
|
style={{
|
|
223
228
|
padding: '4px 12px',
|
|
@@ -232,10 +237,11 @@ const ToolCallDisplay: FunctionComponent<{
|
|
|
232
237
|
Approve
|
|
233
238
|
</button>
|
|
234
239
|
<button
|
|
235
|
-
onClick={() => {
|
|
240
|
+
onClick={async () => {
|
|
236
241
|
setResponded('denied')
|
|
237
|
-
handleApproval(toolCallId, false)
|
|
238
|
-
|
|
242
|
+
if (await handleApproval(toolCallId, false)) {
|
|
243
|
+
addResult?.({ approved: false })
|
|
244
|
+
}
|
|
239
245
|
}}
|
|
240
246
|
style={{
|
|
241
247
|
padding: '4px 12px',
|