@yeaft/webchat-agent 1.0.415 → 1.0.417
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/browser-runtime/chromium.js +192 -0
- package/browser-runtime/cli.js +1 -1
- package/browser-runtime/extension/manifest.json +3 -0
- package/browser-runtime/extension/offscreen.js +201 -25
- package/browser-runtime/extension/popup.js +4 -1
- package/browser-runtime/extension/service-worker.js +47 -7
- package/browser-runtime/extension.js +1 -1
- package/browser-runtime/index.js +3 -0
- package/browser-runtime/local-bridge.js +194 -0
- package/browser-runtime/messages.js +73 -0
- package/browser-runtime/service.js +549 -26
- package/connection/index.js +2 -0
- package/connection/message-router.js +2 -0
- package/index.js +2 -0
- package/local-runtime/agent/container-manager.js +189 -0
- package/local-runtime/server/.env.example +10 -0
- package/local-runtime/server/browser-runtime-routes.js +265 -0
- package/local-runtime/server/client-protocol.js +4 -0
- package/local-runtime/server/config.js +28 -0
- package/local-runtime/server/handlers/agent-browser.js +308 -0
- package/local-runtime/server/handlers/client-browser.js +290 -0
- package/local-runtime/server/ws-agent.js +8 -1
- package/local-runtime/server/ws-client.js +33 -2
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +152 -95
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +2 -2
- package/local-runtime/web/style.bundle.css +1 -1
- package/local-runtime/web/style.bundle.css.gz +0 -0
- package/package.json +1 -1
- package/scripts/prepare-local-runtime.js +39 -20
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
import { cpSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'fs';
|
|
2
|
-
import { dirname, join } from 'path';
|
|
2
|
+
import { dirname, join, resolve } from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const runtimeDir = join(agentDir, 'local-runtime');
|
|
5
|
+
const scriptPath = fileURLToPath(import.meta.url);
|
|
6
|
+
const defaultAgentDir = join(dirname(scriptPath), '..');
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
join(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
recursive: true,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Build the Server and Web payload embedded in the published Agent package.
|
|
10
|
+
* Server imports that cross into agent/ must be copied explicitly so the
|
|
11
|
+
* packaged local runtime has the same module boundary as the source tree.
|
|
12
|
+
*/
|
|
13
|
+
export function prepareLocalRuntime({
|
|
14
|
+
agentDir = defaultAgentDir,
|
|
15
|
+
rootDir = join(agentDir, '..'),
|
|
16
|
+
runtimeDir = join(agentDir, 'local-runtime'),
|
|
17
|
+
} = {}) {
|
|
18
|
+
rmSync(runtimeDir, { recursive: true, force: true });
|
|
19
|
+
mkdirSync(runtimeDir, { recursive: true });
|
|
20
|
+
const excludedServerPaths = new Set([
|
|
21
|
+
join(rootDir, 'server', 'node_modules'),
|
|
22
|
+
join(rootDir, 'server', 'data'),
|
|
23
|
+
join(rootDir, 'server', '.env'),
|
|
24
|
+
join(rootDir, 'server', 'user.json'),
|
|
25
|
+
join(rootDir, 'server', 'users.json'),
|
|
26
|
+
]);
|
|
27
|
+
cpSync(join(rootDir, 'server'), join(runtimeDir, 'server'), {
|
|
28
|
+
recursive: true,
|
|
29
|
+
filter: source => !excludedServerPaths.has(source),
|
|
30
|
+
});
|
|
31
|
+
cpSync(join(rootDir, 'web', 'dist'), join(runtimeDir, 'web'), { recursive: true });
|
|
23
32
|
|
|
24
|
-
const
|
|
25
|
-
|
|
33
|
+
const runtimeAgentDir = join(runtimeDir, 'agent');
|
|
34
|
+
mkdirSync(runtimeAgentDir, { recursive: true });
|
|
35
|
+
cpSync(join(agentDir, 'container-manager.js'), join(runtimeAgentDir, 'container-manager.js'));
|
|
36
|
+
|
|
37
|
+
const { version } = JSON.parse(readFileSync(join(agentDir, 'package.json'), 'utf8'));
|
|
38
|
+
writeFileSync(join(runtimeDir, 'version.json'), `${JSON.stringify({ version })}\n`);
|
|
39
|
+
return runtimeDir;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (process.argv[1] && resolve(process.argv[1]) === resolve(scriptPath)) {
|
|
43
|
+
prepareLocalRuntime();
|
|
44
|
+
}
|