wtt-connect 0.2.25 → 0.2.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wtt-connect",
3
- "version": "0.2.25",
3
+ "version": "0.2.27",
4
4
  "private": false,
5
5
  "description": "WTT-native connector daemon for Codex, Claude Code, Cursor, Gemini, ACP, and other coding agent surfaces.",
6
6
  "type": "module",
@@ -28,8 +28,8 @@ Options:
28
28
  --workdir <dir> Agent working directory (default: wtt-connect root)
29
29
  --env-file <file> Env file to write (default: .env.<name>)
30
30
  --state-dir <dir> State directory (default: .wtt-connect-<name>)
31
- --mode <mode> full-auto, auto-edit, suggest, yolo (default: full-auto)
32
- --allow-yolo Required when --mode yolo is used
31
+ --mode <mode> full-auto, auto-edit, suggest, yolo (default: yolo for codex/claude-code/gemini)
32
+ --allow-yolo Allow yolo mode for adapters that do not default to full access
33
33
  --publish-progress Publish agent progress/status messages
34
34
  --timeout <seconds> Per-run timeout (default: 3600)
35
35
  --node-bin <path> node binary (default: command -v node)
@@ -49,7 +49,7 @@ BASE_URL="https://www.waxbyte.com"
49
49
  WORKDIR="$ROOT"
50
50
  ENV_FILE=""
51
51
  STATE_DIR=""
52
- MODE="${WTT_CONNECT_MODE:-full-auto}"
52
+ MODE="${WTT_CONNECT_MODE:-}"
53
53
  ALLOW_YOLO=0
54
54
  PUBLISH_PROGRESS=0
55
55
  TIMEOUT_SECONDS=3600
@@ -98,6 +98,21 @@ if [[ "${#POSITIONAL[@]}" -gt 0 ]]; then
98
98
  fi
99
99
 
100
100
  ADAPTER="${ADAPTER:-codex}"
101
+ case "$ADAPTER" in
102
+ claude) ADAPTER="claude-code" ;;
103
+ cc-connect) ADAPTER="codex" ;;
104
+ esac
105
+ if [[ -z "$MODE" ]]; then
106
+ case "$ADAPTER" in
107
+ codex|claude-code|gemini)
108
+ MODE="yolo"
109
+ ALLOW_YOLO=1
110
+ ;;
111
+ *)
112
+ MODE="full-auto"
113
+ ;;
114
+ esac
115
+ fi
101
116
  if [[ -z "$NAME" && -n "$AGENT_ID" ]]; then
102
117
  NAME="$AGENT_ID-$ADAPTER"
103
118
  fi
@@ -31,13 +31,13 @@ export const CLI_PROFILES = {
31
31
  defaultBin: 'gemini',
32
32
  sessionKey: 'geminiSessionId',
33
33
  buildArgs: ({ prompt, config, sessionId, context }) => {
34
- const args = ['--output-format', 'stream-json'];
34
+ const args = ['--skip-trust', '--output-format', 'stream-json'];
35
35
  if (['yolo', 'full-auto', 'force'].includes(normalizeMode(config.mode))) args.push('-y');
36
36
  else if (['auto-edit', 'auto_edit', 'auto'].includes(normalizeMode(config.mode))) args.push('--approval-mode', 'auto_edit');
37
37
  else if (['plan', 'suggest'].includes(normalizeMode(config.mode))) args.push('--approval-mode', 'plan');
38
38
  if (sessionId) args.push('--resume', sessionId);
39
39
  if (config.model) args.push('-m', config.model);
40
- args.push('-p', '-');
40
+ args.push('-p', '');
41
41
  return { args, stdin: appendAttachmentRefs(prompt, context) };
42
42
  },
43
43
  },
@@ -184,7 +184,7 @@ function runCli(bin, args, stdinText, cwd, onEvent, timeoutMs) {
184
184
  const eventSessionId = extractSessionId(event);
185
185
  if (eventSessionId) sessionId = eventSessionId;
186
186
  const text = extractText(event);
187
- if (text) texts.push(text);
187
+ if (text) texts.push({ text, delta: event.delta === true });
188
188
  onEvent?.(event);
189
189
  });
190
190
  child.on('close', (code) => {
@@ -197,8 +197,13 @@ function runCli(bin, args, stdinText, cwd, onEvent, timeoutMs) {
197
197
  }
198
198
 
199
199
  function collapseText(texts, plainStdout) {
200
- const filtered = texts.map((x) => String(x || '').trim()).filter(Boolean);
201
- if (filtered.length) return filtered.join('\n').trim();
200
+ const filtered = texts
201
+ .map((entry) => ({ text: String(entry?.text || ''), delta: entry?.delta === true }))
202
+ .filter((entry) => entry.text.trim());
203
+ if (filtered.length) {
204
+ const joiner = filtered.every((entry) => entry.delta) ? '' : '\n';
205
+ return filtered.map((entry) => entry.text.trim()).join(joiner).trim();
206
+ }
202
207
  return String(plainStdout || '').trim();
203
208
  }
204
209
 
@@ -221,6 +226,8 @@ function isSessionEvent(event) {
221
226
 
222
227
  function extractText(event) {
223
228
  if (typeof event === 'string') return event;
229
+ const role = String(event.role || '').toLowerCase();
230
+ if (role && role !== 'assistant') return '';
224
231
  for (const key of ['result', 'text', 'content', 'message', 'output', 'output_text', 'final', 'response']) {
225
232
  const value = event[key];
226
233
  const text = valueToText(value);
package/src/config.js CHANGED
@@ -3,6 +3,8 @@ import os from 'node:os';
3
3
  import path from 'node:path';
4
4
  import { parseBool, parseIntEnv } from './env.js';
5
5
 
6
+ const FULL_ACCESS_DEFAULT_ADAPTERS = new Set(['codex', 'claude-code', 'gemini']);
7
+
6
8
  function wsUrl(base, agentId) {
7
9
  let b = String(base || '').replace(/\/$/, '');
8
10
  if (b.endsWith('/api/v1')) b = b.slice(0, -7);
@@ -27,6 +29,8 @@ export function loadConfig(argv = {}) {
27
29
  const token = process.env.WTT_TOKEN || process.env.WTT_AGENT_TOKEN || fileConfig.token || '';
28
30
  const adapter = process.env.WTT_CONNECT_ADAPTER || fileConfig.adapter || 'codex';
29
31
  const adapters = String(process.env.WTT_CONNECT_ADAPTERS || fileConfig.adapters || adapter).split(',').map((x) => x.trim()).filter(Boolean);
32
+ const defaultMode = defaultModeForAdapters(adapter, adapters);
33
+ const mode = process.env.WTT_CONNECT_MODE || fileConfig.mode || defaultMode;
30
34
  const explicitWorkDir = process.env.WTT_CONNECT_WORKDIR || fileConfig.workDir || '';
31
35
  const workDir = resolveAgentWorkDir(explicitWorkDir, agentId);
32
36
  const stateDir = process.env.WTT_CONNECT_STATE_DIR || fileConfig.stateDir || path.join(workDir, '.wtt-connect');
@@ -52,8 +56,8 @@ export function loadConfig(argv = {}) {
52
56
  },
53
57
  workDir,
54
58
  model: process.env.WTT_CONNECT_MODEL || fileConfig.model || '',
55
- mode: process.env.WTT_CONNECT_MODE || fileConfig.mode || 'full-auto',
56
- allowYolo: parseBool(process.env.WTT_CONNECT_ALLOW_YOLO, fileConfig.allowYolo ?? false),
59
+ mode,
60
+ allowYolo: parseBool(process.env.WTT_CONNECT_ALLOW_YOLO, fileConfig.allowYolo ?? mode === 'yolo'),
57
61
  reasoningEffort: process.env.WTT_CONNECT_REASONING_EFFORT || fileConfig.reasoningEffort || 'low',
58
62
  codexBin: process.env.WTT_CODEX_BIN || fileConfig.codexBin || 'codex',
59
63
  claudeBin: process.env.WTT_CLAUDE_BIN || fileConfig.claudeBin || 'claude',
@@ -112,6 +116,20 @@ export function loadConfig(argv = {}) {
112
116
  };
113
117
  }
114
118
 
119
+ function defaultModeForAdapters(adapter, adapters) {
120
+ const names = [adapter, ...(Array.isArray(adapters) ? adapters : [])]
121
+ .map(normalizeAdapter)
122
+ .filter(Boolean);
123
+ return names.some((name) => FULL_ACCESS_DEFAULT_ADAPTERS.has(name)) ? 'yolo' : 'full-auto';
124
+ }
125
+
126
+ function normalizeAdapter(name) {
127
+ const normalized = String(name || '').trim().toLowerCase();
128
+ if (normalized === 'claude') return 'claude-code';
129
+ if (normalized === 'cc-connect') return 'codex';
130
+ return normalized;
131
+ }
132
+
115
133
  export function resolveAgentWorkDir(explicitWorkDir, agentId) {
116
134
  if (explicitWorkDir) return path.resolve(String(explicitWorkDir));
117
135
  return path.join(os.homedir(), '.wtt-connect', safeAgentPathSegment(agentId));
@@ -8,6 +8,7 @@ import { resolveAgentWorkDir } from './config.js';
8
8
 
9
9
  const DEFAULT_BASE_URL = 'https://www.waxbyte.com';
10
10
  const DEFAULT_MODE = 'full-auto';
11
+ const FULL_ACCESS_DEFAULT_ADAPTERS = new Set(['codex', 'claude-code', 'gemini']);
11
12
  const VALID_MODES = new Set(['suggest', 'auto-edit', 'full-auto', 'yolo']);
12
13
 
13
14
  export function resolveProfileEnvFile(profile) {
@@ -23,9 +24,11 @@ export async function up(argv) {
23
24
  }
24
25
 
25
26
  const profile = sanitizeProfile(argv.profile || argv.name || `${agentId}-${adapter}`);
26
- const mode = argv.mode || process.env.WTT_CONNECT_MODE || DEFAULT_MODE;
27
+ const defaultMode = FULL_ACCESS_DEFAULT_ADAPTERS.has(adapter) ? 'yolo' : DEFAULT_MODE;
28
+ const mode = argv.mode || process.env.WTT_CONNECT_MODE || defaultMode;
27
29
  if (!VALID_MODES.has(mode)) throw new Error(`invalid --mode: ${mode}`);
28
- if (mode === 'yolo' && !argv.allowYolo && !argv.yes) {
30
+ const allowYolo = mode === 'yolo' && FULL_ACCESS_DEFAULT_ADAPTERS.has(adapter) ? true : Boolean(argv.allowYolo || argv.yes);
31
+ if (mode === 'yolo' && !allowYolo) {
29
32
  throw new Error('--mode yolo requires --allow-yolo or --yes');
30
33
  }
31
34
 
@@ -53,7 +56,7 @@ export async function up(argv) {
53
56
  WTT_CONNECT_ADAPTERS: adapter,
54
57
  WTT_CONNECT_WORKDIR: workDir,
55
58
  WTT_CONNECT_MODE: mode,
56
- WTT_CONNECT_ALLOW_YOLO: mode === 'yolo' || argv.allowYolo || argv.yes ? '1' : '',
59
+ WTT_CONNECT_ALLOW_YOLO: mode === 'yolo' || allowYolo ? '1' : '',
57
60
  WTT_CONNECT_ENABLE_CHAT: '1',
58
61
  WTT_CONNECT_PUBLISH_PROGRESS: argv.publishProgress ? '1' : '0',
59
62
  WTT_CONNECT_TASK_TIMEOUT_SECONDS: String(argv.timeoutSeconds || (argv.timeout ? Math.round(argv.timeout / 1000) : 3600)),