@pellux/goodvibes-sdk 1.3.0 → 1.3.1
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.
|
@@ -20,9 +20,14 @@ export interface NotifyOptions {
|
|
|
20
20
|
force?: boolean;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* True when this call must
|
|
24
|
-
*
|
|
25
|
-
* whoever's desktop
|
|
23
|
+
* True when this call must not reach an external side effect: real desktop
|
|
24
|
+
* notifications (notify-send/osascript) and real webhook HTTP deliveries must
|
|
25
|
+
* never fire from an automated test run and spam whoever's desktop or endpoint
|
|
26
|
+
* the tests happen to execute on.
|
|
27
|
+
*
|
|
28
|
+
* Note this governs only the external shell-out/HTTP layer. The in-process
|
|
29
|
+
* terminal bell (a single \x07 byte written to this process's own stdout) has
|
|
30
|
+
* no external side effect and is NOT gated by this — see {@link notifyCompletion}.
|
|
26
31
|
*
|
|
27
32
|
* Suppressed when either:
|
|
28
33
|
* - `NODE_ENV === 'test'` (set automatically by `bun test`), or
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/notify.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAKrF;;;;;;;;GAQG;AACH,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED
|
|
1
|
+
{"version":3,"file":"notify.d.ts","sourceRoot":"","sources":["../../../src/platform/utils/notify.ts"],"names":[],"mappings":"AAAA,qFAAqF;AAKrF;;;;;;;;GAQG;AACH,iFAAiF;AACjF,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,CAM3D;AAiCD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAgClH"}
|
|
@@ -15,9 +15,14 @@ export function escapeAppleScript(s) {
|
|
|
15
15
|
return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* True when this call must
|
|
19
|
-
*
|
|
20
|
-
* whoever's desktop
|
|
18
|
+
* True when this call must not reach an external side effect: real desktop
|
|
19
|
+
* notifications (notify-send/osascript) and real webhook HTTP deliveries must
|
|
20
|
+
* never fire from an automated test run and spam whoever's desktop or endpoint
|
|
21
|
+
* the tests happen to execute on.
|
|
22
|
+
*
|
|
23
|
+
* Note this governs only the external shell-out/HTTP layer. The in-process
|
|
24
|
+
* terminal bell (a single \x07 byte written to this process's own stdout) has
|
|
25
|
+
* no external side effect and is NOT gated by this — see {@link notifyCompletion}.
|
|
21
26
|
*
|
|
22
27
|
* Suppressed when either:
|
|
23
28
|
* - `NODE_ENV === 'test'` (set automatically by `bun test`), or
|
|
@@ -68,19 +73,28 @@ function spawnNotification(command) {
|
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
export function notifyCompletion(title, message, durationMs, options) {
|
|
71
|
-
if (isNotifySuppressed(options?.force)) {
|
|
72
|
-
logger.debug('Completion notification suppressed under test', { title, durationMs });
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
76
|
// Terminal bell for responses > 5s.
|
|
76
77
|
// Surface-specific: this writes directly to stdout and is only meaningful
|
|
77
78
|
// in a terminal context. Host surfaces that manage their own output stream
|
|
78
79
|
// should inject this behaviour via a callback rather than calling it here.
|
|
80
|
+
//
|
|
81
|
+
// The bell is an in-process byte write with no external side effect, so it
|
|
82
|
+
// is emitted even under test suppression — only the real desktop-notification
|
|
83
|
+
// spawn below is suppressed. (This is the notify-guard scope fix: silencing a
|
|
84
|
+
// test run must not silence the terminal bell, which several host surfaces
|
|
85
|
+
// assert as product behaviour.)
|
|
79
86
|
if (durationMs > 5000) {
|
|
80
87
|
process.stdout.write('\x07');
|
|
81
88
|
}
|
|
82
|
-
// Desktop notification for responses > 30s
|
|
89
|
+
// Desktop notification for responses > 30s. Real notify-send/osascript
|
|
90
|
+
// spawns must never fire from an automated test run — suppressed under
|
|
91
|
+
// NODE_ENV=test / GOODVIBES_SUPPRESS_NOTIFY, with `force` as the opt-back-in
|
|
92
|
+
// for tests that exercise this shell-out layer itself.
|
|
83
93
|
if (durationMs > 30000) {
|
|
94
|
+
if (isNotifySuppressed(options?.force)) {
|
|
95
|
+
logger.debug('Completion desktop notification suppressed under test', { title, durationMs });
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
84
98
|
if (process.platform === 'linux') {
|
|
85
99
|
spawnNotification(['notify-send', title, message]);
|
|
86
100
|
}
|
package/dist/platform/version.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
let version = '1.3.
|
|
3
|
+
let version = '1.3.1';
|
|
4
4
|
try {
|
|
5
5
|
const pkg = JSON.parse(readFileSync(join(import.meta.dir, '..', '..', 'package.json'), 'utf-8'));
|
|
6
6
|
version = pkg.version ?? version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pellux/goodvibes-sdk",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "TypeScript SDK for building GoodVibes operator, peer, web, mobile, and daemon-connected apps with typed contracts, auth, realtime events, and transport layers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"goodvibes",
|
|
@@ -477,14 +477,14 @@
|
|
|
477
477
|
"sideEffects": false,
|
|
478
478
|
"type": "module",
|
|
479
479
|
"dependencies": {
|
|
480
|
-
"@pellux/goodvibes-contracts": "1.3.
|
|
481
|
-
"@pellux/goodvibes-daemon-sdk": "1.3.
|
|
482
|
-
"@pellux/goodvibes-errors": "1.3.
|
|
483
|
-
"@pellux/goodvibes-operator-sdk": "1.3.
|
|
484
|
-
"@pellux/goodvibes-peer-sdk": "1.3.
|
|
485
|
-
"@pellux/goodvibes-transport-core": "1.3.
|
|
486
|
-
"@pellux/goodvibes-transport-http": "1.3.
|
|
487
|
-
"@pellux/goodvibes-transport-realtime": "1.3.
|
|
480
|
+
"@pellux/goodvibes-contracts": "1.3.1",
|
|
481
|
+
"@pellux/goodvibes-daemon-sdk": "1.3.1",
|
|
482
|
+
"@pellux/goodvibes-errors": "1.3.1",
|
|
483
|
+
"@pellux/goodvibes-operator-sdk": "1.3.1",
|
|
484
|
+
"@pellux/goodvibes-peer-sdk": "1.3.1",
|
|
485
|
+
"@pellux/goodvibes-transport-core": "1.3.1",
|
|
486
|
+
"@pellux/goodvibes-transport-http": "1.3.1",
|
|
487
|
+
"@pellux/goodvibes-transport-realtime": "1.3.1"
|
|
488
488
|
},
|
|
489
489
|
"optionalDependencies": {
|
|
490
490
|
"@agentclientprotocol/sdk": "^0.21.0",
|