sinapse-ai 1.14.0 → 1.15.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/.sinapse-ai/data/entity-registry.yaml +9 -11
- package/.sinapse-ai/development/templates/chrome-brain/rules/chrome-brain-autoload.md +4 -0
- package/.sinapse-ai/development/templates/chrome-brain/scripts/chrome-brain-log.cjs +78 -0
- package/.sinapse-ai/development/templates/chrome-brain/scripts/chrome-ensure.cjs +108 -0
- package/.sinapse-ai/install-manifest.yaml +22 -10
- package/.sinapse-ai/product/templates/statusline/agent-badges.json +862 -0
- package/.sinapse-ai/product/templates/statusline/statusline-script.js +36 -2
- package/.sinapse-ai/product/templates/statusline/track-agent.cjs +119 -9
- package/CHANGELOG.md +3 -6
- package/bin/commands/install.js +22 -44
- package/bin/lib/header.js +14 -10
- package/bin/lib/setup-statusline.js +12 -1
- package/bin/modules/chrome-brain-installer.js +124 -199
- package/package.json +1 -1
- package/scripts/gen-agent-badges.js +105 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
metadata:
|
|
2
2
|
version: 1.0.0
|
|
3
|
-
lastUpdated: '2026-06-
|
|
3
|
+
lastUpdated: '2026-06-24T13:49:06.535Z'
|
|
4
4
|
entityCount: 792
|
|
5
5
|
checksumAlgorithm: sha256
|
|
6
6
|
resolutionRate: 100
|
|
@@ -163,8 +163,8 @@ entities:
|
|
|
163
163
|
score: 0.7
|
|
164
164
|
constraints: []
|
|
165
165
|
extensionPoints: []
|
|
166
|
-
checksum: sha256:
|
|
167
|
-
lastVerified: '2026-06-
|
|
166
|
+
checksum: sha256:626521b1e3cdba60377871b0549a36c0da35ea5f57a9174df65273b5797508e2
|
|
167
|
+
lastVerified: '2026-06-24T05:00:49.158Z'
|
|
168
168
|
local:
|
|
169
169
|
path: bin/commands/local.js
|
|
170
170
|
layer: L1
|
|
@@ -407,8 +407,8 @@ entities:
|
|
|
407
407
|
score: 0.7
|
|
408
408
|
constraints: []
|
|
409
409
|
extensionPoints: []
|
|
410
|
-
checksum: sha256:
|
|
411
|
-
lastVerified: '2026-06-
|
|
410
|
+
checksum: sha256:46f58aab3365467fc31e44b4e5db321aded90de64aa1f81a96305bd65ad90061
|
|
411
|
+
lastVerified: '2026-06-24T05:00:49.160Z'
|
|
412
412
|
prompts:
|
|
413
413
|
path: bin/lib/prompts.js
|
|
414
414
|
layer: L1
|
|
@@ -452,8 +452,8 @@ entities:
|
|
|
452
452
|
score: 0.7
|
|
453
453
|
constraints: []
|
|
454
454
|
extensionPoints: []
|
|
455
|
-
checksum: sha256:
|
|
456
|
-
lastVerified: '2026-06-
|
|
455
|
+
checksum: sha256:05d5dc88053f5d675e58a68f268d53a2f1497eb13ae63ac21f73220ecadcaca4
|
|
456
|
+
lastVerified: '2026-06-24T05:00:49.161Z'
|
|
457
457
|
squads:
|
|
458
458
|
path: bin/lib/squads.js
|
|
459
459
|
layer: L1
|
|
@@ -486,8 +486,6 @@ entities:
|
|
|
486
486
|
- chrome
|
|
487
487
|
- brain
|
|
488
488
|
- installer
|
|
489
|
-
- chrome-ensure
|
|
490
|
-
- (auto-launch)
|
|
491
489
|
usedBy:
|
|
492
490
|
- cli
|
|
493
491
|
- install
|
|
@@ -500,8 +498,8 @@ entities:
|
|
|
500
498
|
score: 0.7
|
|
501
499
|
constraints: []
|
|
502
500
|
extensionPoints: []
|
|
503
|
-
checksum: sha256:
|
|
504
|
-
lastVerified: '2026-06-
|
|
501
|
+
checksum: sha256:e1186d8324dd01d78a9f17c8a5015e51f661d952d70aa339464097e0f3d1fd97
|
|
502
|
+
lastVerified: '2026-06-24T13:49:06.202Z'
|
|
505
503
|
env-config:
|
|
506
504
|
path: bin/modules/env-config.js
|
|
507
505
|
layer: L1
|
|
@@ -21,6 +21,10 @@ When the user's prompt matches ANY of these patterns, Chrome Brain is active:
|
|
|
21
21
|
4. Track screenshot count — max 15 per session
|
|
22
22
|
5. Handoff results to domain squad when applicable
|
|
23
23
|
|
|
24
|
+
## Janela fixa & login (uma vez)
|
|
25
|
+
|
|
26
|
+
A automação roda numa **janela de Chrome dedicada e fixa** (perfil `~/.chrome-debug-profile`), separada do Chrome pessoal do usuário. Ela é lançada **só quando uma tarefa de browser precisa** e **nunca é morta enquanto saudável** (o `chrome-ensure` só relança se a porta estiver realmente fora do ar). Na primeira vez que uma tarefa acessar um site que exige login, o usuário loga **uma vez** nessa janela — o perfil persiste, então não precisa logar de novo. Para logar proativamente em todas as contas de uma vez: `sinapse chrome-brain login`.
|
|
27
|
+
|
|
24
28
|
## Auto-Learning — MANDATORY
|
|
25
29
|
|
|
26
30
|
After completing ANY browser automation task, evaluate:
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Chrome Brain — chrome-brain-log (Node, cross-platform).
|
|
6
|
+
*
|
|
7
|
+
* Called by the PostToolUse hook after every browser MCP tool. Appends a usage
|
|
8
|
+
* line and warns when the per-session screenshot count gets risky (the API has
|
|
9
|
+
* a ~20MB response cap). Node version of the old bash logger so it runs hidden
|
|
10
|
+
* on Windows (no console window) and needs no date/awk/grep.
|
|
11
|
+
*
|
|
12
|
+
* FAIL-SOFT: never throws, always exits 0.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const fs = require('fs');
|
|
16
|
+
const os = require('os');
|
|
17
|
+
const path = require('path');
|
|
18
|
+
|
|
19
|
+
function toolName() {
|
|
20
|
+
// Claude Code passes a JSON payload on stdin; fall back to env then 'unknown'.
|
|
21
|
+
try {
|
|
22
|
+
const raw = fs.readFileSync(0, 'utf8');
|
|
23
|
+
if (raw) {
|
|
24
|
+
const j = JSON.parse(raw);
|
|
25
|
+
return j.tool_name || j.toolName || process.env.HOOK_TOOL_NAME || 'unknown';
|
|
26
|
+
}
|
|
27
|
+
} catch {
|
|
28
|
+
/* no stdin / not JSON */
|
|
29
|
+
}
|
|
30
|
+
return process.env.HOOK_TOOL_NAME || 'unknown';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
const dir = path.join(os.homedir(), '.chrome-brain');
|
|
35
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
36
|
+
|
|
37
|
+
const now = new Date();
|
|
38
|
+
const today = now.toISOString().slice(0, 10).replace(/-/g, ''); // YYYYMMDD
|
|
39
|
+
const time = now.toTimeString().slice(0, 8); // HH:MM:SS
|
|
40
|
+
const tool = toolName();
|
|
41
|
+
|
|
42
|
+
fs.appendFileSync(path.join(dir, `session-${today}.log`), `${time} ${tool}\n`);
|
|
43
|
+
|
|
44
|
+
if (/take_screenshot|take_snapshot/.test(tool)) {
|
|
45
|
+
const countFile = path.join(dir, '.screenshot-count');
|
|
46
|
+
const dateFile = path.join(dir, '.screenshot-date');
|
|
47
|
+
|
|
48
|
+
let lastDate = '';
|
|
49
|
+
try {
|
|
50
|
+
lastDate = fs.readFileSync(dateFile, 'utf8').trim();
|
|
51
|
+
} catch {
|
|
52
|
+
/* first run */
|
|
53
|
+
}
|
|
54
|
+
if (lastDate !== today) {
|
|
55
|
+
fs.writeFileSync(dateFile, today);
|
|
56
|
+
fs.writeFileSync(countFile, '0');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
let count = 0;
|
|
60
|
+
try {
|
|
61
|
+
count = parseInt(fs.readFileSync(countFile, 'utf8'), 10) || 0;
|
|
62
|
+
} catch {
|
|
63
|
+
/* default 0 */
|
|
64
|
+
}
|
|
65
|
+
count += 1;
|
|
66
|
+
fs.writeFileSync(countFile, String(count));
|
|
67
|
+
|
|
68
|
+
if (count === 12) {
|
|
69
|
+
process.stderr.write('WARNING: 12 screenshots this session. Consider saving state and rotating.\n');
|
|
70
|
+
} else if (count >= 15) {
|
|
71
|
+
process.stderr.write('CRITICAL: 15+ screenshots. Session at risk of the API size cap. Save state NOW.\n');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
} catch {
|
|
75
|
+
/* fail-soft */
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
process.exit(0);
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Chrome Brain — chrome-ensure (Node, cross-platform).
|
|
6
|
+
*
|
|
7
|
+
* Called by the PreToolUse hook before any browser MCP tool. Guarantees the
|
|
8
|
+
* SINGLE fixed-profile debug Chrome is up on the CDP port — and crucially:
|
|
9
|
+
* - NEVER kills a healthy instance (the old bash script force-killed on a
|
|
10
|
+
* flaky check, which dropped the live DevTools connection).
|
|
11
|
+
* - Launches detached + windowsHide so NO console (CMD/PowerShell) window
|
|
12
|
+
* ever pops (the old `#!/bin/bash` script spawned a console on Windows).
|
|
13
|
+
* - Uses one fixed profile so the user logs in ONCE and stays logged in.
|
|
14
|
+
*
|
|
15
|
+
* Reads config from ~/.sinapse/chrome-brain.json (written at install time):
|
|
16
|
+
* { "chromePath": "...", "port": 9222, "profile": "~/.chrome-debug-profile" }
|
|
17
|
+
*
|
|
18
|
+
* FAIL-SOFT: any error -> exit 0. A browser helper is never worth blocking a
|
|
19
|
+
* tool call (the MCP itself will surface a clear error if Chrome is truly down).
|
|
20
|
+
*
|
|
21
|
+
* Pass `--visible` (or run via `chrome-brain login`) to force a launch even when
|
|
22
|
+
* an instance is already up — used to open the window for first-time login.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const fs = require('fs');
|
|
26
|
+
const os = require('os');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
const http = require('http');
|
|
29
|
+
const { spawn } = require('child_process');
|
|
30
|
+
|
|
31
|
+
const CONFIG_PATH = path.join(os.homedir(), '.sinapse', 'chrome-brain.json');
|
|
32
|
+
|
|
33
|
+
function readConfig() {
|
|
34
|
+
try {
|
|
35
|
+
const c = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
|
|
36
|
+
if (!c || !c.chromePath) return null;
|
|
37
|
+
return {
|
|
38
|
+
chromePath: c.chromePath,
|
|
39
|
+
port: Number(c.port) || 9222,
|
|
40
|
+
profile: c.profile || path.join(os.homedir(), '.chrome-debug-profile'),
|
|
41
|
+
};
|
|
42
|
+
} catch {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// True iff a debug Chrome is already answering CDP on the port. Short timeout so
|
|
48
|
+
// the hook never stalls a tool call.
|
|
49
|
+
function isAlive(port) {
|
|
50
|
+
return new Promise((resolve) => {
|
|
51
|
+
const req = http.get(
|
|
52
|
+
{ host: '127.0.0.1', port, path: '/json/version', timeout: 1200 },
|
|
53
|
+
(res) => {
|
|
54
|
+
res.resume();
|
|
55
|
+
resolve(res.statusCode === 200);
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
req.on('error', () => resolve(false));
|
|
59
|
+
req.on('timeout', () => {
|
|
60
|
+
req.destroy();
|
|
61
|
+
resolve(false);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function launch(cfg) {
|
|
67
|
+
const args = [
|
|
68
|
+
`--remote-debugging-port=${cfg.port}`,
|
|
69
|
+
`--user-data-dir=${cfg.profile}`,
|
|
70
|
+
'--no-first-run',
|
|
71
|
+
'--no-default-browser-check',
|
|
72
|
+
];
|
|
73
|
+
// detached + ignored stdio + unref: Chrome survives this short-lived hook
|
|
74
|
+
// process and keeps the fixed profile alive across the whole session.
|
|
75
|
+
// windowsHide hides any console wrapper (chrome.exe itself is a GUI app, so
|
|
76
|
+
// its own window still shows — that is intentional, the user logs in there).
|
|
77
|
+
const child = spawn(cfg.chromePath, args, {
|
|
78
|
+
detached: true,
|
|
79
|
+
stdio: 'ignore',
|
|
80
|
+
windowsHide: true,
|
|
81
|
+
});
|
|
82
|
+
child.unref();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async function main() {
|
|
86
|
+
const force = process.argv.includes('--visible') || process.argv.includes('--force');
|
|
87
|
+
const cfg = readConfig();
|
|
88
|
+
if (!cfg) process.exit(0); // not configured -> do nothing, never block
|
|
89
|
+
|
|
90
|
+
const alive = await isAlive(cfg.port);
|
|
91
|
+
if (alive && !force) process.exit(0); // healthy -> NEVER touch it, just return
|
|
92
|
+
|
|
93
|
+
try {
|
|
94
|
+
launch(cfg);
|
|
95
|
+
} catch {
|
|
96
|
+
process.exit(0);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Poll until ready (~10s max). We never kill anything; if it does not come up
|
|
100
|
+
// we exit quietly and let the MCP report the connection error.
|
|
101
|
+
for (let i = 0; i < 20; i++) {
|
|
102
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
103
|
+
if (await isAlive(cfg.port)) process.exit(0);
|
|
104
|
+
}
|
|
105
|
+
process.exit(0);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
main().catch(() => process.exit(0));
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
# - SHA256 hashes for change detection
|
|
8
8
|
# - File types for categorization
|
|
9
9
|
#
|
|
10
|
-
version: 1.
|
|
10
|
+
version: 1.15.0
|
|
11
11
|
generator: scripts/generate-install-manifest.js
|
|
12
|
-
file_count:
|
|
12
|
+
file_count: 1150
|
|
13
13
|
files:
|
|
14
14
|
- path: cli/commands/config/index.js
|
|
15
15
|
hash: sha256:bfa83cb1dc111b0b30dd298dc0abc2150b73f939b6cd4458effa8e6d407bc9e2
|
|
@@ -1344,9 +1344,9 @@ files:
|
|
|
1344
1344
|
type: data
|
|
1345
1345
|
size: 9602
|
|
1346
1346
|
- path: data/entity-registry.yaml
|
|
1347
|
-
hash: sha256:
|
|
1347
|
+
hash: sha256:1754430439419493ac7b1c5a6c3473bfafb08a6f2bdb94826188f3dfcfb86849
|
|
1348
1348
|
type: data
|
|
1349
|
-
size:
|
|
1349
|
+
size: 547841
|
|
1350
1350
|
- path: data/learned-patterns.yaml
|
|
1351
1351
|
hash: sha256:1a4cd045c087b9dfd7046ff1464a9d2edb85fba77cf0b6fba14f4bb9004c741e
|
|
1352
1352
|
type: data
|
|
@@ -2708,9 +2708,13 @@ files:
|
|
|
2708
2708
|
type: template
|
|
2709
2709
|
size: 2048
|
|
2710
2710
|
- path: development/templates/chrome-brain/rules/chrome-brain-autoload.md
|
|
2711
|
-
hash: sha256:
|
|
2711
|
+
hash: sha256:ff4eb0dfda916b7441e020ff722336c46d87ef47234f08cb2fef009cb5aaa467
|
|
2712
2712
|
type: template
|
|
2713
|
-
size:
|
|
2713
|
+
size: 2540
|
|
2714
|
+
- path: development/templates/chrome-brain/scripts/chrome-brain-log.cjs
|
|
2715
|
+
hash: sha256:baddce09225c16076a67afc0029e89dafcf9dcebbcef39a51c53dd9e63390710
|
|
2716
|
+
type: template
|
|
2717
|
+
size: 2268
|
|
2714
2718
|
- path: development/templates/chrome-brain/scripts/chrome-brain-log.sh
|
|
2715
2719
|
hash: sha256:d72c54d9b67745fac667f1fb05387f11b9bfc55b8bebb64cca67c9a44171d436
|
|
2716
2720
|
type: template
|
|
@@ -2719,6 +2723,10 @@ files:
|
|
|
2719
2723
|
hash: sha256:5907538f71757df0954533507e5efac4ebb4c18f92fb93cd305b61fa1c379809
|
|
2720
2724
|
type: template
|
|
2721
2725
|
size: 7207
|
|
2726
|
+
- path: development/templates/chrome-brain/scripts/chrome-ensure.cjs
|
|
2727
|
+
hash: sha256:7ff77f28a86fa655e89f292b6b5ebe51a20befb4faf7be99d221b338388472ba
|
|
2728
|
+
type: template
|
|
2729
|
+
size: 3578
|
|
2722
2730
|
- path: development/templates/chrome-brain/scripts/chrome-ensure.sh
|
|
2723
2731
|
hash: sha256:eab2018b622c8550381c6d4555f4496595859b98401dff63a3036abf8433ebfa
|
|
2724
2732
|
type: template
|
|
@@ -4187,18 +4195,22 @@ files:
|
|
|
4187
4195
|
hash: sha256:3f8bb48230df89cf987330f7c9aff19edbc35a65a9cbff799e28480155dd8919
|
|
4188
4196
|
type: template
|
|
4189
4197
|
size: 6764
|
|
4198
|
+
- path: product/templates/statusline/agent-badges.json
|
|
4199
|
+
hash: sha256:9a926dc37107a34880aef351f540f3425f1ec60e77870f7f319980ee53576ead
|
|
4200
|
+
type: template
|
|
4201
|
+
size: 18475
|
|
4190
4202
|
- path: product/templates/statusline/statusline-script.js
|
|
4191
|
-
hash: sha256:
|
|
4203
|
+
hash: sha256:5860eecf6b02701666ff42f858bf25e3524f124210ef70d2b5243b829e893bb8
|
|
4192
4204
|
type: template
|
|
4193
|
-
size:
|
|
4205
|
+
size: 8748
|
|
4194
4206
|
- path: product/templates/statusline/track-agent-clear.cjs
|
|
4195
4207
|
hash: sha256:3cda606de2463374e60440ba6cae9ca98e39b782b19c6ae39aa7569a1b211f09
|
|
4196
4208
|
type: template
|
|
4197
4209
|
size: 2137
|
|
4198
4210
|
- path: product/templates/statusline/track-agent.cjs
|
|
4199
|
-
hash: sha256:
|
|
4211
|
+
hash: sha256:0194c9a5750ed9e7a11fb5de21060021f64636f21e8b91039543abccaf6a4c86
|
|
4200
4212
|
type: template
|
|
4201
|
-
size:
|
|
4213
|
+
size: 10990
|
|
4202
4214
|
- path: product/templates/story-tmpl.yaml
|
|
4203
4215
|
hash: sha256:43a050de5ef51f53f890fd20f77ac567b297a40597f467b3bc6d00c8193c7fa6
|
|
4204
4216
|
type: template
|