clikit-plugin 0.1.9 → 0.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/cli.js
CHANGED
|
@@ -6,9 +6,17 @@ import * as fs from "fs";
|
|
|
6
6
|
import * as path from "path";
|
|
7
7
|
import * as os from "os";
|
|
8
8
|
var PLUGIN_NAME = "clikit-plugin";
|
|
9
|
-
var VERSION = "0.
|
|
9
|
+
var VERSION = "0.2.0";
|
|
10
10
|
function getRealHome() {
|
|
11
|
-
|
|
11
|
+
if (process.env.SNAP_REAL_HOME) {
|
|
12
|
+
return process.env.SNAP_REAL_HOME;
|
|
13
|
+
}
|
|
14
|
+
const home = os.homedir();
|
|
15
|
+
const snapMatch = home.match(/^(\/home\/[^/]+)\/snap\//);
|
|
16
|
+
if (snapMatch) {
|
|
17
|
+
return snapMatch[1];
|
|
18
|
+
}
|
|
19
|
+
return home;
|
|
12
20
|
}
|
|
13
21
|
function getConfigDir() {
|
|
14
22
|
const home = getRealHome();
|
|
@@ -17,7 +17,7 @@ export interface NotificationPayload {
|
|
|
17
17
|
urgency?: "low" | "normal" | "critical";
|
|
18
18
|
}
|
|
19
19
|
export declare function sendNotification(payload: NotificationPayload): boolean;
|
|
20
|
-
export declare function buildIdleNotification(sessionId?:
|
|
21
|
-
export declare function buildErrorNotification(error: unknown, sessionId?:
|
|
20
|
+
export declare function buildIdleNotification(sessionId?: unknown, prefix?: string): NotificationPayload;
|
|
21
|
+
export declare function buildErrorNotification(error: unknown, sessionId?: unknown, prefix?: string): NotificationPayload;
|
|
22
22
|
export declare function formatNotificationLog(payload: NotificationPayload, sent: boolean): string;
|
|
23
23
|
//# sourceMappingURL=session-notification.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-notification.d.ts","sourceRoot":"","sources":["../../src/hooks/session-notification.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;CACzC;AA0BD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAsBtE;AAED,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"session-notification.d.ts","sourceRoot":"","sources":["../../src/hooks/session-notification.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,WAAW,yBAAyB;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,UAAU,CAAC;CACzC;AA0BD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAsBtE;AAED,wBAAgB,qBAAqB,CACnC,SAAS,CAAC,EAAE,OAAO,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,mBAAmB,CAUrB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,OAAO,EACnB,MAAM,CAAC,EAAE,MAAM,GACd,mBAAmB,CAerB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAIzF"}
|
package/dist/index.js
CHANGED
|
@@ -4424,18 +4424,20 @@ function sendNotification(payload) {
|
|
|
4424
4424
|
}
|
|
4425
4425
|
function buildIdleNotification(sessionId, prefix) {
|
|
4426
4426
|
const titlePrefix = prefix || "OpenCode";
|
|
4427
|
+
const sid = typeof sessionId === "string" ? sessionId : undefined;
|
|
4427
4428
|
return {
|
|
4428
4429
|
title: `${titlePrefix} \u2014 Task Complete`,
|
|
4429
|
-
body:
|
|
4430
|
+
body: sid ? `Session ${sid.substring(0, 8)} is idle and waiting for input.` : "Session is idle and waiting for input.",
|
|
4430
4431
|
urgency: "normal"
|
|
4431
4432
|
};
|
|
4432
4433
|
}
|
|
4433
4434
|
function buildErrorNotification(error, sessionId, prefix) {
|
|
4434
4435
|
const titlePrefix = prefix || "OpenCode";
|
|
4435
4436
|
const errorStr = typeof error === "string" ? error : error instanceof Error ? error.message : String(error);
|
|
4437
|
+
const sid = typeof sessionId === "string" ? sessionId : undefined;
|
|
4436
4438
|
return {
|
|
4437
4439
|
title: `${titlePrefix} \u2014 Error`,
|
|
4438
|
-
body:
|
|
4440
|
+
body: sid ? `Session ${sid.substring(0, 8)}: ${errorStr.substring(0, 100)}` : errorStr.substring(0, 120),
|
|
4439
4441
|
urgency: "critical"
|
|
4440
4442
|
};
|
|
4441
4443
|
}
|