@ulthon/ul-opencode-event 0.1.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/LICENSE +21 -0
- package/README.md +154 -0
- package/dist/config.d.ts +25 -0
- package/dist/email.d.ts +10 -0
- package/dist/handler.d.ts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +10080 -0
- package/dist/template.d.ts +5 -0
- package/dist/types.d.ts +95 -0
- package/package.json +53 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification Plugin Type Definitions
|
|
3
|
+
* Supports multi-channel notification with SMTP, Feishu, and DingTalk
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Main configuration interface for the notification plugin
|
|
7
|
+
*/
|
|
8
|
+
export interface NotificationConfig {
|
|
9
|
+
channels: Channel[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Generic channel interface
|
|
13
|
+
*/
|
|
14
|
+
export interface Channel {
|
|
15
|
+
type: ChannelType;
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
name?: string;
|
|
18
|
+
config: ChannelConfig;
|
|
19
|
+
recipients?: string[];
|
|
20
|
+
events: EventConfig;
|
|
21
|
+
templates?: ChannelTemplates;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Supported channel types
|
|
25
|
+
* Phase 1: Only SMTP is implemented
|
|
26
|
+
*/
|
|
27
|
+
export type ChannelType = 'smtp' | 'feishu' | 'dingtalk';
|
|
28
|
+
/**
|
|
29
|
+
* Union type for channel-specific configurations
|
|
30
|
+
*/
|
|
31
|
+
export type ChannelConfig = SMTPConfig | FeishuConfig | DingtalkConfig;
|
|
32
|
+
/**
|
|
33
|
+
* SMTP channel configuration
|
|
34
|
+
*/
|
|
35
|
+
export interface SMTPConfig {
|
|
36
|
+
host: string;
|
|
37
|
+
port: number;
|
|
38
|
+
secure?: boolean;
|
|
39
|
+
auth: {
|
|
40
|
+
user: string;
|
|
41
|
+
pass: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Feishu channel configuration (placeholder for future)
|
|
46
|
+
*/
|
|
47
|
+
export interface FeishuConfig {
|
|
48
|
+
webhook: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* DingTalk channel configuration (placeholder for future)
|
|
52
|
+
*/
|
|
53
|
+
export interface DingtalkConfig {
|
|
54
|
+
webhook: string;
|
|
55
|
+
secret?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Event subscription configuration
|
|
59
|
+
*/
|
|
60
|
+
export interface EventConfig {
|
|
61
|
+
created?: boolean;
|
|
62
|
+
idle?: boolean;
|
|
63
|
+
error?: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Channel-specific templates for different events
|
|
67
|
+
*/
|
|
68
|
+
export interface ChannelTemplates {
|
|
69
|
+
created?: TemplateConfig;
|
|
70
|
+
idle?: TemplateConfig;
|
|
71
|
+
error?: TemplateConfig;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Email template configuration
|
|
75
|
+
*/
|
|
76
|
+
export interface TemplateConfig {
|
|
77
|
+
subject?: string;
|
|
78
|
+
body?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Event payload structure
|
|
82
|
+
*/
|
|
83
|
+
export interface EventPayload {
|
|
84
|
+
eventType: EventType;
|
|
85
|
+
timestamp: string;
|
|
86
|
+
projectName: string;
|
|
87
|
+
sessionId: string;
|
|
88
|
+
message?: string;
|
|
89
|
+
error?: string;
|
|
90
|
+
duration?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Supported event types
|
|
94
|
+
*/
|
|
95
|
+
export type EventType = 'created' | 'idle' | 'error';
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ulthon/ul-opencode-event",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "OpenCode notification plugin - sends email when session events occur",
|
|
5
|
+
"author": "augushong",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "dist/index.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://gitee.com/augushong/ul-opencode-event.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://gitee.com/augushong/ul-opencode-event/issues"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://gitee.com/augushong/ul-opencode-event#readme",
|
|
24
|
+
"keywords": [
|
|
25
|
+
"opencode",
|
|
26
|
+
"plugin",
|
|
27
|
+
"notification",
|
|
28
|
+
"email",
|
|
29
|
+
"smtp"
|
|
30
|
+
],
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "bun build src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly",
|
|
37
|
+
"test": "bun test",
|
|
38
|
+
"lint": "eslint src",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"prepublishOnly": "bun run build"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"nodemailer": "^6.9.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@opencode-ai/plugin": "latest",
|
|
47
|
+
"@types/nodemailer": "^6.4.0",
|
|
48
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
49
|
+
"bun-types": "^1.3.10",
|
|
50
|
+
"eslint": "^9.0.0",
|
|
51
|
+
"typescript": "^5.0.0"
|
|
52
|
+
}
|
|
53
|
+
}
|