GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Permission rework (#6319) · burka/opencode@351ddee

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • test.yml
  • .opencode
    • agent
      • git-committer.md
    • opencode.jsonc
  • bunfig.toml
  • flake.lock
  • package.json
  • packages
    • app/src
      • context
        • global-sync.tsx
        • permission.tsx
      • pages
        • layout.tsx
    • opencode
      • src
        • acp
          • agent.ts
        • agent
          • agent.ts
        • cli/cmd
          • agent.ts
          • debug
            • agent.ts
          • run.ts
          • tui
            • app.tsx
            • component/prompt
              • index.tsx
            • context
              • local.tsx
              • sync.tsx
            • routes/session
              • footer.tsx
              • index.tsx
              • permission.tsx
            • ui
              • dialog.tsx
        • config
          • config.ts
        • installation
          • index.ts
        • permission
          • arity.ts
          • index.ts
          • next.ts
        • plugin
          • index.ts
        • server
          • server.ts
        • session
          • index.ts
          • llm.ts
          • processor.ts
          • prompt.ts
          • system.ts
        • tool
          • bash.ts
          • codesearch.ts
          • edit.ts
          • glob.ts
          • grep.ts
          • ls.ts
          • lsp.ts
          • patch.ts
          • read.ts
          • registry.ts
          • skill.ts
          • task.ts
          • todo.ts
          • tool.ts
          • webfetch.ts
          • websearch.ts
          • write.ts
      • test
        • agent
          • agent.test.ts
        • config
          • config.test.ts
        • fixture
          • fixture.ts
        • permission
          • arity.test.ts
          • next.test.ts
        • tool
          • bash.test.ts
          • grep.test.ts
          • patch.test.ts
          • read.test.ts
    • sdk
      • js/src/v2/gen
        • sdk.gen.ts
        • types.gen.ts
      • openapi.json
    • ui/src
      • components
        • message-part.tsx
        • session-turn.tsx
      • context
        • data.tsx

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/test.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/test.yml
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@ name: test
22

33
on:
44
push:
5-
branches-ignore:
6-
- production
5+
branches:
6+
- dev
77
pull_request:
8-
branches-ignore:
9-
- production
108
workflow_dispatch:
119
jobs:
1210
test:
Collapse file

‎.opencode/agent/git-committer.md‎

Copy file name to clipboardExpand all lines: .opencode/agent/git-committer.md
-10Lines changed: 0 additions & 10 deletions
This file was deleted.
Collapse file

‎.opencode/opencode.jsonc‎

Copy file name to clipboardExpand all lines: .opencode/opencode.jsonc
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@
1010
"options": {},
1111
},
1212
},
13-
"mcp": {},
13+
"permission": "ask",
14+
"mcp": {
15+
"context7": {
16+
"type": "remote",
17+
"url": "https://mcp.context7.com/mcp",
18+
},
19+
},
1420
"tools": {
1521
"github-triage": false,
1622
},
Collapse file

‎bunfig.toml‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
[install]
22
exact = true
3+
4+
[test]
5+
root = "./do-not-run-tests-from-root"
6+
Collapse file

‎flake.lock‎

Copy file name to clipboardExpand all lines: flake.lock
+3-3Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"typecheck": "bun turbo typecheck",
1111
"prepare": "husky",
1212
"random": "echo 'Random script'",
13-
"hello": "echo 'Hello World!'"
13+
"hello": "echo 'Hello World!'",
14+
"test": "echo 'do not run tests from root' && exit 1"
1415
},
1516
"workspaces": {
1617
"packages": [
Collapse file

‎packages/app/src/context/global-sync.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/context/global-sync.tsx
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
type McpStatus,
1616
type LspStatus,
1717
type VcsInfo,
18-
type Permission,
18+
type PermissionRequest,
1919
createOpencodeClient,
2020
} from "@opencode-ai/sdk/v2/client"
2121
import { createStore, produce, reconcile } from "solid-js/store"
@@ -46,7 +46,7 @@ type State = {
4646
[sessionID: string]: Todo[]
4747
}
4848
permission: {
49-
[sessionID: string]: Permission[]
49+
[sessionID: string]: PermissionRequest[]
5050
}
5151
mcp: {
5252
[name: string]: McpStatus
@@ -168,7 +168,7 @@ function createGlobalSync() {
168168
vcs: () => sdk.vcs.get().then((x) => setStore("vcs", x.data)),
169169
permission: () =>
170170
sdk.permission.list().then((x) => {
171-
const grouped: Record<string, Permission[]> = {}
171+
const grouped: Record<string, PermissionRequest[]> = {}
172172
for (const perm of x.data ?? []) {
173173
if (!perm?.id || !perm.sessionID) continue
174174
const existing = grouped[perm.sessionID]
@@ -349,7 +349,7 @@ function createGlobalSync() {
349349
setStore("vcs", { branch: event.properties.branch })
350350
break
351351
}
352-
case "permission.updated": {
352+
case "permission.asked": {
353353
const sessionID = event.properties.sessionID
354354
const permissions = store.permission[sessionID]
355355
if (!permissions) {
@@ -375,7 +375,7 @@ function createGlobalSync() {
375375
case "permission.replied": {
376376
const permissions = store.permission[event.properties.sessionID]
377377
if (!permissions) break
378-
const result = Binary.search(permissions, event.properties.permissionID, (p) => p.id)
378+
const result = Binary.search(permissions, event.properties.requestID, (p) => p.id)
379379
if (!result.found) break
380380
setStore(
381381
"permission",
Collapse file

‎packages/app/src/context/permission.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/context/permission.tsx
+6-8Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createMemo, onCleanup } from "solid-js"
22
import { createStore } from "solid-js/store"
33
import { createSimpleContext } from "@opencode-ai/ui/context"
4-
import type { Permission } from "@opencode-ai/sdk/v2/client"
4+
import type { PermissionRequest } from "@opencode-ai/sdk/v2/client"
55
import { persisted } from "@/utils/persist"
66
import { useGlobalSDK } from "@/context/global-sdk"
77
import { useGlobalSync } from "./global-sync"
@@ -14,10 +14,8 @@ type PermissionRespondFn = (input: {
1414
directory?: string
1515
}) => void
1616

17-
const AUTO_ACCEPT_TYPES = new Set(["edit", "write"])
18-
19-
function shouldAutoAccept(perm: Permission) {
20-
return AUTO_ACCEPT_TYPES.has(perm.type)
17+
function shouldAutoAccept(perm: PermissionRequest) {
18+
return perm.permission === "edit"
2119
}
2220

2321
export const { use: usePermission, provider: PermissionProvider } = createSimpleContext({
@@ -48,7 +46,7 @@ export const { use: usePermission, provider: PermissionProvider } = createSimple
4846
})
4947
}
5048

51-
function respondOnce(permission: Permission, directory?: string) {
49+
function respondOnce(permission: PermissionRequest, directory?: string) {
5250
if (responded.has(permission.id)) return
5351
responded.add(permission.id)
5452
respond({
@@ -65,7 +63,7 @@ export const { use: usePermission, provider: PermissionProvider } = createSimple
6563

6664
const unsubscribe = globalSDK.event.listen((e) => {
6765
const event = e.details
68-
if (event?.type !== "permission.updated") return
66+
if (event?.type !== "permission.asked") return
6967

7068
const perm = event.properties
7169
if (!isAutoAccepting(perm.sessionID)) return
@@ -98,7 +96,7 @@ export const { use: usePermission, provider: PermissionProvider } = createSimple
9896
return {
9997
ready,
10098
respond,
101-
autoResponds(permission: Permission) {
99+
autoResponds(permission: PermissionRequest) {
102100
return isAutoAccepting(permission.sessionID) && shouldAutoAccept(permission)
103101
},
104102
isAutoAccepting,
Collapse file

‎packages/app/src/pages/layout.tsx‎

Copy file name to clipboardExpand all lines: packages/app/src/pages/layout.tsx
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export default function Layout(props: ParentProps) {
175175
const permissionAlertCooldownMs = 5000
176176

177177
const unsub = globalSDK.event.listen((e) => {
178-
if (e.details?.type !== "permission.updated") return
178+
if (e.details?.type !== "permission.asked") return
179179
const directory = e.name
180180
const perm = e.details.properties
181181
if (permission.autoResponds(perm)) return
Collapse file

‎packages/opencode/src/acp/agent.ts‎

Copy file name to clipboardExpand all lines: packages/opencode/src/acp/agent.ts
+14-17Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,19 @@ export namespace ACP {
7171
this.config.sdk.event.subscribe({ directory }).then(async (events) => {
7272
for await (const event of events.stream) {
7373
switch (event.type) {
74-
case "permission.updated":
74+
case "permission.asked":
7575
try {
7676
const permission = event.properties
7777
const res = await this.connection
7878
.requestPermission({
7979
sessionId,
8080
toolCall: {
81-
toolCallId: permission.callID ?? permission.id,
81+
toolCallId: permission.tool?.callID ?? permission.id,
8282
status: "pending",
83-
title: permission.title,
83+
title: permission.permission,
8484
rawInput: permission.metadata,
85-
kind: toToolKind(permission.type),
86-
locations: toLocations(permission.type, permission.metadata),
85+
kind: toToolKind(permission.permission),
86+
locations: toLocations(permission.permission, permission.metadata),
8787
},
8888
options,
8989
})
@@ -93,28 +93,25 @@ export namespace ACP {
9393
permissionID: permission.id,
9494
sessionID: permission.sessionID,
9595
})
96-
await this.config.sdk.permission.respond({
97-
sessionID: permission.sessionID,
98-
permissionID: permission.id,
99-
response: "reject",
96+
await this.config.sdk.permission.reply({
97+
requestID: permission.id,
98+
reply: "reject",
10099
directory,
101100
})
102101
return
103102
})
104103
if (!res) return
105104
if (res.outcome.outcome !== "selected") {
106-
await this.config.sdk.permission.respond({
107-
sessionID: permission.sessionID,
108-
permissionID: permission.id,
109-
response: "reject",
105+
await this.config.sdk.permission.reply({
106+
requestID: permission.id,
107+
reply: "reject",
110108
directory,
111109
})
112110
return
113111
}
114-
await this.config.sdk.permission.respond({
115-
sessionID: permission.sessionID,
116-
permissionID: permission.id,
117-
response: res.outcome.optionId as "once" | "always" | "reject",
112+
await this.config.sdk.permission.reply({
113+
requestID: permission.id,
114+
reply: res.outcome.optionId as "once" | "always" | "reject",
118115
directory,
119116
})
120117
} catch (err) {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.