@yeaft/webchat-agent 1.0.436 → 1.0.437

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/container-cli.js CHANGED
@@ -5,7 +5,6 @@ import {
5
5
  createContainerAgent,
6
6
  inspectContainerAgent,
7
7
  logsContainerAgent,
8
- readSecretInput,
9
8
  removeContainerAgent,
10
9
  startContainerAgent,
11
10
  stopContainerAgent,
@@ -15,10 +14,12 @@ import {
15
14
  function help() {
16
15
  console.log(`
17
16
  Usage:
18
- yeaft-agent container create --server <ws-url> --name <name> (--secret <value> | --secret-file <path>) [--image <image>]
17
+ yeaft-agent container install --server <ws-url> --name <name> --secret <secret> [--image <image>]
19
18
  yeaft-agent container start|stop|status|remove|logs --name <name>
20
19
 
21
20
  The container is an ordinary yeaft-agent. This command only manages its Docker lifecycle.
21
+ The secret is passed as an argument, like 'yeaft-agent install', and persisted by this
22
+ command to a private 0600 file before the container is created.
22
23
  Use --keep-volumes with remove to preserve its Yeaft data and workspace volumes.
23
24
  `);
24
25
  }
@@ -48,11 +49,13 @@ export async function runContainerCli(args) {
48
49
  const { action, options } = parseContainerArgs(args);
49
50
  const name = options.name;
50
51
  let result;
51
- if (action === 'create') {
52
- const secret = await readSecretInput(options);
53
- const secretFile = options.secretFile
54
- ? resolve(options.secretFile)
55
- : join(homedir(), '.yeaft', 'container-agents', name, 'agent-secret');
52
+ if (action === 'install' || action === 'create') {
53
+ if (options.secretFile) {
54
+ throw new Error('--secret-file is no longer supported; pass the secret directly with --secret');
55
+ }
56
+ const secret = String(options.secret || '').trim();
57
+ if (!secret) throw new Error('--secret <secret> is required');
58
+ const secretFile = join(homedir(), '.yeaft', 'container-agents', name, 'agent-secret');
56
59
  await writeAgentSecretFile(secretFile, secret);
57
60
  result = await createContainerAgent({
58
61
  name,
@@ -1,5 +1,5 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { chmod, mkdir, readFile, writeFile } from 'node:fs/promises';
2
+ import { chmod, mkdir, writeFile } from 'node:fs/promises';
3
3
  import { dirname, resolve } from 'node:path';
4
4
 
5
5
  export const DEFAULT_AGENT_IMAGE = 'ghcr.io/yeaft/yeaft-web-code-agent-agent:dev';
@@ -182,8 +182,3 @@ export async function logsContainerAgent(name, { follow = false, ...runtime } =
182
182
  args.push(containerNameForAgent(name));
183
183
  return runDocker(args, { ...runtime, stdout: follow ? 'inherit' : 'pipe' });
184
184
  }
185
-
186
- export async function readSecretInput({ secret, secretFile }) {
187
- if (secretFile) return (await readFile(resolve(secretFile), 'utf8')).trim();
188
- return String(secret || '').trim();
189
- }
@@ -1,5 +1,5 @@
1
1
  import { spawn } from 'node:child_process';
2
- import { chmod, mkdir, readFile, writeFile } from 'node:fs/promises';
2
+ import { chmod, mkdir, writeFile } from 'node:fs/promises';
3
3
  import { dirname, resolve } from 'node:path';
4
4
 
5
5
  export const DEFAULT_AGENT_IMAGE = 'ghcr.io/yeaft/yeaft-web-code-agent-agent:dev';
@@ -182,8 +182,3 @@ export async function logsContainerAgent(name, { follow = false, ...runtime } =
182
182
  args.push(containerNameForAgent(name));
183
183
  return runDocker(args, { ...runtime, stdout: follow ? 'inherit' : 'pipe' });
184
184
  }
185
-
186
- export async function readSecretInput({ secret, secretFile }) {
187
- if (secretFile) return (await readFile(resolve(secretFile), 'utf8')).trim();
188
- return String(secret || '').trim();
189
- }
@@ -1 +1 @@
1
- {"version":"1.0.436"}
1
+ {"version":"1.0.437"}