Add permission asking UI and subAgent session navigation footer (#101)

* feat: add support for OpenCode permission.asked event

Implement UI handling for the new permission.asked event from OpenCode's
PermissionNext system, allowing tools configured with "ask" in opencode.json
to prompt user for approval.

Changes:
- Add permission.asked event handler in useEventStream
- Add patterns[] and always[] fields to Permission type
- Display patterns being requested in PermissionCard
- Show what "Always Allow" will auto-approve

This enables the permission asking feature where tools can require user
approval based on opencode.json configuration.

* feat: add button to open subAgent session from task tool

When an agent uses the task tool to create a subagent session,
a new "Open subAgent session" button is now displayed next to
the task tool output. Clicking this button navigates to the
child session in the chat view.

The button shows only when a sessionId is available in the task
metadata and uses the external link icon to indicate it opens
a separate session context.
This commit is contained in:
aptdnfapt
2026-01-03 23:07:08 +02:00
committed by GitHub
parent d971836962
commit 9887b25864
4 changed files with 151 additions and 29 deletions
+37 -1
View File
@@ -955,8 +955,44 @@ export const useEventStream = () => {
}
break;
case 'permission.replied':
case 'permission.asked':
// New permission system from OpenCode's PermissionNext
if ('sessionID' in props && props.sessionID === currentSessionId) {
const askedProps = props as {
id: string;
permission: string;
sessionID: string;
patterns?: string[];
always?: string[];
metadata: Record<string, unknown>;
tool?: {
messageID: string;
callID: string;
};
};
// Convert new permission.asked event format to Permission type
const permission = {
id: askedProps.id,
type: askedProps.permission,
pattern: askedProps.patterns, // Map patterns to pattern field for compatibility
sessionID: askedProps.sessionID,
messageID: askedProps.tool?.messageID || askedProps.sessionID,
callID: askedProps.tool?.callID,
title: `${askedProps.permission} permission required`,
metadata: {
...askedProps.metadata,
always: askedProps.always, // Store always in metadata for UI access
patterns: askedProps.patterns,
},
time: { created: Date.now() },
} as unknown as Permission;
addPermission(permission);
}
break;
case 'permission.replied':
// Permission was responded to - UI will update via permissionStore
break;
case 'todo.updated': {