kimaki 0.4.27 → 0.4.28
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.
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// with Accept, Accept Always, and Deny options.
|
|
4
4
|
import { StringSelectMenuBuilder, StringSelectMenuInteraction, ActionRowBuilder, } from 'discord.js';
|
|
5
5
|
import crypto from 'node:crypto';
|
|
6
|
-
import {
|
|
6
|
+
import { getOpencodeClientV2 } from '../opencode.js';
|
|
7
7
|
import { NOTIFY_MESSAGE_FLAGS } from '../discord-utils.js';
|
|
8
8
|
import { createLogger } from '../logger.js';
|
|
9
9
|
const logger = createLogger('PERMISSIONS');
|
|
@@ -76,13 +76,13 @@ export async function handlePermissionSelectMenu(interaction) {
|
|
|
76
76
|
await interaction.deferUpdate();
|
|
77
77
|
const response = interaction.values[0];
|
|
78
78
|
try {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
79
|
+
const clientV2 = getOpencodeClientV2(context.directory);
|
|
80
|
+
if (!clientV2) {
|
|
81
|
+
throw new Error('OpenCode server not found for directory');
|
|
82
|
+
}
|
|
83
|
+
await clientV2.permission.reply({
|
|
84
|
+
requestID: context.permission.id,
|
|
85
|
+
reply: response,
|
|
86
86
|
});
|
|
87
87
|
pendingPermissionContexts.delete(contextHash);
|
|
88
88
|
// Update message: show result and remove dropdown
|
package/dist/session-handler.js
CHANGED
|
@@ -136,13 +136,13 @@ export async function handleOpencodeSession({ prompt, thread, projectDirectory,
|
|
|
136
136
|
if (pendingPerm) {
|
|
137
137
|
try {
|
|
138
138
|
sessionLogger.log(`[PERMISSION] Auto-rejecting pending permission ${pendingPerm.permission.id} due to new message`);
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
139
|
+
const clientV2 = getOpencodeClientV2(directory);
|
|
140
|
+
if (clientV2) {
|
|
141
|
+
await clientV2.permission.reply({
|
|
142
|
+
requestID: pendingPerm.permission.id,
|
|
143
|
+
reply: 'reject',
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
146
|
// Clean up both the pending permission and its dropdown context
|
|
147
147
|
cleanupPermissionContext(pendingPerm.contextHash);
|
|
148
148
|
pendingPermissions.delete(thread.id);
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from 'discord.js'
|
|
11
11
|
import crypto from 'node:crypto'
|
|
12
12
|
import type { PermissionRequest } from '@opencode-ai/sdk/v2'
|
|
13
|
-
import {
|
|
13
|
+
import { getOpencodeClientV2 } from '../opencode.js'
|
|
14
14
|
import { NOTIFY_MESSAGE_FLAGS } from '../discord-utils.js'
|
|
15
15
|
import { createLogger } from '../logger.js'
|
|
16
16
|
|
|
@@ -120,13 +120,13 @@ export async function handlePermissionSelectMenu(
|
|
|
120
120
|
const response = interaction.values[0] as 'once' | 'always' | 'reject'
|
|
121
121
|
|
|
122
122
|
try {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
const clientV2 = getOpencodeClientV2(context.directory)
|
|
124
|
+
if (!clientV2) {
|
|
125
|
+
throw new Error('OpenCode server not found for directory')
|
|
126
|
+
}
|
|
127
|
+
await clientV2.permission.reply({
|
|
128
|
+
requestID: context.permission.id,
|
|
129
|
+
reply: response,
|
|
130
130
|
})
|
|
131
131
|
|
|
132
132
|
pendingPermissionContexts.delete(contextHash)
|
package/src/session-handler.ts
CHANGED
|
@@ -221,13 +221,13 @@ export async function handleOpencodeSession({
|
|
|
221
221
|
if (pendingPerm) {
|
|
222
222
|
try {
|
|
223
223
|
sessionLogger.log(`[PERMISSION] Auto-rejecting pending permission ${pendingPerm.permission.id} due to new message`)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
224
|
+
const clientV2 = getOpencodeClientV2(directory)
|
|
225
|
+
if (clientV2) {
|
|
226
|
+
await clientV2.permission.reply({
|
|
227
|
+
requestID: pendingPerm.permission.id,
|
|
228
|
+
reply: 'reject',
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
231
|
// Clean up both the pending permission and its dropdown context
|
|
232
232
|
cleanupPermissionContext(pendingPerm.contextHash)
|
|
233
233
|
pendingPermissions.delete(thread.id)
|