@nocville/npc 0.2.3 → 0.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.
- package/README.md +36 -15
- package/dist/cjs/cli.js +44 -8
- package/dist/cjs/core/base-npc.js +7 -0
- package/dist/cjs/core/polling-npc.js +8 -0
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/npcs/agent-common/shim.js +8 -2
- package/dist/cjs/npcs/github-watcher/github.js +109 -0
- package/dist/cjs/npcs/office-characters/index.js +102 -0
- package/dist/cjs/npcs/process-watcher/index.js +0 -1
- package/dist/cjs/npcs/process-watcher/process-scanner.js +42 -4
- package/dist/cjs/npcs/receptionist/index.js +6 -119
- package/dist/cjs/npcs/security/index.js +26 -0
- package/dist/cjs/npcs/web-page-watcher/basic.js +58 -0
- package/dist/cjs/npcs/web-page-watcher/capture.js +26 -0
- package/dist/cjs/npcs/web-page-watcher/chrome.js +62 -0
- package/dist/cli.js +44 -8
- package/dist/core/base-npc.js +7 -0
- package/dist/core/polling-npc.d.ts +3 -0
- package/dist/core/polling-npc.js +8 -0
- package/dist/core/types.d.ts +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/npcs/agent-common/shim.js +8 -2
- package/dist/npcs/github-watcher/github.d.ts +39 -0
- package/dist/npcs/github-watcher/github.js +103 -0
- package/dist/npcs/office-characters/index.d.ts +55 -0
- package/dist/npcs/office-characters/index.js +91 -0
- package/dist/npcs/process-watcher/index.js +1 -2
- package/dist/npcs/process-watcher/process-scanner.d.ts +3 -1
- package/dist/npcs/process-watcher/process-scanner.js +41 -4
- package/dist/npcs/receptionist/index.d.ts +2 -21
- package/dist/npcs/receptionist/index.js +6 -119
- package/dist/npcs/security/index.d.ts +12 -0
- package/dist/npcs/security/index.js +22 -0
- package/dist/npcs/web-page-watcher/basic.d.ts +16 -0
- package/dist/npcs/web-page-watcher/basic.js +52 -0
- package/dist/npcs/web-page-watcher/capture.js +26 -0
- package/dist/npcs/web-page-watcher/chrome.d.ts +46 -0
- package/dist/npcs/web-page-watcher/chrome.js +57 -0
- package/package.json +2 -2
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
const CHROME_PATHS = {
|
|
3
|
+
darwin: [
|
|
4
|
+
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
|
5
|
+
'/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
|
|
6
|
+
'/Applications/Chromium.app/Contents/MacOS/Chromium',
|
|
7
|
+
'/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge',
|
|
8
|
+
],
|
|
9
|
+
linux: [
|
|
10
|
+
'/usr/bin/google-chrome',
|
|
11
|
+
'/usr/bin/google-chrome-stable',
|
|
12
|
+
'/usr/bin/chromium',
|
|
13
|
+
'/usr/bin/chromium-browser',
|
|
14
|
+
'/usr/bin/microsoft-edge',
|
|
15
|
+
'/snap/bin/chromium',
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
/** Find a usable Chrome/Chromium executable: explicit path → env → known paths. */
|
|
19
|
+
export function findChrome(explicit) {
|
|
20
|
+
const envPath = process.env['CHROME_PATH'];
|
|
21
|
+
const candidates = [
|
|
22
|
+
...(explicit ? [explicit] : []),
|
|
23
|
+
...(envPath ? [envPath] : []),
|
|
24
|
+
...(CHROME_PATHS[process.platform] ?? []),
|
|
25
|
+
];
|
|
26
|
+
for (const p of candidates) {
|
|
27
|
+
if (p && existsSync(p))
|
|
28
|
+
return p;
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Load the optional `puppeteer-core` peer dependency without a static import,
|
|
34
|
+
* so the package builds and runs when it isn't installed. Returns null if the
|
|
35
|
+
* module is absent.
|
|
36
|
+
*/
|
|
37
|
+
export async function loadPuppeteer() {
|
|
38
|
+
try {
|
|
39
|
+
// Indirect dynamic import so TypeScript/bundlers don't require the module
|
|
40
|
+
// at build time.
|
|
41
|
+
const dynImport = new Function('m', 'return import(m)');
|
|
42
|
+
const mod = await dynImport('puppeteer-core');
|
|
43
|
+
return (mod.default ?? mod);
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/** True if the browser reports a live connection. */
|
|
50
|
+
export function browserConnected(browser) {
|
|
51
|
+
if (typeof browser.connected === 'boolean')
|
|
52
|
+
return browser.connected;
|
|
53
|
+
if (typeof browser.isConnected === 'function')
|
|
54
|
+
return browser.isConnected();
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=chrome.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocville/npc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Put your Claude Code and Codex sessions (and your servers) in the Nocville office as live NPCs",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"pngjs": "^7.0.0",
|
|
27
|
-
"@nocville/node": "^0.
|
|
27
|
+
"@nocville/node": "^0.3.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"puppeteer-core": "*"
|