opencode-plugin-apprise 1.2.3 → 1.2.5
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/opencode-plugin-apprise.js +14 -9
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -76,12 +76,14 @@ function formatNotification(payload) {
|
|
|
76
76
|
switch (type) {
|
|
77
77
|
case "idle": {
|
|
78
78
|
const parts = [];
|
|
79
|
+
if (context.sessionTitle)
|
|
80
|
+
parts.push(`\uD83D\uDCCC TITLE: ${context.sessionTitle}`);
|
|
79
81
|
if (context.userRequest)
|
|
80
|
-
parts.push(`\uD83D\uDCDD
|
|
82
|
+
parts.push(`\uD83D\uDCDD REQUEST: ${context.userRequest}`);
|
|
81
83
|
if (context.agentResponse)
|
|
82
|
-
parts.push(`\uD83E\uDD16
|
|
84
|
+
parts.push(`\uD83E\uDD16 RESPONSE: ${context.agentResponse}`);
|
|
83
85
|
if (context.todoStatus)
|
|
84
|
-
parts.push(`\uD83D\uDCCB
|
|
86
|
+
parts.push(`\uD83D\uDCCB TODO: ${context.todoStatus}`);
|
|
85
87
|
body = parts.join(`
|
|
86
88
|
|
|
87
89
|
`);
|
|
@@ -89,12 +91,12 @@ function formatNotification(payload) {
|
|
|
89
91
|
}
|
|
90
92
|
case "question": {
|
|
91
93
|
const parts = [];
|
|
92
|
-
if (context.
|
|
93
|
-
parts.push(`\uD83D\
|
|
94
|
+
if (context.sessionTitle)
|
|
95
|
+
parts.push(`\uD83D\uDCCC TITLE: ${context.sessionTitle}`);
|
|
94
96
|
if (context.question)
|
|
95
|
-
parts.push(`❓
|
|
97
|
+
parts.push(`❓ QUESTION: ${context.question}`);
|
|
96
98
|
if (context.options && context.options.length > 0) {
|
|
97
|
-
parts.push(`
|
|
99
|
+
parts.push(`OPTIONS:
|
|
98
100
|
${context.options.map((option, index) => ` ${index + 1}. ${option}`).join(`
|
|
99
101
|
`)}`);
|
|
100
102
|
}
|
|
@@ -106,9 +108,9 @@ ${context.options.map((option, index) => ` ${index + 1}. ${option}`).join(`
|
|
|
106
108
|
case "permission": {
|
|
107
109
|
const parts = [];
|
|
108
110
|
if (context.toolName)
|
|
109
|
-
parts.push(`\uD83D\uDD27
|
|
111
|
+
parts.push(`\uD83D\uDD27 TOOL: ${context.toolName}`);
|
|
110
112
|
if (context.action)
|
|
111
|
-
parts.push(`⚡
|
|
113
|
+
parts.push(`⚡ ACTION: ${context.action}`);
|
|
112
114
|
body = parts.join(`
|
|
113
115
|
|
|
114
116
|
`);
|
|
@@ -176,6 +178,7 @@ async function sendNotification(config, notification) {
|
|
|
176
178
|
|
|
177
179
|
// src/hooks/shared.ts
|
|
178
180
|
var EMPTY_CONTEXT = {
|
|
181
|
+
sessionTitle: undefined,
|
|
179
182
|
userRequest: undefined,
|
|
180
183
|
agentResponse: undefined,
|
|
181
184
|
question: undefined,
|
|
@@ -246,6 +249,7 @@ function createIdleHook(ctx, config, dedup, delayMs = 30000) {
|
|
|
246
249
|
const sessionInfo = sessionResponse.data;
|
|
247
250
|
if (sessionInfo.parentID)
|
|
248
251
|
return;
|
|
252
|
+
const sessionTitle = sessionInfo.title || undefined;
|
|
249
253
|
const messagesResponse = await ctx.client.session.messages({
|
|
250
254
|
path: { id: sessionID }
|
|
251
255
|
});
|
|
@@ -277,6 +281,7 @@ function createIdleHook(ctx, config, dedup, delayMs = 30000) {
|
|
|
277
281
|
}
|
|
278
282
|
} catch {}
|
|
279
283
|
const payload = createPayload("idle", "\uD83D\uDCE2 OpenCode Attention Required", {
|
|
284
|
+
sessionTitle,
|
|
280
285
|
userRequest,
|
|
281
286
|
agentResponse,
|
|
282
287
|
todoStatus
|
package/dist/types.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface PluginConfig {
|
|
|
4
4
|
export type HookEventType = "idle" | "question" | "permission";
|
|
5
5
|
export type AppriseNotificationType = "info" | "warning" | "success" | "failure";
|
|
6
6
|
export interface NotificationContext {
|
|
7
|
+
sessionTitle: string | undefined;
|
|
7
8
|
userRequest: string | undefined;
|
|
8
9
|
agentResponse: string | undefined;
|
|
9
10
|
question: string | undefined;
|
package/package.json
CHANGED