wtt-connect 0.2.14 → 0.2.15
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/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Implemented production-oriented surfaces:
|
|
|
28
28
|
- Permission broker for agent modes; `full-auto` is the default no-approval mode for Codex and Claude Code
|
|
29
29
|
- Optional WTT media artifact upload path (`/media/sign` → direct upload → `/media/commit`)
|
|
30
30
|
- Agent-generated file artifacts for WTT feed chat (`.docx`, `.pptx`, `.xlsx`, `.pdf`, `.csv`, `.zip`) using explicit final-response markers that are converted into WTT file cards
|
|
31
|
-
- Attachment staging for WTT message media/files; image attachments are passed to Codex with `--image
|
|
31
|
+
- Attachment staging for WTT message media/files; image attachments are passed to adapters that support image inputs, such as Codex with `--image`; Claude Code stays on the Claude Code adapter and returns its own result if the selected model cannot reason over images
|
|
32
32
|
- STT extension point (`command` and OpenAI/Whisper providers) for audio attachments
|
|
33
33
|
- Setup/claim-code command, smoke-task/smoke-chat commands, start script, and macOS launchd installer
|
|
34
34
|
- npm-installable Node.js implementation (Node >= 22) with runtime dependencies installed by npm
|
package/package.json
CHANGED
|
@@ -12,10 +12,6 @@ export class ClaudeCodeAdapter {
|
|
|
12
12
|
|
|
13
13
|
async run(prompt, context = {}) {
|
|
14
14
|
const sessionKey = context.sessionKey || 'default';
|
|
15
|
-
if (context.images?.length && this.config.codexBin) {
|
|
16
|
-
log('info', 'claude-code image fallback via codex', { sessionKey, images: context.images.length });
|
|
17
|
-
return runCodexVision(this.config.codexBin, prompt, context.images, this.config.workDir, this.config.taskTimeoutSeconds * 1000, this.config, context.onProgress);
|
|
18
|
-
}
|
|
19
15
|
const stored = this.store?.getSession(sessionKey) || {};
|
|
20
16
|
const sessionId = this.sessionByKey.get(sessionKey) || stored.claudeSessionId;
|
|
21
17
|
const args = this.buildArgs(prompt, sessionId);
|
|
@@ -116,54 +112,6 @@ function extractSessionId(ev) {
|
|
|
116
112
|
|| '';
|
|
117
113
|
}
|
|
118
114
|
|
|
119
|
-
async function runCodexVision(bin, prompt, images, cwd, timeoutMs, config = {}, onEvent) {
|
|
120
|
-
const args = ['exec', '--skip-git-repo-check', '--json', '--cd', cwd];
|
|
121
|
-
if (['full-auto', 'yolo'].includes(config.mode)) args.push('--dangerously-bypass-approvals-and-sandbox');
|
|
122
|
-
for (const img of images || []) args.push('--image', img);
|
|
123
|
-
args.push('-');
|
|
124
|
-
return new Promise((resolve, reject) => {
|
|
125
|
-
const child = spawn(bin, args, { cwd, stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env } });
|
|
126
|
-
let stderr = '';
|
|
127
|
-
const messages = [];
|
|
128
|
-
const timer = setTimeout(() => {
|
|
129
|
-
child.kill('SIGTERM');
|
|
130
|
-
reject(new Error(`${bin} vision fallback timed out after ${timeoutMs}ms`));
|
|
131
|
-
}, timeoutMs);
|
|
132
|
-
child.stderr.on('data', (d) => { stderr += d.toString(); });
|
|
133
|
-
child.on('error', (err) => { clearTimeout(timer); reject(err); });
|
|
134
|
-
const rl = readline.createInterface({ input: child.stdout });
|
|
135
|
-
rl.on('line', (line) => {
|
|
136
|
-
if (!line.trim()) return;
|
|
137
|
-
try {
|
|
138
|
-
const event = JSON.parse(line);
|
|
139
|
-
if (onEvent) Promise.resolve(onEvent(event)).catch(() => {});
|
|
140
|
-
const text = extractCodexText(event);
|
|
141
|
-
if (text) messages.push(text);
|
|
142
|
-
} catch {}
|
|
143
|
-
});
|
|
144
|
-
child.on('close', (code) => {
|
|
145
|
-
clearTimeout(timer);
|
|
146
|
-
if (code !== 0) reject(new Error(`${bin} vision fallback exited ${code}: ${truncate(stderr.trim(), 1200)}`));
|
|
147
|
-
else {
|
|
148
|
-
const finalMessages = dedupeAdjacent(messages);
|
|
149
|
-
resolve((finalMessages[finalMessages.length - 1] || '').trim());
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
child.stdin.end(prompt);
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function extractCodexText(event) {
|
|
157
|
-
if (event.type !== 'item.completed' || !event.item) return '';
|
|
158
|
-
const item = event.item;
|
|
159
|
-
if (!['agent_message', 'message'].includes(item.type)) return '';
|
|
160
|
-
if (typeof item.text === 'string') return item.text;
|
|
161
|
-
if (typeof item.content === 'string') return item.content;
|
|
162
|
-
if (typeof item.output_text === 'string') return item.output_text;
|
|
163
|
-
if (Array.isArray(item.content)) return item.content.map((p) => p?.text || p?.content || '').filter(Boolean).join('\n');
|
|
164
|
-
return '';
|
|
165
|
-
}
|
|
166
|
-
|
|
167
115
|
function extractEventError(ev) {
|
|
168
116
|
if (!ev) return '';
|
|
169
117
|
if (typeof ev.error === 'string') return ev.error;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
[Unit]
|
|
2
|
-
Description=WTT Connect Claude Code Agent
|
|
3
|
-
After=network-online.target
|
|
4
|
-
Wants=network-online.target
|
|
5
|
-
|
|
6
|
-
[Service]
|
|
7
|
-
Type=simple
|
|
8
|
-
WorkingDirectory=/mnt/wd10t/saiph/wtt/wtt/tools/wtt-connect
|
|
9
|
-
ExecStart=/usr/bin/node --experimental-websocket /mnt/wd10t/saiph/wtt/wtt/tools/wtt-connect/bin/wtt-connect.js start --env-file /mnt/wd10t/saiph/wtt/wtt/tools/wtt-connect/.env.claude
|
|
10
|
-
Restart=always
|
|
11
|
-
RestartSec=5
|
|
12
|
-
|
|
13
|
-
[Install]
|
|
14
|
-
WantedBy=default.target
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
[Unit]
|
|
2
|
-
Description=WTT Connect Codex Agent
|
|
3
|
-
After=network-online.target
|
|
4
|
-
Wants=network-online.target
|
|
5
|
-
|
|
6
|
-
[Service]
|
|
7
|
-
Type=simple
|
|
8
|
-
WorkingDirectory=/mnt/wd10t/saiph/wtt/wtt/tools/wtt-connect
|
|
9
|
-
ExecStart=/usr/bin/node --experimental-websocket /mnt/wd10t/saiph/wtt/wtt/tools/wtt-connect/bin/wtt-connect.js start --env-file /mnt/wd10t/saiph/wtt/wtt/tools/wtt-connect/.env
|
|
10
|
-
Restart=always
|
|
11
|
-
RestartSec=5
|
|
12
|
-
|
|
13
|
-
[Install]
|
|
14
|
-
WantedBy=default.target
|