@yeaft/webchat-agent 1.0.445 → 1.0.446
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/Dockerfile +5 -2
- package/cli.js +9 -0
- package/connection/upgrade.js +18 -0
- package/container-manager.js +1 -0
- package/index.js +5 -2
- package/local-runtime/agent/container-manager.js +1 -0
- package/local-runtime/server/handlers/client-misc.js +15 -0
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +25 -25
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +1 -1
- package/package.json +1 -1
- package/upgrade-command.js +19 -0
package/Dockerfile
CHANGED
|
@@ -4,7 +4,8 @@ ARG BUILD_VERSION=dev
|
|
|
4
4
|
ENV NODE_ENV=production \
|
|
5
5
|
HOME=/home/yeaft \
|
|
6
6
|
YEAFT_DIR=/home/yeaft/.yeaft \
|
|
7
|
-
WORK_DIR=/workspace
|
|
7
|
+
WORK_DIR=/workspace \
|
|
8
|
+
YEAFT_AGENT_RUNTIME=container_agent
|
|
8
9
|
|
|
9
10
|
RUN apt-get update \
|
|
10
11
|
&& apt-get install -y --no-install-recommends ca-certificates git openssh-client tini \
|
|
@@ -16,7 +17,9 @@ RUN apt-get update \
|
|
|
16
17
|
WORKDIR /app
|
|
17
18
|
COPY package.json package-lock.json ./
|
|
18
19
|
COPY agent/package.json ./agent/
|
|
19
|
-
RUN npm ci --workspace=agent --omit=dev
|
|
20
|
+
RUN npm_config_cache=/tmp/yeaft-npm-cache npm ci --workspace=agent --omit=dev \
|
|
21
|
+
&& rm -rf /tmp/yeaft-npm-cache \
|
|
22
|
+
&& install -d -m 0700 -o yeaft -g yeaft /home/yeaft/.npm
|
|
20
23
|
COPY --chown=yeaft:yeaft agent ./agent
|
|
21
24
|
RUN node -e "const fs=require('fs'); const p='agent/package.json'; const j=JSON.parse(fs.readFileSync(p)); j.version=process.argv[1].replace(/^v/, ''); fs.writeFileSync(p, JSON.stringify(j, null, 2) + '\\n')" "$BUILD_VERSION" \
|
|
22
25
|
&& chmod 0755 agent/container-entrypoint.sh
|
package/cli.js
CHANGED
|
@@ -38,9 +38,12 @@ import {
|
|
|
38
38
|
warnDeprecatedInstanceArg,
|
|
39
39
|
} from './service/config.js';
|
|
40
40
|
import {
|
|
41
|
+
buildContainerImageUpgradeMessage,
|
|
41
42
|
buildUpgradeInstallCommand,
|
|
42
43
|
buildUpgradeMetadataUrl,
|
|
43
44
|
buildUpgradeVersionCommand,
|
|
45
|
+
CONTAINER_IMAGE_UPGRADE_REASON,
|
|
46
|
+
isContainerAgentRuntime,
|
|
44
47
|
createWindowsUpgradeRun,
|
|
45
48
|
launchWindowsUpgradeScript,
|
|
46
49
|
prepareWindowsUpgradeRunner,
|
|
@@ -545,6 +548,7 @@ function parseAndStart(args) {
|
|
|
545
548
|
}
|
|
546
549
|
|
|
547
550
|
async function checkForUpdates() {
|
|
551
|
+
if (isContainerAgentRuntime()) return;
|
|
548
552
|
try {
|
|
549
553
|
const res = await fetch(buildUpgradeMetadataUrl(pkg.name));
|
|
550
554
|
if (!res.ok) return;
|
|
@@ -562,6 +566,11 @@ async function checkForUpdates() {
|
|
|
562
566
|
async function upgrade(args = []) {
|
|
563
567
|
warnDeprecatedInstanceArg(args);
|
|
564
568
|
const instanceId = resolveServiceInstanceId(args, process.env, { management: true });
|
|
569
|
+
if (isContainerAgentRuntime()) {
|
|
570
|
+
console.error(`${CONTAINER_IMAGE_UPGRADE_REASON}: ${buildContainerImageUpgradeMessage(pkg.version)}`);
|
|
571
|
+
process.exitCode = 1;
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
565
574
|
console.log(`Current version: ${pkg.version}`);
|
|
566
575
|
console.log('Checking for updates...');
|
|
567
576
|
|
package/connection/upgrade.js
CHANGED
|
@@ -8,6 +8,10 @@ import { getConfigDir, getServiceName, getPm2AppName, getLaunchdPlistPath, DEFAU
|
|
|
8
8
|
import {
|
|
9
9
|
buildUpgradeInstallCommand,
|
|
10
10
|
buildUpgradeMetadataArgs,
|
|
11
|
+
buildContainerImageUpgradeMessage,
|
|
12
|
+
CONTAINER_AGENT_CAPABILITY,
|
|
13
|
+
CONTAINER_IMAGE_UPGRADE_REASON,
|
|
14
|
+
isContainerAgentRuntime,
|
|
11
15
|
createWindowsUpgradeRun,
|
|
12
16
|
launchWindowsUpgradeScript,
|
|
13
17
|
prepareWindowsUpgradeRunner,
|
|
@@ -175,6 +179,20 @@ function compareCmp(cur, cmp) {
|
|
|
175
179
|
}
|
|
176
180
|
|
|
177
181
|
export async function handleUpgradeAgent() {
|
|
182
|
+
if (isContainerAgentRuntime() || ctx.agentCapabilities?.includes(CONTAINER_AGENT_CAPABILITY)) {
|
|
183
|
+
const version = ctx.agentVersion || null;
|
|
184
|
+
const error = buildContainerImageUpgradeMessage(version);
|
|
185
|
+
console.warn(`[Agent] Upgrade rejected (${CONTAINER_IMAGE_UPGRADE_REASON}): ${error}`);
|
|
186
|
+
await sendToServer({
|
|
187
|
+
type: 'upgrade_agent_ack',
|
|
188
|
+
success: false,
|
|
189
|
+
reason: CONTAINER_IMAGE_UPGRADE_REASON,
|
|
190
|
+
error,
|
|
191
|
+
version,
|
|
192
|
+
});
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
178
196
|
console.log('[Agent] Upgrade requested, checking for updates...');
|
|
179
197
|
try {
|
|
180
198
|
const pkgName = ctx.pkgName || '@yeaft/webchat-agent';
|
package/container-manager.js
CHANGED
|
@@ -122,6 +122,7 @@ export function buildCreateArgs({
|
|
|
122
122
|
'--mount', `type=bind,src=${resolve(secretFile)},dst=/run/yeaft-host-secret,readonly`,
|
|
123
123
|
'--env', `SERVER_URL=${serverUrl}`,
|
|
124
124
|
'--env', `AGENT_NAME=${agentName}`,
|
|
125
|
+
'--env', 'YEAFT_AGENT_RUNTIME=container_agent',
|
|
125
126
|
'--env', 'AGENT_SECRET_FILE=/run/yeaft-host-secret',
|
|
126
127
|
'--env', 'YEAFT_DIR=/home/yeaft/.yeaft',
|
|
127
128
|
'--env', 'WORK_DIR=/workspace',
|
package/index.js
CHANGED
|
@@ -20,7 +20,9 @@ import {
|
|
|
20
20
|
import { loadNodePty } from './terminal.js';
|
|
21
21
|
import { connect } from './connection.js';
|
|
22
22
|
import { loadMcpServers } from './mcp.js';
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
getAgentUpgradeCapability,
|
|
25
|
+
} from './upgrade-command.js';
|
|
24
26
|
import { loadConfig as loadYeaftConfig } from './yeaft/config.js';
|
|
25
27
|
import { initYeaftDir } from './yeaft/init.js';
|
|
26
28
|
import { updateBrowserRuntimeSettings } from './yeaft/config-api.js';
|
|
@@ -173,7 +175,8 @@ async function detectCapabilities() {
|
|
|
173
175
|
// agent build can speak plaintext WS frames. New servers see this and
|
|
174
176
|
// flip `agent.encryptOutbound = false`, stopping outbound encryption
|
|
175
177
|
// to this peer. Old servers ignore the unknown capability token.
|
|
176
|
-
const capabilities = ['background_tasks', 'file_editor', 'ping_session', 'plaintext-ok', 'workbench_session_routes',
|
|
178
|
+
const capabilities = ['background_tasks', 'file_editor', 'ping_session', 'plaintext-ok', 'workbench_session_routes', 'work_center', 'work_center_message_v2', 'session_history_search', 'session_history_outline', 'session_history_window_prefetch', 'file_reference_resolution', 'yeaft_plugins', 'yeaft_managed_skills'];
|
|
179
|
+
capabilities.push(getAgentUpgradeCapability());
|
|
177
180
|
if (process.platform === 'linux') capabilities.push('work_item_attachments');
|
|
178
181
|
const pty = await loadNodePty();
|
|
179
182
|
if (pty) capabilities.push('terminal');
|
|
@@ -122,6 +122,7 @@ export function buildCreateArgs({
|
|
|
122
122
|
'--mount', `type=bind,src=${resolve(secretFile)},dst=/run/yeaft-host-secret,readonly`,
|
|
123
123
|
'--env', `SERVER_URL=${serverUrl}`,
|
|
124
124
|
'--env', `AGENT_NAME=${agentName}`,
|
|
125
|
+
'--env', 'YEAFT_AGENT_RUNTIME=container_agent',
|
|
125
126
|
'--env', 'AGENT_SECRET_FILE=/run/yeaft-host-secret',
|
|
126
127
|
'--env', 'YEAFT_DIR=/home/yeaft/.yeaft',
|
|
127
128
|
'--env', 'WORK_DIR=/workspace',
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
// may receive remote upgrade commands. Version thresholds are insufficient:
|
|
14
14
|
// builds without this capability may still inherit the installed package cwd.
|
|
15
15
|
export const SAFE_REMOTE_UPGRADE_CAPABILITY = 'remote_upgrade_safe';
|
|
16
|
+
export const CONTAINER_AGENT_CAPABILITY = 'container_agent';
|
|
17
|
+
export const CONTAINER_IMAGE_UPGRADE_REASON = 'container_image_upgrade_required';
|
|
16
18
|
export { YEAFT_PLUGINS_CAPABILITY, YEAFT_PLUGINS_UNSUPPORTED_ERROR };
|
|
17
19
|
|
|
18
20
|
async function rejectUnsupportedYeaftPlugins(client, msg, agentId) {
|
|
@@ -59,6 +61,19 @@ export async function handleClientMisc(clientId, client, msg, checkAgentAccess)
|
|
|
59
61
|
if (!upgradeAgentId) break;
|
|
60
62
|
if (!await checkAgentAccess(upgradeAgentId)) break;
|
|
61
63
|
const upgradeAgent = agents.get(upgradeAgentId);
|
|
64
|
+
if (Array.isArray(upgradeAgent?.capabilities)
|
|
65
|
+
&& upgradeAgent.capabilities.includes(CONTAINER_AGENT_CAPABILITY)) {
|
|
66
|
+
await sendToWebClient(client, {
|
|
67
|
+
type: 'upgrade_agent_ack',
|
|
68
|
+
agentId: upgradeAgentId,
|
|
69
|
+
success: false,
|
|
70
|
+
reason: CONTAINER_IMAGE_UPGRADE_REASON,
|
|
71
|
+
version: upgradeAgent?.version || null,
|
|
72
|
+
requiredCapability: CONTAINER_AGENT_CAPABILITY,
|
|
73
|
+
error: 'Container Agent is managed as a Docker image. Pull the configured image and recreate the same container through the Server/Sandbox lifecycle while keeping its persistent volumes and host-side agent-secret file.',
|
|
74
|
+
});
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
62
77
|
if (requiresManualUpgradeBridge(upgradeAgent?.capabilities, upgradeAgent?.platform)) {
|
|
63
78
|
await sendToWebClient(client, {
|
|
64
79
|
type: 'upgrade_agent_ack',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"1.0.
|
|
1
|
+
{"version":"1.0.446"}
|