@icaruk/zai-peak-hours 0.0.5 → 0.0.8
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/index.d.ts +1 -1
- package/dist/index.js +5 -22
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Plugin } from '@opencode-ai/plugin';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const PeakHours: Plugin;
|
package/dist/index.js
CHANGED
|
@@ -38,9 +38,7 @@ async function showPeakHoursToast(client) {
|
|
|
38
38
|
if (!config.enabled) {
|
|
39
39
|
await client.tui.showToast({
|
|
40
40
|
body: {
|
|
41
|
-
message: 'Peak Hours plugin is disabled in config'
|
|
42
|
-
variant: 'info',
|
|
43
|
-
duration: 3000
|
|
41
|
+
message: 'Peak Hours plugin is disabled in config'
|
|
44
42
|
}
|
|
45
43
|
});
|
|
46
44
|
return;
|
|
@@ -49,9 +47,7 @@ async function showPeakHoursToast(client) {
|
|
|
49
47
|
const message = formatPeakHoursMessage(status);
|
|
50
48
|
await client.tui.showToast({
|
|
51
49
|
body: {
|
|
52
|
-
message
|
|
53
|
-
variant: status.inPeakHours ? 'warning' : 'info',
|
|
54
|
-
duration: 5000
|
|
50
|
+
message
|
|
55
51
|
}
|
|
56
52
|
});
|
|
57
53
|
}
|
|
@@ -65,25 +61,15 @@ Update interval: ${config.updateIntervalMinutes} minutes
|
|
|
65
61
|
Current time: ${currentTime}
|
|
66
62
|
In peak hours: ${status.inPeakHours}
|
|
67
63
|
Time until ${status.transitionType}: ${status.timeUntilTransition}
|
|
68
|
-
|
|
64
|
+
===================================`;
|
|
69
65
|
await client.tui.showToast({
|
|
70
66
|
body: {
|
|
71
|
-
message: diagnostics
|
|
72
|
-
variant: 'info',
|
|
73
|
-
duration: 8000
|
|
67
|
+
message: diagnostics
|
|
74
68
|
}
|
|
75
69
|
});
|
|
76
70
|
}
|
|
77
|
-
export const
|
|
71
|
+
export const PeakHours = async ({ client }) => {
|
|
78
72
|
const config = loadConfig();
|
|
79
|
-
const updateInterval = config.updateIntervalMinutes * 60 * 1000;
|
|
80
|
-
await client.tui.showToast({
|
|
81
|
-
body: {
|
|
82
|
-
message: 'Peak Hours Plugin loaded successfully',
|
|
83
|
-
variant: 'info',
|
|
84
|
-
duration: 3000
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
73
|
return {
|
|
88
74
|
config: async (input) => {
|
|
89
75
|
input.command ?? (input.command = {});
|
|
@@ -112,9 +98,6 @@ export const PeakHoursPlugin = async ({ client }) => {
|
|
|
112
98
|
return;
|
|
113
99
|
}
|
|
114
100
|
await showPeakHoursToast(client);
|
|
115
|
-
timerId = setInterval(async () => {
|
|
116
|
-
await showPeakHoursToast(client);
|
|
117
|
-
}, updateInterval);
|
|
118
101
|
},
|
|
119
102
|
tool: {
|
|
120
103
|
'peak_hours': tool({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icaruk/zai-peak-hours",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin to display z.ai peak hours information with automatic timezone detection",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@opencode-ai/plugin": "^1.4.0",
|
|
30
|
+
"@opencode-ai/sdk": "^1.4.3",
|
|
30
31
|
"dayjs": "^1.11.10"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|