@pikku/assistant-ui 0.12.7 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikku/assistant-ui",
3
- "version": "0.12.7",
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
- "@assistant-ui/react": "^0.12.12 || ^0.14.0",
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": {
package/src/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export {
2
2
  usePikkuAgentRuntime,
3
- usePikkuAgentNonStreamingRuntime,
4
3
  PikkuApprovalContext,
5
4
  usePikkuApproval,
6
5
  convertDbMessages,
@@ -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 = (args as any)?.__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
- addResult?.({ approved: true })
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
- addResult?.({ approved: false })
242
+ if (await handleApproval(toolCallId, false)) {
243
+ addResult?.({ approved: false })
244
+ }
239
245
  }}
240
246
  style={{
241
247
  padding: '4px 12px',