@empir3/empir3-bridge 0.3.21
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/CHANGELOG.md +1531 -0
- package/CODE_OF_CONDUCT.md +9 -0
- package/CONTRIBUTING.md +75 -0
- package/LICENSE +21 -0
- package/README.md +464 -0
- package/SECURITY.md +130 -0
- package/assets/accuracy-lab.html +2639 -0
- package/assets/api-clis-real.jpg +0 -0
- package/assets/bridge-console-hero.jpg +0 -0
- package/assets/browser-privacy.svg +151 -0
- package/assets/demo-orchestration.svg +74 -0
- package/assets/desktop-select-region.jpg +0 -0
- package/assets/in-page-chat.gif +0 -0
- package/assets/orchestration-hero.svg +126 -0
- package/assets/social-preview.png +0 -0
- package/assets/zara-accent.png +0 -0
- package/build/bootstrap.js +548 -0
- package/build/build.js +680 -0
- package/build/payload-entry.js +649 -0
- package/build/payload-signing-pub.json +7 -0
- package/docs/AGENT_GUIDE.md +259 -0
- package/docs/RELEASE.md +106 -0
- package/docs/SAFETY.md +112 -0
- package/docs/TESTING.md +181 -0
- package/installer/server.js +231 -0
- package/installer/ui/app.js +278 -0
- package/installer/ui/index.html +24 -0
- package/installer/ui/styles.css +146 -0
- package/package.json +95 -0
- package/scripts/bootstrap-e2e.mjs +650 -0
- package/scripts/certify-bridge.mjs +636 -0
- package/scripts/check-companion-surface.mjs +118 -0
- package/scripts/extract-welcome.mjs +64 -0
- package/scripts/gh-route-handler-check.mjs +57 -0
- package/scripts/gh-wire-test.mjs +107 -0
- package/scripts/publish-downloads.mjs +180 -0
- package/scripts/smoke-all-tools.mjs +509 -0
- package/scripts/smoke-live-bridge.mjs +696 -0
- package/scripts/splice-welcome.mjs +63 -0
- package/scripts/welcome-body.txt +2733 -0
- package/src/anthropic-client.ts +192 -0
- package/src/bootstrap-exe.ts +69 -0
- package/src/bridge.ts +2444 -0
- package/src/chat.ts +345 -0
- package/src/cli-runner.ts +239 -0
- package/src/cli.ts +649 -0
- package/src/config.ts +199 -0
- package/src/desktop-overlay.ps1 +121 -0
- package/src/executable-resolver.ts +330 -0
- package/src/handlers/agy-imagegen.ts +179 -0
- package/src/handlers/github-cli.ts +399 -0
- package/src/handlers/higgsfield-cli.ts +783 -0
- package/src/launch.js +337 -0
- package/src/mcp-server.ts +1265 -0
- package/src/pair-claim.ts +218 -0
- package/src/payload-daemon.ts +168 -0
- package/src/server.ts +21036 -0
- package/src/tool-defaults.ts +230 -0
- package/src/update-check.js +136 -0
- package/tray/build.py +76 -0
- package/tray/requirements.txt +2 -0
- package/tray/tray.py +1843 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// One-shot splice: replace getWelcomeHtml() in src/server.ts with the
|
|
2
|
+
// generated body from scripts/welcome-body.txt (the template-literal
|
|
3
|
+
// contents only — no function wrapper).
|
|
4
|
+
//
|
|
5
|
+
// Why: the old function is ~770 lines; doing this via Edit means moving
|
|
6
|
+
// 50KB through the tool, which is fragile. Splicing by line range is
|
|
7
|
+
// surgical and obvious — `git diff` shows exactly one block changed.
|
|
8
|
+
|
|
9
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
10
|
+
import { fileURLToPath } from 'node:url';
|
|
11
|
+
import { dirname, join } from 'node:path';
|
|
12
|
+
|
|
13
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const ROOT = join(here, '..');
|
|
15
|
+
const SRV = join(ROOT, 'src', 'server.ts');
|
|
16
|
+
const BODY = join(here, 'welcome-body.txt');
|
|
17
|
+
|
|
18
|
+
const src = readFileSync(SRV, 'utf8');
|
|
19
|
+
const body = readFileSync(BODY, 'utf8');
|
|
20
|
+
|
|
21
|
+
const startMarker = "function getWelcomeHtml(apiBase = '') {";
|
|
22
|
+
const startIdx = src.indexOf(startMarker);
|
|
23
|
+
if (startIdx === -1) throw new Error('start marker not found in src/server.ts');
|
|
24
|
+
|
|
25
|
+
// The function ends at the FIRST line that is just `}` after the start.
|
|
26
|
+
// Walk line by line from startIdx.
|
|
27
|
+
const before = src.slice(0, startIdx);
|
|
28
|
+
let i = startIdx;
|
|
29
|
+
let depth = 0;
|
|
30
|
+
let inSingle = false, inDouble = false, inBacktick = false, inLine = false, inBlock = false;
|
|
31
|
+
let prevCh = '';
|
|
32
|
+
let stopAt = -1;
|
|
33
|
+
for (; i < src.length; i++) {
|
|
34
|
+
const c = src[i];
|
|
35
|
+
// Comment skipping
|
|
36
|
+
if (inLine) { if (c === '\n') inLine = false; prevCh = c; continue; }
|
|
37
|
+
if (inBlock) { if (prevCh === '*' && c === '/') inBlock = false; prevCh = c; continue; }
|
|
38
|
+
if (!inSingle && !inDouble && !inBacktick) {
|
|
39
|
+
if (c === '/' && src[i+1] === '/') { inLine = true; i++; prevCh = ''; continue; }
|
|
40
|
+
if (c === '/' && src[i+1] === '*') { inBlock = true; i++; prevCh = ''; continue; }
|
|
41
|
+
}
|
|
42
|
+
// String skipping (only outside other strings/comments)
|
|
43
|
+
if (!inDouble && !inBacktick && c === "'" && prevCh !== '\\') { inSingle = !inSingle; prevCh = c; continue; }
|
|
44
|
+
if (!inSingle && !inBacktick && c === '"' && prevCh !== '\\') { inDouble = !inDouble; prevCh = c; continue; }
|
|
45
|
+
if (!inSingle && !inDouble && c === '`' && prevCh !== '\\') { inBacktick = !inBacktick; prevCh = c; continue; }
|
|
46
|
+
if (inSingle || inDouble || inBacktick) { prevCh = c; continue; }
|
|
47
|
+
// Brace tracking
|
|
48
|
+
if (c === '{') depth++;
|
|
49
|
+
else if (c === '}') {
|
|
50
|
+
depth--;
|
|
51
|
+
if (depth === 0) { stopAt = i + 1; break; }
|
|
52
|
+
}
|
|
53
|
+
prevCh = c;
|
|
54
|
+
}
|
|
55
|
+
if (stopAt === -1) throw new Error('matching closing brace not found');
|
|
56
|
+
|
|
57
|
+
const after = src.slice(stopAt);
|
|
58
|
+
const newFn = "function getWelcomeHtml(apiBase = '') {\n" + body + "\n}";
|
|
59
|
+
|
|
60
|
+
writeFileSync(SRV, before + newFn + after);
|
|
61
|
+
const oldLen = (src.slice(startIdx, stopAt).match(/\n/g) || []).length + 1;
|
|
62
|
+
const newLen = (newFn.match(/\n/g) || []).length + 1;
|
|
63
|
+
console.log(`Replaced getWelcomeHtml: ${oldLen} → ${newLen} lines`);
|