opencode-plugin-apprise 1.1.0 → 1.2.0
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/dist/hooks/idle.d.ts +1 -1
- package/dist/opencode-plugin-apprise.js +10 -16
- package/dist/types.d.ts +1 -2
- package/package.json +1 -1
- package/dist/hooks/background.d.ts +0 -4
package/dist/hooks/idle.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Hooks, PluginInput } from "@opencode-ai/plugin";
|
|
2
2
|
import type { DedupChecker } from "../dedup.js";
|
|
3
3
|
import type { PluginConfig } from "../types.js";
|
|
4
|
-
export declare function createIdleHook(ctx: PluginInput, config: PluginConfig, dedup: DedupChecker): NonNullable<Hooks["event"]>;
|
|
4
|
+
export declare function createIdleHook(ctx: PluginInput, config: PluginConfig, dedup: DedupChecker, interactiveSessions: Set<string>): NonNullable<Hooks["event"]>;
|
|
@@ -54,7 +54,6 @@ function createDedupChecker() {
|
|
|
54
54
|
var TYPE_MAP = {
|
|
55
55
|
idle: "info",
|
|
56
56
|
question: "warning",
|
|
57
|
-
background: "success",
|
|
58
57
|
permission: "warning"
|
|
59
58
|
};
|
|
60
59
|
var DEFAULT_TRUNCATE_LENGTH = 1500;
|
|
@@ -127,17 +126,6 @@ ${context.options.map((option, index) => ` ${index + 1}. ${option}`).join(`
|
|
|
127
126
|
}
|
|
128
127
|
body = parts.join(`
|
|
129
128
|
|
|
130
|
-
`);
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
case "background": {
|
|
134
|
-
const parts = [];
|
|
135
|
-
if (context.taskName)
|
|
136
|
-
parts.push(`Task: ${context.taskName}`);
|
|
137
|
-
if (context.agentResponse)
|
|
138
|
-
parts.push(`Result: ${context.agentResponse}`);
|
|
139
|
-
body = parts.join(`
|
|
140
|
-
|
|
141
129
|
`);
|
|
142
130
|
break;
|
|
143
131
|
}
|
|
@@ -220,7 +208,6 @@ var EMPTY_CONTEXT = {
|
|
|
220
208
|
question: undefined,
|
|
221
209
|
options: undefined,
|
|
222
210
|
todoStatus: undefined,
|
|
223
|
-
taskName: undefined,
|
|
224
211
|
toolName: undefined,
|
|
225
212
|
action: undefined
|
|
226
213
|
};
|
|
@@ -251,7 +238,7 @@ function extractText(message) {
|
|
|
251
238
|
return parts.join(`
|
|
252
239
|
`).trim() || undefined;
|
|
253
240
|
}
|
|
254
|
-
function createIdleHook(ctx, config, dedup) {
|
|
241
|
+
function createIdleHook(ctx, config, dedup, interactiveSessions) {
|
|
255
242
|
return async ({ event }) => {
|
|
256
243
|
if (event.type !== "session.status")
|
|
257
244
|
return;
|
|
@@ -260,6 +247,8 @@ function createIdleHook(ctx, config, dedup) {
|
|
|
260
247
|
return;
|
|
261
248
|
if (!props.sessionID)
|
|
262
249
|
return;
|
|
250
|
+
if (!interactiveSessions.has(props.sessionID))
|
|
251
|
+
return;
|
|
263
252
|
let userRequest = undefined;
|
|
264
253
|
let agentResponse = undefined;
|
|
265
254
|
let todoStatus = undefined;
|
|
@@ -392,7 +381,8 @@ var plugin = async (input) => {
|
|
|
392
381
|
return {};
|
|
393
382
|
}
|
|
394
383
|
const dedup = createDedupChecker();
|
|
395
|
-
const
|
|
384
|
+
const interactiveSessions = new Set;
|
|
385
|
+
const idleHook = createIdleHook(input, config, dedup, interactiveSessions);
|
|
396
386
|
const questionHook = createQuestionHook(config, dedup);
|
|
397
387
|
const permissionHooks = createPermissionHooks(config, dedup);
|
|
398
388
|
const combinedEventHook = async ({ event }) => {
|
|
@@ -400,9 +390,13 @@ var plugin = async (input) => {
|
|
|
400
390
|
await permissionHooks.eventFallback({ event });
|
|
401
391
|
await idleHook({ event });
|
|
402
392
|
};
|
|
393
|
+
const chatMessageHook = async (input2) => {
|
|
394
|
+
interactiveSessions.add(input2.sessionID);
|
|
395
|
+
};
|
|
403
396
|
return {
|
|
404
397
|
event: combinedEventHook,
|
|
405
|
-
"permission.ask": permissionHooks.permissionAsk
|
|
398
|
+
"permission.ask": permissionHooks.permissionAsk,
|
|
399
|
+
"chat.message": chatMessageHook
|
|
406
400
|
};
|
|
407
401
|
};
|
|
408
402
|
var src_default = plugin;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export interface PluginConfig {
|
|
2
2
|
tag?: string;
|
|
3
3
|
}
|
|
4
|
-
export type HookEventType = "idle" | "question" | "
|
|
4
|
+
export type HookEventType = "idle" | "question" | "permission";
|
|
5
5
|
export type AppriseNotificationType = "info" | "warning" | "success" | "failure";
|
|
6
6
|
export interface NotificationContext {
|
|
7
7
|
userRequest: string | undefined;
|
|
@@ -9,7 +9,6 @@ export interface NotificationContext {
|
|
|
9
9
|
question: string | undefined;
|
|
10
10
|
options: string[] | undefined;
|
|
11
11
|
todoStatus: string | undefined;
|
|
12
|
-
taskName: string | undefined;
|
|
13
12
|
toolName: string | undefined;
|
|
14
13
|
action: string | undefined;
|
|
15
14
|
}
|
package/package.json
CHANGED