@7ots/cli 0.1.15 → 0.1.17
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/cli/lib/integrations.mjs +65 -13
- package/cli/lib/mcp.mjs +160 -0
- package/cli/lib/pet-core.mjs +5 -4
- package/cli/lib/pet-server.mjs +14 -5
- package/cli/pet/pet.html +4 -1
- package/cli/pet/settings.html +103 -36
- package/package.json +1 -1
- package/server/platform/connect.mjs +35 -0
- package/server/platform/integrations.mjs +169 -0
- package/server/platform/orquesta.mjs +12 -3
- package/server/platform/store.mjs +2 -0
- package/src/i18n/messages/platform.js +27 -0
package/cli/lib/integrations.mjs
CHANGED
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
* orquesta { on, projectId?, projectName? } talk to your Orquesta agents (ORQUESTA_TOKEN): list them, send a message,
|
|
7
7
|
* and it tells you what the agent answered when it finishes
|
|
8
8
|
* apumail { on, inbox } read your email (APUMAIL_TOKEN) — also needs access.inbox
|
|
9
|
-
* custom [{ id, name, instructions, url?, command?, envVar?, on }]
|
|
10
|
-
*
|
|
9
|
+
* custom [{ id, kind, name, instructions, url?, command?, envVar?, on }] told to the brain; by kind:
|
|
10
|
+
* mcp an MCP server (url = Streamable HTTP, or command = stdio): it lists and calls its tools (mcp.mjs)
|
|
11
|
+
* api a URL it can GET (plus a sub-path it picks), Bearer $envVar
|
|
12
|
+
* command a command it can run (/bin/sh -c, 20 s)
|
|
13
|
+
* note only the instructions
|
|
11
14
|
* access.logs it may read the logs of running processes: journal (systemd unit), pm2, docker, a log file,
|
|
12
15
|
* or a running process (its stdout file, else its journal). Secrets are redacted, ~80 lines.
|
|
13
16
|
* config.character { backstory, style, quirks, examples, scenario, greeting, letta?: { on, agentId } }
|
|
@@ -26,6 +29,7 @@ import { closeSync, openSync, readSync, readlinkSync, realpathSync, statSync } f
|
|
|
26
29
|
import { homedir } from 'node:os';
|
|
27
30
|
import { env, loadConfig, loadKeys } from './config.mjs';
|
|
28
31
|
import { SEVENOTS_URL, me as accountMe, signedIn } from './account.mjs';
|
|
32
|
+
import { mcpCall, mcpTools, mcpToolsCached } from './mcp.mjs';
|
|
29
33
|
|
|
30
34
|
const LETTA_URL = (process.env.LETTA_BASE_URL || 'https://api.letta.com').replace(/\/+$/, '');
|
|
31
35
|
const APUMAIL_API = (process.env.APUMAIL_API || 'https://api.apumail.com').replace(/\/+$/, '');
|
|
@@ -82,12 +86,24 @@ export function normalizeIntegrations(d = {}, prev = {}) {
|
|
|
82
86
|
const envVar = str(c.envVar, 64);
|
|
83
87
|
if (envVar && !/^[A-Z][A-Z0-9_]{1,63}$/.test(envVar)) throw new Error('customEnv');
|
|
84
88
|
const id = /^[\w-]{1,40}$/.test(c.id || '') ? c.id : randomBytes(4).toString('hex');
|
|
85
|
-
|
|
89
|
+
const kind = customKind(c);
|
|
90
|
+
const command = kind === 'mcp' || kind === 'command' ? str(c.command, 500) : '';
|
|
91
|
+
const keepUrl = kind === 'mcp' || kind === 'api' ? url : '';
|
|
92
|
+
if (kind === 'api' && !keepUrl) throw new Error('customUrl');
|
|
93
|
+
if (kind === 'command' && !command) throw new Error('customCmd');
|
|
94
|
+
if (kind === 'mcp' && !keepUrl && !command) throw new Error('customMcp');
|
|
95
|
+
return { id, kind, name, instructions: str(c.instructions, 1500), ...(keepUrl ? { url: keepUrl } : {}), ...(command && !(kind === 'mcp' && keepUrl) ? { command } : {}), ...(envVar && kind !== 'note' ? { envVar } : {}), on: bool(c.on, true) };
|
|
86
96
|
});
|
|
87
97
|
}
|
|
88
98
|
return out;
|
|
89
99
|
}
|
|
90
100
|
|
|
101
|
+
/** The kind of a custom integration (older ones had none: guessed from what they have). */
|
|
102
|
+
export function customKind(c = {}) {
|
|
103
|
+
if (['mcp', 'api', 'command', 'note'].includes(c.kind)) return c.kind;
|
|
104
|
+
return c.url ? 'api' : c.command ? 'command' : 'note';
|
|
105
|
+
}
|
|
106
|
+
|
|
91
107
|
// ── what goes into the system prompt ──
|
|
92
108
|
|
|
93
109
|
const lettaCache = { at: 0, agentId: '', text: '', busy: false };
|
|
@@ -229,10 +245,24 @@ async function readInbox(otsId) {
|
|
|
229
245
|
|
|
230
246
|
// ── custom integrations ──
|
|
231
247
|
|
|
232
|
-
|
|
248
|
+
const customToken = (c) => (c.envVar ? process.env[c.envVar] || loadKeys()[c.envVar] || '' : '');
|
|
249
|
+
|
|
250
|
+
/** Settings → "Test": what the integration answers (an MCP server: its tools). */
|
|
251
|
+
export async function testCustom(c) {
|
|
252
|
+
const kind = customKind(c);
|
|
253
|
+
if (kind === 'mcp') {
|
|
254
|
+
const tools = await mcpTools(c, customToken(c), { fresh: true });
|
|
255
|
+
return { ok: true, tools: tools.map((t) => ({ name: t.name, description: t.description })) };
|
|
256
|
+
}
|
|
257
|
+
if (kind === 'note') return { ok: true, text: '' };
|
|
258
|
+
return { ok: true, text: (await runCustom(c)).slice(0, 1500) };
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
async function runCustom(c, path = '') {
|
|
233
262
|
if (c.url) {
|
|
234
|
-
const tok = c
|
|
235
|
-
const
|
|
263
|
+
const tok = customToken(c);
|
|
264
|
+
const target = path && /^[/?][^\s"'<>]*$/.test(path) && !path.startsWith('//') ? c.url.replace(/\/+$/, '') + path : c.url;
|
|
265
|
+
const res = await fetch(target, { headers: { Accept: 'application/json, text/plain;q=0.9, */*;q=0.5', ...(tok ? { Authorization: `Bearer ${tok}` } : {}) }, signal: AbortSignal.timeout(15000) });
|
|
236
266
|
const body = (await res.text()).slice(0, 20000);
|
|
237
267
|
return redact(`HTTP ${res.status}\n${body}`).slice(0, MAX_OUT);
|
|
238
268
|
}
|
|
@@ -345,7 +375,15 @@ export function createExtras({ config, brain, system, onLater, confirm = null, c
|
|
|
345
375
|
};
|
|
346
376
|
const mailOn = () => config().access?.inbox === true && config().integrations?.apumail?.on && config().integrations.apumail.inbox && Boolean(env().APUMAIL_TOKEN);
|
|
347
377
|
const cloudId = () => (env().SEVENOTS_TOKEN && config().account?.otsId) || null;
|
|
348
|
-
const customs = () => (config().integrations?.custom || []).filter((c) => c.on !== false && (c.url || c.command));
|
|
378
|
+
const customs = () => (config().integrations?.custom || []).filter((c) => c.on !== false && customKind(c) !== 'note' && (c.url || c.command));
|
|
379
|
+
const toolsLine = (x) => {
|
|
380
|
+
const tools = mcpToolsCached(x);
|
|
381
|
+
if (!tools) {
|
|
382
|
+
mcpTools(x, customToken(x)).catch((e) => log(`mcp ${x.name}: ${redact(e.message).slice(0, 160)}`));
|
|
383
|
+
return ' (its tools: call it without "tool" to list them)';
|
|
384
|
+
}
|
|
385
|
+
return `. Its tools: ${tools.map((t) => `${t.name}(${t.params})${t.description ? ` — ${t.description.slice(0, 90)}` : ''}`).join('; ')}`;
|
|
386
|
+
};
|
|
349
387
|
|
|
350
388
|
async function projects() {
|
|
351
389
|
if (Date.now() - projCache.at < 5 * 60_000 && projCache.list.length) return projCache.list;
|
|
@@ -394,7 +432,12 @@ export function createExtras({ config, brain, system, onLater, confirm = null, c
|
|
|
394
432
|
}
|
|
395
433
|
else if (connect && !hasOrq()) lines.push(`{"type":"orquesta_connect"} (Orquesta, their coding agents, is NOT connected yet: when they ask about Orquesta or their projects, use this instead of saying you have no access; they approve it, then sign in in their browser)`);
|
|
396
434
|
if (cloudId()) lines.push(`{"type":"read_inbox"} (read what people wrote to you lately on apuchat and email, your own accounts on 7ots.com, and what you answered them; then sum it up for your human)`);
|
|
397
|
-
for (const x of customs())
|
|
435
|
+
for (const x of customs()) {
|
|
436
|
+
const kind = customKind(x);
|
|
437
|
+
if (kind === 'mcp') lines.push(`{"type":"integration","id":"${x.id}","tool":"tool name","args":{}} (MCP server "${x.name}"${toolsLine(x)})`);
|
|
438
|
+
else if (kind === 'api') lines.push(`{"type":"integration","id":"${x.id}","path":"optional /sub/path?query"} (GET the API "${x.name}" at ${x.url})`);
|
|
439
|
+
else lines.push(`{"type":"integration","id":"${x.id}"} (run "${x.name}")`);
|
|
440
|
+
}
|
|
398
441
|
return lines.length ? `More actions you have:\n${lines.join('\n')}` : '';
|
|
399
442
|
},
|
|
400
443
|
/** A raw AI action → a validated one, or null. */
|
|
@@ -405,7 +448,7 @@ export function createExtras({ config, brain, system, onLater, confirm = null, c
|
|
|
405
448
|
if (a?.type === 'orquesta_connect' && connect) return { type: 'orquesta_connect', extra: true };
|
|
406
449
|
if (a?.type === 'orquesta_list') return { type: 'orquesta_list', extra: true };
|
|
407
450
|
if (a?.type === 'orquesta' && a.text) return { type: 'orquesta', extra: true, project: a.project ? String(a.project).slice(0, 120) : null, text: String(a.text).slice(0, 4000) };
|
|
408
|
-
if (a?.type === 'integration' && a.id) return { type: 'integration', extra: true, id: String(a.id).slice(0, 40) };
|
|
451
|
+
if (a?.type === 'integration' && a.id) return { type: 'integration', extra: true, id: String(a.id).slice(0, 40), ...(a.tool ? { tool: String(a.tool).slice(0, 80), args: a.args && typeof a.args === 'object' && !Array.isArray(a.args) ? a.args : {} } : {}), ...(a.path ? { path: String(a.path).slice(0, 300) } : {}) };
|
|
409
452
|
return null;
|
|
410
453
|
},
|
|
411
454
|
/** Runs one: { say?, data? }. data goes back to the brain for the final reply. Never throws. */
|
|
@@ -455,7 +498,16 @@ export function createExtras({ config, brain, system, onLater, confirm = null, c
|
|
|
455
498
|
if (a.type === 'integration') {
|
|
456
499
|
const x = customs().find((y) => y.id === a.id);
|
|
457
500
|
if (!x) return { data: '(that integration is off or does not exist)' };
|
|
458
|
-
|
|
501
|
+
if (customKind(x) === 'mcp') {
|
|
502
|
+
if (!a.tool) {
|
|
503
|
+
const tools = await mcpTools(x, customToken(x));
|
|
504
|
+
return { data: `${x.name} tools:\n${tools.map((t) => `- ${t.name}(${t.params})${t.description ? `: ${t.description}` : ''}`).join('\n') || '(none)'}` };
|
|
505
|
+
}
|
|
506
|
+
// anything that may change something gets the human's OK first
|
|
507
|
+
if (!/^(get|list|search|read|fetch|find|query|describe|show|lookup|count)[\w-]*$/i.test(a.tool) && !(await ask(lang, 'mcp', x.name, a.tool, cut(JSON.stringify(a.args || {}), 140)))) return { data: `(they rejected calling ${a.tool}: do not call it)` };
|
|
508
|
+
return { data: `${x.name} · ${a.tool}:\n${redact(await mcpCall(x, customToken(x), a.tool, a.args)).slice(0, MAX_OUT) || '(empty)'}` };
|
|
509
|
+
}
|
|
510
|
+
return { data: `${x.name}:\n${(await runCustom(x, a.path)) || '(empty)'}` };
|
|
459
511
|
}
|
|
460
512
|
} catch (e) {
|
|
461
513
|
return { data: `(${a.type} failed: ${redact(e.message).slice(0, 200)})` };
|
|
@@ -466,9 +518,9 @@ export function createExtras({ config, brain, system, onLater, confirm = null, c
|
|
|
466
518
|
}
|
|
467
519
|
|
|
468
520
|
const ASKS = {
|
|
469
|
-
en: { inbox: 'Read the messages people sent me on apuchat and email?', connect: 'Connect your Orquesta? I’ll open the connection in your browser.', send: (p, t) => `Send this to your Orquesta agent in “${p}”? «${t}»`, connected: (o) => `Orquesta connected${o ? ` (${o})` : ''}. Now I can see your agents.`, notConnected: 'Orquesta didn’t get connected (the sign-in expired). Ask me again whenever you like.' },
|
|
470
|
-
es: { inbox: '¿Leo los mensajes que me mandaron por apuchat y correo?', connect: '¿Conecto tu Orquesta? Abro la conexión en tu navegador.', send: (p, t) => `¿Le mando esto a tu agente de Orquesta en “${p}”? «${t}»`, connected: (o) => `Orquesta conectada${o ? ` (${o})` : ''}. Ya puedo ver tus agentes.`, notConnected: 'No se conectó Orquesta (el inicio de sesión expiró). Pídemelo de nuevo cuando quieras.' },
|
|
471
|
-
pt: { inbox: 'Leio as mensagens que me mandaram no apuchat e por e-mail?', connect: 'Conecto sua Orquesta? Abro a conexão no seu navegador.', send: (p, t) => `Mando isto para seu agente da Orquesta em “${p}”? «${t}»`, connected: (o) => `Orquesta conectada${o ? ` (${o})` : ''}. Agora vejo seus agentes.`, notConnected: 'A Orquesta não foi conectada (o login expirou). Me peça de novo quando quiser.' },
|
|
521
|
+
en: { mcp: (n, tool, args) => `Use “${tool}” on ${n}? ${args}`, inbox: 'Read the messages people sent me on apuchat and email?', connect: 'Connect your Orquesta? I’ll open the connection in your browser.', send: (p, t) => `Send this to your Orquesta agent in “${p}”? «${t}»`, connected: (o) => `Orquesta connected${o ? ` (${o})` : ''}. Now I can see your agents.`, notConnected: 'Orquesta didn’t get connected (the sign-in expired). Ask me again whenever you like.' },
|
|
522
|
+
es: { mcp: (n, tool, args) => `¿Uso “${tool}” en ${n}? ${args}`, inbox: '¿Leo los mensajes que me mandaron por apuchat y correo?', connect: '¿Conecto tu Orquesta? Abro la conexión en tu navegador.', send: (p, t) => `¿Le mando esto a tu agente de Orquesta en “${p}”? «${t}»`, connected: (o) => `Orquesta conectada${o ? ` (${o})` : ''}. Ya puedo ver tus agentes.`, notConnected: 'No se conectó Orquesta (el inicio de sesión expiró). Pídemelo de nuevo cuando quieras.' },
|
|
523
|
+
pt: { mcp: (n, tool, args) => `Uso “${tool}” em ${n}? ${args}`, inbox: 'Leio as mensagens que me mandaram no apuchat e por e-mail?', connect: 'Conecto sua Orquesta? Abro a conexão no seu navegador.', send: (p, t) => `Mando isto para seu agente da Orquesta em “${p}”? «${t}»`, connected: (o) => `Orquesta conectada${o ? ` (${o})` : ''}. Agora vejo seus agentes.`, notConnected: 'A Orquesta não foi conectada (o login expirou). Me peça de novo quando quiser.' },
|
|
472
524
|
};
|
|
473
525
|
function say(lang, k, ...v) {
|
|
474
526
|
const L = ASKS[String(lang || '').slice(0, 2)] || ASKS.en;
|
package/cli/lib/mcp.mjs
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal MCP client for custom integrations of kind 'mcp' (settings → Permissions → Integrations).
|
|
3
|
+
*
|
|
4
|
+
* url Streamable HTTP: JSON-RPC POSTs, the answer as JSON or one SSE stream; Mcp-Session-Id kept per call
|
|
5
|
+
* command stdio: the server is started for each call (/bin/sh -c), newline-delimited JSON-RPC, killed after
|
|
6
|
+
*
|
|
7
|
+
* Only tools: tools/list (cached 10 min) and tools/call. A token (Bearer, HTTP) comes from an env var;
|
|
8
|
+
* stdio servers get it in their environment under the same name.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { spawn } from 'node:child_process';
|
|
12
|
+
|
|
13
|
+
const PROTOCOL = '2025-03-26';
|
|
14
|
+
const CLIENT = { name: '7ots', version: '1' };
|
|
15
|
+
const TIMEOUT = 30_000;
|
|
16
|
+
const cache = new Map(); // key → { at, tools }
|
|
17
|
+
|
|
18
|
+
const rpc = (id, method, params) => ({ jsonrpc: '2.0', ...(id != null ? { id } : {}), method, ...(params ? { params } : {}) });
|
|
19
|
+
|
|
20
|
+
function fail(r) {
|
|
21
|
+
if (r?.error) throw new Error(['MCP', r.error.code, r.error.message || 'error'].filter((x) => x != null && x !== '').join(' '));
|
|
22
|
+
return r?.result;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// ── Streamable HTTP ──
|
|
26
|
+
async function httpSession(url, token) {
|
|
27
|
+
let session = '';
|
|
28
|
+
let next = 1;
|
|
29
|
+
const post = async (msg) => {
|
|
30
|
+
const res = await fetch(url, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: { 'Content-Type': 'application/json', Accept: 'application/json, text/event-stream', 'MCP-Protocol-Version': PROTOCOL, ...(session ? { 'Mcp-Session-Id': session } : {}), ...(token ? { Authorization: `Bearer ${token}` } : {}) },
|
|
33
|
+
body: JSON.stringify(msg),
|
|
34
|
+
redirect: 'error', // the cloud checked this host is public: a redirect could point anywhere
|
|
35
|
+
signal: AbortSignal.timeout(TIMEOUT),
|
|
36
|
+
});
|
|
37
|
+
session = res.headers.get('mcp-session-id') || session;
|
|
38
|
+
if (msg.id == null) return null;
|
|
39
|
+
if (!res.ok) throw new Error(`MCP HTTP ${res.status}`);
|
|
40
|
+
const type = res.headers.get('content-type') || '';
|
|
41
|
+
const text = await res.text();
|
|
42
|
+
if (!type.includes('text/event-stream')) return JSON.parse(text);
|
|
43
|
+
// the first SSE message that answers this id
|
|
44
|
+
for (const block of text.split(/\r?\n\r?\n/)) {
|
|
45
|
+
const data = block.split(/\r?\n/).filter((l) => l.startsWith('data:')).map((l) => l.slice(5).trimStart()).join('\n');
|
|
46
|
+
if (!data) continue;
|
|
47
|
+
try {
|
|
48
|
+
const m = JSON.parse(data);
|
|
49
|
+
if (m.id === msg.id) return m;
|
|
50
|
+
} catch {}
|
|
51
|
+
}
|
|
52
|
+
throw new Error('MCP: no answer in the stream');
|
|
53
|
+
};
|
|
54
|
+
fail(await post(rpc(next++, 'initialize', { protocolVersion: PROTOCOL, capabilities: {}, clientInfo: CLIENT })));
|
|
55
|
+
await post(rpc(null, 'notifications/initialized'));
|
|
56
|
+
return {
|
|
57
|
+
call: async (method, params) => fail(await post(rpc(next++, method, params))),
|
|
58
|
+
close: () => (session ? fetch(url, { method: 'DELETE', headers: { 'Mcp-Session-Id': session, ...(token ? { Authorization: `Bearer ${token}` } : {}) }, signal: AbortSignal.timeout(5000) }).catch(() => {}) : null),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// ── stdio ──
|
|
63
|
+
async function stdioSession(command, extraEnv) {
|
|
64
|
+
const child = spawn('/bin/sh', ['-c', command], { stdio: ['pipe', 'pipe', 'ignore'], env: { ...process.env, ...extraEnv } });
|
|
65
|
+
const waiting = new Map();
|
|
66
|
+
let buf = '';
|
|
67
|
+
let dead = null;
|
|
68
|
+
child.stdout.setEncoding('utf8');
|
|
69
|
+
child.stdout.on('data', (d) => {
|
|
70
|
+
buf += d;
|
|
71
|
+
let i;
|
|
72
|
+
while ((i = buf.indexOf('\n')) >= 0) {
|
|
73
|
+
const line = buf.slice(0, i).trim();
|
|
74
|
+
buf = buf.slice(i + 1);
|
|
75
|
+
if (!line) continue;
|
|
76
|
+
try {
|
|
77
|
+
const m = JSON.parse(line);
|
|
78
|
+
if (m.id != null && waiting.has(m.id)) waiting.get(m.id)(m);
|
|
79
|
+
} catch {}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const die = (e) => {
|
|
83
|
+
dead = e;
|
|
84
|
+
for (const r of waiting.values()) r({ error: { message: e.message } });
|
|
85
|
+
waiting.clear();
|
|
86
|
+
};
|
|
87
|
+
child.on('error', die);
|
|
88
|
+
child.stdin.on('error', () => {}); // EPIPE when it already died: the exit handler answers
|
|
89
|
+
child.on('exit', (code) => die(new Error(`the MCP server exited (${code})`)));
|
|
90
|
+
let next = 1;
|
|
91
|
+
const send = (msg) => {
|
|
92
|
+
if (dead) return Promise.resolve({ error: { message: dead.message } });
|
|
93
|
+
child.stdin.write(`${JSON.stringify(msg)}\n`);
|
|
94
|
+
if (msg.id == null) return Promise.resolve(null);
|
|
95
|
+
return new Promise((res) => {
|
|
96
|
+
const t = setTimeout(() => (waiting.delete(msg.id), res({ error: { message: 'MCP timeout' } })), TIMEOUT);
|
|
97
|
+
waiting.set(msg.id, (m) => (clearTimeout(t), waiting.delete(msg.id), res(m)));
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const close = () => {
|
|
101
|
+
try {
|
|
102
|
+
child.stdin.end();
|
|
103
|
+
child.kill();
|
|
104
|
+
} catch {}
|
|
105
|
+
};
|
|
106
|
+
try {
|
|
107
|
+
fail(await send(rpc(next++, 'initialize', { protocolVersion: PROTOCOL, capabilities: {}, clientInfo: CLIENT })));
|
|
108
|
+
} catch (e) {
|
|
109
|
+
close();
|
|
110
|
+
throw e;
|
|
111
|
+
}
|
|
112
|
+
await send(rpc(null, 'notifications/initialized'));
|
|
113
|
+
return { call: async (method, params) => fail(await send(rpc(next++, method, params))), close };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function withSession(c, token, fn) {
|
|
117
|
+
const s = c.url ? await httpSession(c.url, token) : await stdioSession(c.command, c.envVar && token ? { [c.envVar]: token } : {});
|
|
118
|
+
try {
|
|
119
|
+
return await fn(s);
|
|
120
|
+
} finally {
|
|
121
|
+
s.close();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const key = (c) => `${c.url || ''}|${c.command || ''}|${c.envVar || ''}`;
|
|
126
|
+
|
|
127
|
+
/** The server's tools: [{ name, description, params }] (params: "a, b?" from the input schema). */
|
|
128
|
+
export async function mcpTools(c, token, { fresh = false } = {}) {
|
|
129
|
+
const hit = cache.get(key(c));
|
|
130
|
+
if (!fresh && hit && Date.now() - hit.at < 10 * 60_000) return hit.tools;
|
|
131
|
+
const tools = await withSession(c, token, async (s) => {
|
|
132
|
+
const all = [];
|
|
133
|
+
let cursor;
|
|
134
|
+
for (let i = 0; i < 5; i++) {
|
|
135
|
+
const r = await s.call('tools/list', cursor ? { cursor } : {});
|
|
136
|
+
all.push(...(r?.tools || []));
|
|
137
|
+
if (!(cursor = r?.nextCursor)) break;
|
|
138
|
+
}
|
|
139
|
+
return all;
|
|
140
|
+
});
|
|
141
|
+
const out = tools.slice(0, 60).map((t) => {
|
|
142
|
+
const props = t.inputSchema?.properties || {};
|
|
143
|
+
const req = new Set(t.inputSchema?.required || []);
|
|
144
|
+
return { name: String(t.name).slice(0, 80), description: String(t.description || '').replace(/\s+/g, ' ').slice(0, 200), params: Object.keys(props).slice(0, 12).map((p) => (req.has(p) ? p : `${p}?`)).join(', ') };
|
|
145
|
+
});
|
|
146
|
+
cache.set(key(c), { at: Date.now(), tools: out });
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Cached tools without a round trip (null when not fetched yet). */
|
|
151
|
+
export function mcpToolsCached(c) {
|
|
152
|
+
return cache.get(key(c))?.tools || null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Calls one tool → its text content. */
|
|
156
|
+
export async function mcpCall(c, token, tool, args = {}) {
|
|
157
|
+
const r = await withSession(c, token, (s) => s.call('tools/call', { name: tool, arguments: args && typeof args === 'object' ? args : {} }));
|
|
158
|
+
const text = (r?.content || []).map((p) => (p.type === 'text' ? p.text : p.type === 'resource' ? p.resource?.text || '' : `[${p.type}]`)).join('\n');
|
|
159
|
+
return `${r?.isError ? 'ERROR: ' : ''}${text || JSON.stringify(r?.structuredContent ?? '')}`;
|
|
160
|
+
}
|
package/cli/lib/pet-core.mjs
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* food, energy, fun 0..100 (100 = full / rested / happy). They decay with time.
|
|
5
5
|
* xp, level grow with work that goes well (passing commands, finished agent turns).
|
|
6
6
|
* asleep while asleep energy recovers and it stays quiet. It sleeps until you wake it
|
|
7
|
-
* (wake, feed, play)
|
|
7
|
+
* (wake, feed, play). The agent's events don't wake it: only what you asked for
|
|
8
|
+
* (a reminder, a watcher, an answer) stirs it for a moment (pet-server).
|
|
8
9
|
*
|
|
9
10
|
* Events come from hooks (Claude Code, the shell) and from the user (feed, play, sleep).
|
|
10
11
|
*/
|
|
@@ -147,16 +148,16 @@ export function applyEvent(p, ev, now = Date.now()) {
|
|
|
147
148
|
p.stats.turns++;
|
|
148
149
|
happy();
|
|
149
150
|
r.levelUp = gainXp(p, 5);
|
|
150
|
-
Object.assign(r, { line: 'stop', gesture: 'jump', important: true
|
|
151
|
+
Object.assign(r, { line: 'stop', gesture: 'jump', important: true }); // background work finished
|
|
151
152
|
break;
|
|
152
153
|
case 'notify':
|
|
153
|
-
Object.assign(r, { line: 'waiting', gesture: 'wave', important: true
|
|
154
|
+
Object.assign(r, { line: 'waiting', gesture: 'wave', important: true });
|
|
154
155
|
break;
|
|
155
156
|
case 'start':
|
|
156
157
|
Object.assign(r, { line: 'hello', gesture: 'wave', important: true });
|
|
157
158
|
break;
|
|
158
159
|
case 'say':
|
|
159
|
-
Object.assign(r, { important: true
|
|
160
|
+
Object.assign(r, { important: true });
|
|
160
161
|
break;
|
|
161
162
|
default:
|
|
162
163
|
break;
|
package/cli/lib/pet-server.mjs
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* GET /processes what the pet is running (reminders, watchers, screen) + the computer's (access.processes)
|
|
20
20
|
* POST /watchers/cancel { id | 'all' }
|
|
21
21
|
* GET /cloud 7ots.com link + the cloud assistant's VM status (integrations.mjs)
|
|
22
|
+
* POST /integrations/test { integration } → { ok, tools? (MCP), text?, error? } (a draft, not saved)
|
|
22
23
|
* GET /orquesta/projects · POST /orquesta/send { projectId, text } · GET /orquesta/prompt?id= your Orquesta agents
|
|
23
24
|
* POST /character/letta write the character sheet into a Letta agent's persona (LETTA_API_KEY)
|
|
24
25
|
* GET /settings?token=… the settings page: brain, what it may see and do, notes, reminders
|
|
@@ -57,7 +58,7 @@ import { createSiteContext } from './prowl.mjs';
|
|
|
57
58
|
import { SEVENOTS_URL, community, sync as syncOt, logout as accountLogout, me as accountMe, pull as pullOt, signedIn, startLogin, use as useOt } from './account.mjs';
|
|
58
59
|
import { openUrl } from './open.mjs';
|
|
59
60
|
import { VM_KINDS } from './vm.mjs';
|
|
60
|
-
import { cloudStatus, createExtras, lettaSync, normalizeCharacter, normalizeIntegrations } from './integrations.mjs';
|
|
61
|
+
import { cloudStatus, createExtras, lettaSync, normalizeCharacter, normalizeIntegrations, redact, testCustom } from './integrations.mjs';
|
|
61
62
|
import { spawn } from 'node:child_process';
|
|
62
63
|
import { openSync } from 'node:fs';
|
|
63
64
|
import { line } from './lines.mjs';
|
|
@@ -306,13 +307,12 @@ export function startPetServer({ port = PET_PORT, log = () => {} } = {}) {
|
|
|
306
307
|
function onEvent(ev) {
|
|
307
308
|
const act = track(ev);
|
|
308
309
|
if (act) broadcast({ activity: act });
|
|
310
|
+
const r = applyEvent(pet, ev);
|
|
311
|
+
// asleep it sleeps: the agent's events (finished, waiting, failures) don't move it or make it talk
|
|
312
|
+
if (pet.asleep && ev.type !== 'sleep') return broadcast({});
|
|
309
313
|
// Something in the agent's terminal needs you: walk over there and point at it.
|
|
310
314
|
if (ev.type === 'stop' || ev.type === 'notify' || (ev.type === 'shell' && ![0, 130].includes(Number(ev.code)))) broadcast({ point: 'agent' });
|
|
311
|
-
const r = applyEvent(pet, ev);
|
|
312
315
|
if (r.effect || r.morph) broadcast({ effect: r.effect, morph: r.morph });
|
|
313
|
-
// asleep: only urgent things (the agent waiting, finished work, a message) stir it, and it dozes off again
|
|
314
|
-
if (pet.asleep && ev.type !== 'sleep' && !r.stir) return broadcast({});
|
|
315
|
-
if (r.stir) broadcast({ stir: true });
|
|
316
316
|
if (ev.type === 'say' && ev.text) {
|
|
317
317
|
lastSpoke = Date.now();
|
|
318
318
|
broadcast({ say: String(ev.text).slice(0, 300), gesture: 'wave' });
|
|
@@ -878,6 +878,15 @@ export function startPetServer({ port = PET_PORT, log = () => {} } = {}) {
|
|
|
878
878
|
a.done(data.ok === true);
|
|
879
879
|
return json(200, { ok: true });
|
|
880
880
|
}
|
|
881
|
+
if (p === '/integrations/test') {
|
|
882
|
+
// a draft (not saved yet) is validated like a save, then tried once
|
|
883
|
+
try {
|
|
884
|
+
const [c] = normalizeIntegrations({ custom: [data.integration || {}] }).custom;
|
|
885
|
+
return json(200, await testCustom(c));
|
|
886
|
+
} catch (e) {
|
|
887
|
+
return json(200, { ok: false, error: redact(e.message).slice(0, 300) });
|
|
888
|
+
}
|
|
889
|
+
}
|
|
881
890
|
if (p === '/orquesta/connect') {
|
|
882
891
|
const r = connectOrquesta();
|
|
883
892
|
r.catch((e) => log(`orquesta: ${e.message}`));
|
package/cli/pet/pet.html
CHANGED
|
@@ -463,7 +463,7 @@
|
|
|
463
463
|
const post = (path, body) => fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-7ots-Token': BOOT.token }, body: JSON.stringify(body) });
|
|
464
464
|
let asleep = false;
|
|
465
465
|
// something urgent while asleep: it wakes up for a moment (says it, walks over), then dozes off again
|
|
466
|
-
let stirUntil = 0, stirT = 0;
|
|
466
|
+
let stirUntil = 0, stirT = 0, sleptAt = 0;
|
|
467
467
|
function stir() {
|
|
468
468
|
stirUntil = Date.now() + 30000;
|
|
469
469
|
document.body.classList.remove('asleep');
|
|
@@ -493,6 +493,7 @@
|
|
|
493
493
|
$('#mood').style.setProperty('--mood', MOOD_COLOR[m] || 'var(--muted)');
|
|
494
494
|
}
|
|
495
495
|
function render(s) {
|
|
496
|
+
if (s.asleep && !asleep && last) sleptAt = Date.now(); // just sent to bed: its "good night" still gets said
|
|
496
497
|
last = s;
|
|
497
498
|
asleep = s.asleep;
|
|
498
499
|
const stirred = asleep && Date.now() < stirUntil;
|
|
@@ -739,6 +740,8 @@
|
|
|
739
740
|
if (m.ask) ask4(m.ask); // before thinking: an approved ask hands the bubble back to the dots
|
|
740
741
|
if ('thinking' in m) setThinking(!!m.thinking);
|
|
741
742
|
if (m.activity) addActivity(m.activity);
|
|
743
|
+
// asleep (and not stirred by something you asked for): no moving, gestures or talking
|
|
744
|
+
if (asleep && Date.now() >= stirUntil && Date.now() - sleptAt > 15000) return void (m.dance && dance(m.dance));
|
|
742
745
|
if (m.gesture) ch.gesture(m.gesture);
|
|
743
746
|
if (m.morph) ch.morph?.(m.morph);
|
|
744
747
|
if (m.effect) ch.effect?.(m.effect);
|
package/cli/pet/settings.html
CHANGED
|
@@ -219,6 +219,20 @@
|
|
|
219
219
|
.integ .vm { display: grid; gap: 2px; padding-top: 8px; border-top: 1px solid var(--line); }
|
|
220
220
|
.sw .kinds { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 12px; }
|
|
221
221
|
.integ .vm b { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
|
|
222
|
+
.brands { display: flex; flex-wrap: wrap; gap: 6px; grid-column: 1 / -1; margin-top: 4px; }
|
|
223
|
+
.brand { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 4px; border: 1px solid var(--line); border-radius: 99px; font-size: 12px; color: var(--ink); text-decoration: none; background: var(--panel); }
|
|
224
|
+
.brand:hover { border-color: var(--accent); }
|
|
225
|
+
.brand svg:last-child { opacity: .55; }
|
|
226
|
+
.kindpick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
|
|
227
|
+
.kindpick small { color: var(--muted); font-size: 12.5px; margin-right: 4px; }
|
|
228
|
+
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
|
|
229
|
+
.seg button { font-size: 12.5px; padding: 5px 10px; }
|
|
230
|
+
.seg button.on { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
|
|
231
|
+
.integ .where { display: flex; align-items: center; gap: 8px; min-width: 0; }
|
|
232
|
+
.integ .where .kind { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 1px 8px; border-radius: 99px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-size: 11px; font-weight: 600; }
|
|
233
|
+
.integ .where code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
|
|
234
|
+
.fields .or { align-self: center; color: var(--muted); font-size: 12px; padding-top: 16px; }
|
|
235
|
+
.testout { white-space: pre-wrap; max-height: 220px; overflow: auto; font-size: 12px; margin: 0; }
|
|
222
236
|
.fields { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
|
|
223
237
|
footer { color: var(--muted); font-size: 12px; text-align: center; }
|
|
224
238
|
footer code { font: 11.5px var(--mono); }
|
|
@@ -485,14 +499,15 @@
|
|
|
485
499
|
vapuchat: 'apuchat audio', vapuchatD: 'apuchat’s voices, with your apuchat voice token.', vgrok: 'Grok AI', vgrokD: 'xAI’s text-to-speech, with your xAI key.', vfish: 'Fish Audio', vfishD: 'fish.audio voices (also cloned ones), with your key.',
|
|
486
500
|
logs: 'Process logs', logsD: 'Read the last lines of a service’s logs (journal, pm2, docker, a .log file or a running program) when you ask. Keys and tokens are hidden.',
|
|
487
501
|
sites: 'Site guides', sitesD: 'When you mention a site, read its usage guide on Prowl.world (only the domain is sent).',
|
|
488
|
-
inbox: 'Read your mail', inboxD: 'Read and summarize
|
|
502
|
+
inbox: 'Read your mail', inboxD: 'Read and summarize your apumail inbox (set it up below) and what people wrote to your ot on apuchat, when you ask.',
|
|
489
503
|
integH: 'Integrations', integHint: 'Other places it can reach. What you turn on here is listed to its brain as a tool.',
|
|
490
504
|
cloudH: '7ots cloud', cloudD: 'Your account on 7ots.com and the ot twinned with this one.', cloudOff: 'Not connected.', cloudAs: 'Connected as {who}', cloudTwin: 'twin: {name}', cloudNoTwin: 'no ot twinned yet', goAcc: 'Connect in Account',
|
|
491
505
|
offload: 'Hand work to your server', offloadD: 'Send long tasks (research, reading pages…) to your ot’s cloud worker. It only gets the request and, with Memory on, your notes.', kindsL: 'Kinds', k_research: 'research', k_browse: 'read pages', k_long: 'long tasks', k_code: 'code', k_shell: 'shell commands', vmNone: 'no server yet: add yours at 7ots.com → your ot → Assistant', vmPending: 'waiting for the server to enroll', vmOnline: 'online', vmOffline: 'offline', vmTerminated: 'revoked',
|
|
492
506
|
vmH: 'Cloud assistant', vmD: 'Your ot running 24/7 in the cloud, even with this computer off.', vmDenied: 'no access', vmError: 'couldn’t check', vmSince: 'since {d}',
|
|
493
507
|
orqH: 'Orquesta', orqD: 'See your Orquesta agents and send them tasks; it tells you when they finish.', orqHint: 'Or run 7ots login orquesta in a terminal.', orqNoToken: 'Not connected: it can’t see your agents yet.', orqConnect: 'Connect Orquesta', orqWaiting: 'Finish signing in in your browser…', orqProject: 'Agent (default project)', orqOnline: 'online', orqOffline: 'offline', orqNone: 'No projects.', orqSend: 'Send', orqTask: 'Task for the agent', orqSent: 'Sent · {status}', orqRefresh: 'Reload',
|
|
494
|
-
mailH: 'Email (apumail)', mailD: 'An apumail inbox it can read when you ask (turn on “Read your mail” above).', mailInbox: 'Inbox address', mailToken: 'apumail token',
|
|
495
|
-
customH: 'Custom integrations', customD: '
|
|
508
|
+
mailH: 'Email (apumail)', mailD: 'An apumail inbox it can read when you ask (turn on “Read your mail” above).', mailInbox: 'Inbox address', mailToken: 'apumail token',
|
|
509
|
+
customH: 'Custom integrations', customD: 'Connect it to anything: an MCP server, an API, a command on this computer, or just tell it how something works. It sees these as tools and uses them when you ask.', customAdd: 'Add:', customName: 'Name', customInstr: 'Instructions for the brain', customUrl: 'URL (optional)', customCmd: 'Command (optional)', customEnv: 'Token env var (optional)', customEnvHint: 'Read from this computer’s environment or ~/.7ots/keys.json, never shown.', edit: 'Edit', remove: 'Remove', untitled: 'New integration',
|
|
510
|
+
ck_mcp: 'MCP server', ck_api: 'API', ck_command: 'Command', ck_note: 'Instructions only', ck_mcpD: 'A Model Context Protocol server: it lists its tools and calls them', ck_apiD: 'A URL it can read (GET), with a token', ck_commandD: 'A command it can run on this computer', ck_noteD: 'Just tell it something it should know or do', ck_mcpPh: 'GitHub, Linear, my database…', ck_apiPh: 'Weather, my CRM…', ck_commandPh: 'Disk usage, git status…', ck_notePh: 'How we deploy…', ck_mcpInstr: 'When to use it (optional): “for anything about my issues”', ck_apiInstr: 'What it returns and when to use it', ck_commandInstr: 'What it shows and when to run it', ck_noteInstr: 'What it should know or do', mcpUrl: 'Server URL (HTTP)', mcpCmd: 'Command that starts it (stdio)', mcpHint: 'Remote servers by URL (Streamable HTTP); local ones by command. It asks you before calling a tool that may change something.', apiUrl: 'Base URL', apiHint: 'It can add a sub-path or query to this URL. GET only; the token goes as Bearer.', cmdHint: 'Runs with /bin/sh on this computer, 20 s max. Secrets in the output are hidden.', mcpTest: 'Connect and list tools', customTest: 'Try it', mcpTools: '{n} tools', orWord: 'or', whatIs: 'What is {n}?', e_customCmd: 'a command is needed', e_customMcp: 'an MCP server needs a URL or a command',
|
|
496
511
|
charH: 'Character sheet', charHint: 'Who it is. This weighs more than the traits from 7ots.com: backstory, how it talks, its quirks and example dialogues.',
|
|
497
512
|
chBackstory: 'Backstory', chStyle: 'How it talks', chQuirks: 'Quirks', chScenario: 'Scenario (optional)', chGreeting: 'Greeting (optional)', chExamples: 'Example dialogues',
|
|
498
513
|
vcConf: 'Configure voice', vcNow: 'Voice: {v} · change', vcId: 'Voice id', vcIdPh: 'Empty = provider default', vcPick: 'Pick one of your {n} voices…', vcNoList: 'No voices in your account yet', vcModel: 'Model', vcOneModel: 'xAI has a single voice model.', vcDefault: 'Default', vcStyle: 'Style (how it speaks)', vcStylePh: 'E.g.: warm, a bit sarcastic, fast', vcTest: 'Try', vcTesting: 'Generating…', vcSave: 'Use this voice', vcPage: 'Browse voices on the site', vcKeyFirst: 'Save the key first to list your voices.', chExamplesPh: 'Human: how are you?\n{name}: …', chIdeaPh: 'Idea (optional): a grumpy retired wizard who loves trains…', chAi: 'Fill with AI', chAiWait: 'The AI is writing the sheet in {lang}… (up to a minute)', chAiLang: 'Language of the sheet', chAiPartial: 'Draft ready, but these came back empty: {f}. Try again.', chAiDone: 'Draft ready: review it and Save', chAiBrain: 'Pick an AI brain first (Brain section)', importCard: 'Import card', exportCard: 'Export card', imported: 'Imported ✓', badCard: 'That file has no character card (chara_card_v2 JSON or PNG).',
|
|
@@ -506,14 +521,15 @@
|
|
|
506
521
|
vapuchat: 'apuchat audio', vapuchatD: 'Las voces de apuchat, con tu token de voz de apuchat.', vgrok: 'Grok AI', vgrokD: 'Texto a voz de xAI, con tu key de xAI.', vfish: 'Fish Audio', vfishD: 'Voces de fish.audio (también clonadas), con tu key.',
|
|
507
522
|
logs: 'Logs de procesos', logsD: 'Leer las últimas líneas de los logs de un servicio (journal, pm2, docker, un archivo .log o un programa corriendo) cuando se lo pides. Claves y tokens se ocultan.',
|
|
508
523
|
sites: 'Guías de sitios', sitesD: 'Cuando nombras un sitio, leer su guía de uso en Prowl.world (solo se envía el dominio).',
|
|
509
|
-
inbox: 'Leer tu correo', inboxD: 'Leer y resumir
|
|
524
|
+
inbox: 'Leer tu correo', inboxD: 'Leer y resumir tu bandeja de apumail (se configura abajo) y lo que le escribieron a tu ot por apuchat, cuando se lo pides.',
|
|
510
525
|
integH: 'Integraciones', integHint: 'Otros lugares a los que puede llegar. Lo que actives acá se le presenta a su cerebro como herramienta.',
|
|
511
526
|
cloudH: '7ots nube', cloudD: 'Tu cuenta en 7ots.com y el ot gemelo de este.', cloudOff: 'Sin conectar.', cloudAs: 'Conectado como {who}', cloudTwin: 'gemelo: {name}', cloudNoTwin: 'todavía sin ot gemelo', goAcc: 'Conectar en Cuenta',
|
|
512
527
|
offload: 'Mandar trabajo a tu servidor', offloadD: 'Envía tareas largas (investigar, leer páginas…) al worker en la nube de tu ot. Solo recibe el pedido y, con Memoria activa, tus notas.', kindsL: 'Tipos', k_research: 'investigar', k_browse: 'leer páginas', k_long: 'tareas largas', k_code: 'código', k_shell: 'comandos shell', vmNone: 'aún sin servidor: agrega el tuyo en 7ots.com → tu ot → Asistente', vmPending: 'esperando que el servidor se enrole', vmOnline: 'en línea', vmOffline: 'desconectado', vmTerminated: 'revocado',
|
|
513
528
|
vmH: 'Asistente en la nube', vmD: 'Tu ot funcionando 24/7 en la nube, aunque este computador esté apagado.', vmDenied: 'sin acceso', vmError: 'no se pudo revisar', vmSince: 'desde {d}',
|
|
514
529
|
orqH: 'Orquesta', orqD: 'Ver tus agentes de Orquesta y mandarles tareas; te avisa cuando terminan.', orqHint: 'O ejecuta 7ots login orquesta en una terminal.', orqNoToken: 'Sin conectar: todavía no ve tus agentes.', orqConnect: 'Conectar Orquesta', orqWaiting: 'Termina de iniciar sesión en tu navegador…', orqProject: 'Agente (proyecto por defecto)', orqOnline: 'en línea', orqOffline: 'desconectado', orqNone: 'Sin proyectos.', orqSend: 'Enviar', orqTask: 'Tarea para el agente', orqSent: 'Enviado · {status}', orqRefresh: 'Recargar',
|
|
515
|
-
mailH: 'Correo (apumail)', mailD: 'Una bandeja de apumail que puede leer cuando se lo pides (activa “Leer tu correo” arriba).', mailInbox: 'Dirección de la bandeja', mailToken: 'Token de apumail',
|
|
516
|
-
customH: 'Integraciones propias', customD: '
|
|
530
|
+
mailH: 'Correo (apumail)', mailD: 'Una bandeja de apumail que puede leer cuando se lo pides (activa “Leer tu correo” arriba).', mailInbox: 'Dirección de la bandeja', mailToken: 'Token de apumail',
|
|
531
|
+
customH: 'Integraciones propias', customD: 'Conéctalo con lo que quieras: un servidor MCP, una API, un comando de este computador, o solo explícale cómo funciona algo. Los ve como herramientas y los usa cuando se lo pides.', customAdd: 'Agregar:', customName: 'Nombre', customInstr: 'Instrucciones para el cerebro', customUrl: 'URL (opcional)', customCmd: 'Comando (opcional)', customEnv: 'Variable con el token (opcional)', customEnvHint: 'Se lee del entorno de este computador o de ~/.7ots/keys.json, nunca se muestra.', edit: 'Editar', remove: 'Quitar', untitled: 'Nueva integración',
|
|
532
|
+
ck_mcp: 'Servidor MCP', ck_api: 'API', ck_command: 'Comando', ck_note: 'Solo instrucciones', ck_mcpD: 'Un servidor Model Context Protocol: lista sus herramientas y las usa', ck_apiD: 'Una URL que puede leer (GET), con un token', ck_commandD: 'Un comando que puede ejecutar en este computador', ck_noteD: 'Solo dile algo que debe saber o hacer', ck_mcpPh: 'GitHub, Linear, mi base de datos…', ck_apiPh: 'Clima, mi CRM…', ck_commandPh: 'Uso de disco, git status…', ck_notePh: 'Cómo deployamos…', ck_mcpInstr: 'Cuándo usarlo (opcional): “para todo lo de mis issues”', ck_apiInstr: 'Qué devuelve y cuándo usarla', ck_commandInstr: 'Qué muestra y cuándo ejecutarlo', ck_noteInstr: 'Qué debe saber o hacer', mcpUrl: 'URL del servidor (HTTP)', mcpCmd: 'Comando que lo inicia (stdio)', mcpHint: 'Servidores remotos por URL (Streamable HTTP); locales por comando. Te pregunta antes de usar una herramienta que pueda cambiar algo.', apiUrl: 'URL base', apiHint: 'Puede agregar una sub-ruta o query a esta URL. Solo GET; el token va como Bearer.', cmdHint: 'Corre con /bin/sh en este computador, máximo 20 s. Los secretos en la salida se ocultan.', mcpTest: 'Conectar y listar herramientas', customTest: 'Probar', mcpTools: '{n} herramientas', orWord: 'o', whatIs: '¿Qué es {n}?', e_customCmd: 'falta el comando', e_customMcp: 'un servidor MCP necesita una URL o un comando',
|
|
517
533
|
charH: 'Ficha del personaje', charHint: 'Quién es. Pesa más que los rasgos de 7ots.com: historia, cómo habla, sus manías y diálogos de ejemplo.',
|
|
518
534
|
chBackstory: 'Historia', chStyle: 'Cómo habla', chQuirks: 'Manías', chScenario: 'Escenario (opcional)', chGreeting: 'Saludo (opcional)', chExamples: 'Diálogos de ejemplo',
|
|
519
535
|
vcConf: 'Configurar voz', vcNow: 'Voz: {v} · cambiar', vcId: 'Id de la voz', vcIdPh: 'Vacío = la del proveedor', vcPick: 'Elige una de tus {n} voces…', vcNoList: 'Aún no hay voces en tu cuenta', vcModel: 'Modelo', vcOneModel: 'xAI tiene un único modelo de voz.', vcDefault: 'Por defecto', vcStyle: 'Estilo (cómo habla)', vcStylePh: 'Ej.: cálido, algo sarcástico, rápido', vcTest: 'Probar', vcTesting: 'Generando…', vcSave: 'Usar esta voz', vcPage: 'Ver voces en su sitio', vcKeyFirst: 'Guarda primero la key para listar tus voces.', chExamplesPh: 'Human: ¿cómo estás?\n{name}: …', chIdeaPh: 'Idea (opcional): un mago jubilado gruñón que ama los trenes…', chAi: 'Rellenar con IA', chAiWait: 'La IA está escribiendo la ficha en {lang}… (hasta un minuto)', chAiLang: 'Idioma de la ficha', chAiPartial: 'Borrador listo, pero estos vinieron vacíos: {f}. Prueba de nuevo.', chAiDone: 'Borrador listo: revísalo y Guarda', chAiBrain: 'Elige primero un cerebro con IA (sección Cerebro)', importCard: 'Importar ficha', exportCard: 'Exportar ficha', imported: 'Importada ✓', badCard: 'Ese archivo no trae una ficha de personaje (JSON o PNG chara_card_v2).',
|
|
@@ -527,14 +543,15 @@
|
|
|
527
543
|
vapuchat: 'apuchat audio', vapuchatD: 'As vozes do apuchat, com seu token de voz do apuchat.', vgrok: 'Grok AI', vgrokD: 'Texto para voz da xAI, com sua key da xAI.', vfish: 'Fish Audio', vfishD: 'Vozes do fish.audio (também clonadas), com sua key.',
|
|
528
544
|
logs: 'Logs de processos', logsD: 'Ler as últimas linhas dos logs de um serviço (journal, pm2, docker, um arquivo .log ou um programa rodando) quando você pede. Chaves e tokens ficam ocultos.',
|
|
529
545
|
sites: 'Guias de sites', sitesD: 'Quando você cita um site, ler o guia de uso dele no Prowl.world (só o domínio é enviado).',
|
|
530
|
-
inbox: 'Ler seu e-mail', inboxD: 'Ler e resumir
|
|
546
|
+
inbox: 'Ler seu e-mail', inboxD: 'Ler e resumir sua caixa do apumail (configure abaixo) e o que escreveram para seu ot no apuchat, quando você pede.',
|
|
531
547
|
integH: 'Integrações', integHint: 'Outros lugares que ele pode alcançar. O que você ativar aqui aparece para o cérebro como ferramenta.',
|
|
532
548
|
cloudH: '7ots nuvem', cloudD: 'Sua conta no 7ots.com e o ot gêmeo deste.', cloudOff: 'Não conectado.', cloudAs: 'Conectado como {who}', cloudTwin: 'gêmeo: {name}', cloudNoTwin: 'ainda sem ot gêmeo', goAcc: 'Conectar em Conta',
|
|
533
549
|
offload: 'Mandar trabalho ao seu servidor', offloadD: 'Envia tarefas longas (pesquisar, ler páginas…) ao worker na nuvem do seu ot. Ele só recebe o pedido e, com Memória ativa, suas notas.', kindsL: 'Tipos', k_research: 'pesquisar', k_browse: 'ler páginas', k_long: 'tarefas longas', k_code: 'código', k_shell: 'comandos shell', vmNone: 'ainda sem servidor: adicione o seu em 7ots.com → seu ot → Assistente', vmPending: 'esperando o servidor se registrar', vmOnline: 'online', vmOffline: 'offline', vmTerminated: 'revogado',
|
|
534
550
|
vmH: 'Assistente na nuvem', vmD: 'Seu ot rodando 24/7 na nuvem, mesmo com este computador desligado.', vmDenied: 'sem acesso', vmError: 'não deu para verificar', vmSince: 'desde {d}',
|
|
535
551
|
orqH: 'Orquesta', orqD: 'Ver seus agentes da Orquesta e mandar tarefas; ele avisa quando terminam.', orqHint: 'Ou rode 7ots login orquesta num terminal.', orqNoToken: 'Sem conexão: ainda não vê seus agentes.', orqConnect: 'Conectar Orquesta', orqWaiting: 'Termine o login no seu navegador…', orqProject: 'Agente (projeto padrão)', orqOnline: 'online', orqOffline: 'offline', orqNone: 'Sem projetos.', orqSend: 'Enviar', orqTask: 'Tarefa para o agente', orqSent: 'Enviado · {status}', orqRefresh: 'Recarregar',
|
|
536
|
-
mailH: 'E-mail (apumail)', mailD: 'Uma caixa do apumail que ele pode ler quando você pede (ative “Ler seu e-mail” acima).', mailInbox: 'Endereço da caixa', mailToken: 'Token do apumail',
|
|
537
|
-
customH: 'Integrações próprias', customD: '
|
|
552
|
+
mailH: 'E-mail (apumail)', mailD: 'Uma caixa do apumail que ele pode ler quando você pede (ative “Ler seu e-mail” acima).', mailInbox: 'Endereço da caixa', mailToken: 'Token do apumail',
|
|
553
|
+
customH: 'Integrações próprias', customD: 'Conecte com o que quiser: um servidor MCP, uma API, um comando deste computador, ou só explique como algo funciona. Ele vê isso como ferramentas e usa quando você pede.', customAdd: 'Adicionar:', customName: 'Nome', customInstr: 'Instruções para o cérebro', customUrl: 'URL (opcional)', customCmd: 'Comando (opcional)', customEnv: 'Variável com o token (opcional)', customEnvHint: 'Lida do ambiente deste computador ou de ~/.7ots/keys.json, nunca mostrada.', edit: 'Editar', remove: 'Remover', untitled: 'Nova integração',
|
|
554
|
+
ck_mcp: 'Servidor MCP', ck_api: 'API', ck_command: 'Comando', ck_note: 'Só instruções', ck_mcpD: 'Um servidor Model Context Protocol: lista as ferramentas e as usa', ck_apiD: 'Uma URL que ele pode ler (GET), com um token', ck_commandD: 'Um comando que ele pode rodar neste computador', ck_noteD: 'Só diga algo que ele deve saber ou fazer', ck_mcpPh: 'GitHub, Linear, meu banco de dados…', ck_apiPh: 'Clima, meu CRM…', ck_commandPh: 'Uso de disco, git status…', ck_notePh: 'Como fazemos deploy…', ck_mcpInstr: 'Quando usar (opcional): “para tudo sobre minhas issues”', ck_apiInstr: 'O que retorna e quando usar', ck_commandInstr: 'O que mostra e quando rodar', ck_noteInstr: 'O que ele deve saber ou fazer', mcpUrl: 'URL do servidor (HTTP)', mcpCmd: 'Comando que o inicia (stdio)', mcpHint: 'Servidores remotos por URL (Streamable HTTP); locais por comando. Ele pergunta antes de usar uma ferramenta que pode mudar algo.', apiUrl: 'URL base', apiHint: 'Ele pode adicionar um sub-caminho ou query a esta URL. Só GET; o token vai como Bearer.', cmdHint: 'Roda com /bin/sh neste computador, no máximo 20 s. Segredos na saída ficam ocultos.', mcpTest: 'Conectar e listar ferramentas', customTest: 'Testar', mcpTools: '{n} ferramentas', orWord: 'ou', whatIs: 'O que é {n}?', e_customCmd: 'falta o comando', e_customMcp: 'um servidor MCP precisa de uma URL ou de um comando',
|
|
538
555
|
charH: 'Ficha do personagem', charHint: 'Quem ele é. Pesa mais que os traços do 7ots.com: história, jeito de falar, manias e diálogos de exemplo.',
|
|
539
556
|
chBackstory: 'História', chStyle: 'Jeito de falar', chQuirks: 'Manias', chScenario: 'Cenário (opcional)', chGreeting: 'Saudação (opcional)', chExamples: 'Diálogos de exemplo',
|
|
540
557
|
vcConf: 'Configurar voz', vcNow: 'Voz: {v} · trocar', vcId: 'Id da voz', vcIdPh: 'Vazio = a do provedor', vcPick: 'Escolha uma das suas {n} vozes…', vcNoList: 'Ainda não há vozes na sua conta', vcModel: 'Modelo', vcOneModel: 'O xAI tem um único modelo de voz.', vcDefault: 'Padrão', vcStyle: 'Estilo (como fala)', vcStylePh: 'Ex.: caloroso, meio sarcástico, rápido', vcTest: 'Testar', vcTesting: 'Gerando…', vcSave: 'Usar esta voz', vcPage: 'Ver vozes no site', vcKeyFirst: 'Salve a key primeiro para listar suas vozes.', chExamplesPh: 'Human: tudo bem?\n{name}: …', chIdeaPh: 'Ideia (opcional): um mago aposentado ranzinza que ama trens…', chAi: 'Preencher com IA', chAiWait: 'A IA está escrevendo a ficha em {lang}… (até um minuto)', chAiLang: 'Idioma da ficha', chAiPartial: 'Rascunho pronto, mas estes vieram vazios: {f}. Tente de novo.', chAiDone: 'Rascunho pronto: revise e Salve', chAiBrain: 'Escolha antes um cérebro com IA (seção Cérebro)', importCard: 'Importar ficha', exportCard: 'Exportar ficha', imported: 'Importada ✓', badCard: 'Esse arquivo não tem uma ficha de personagem (JSON ou PNG chara_card_v2).',
|
|
@@ -897,6 +914,7 @@
|
|
|
897
914
|
box.append(sw('processes', S.config.access.processes === true, false, false));
|
|
898
915
|
box.append(sw('logs', S.config.access.logs === true, false, false));
|
|
899
916
|
box.append(sw('inbox', S.config.access.inbox === true, false, false));
|
|
917
|
+
box.lastChild.append(brandLinks('apumail', 'apuchat'));
|
|
900
918
|
const vm = sw('vm', S.config.access.vm === true, false, false);
|
|
901
919
|
if (S.config.access.vm) vm.append(vmKindsRow());
|
|
902
920
|
box.append(vm);
|
|
@@ -1525,6 +1543,9 @@
|
|
|
1525
1543
|
const card = (lg, title, desc, tog, ...body) =>
|
|
1526
1544
|
el('div', { className: 'integ' }, el('header', {}, el('b', {}, lg, title), tog), desc ? el('small', { textContent: desc }) : null, ...body);
|
|
1527
1545
|
const field = (label, input) => el('label', { className: 'f' }, label, input);
|
|
1546
|
+
// The product's mark + a link to see what it is.
|
|
1547
|
+
const BRAND_URL = { apumail: 'https://apumail.com', apuchat: 'https://apuchat.com' };
|
|
1548
|
+
const brandLinks = (...names) => el('div', { className: 'brands' }, ...names.map((n) => el('a', { className: 'brand', href: BRAND_URL[n], target: '_blank', rel: 'noopener', title: t('whatIs', { n }) }, logo(n, 16), el('span', { textContent: n }), ico('external-link', 12))));
|
|
1528
1549
|
function renderInteg() {
|
|
1529
1550
|
const box = $('#integ');
|
|
1530
1551
|
const I = S.integrations || {};
|
|
@@ -1617,7 +1638,7 @@
|
|
|
1617
1638
|
const orq = card(logo('orquesta', 18), t('orqH'), t('orqD'), toggle(oq.on, (on) => save({ integrations: { orquesta: { on } } }, msg), t('orqH')),
|
|
1618
1639
|
el('div', { className: 'fields' }, tokenIn, saveTok), el('small', { textContent: t('orqHint') }), proj);
|
|
1619
1640
|
|
|
1620
|
-
// Email: an apumail inbox
|
|
1641
|
+
// Email: an apumail inbox
|
|
1621
1642
|
const am = I.apumail || {};
|
|
1622
1643
|
const inbox = el('input', { type: 'text', value: am.inbox || '', placeholder: 'ot@apumail.com', autocomplete: 'off' });
|
|
1623
1644
|
const mailTok = keyField('APUMAIL_TOKEN', t('mailToken'));
|
|
@@ -1628,44 +1649,90 @@
|
|
|
1628
1649
|
renderInteg();
|
|
1629
1650
|
});
|
|
1630
1651
|
const mail = card(logo('apumail', 18), t('mailH'), t('mailD'), toggle(am.on, (on) => save({ integrations: { apumail: { on } } }, msg), t('mailH')),
|
|
1631
|
-
el('div', { className: 'fields' }, field(t('mailInbox'), inbox), mailTok, saveMail));
|
|
1632
|
-
const gmail = el('div', { className: 'integ soon' }, el('header', {}, el('b', {}, logo('gmail', 18), 'Gmail', el('span', { className: 'tag', textContent: t('soon') }))), el('small', { textContent: t('gmailD') }));
|
|
1652
|
+
el('div', { className: 'fields' }, field(t('mailInbox'), inbox), mailTok, saveMail), brandLinks('apumail'));
|
|
1633
1653
|
|
|
1634
|
-
// Custom:
|
|
1635
|
-
|
|
1636
|
-
const
|
|
1654
|
+
// Custom: an MCP server, an API, a command, or just instructions — told to the brain as tools
|
|
1655
|
+
const KINDS = { mcp: 'workflow', api: 'globe', command: 'terminal', note: 'scroll-text' };
|
|
1656
|
+
const kindOf = (c) => c.kind || (c.url ? 'api' : c.command ? 'command' : 'note');
|
|
1657
|
+
let custom = (I.custom || []).map((c) => ({ ...c, kind: kindOf(c) }));
|
|
1658
|
+
const list = el('div', { className: 'customs' });
|
|
1637
1659
|
const saveCustom = async () => {
|
|
1638
|
-
await save({ integrations: { custom } }, msg);
|
|
1639
|
-
custom = (S.integrations?.custom || []).map((c) => ({ ...c }));
|
|
1660
|
+
await save({ integrations: { custom: custom.map(({ _new, _open, ...c }) => c) } }, msg);
|
|
1661
|
+
custom = (S.integrations?.custom || []).map((c) => ({ ...c, kind: kindOf(c) }));
|
|
1640
1662
|
draw();
|
|
1641
1663
|
};
|
|
1642
|
-
const
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1664
|
+
const addRow = el('div', { className: 'kindpick' }, el('small', { textContent: t('customAdd') }),
|
|
1665
|
+
...Object.entries(KINDS).map(([k, ic]) => {
|
|
1666
|
+
const b = el('button', { title: t(`ck_${k}D`) }, ico(ic, 15), ' ', t(`ck_${k}`));
|
|
1667
|
+
b.addEventListener('click', () => {
|
|
1668
|
+
custom.push({ kind: k, name: '', instructions: '', on: true, _new: true });
|
|
1669
|
+
draw();
|
|
1670
|
+
list.querySelector('.integ:last-of-type input')?.focus();
|
|
1671
|
+
});
|
|
1672
|
+
return b;
|
|
1673
|
+
}));
|
|
1674
|
+
const where = (c) => (c.kind === 'mcp' ? c.url || c.command || '' : c.kind === 'api' ? c.url || '' : c.kind === 'command' ? c.command || '' : '');
|
|
1647
1675
|
const draw = () => list.replaceChildren(...custom.map((c, i) => {
|
|
1648
|
-
const inp = (k,
|
|
1649
|
-
const n =
|
|
1676
|
+
const inp = (k, ph = '', area = false) => {
|
|
1677
|
+
const n = area ? el('textarea', { rows: 3, value: c[k] || '', placeholder: ph }) : el('input', { type: 'text', value: c[k] || '', placeholder: ph, autocomplete: 'off', spellcheck: false });
|
|
1650
1678
|
n.addEventListener('input', () => (c[k] = n.value));
|
|
1651
1679
|
return n;
|
|
1652
1680
|
};
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1681
|
+
const body = el('div', { className: 'rows' });
|
|
1682
|
+
const out = el('pre', { className: 'testout', hidden: true });
|
|
1683
|
+
const fill = () => {
|
|
1684
|
+
const kindSel = el('div', { className: 'seg', role: 'radiogroup' }, ...Object.entries(KINDS).map(([k, ic]) => {
|
|
1685
|
+
const b = el('button', { className: c.kind === k ? 'on' : '', type: 'button' }, ico(ic, 14), ' ', t(`ck_${k}`));
|
|
1686
|
+
b.setAttribute('aria-pressed', String(c.kind === k));
|
|
1687
|
+
b.addEventListener('click', () => ((c.kind = k), fill()));
|
|
1688
|
+
return b;
|
|
1689
|
+
}));
|
|
1690
|
+
const env = () => field(t('customEnv'), inp('envVar', 'MY_TOKEN'));
|
|
1691
|
+
const parts = {
|
|
1692
|
+
// an MCP server: remote (URL) or started here (command)
|
|
1693
|
+
mcp: [el('div', { className: 'fields' }, field(t('mcpUrl'), inp('url', 'https://example.com/mcp')), el('span', { className: 'or', textContent: t('orWord') }), field(t('mcpCmd'), inp('command', 'npx -y @modelcontextprotocol/server-…'))), el('div', { className: 'fields' }, env()), el('small', { textContent: t('mcpHint') })],
|
|
1694
|
+
api: [el('div', { className: 'fields' }, field(t('apiUrl'), inp('url', 'https://api.example.com/v1')), env()), el('small', { textContent: t('apiHint') })],
|
|
1695
|
+
command: [el('div', { className: 'fields' }, field(t('customCmd'), inp('command', 'curl -s … | jq …')), env()), el('small', { textContent: t('cmdHint') })],
|
|
1696
|
+
note: [],
|
|
1697
|
+
}[c.kind];
|
|
1698
|
+
const ok = el('button', { className: 'primary', textContent: t('save') });
|
|
1699
|
+
ok.addEventListener('click', () => ((c._open = false), saveCustom()));
|
|
1700
|
+
const test = el('button', {}, ico('refresh-cw', 14), ' ', t(c.kind === 'mcp' ? 'mcpTest' : 'customTest'));
|
|
1701
|
+
test.hidden = c.kind === 'note';
|
|
1702
|
+
test.addEventListener('click', async () => {
|
|
1703
|
+
test.disabled = true;
|
|
1704
|
+
out.hidden = false;
|
|
1705
|
+
out.textContent = '…';
|
|
1706
|
+
try {
|
|
1707
|
+
const { _new, _open, ...draft } = c;
|
|
1708
|
+
const r = await api('/integrations/test', { integration: { ...draft, name: draft.name || 'test' } });
|
|
1709
|
+
if (!r.ok) out.textContent = `✗ ${errText(new Error(r.error))}`;
|
|
1710
|
+
else if (r.tools) out.textContent = r.tools.length ? `✓ ${t('mcpTools', { n: r.tools.length })}\n${r.tools.map((x) => `• ${x.name}${x.description ? ` — ${x.description}` : ''}`).join('\n')}` : `✓ ${t('mcpTools', { n: 0 })}`;
|
|
1711
|
+
else out.textContent = `✓ ${r.text || ''}`;
|
|
1712
|
+
} catch (e) {
|
|
1713
|
+
out.textContent = `✗ ${e.message}`;
|
|
1714
|
+
} finally {
|
|
1715
|
+
test.disabled = false;
|
|
1716
|
+
}
|
|
1717
|
+
});
|
|
1718
|
+
const rm = el('button', { className: 'x', textContent: t('remove') });
|
|
1719
|
+
rm.addEventListener('click', () => (custom.splice(i, 1), saveCustom()));
|
|
1720
|
+
body.replaceChildren(kindSel, field(t('customName'), inp('name', t(`ck_${c.kind}Ph`))), ...parts,
|
|
1721
|
+
field(t('customInstr'), inp('instructions', t(`ck_${c.kind}Instr`), true)), out, el('div', { className: 'fields' }, ok, test, rm));
|
|
1722
|
+
};
|
|
1723
|
+
fill();
|
|
1724
|
+
const open = !!(c._new || c._open);
|
|
1725
|
+
const det = el('details', { open }, el('summary', { textContent: t('edit') }), body);
|
|
1726
|
+
det.addEventListener('toggle', () => (c._open = det.open));
|
|
1727
|
+
const sub = el('small', { className: 'where' }, el('span', { className: 'kind' }, ico(KINDS[c.kind], 12), ' ', t(`ck_${c.kind}`)), where(c) ? el('code', { textContent: where(c) }) : null);
|
|
1728
|
+
return card(ico(KINDS[c.kind] || 'plug', 18), c.name || t('untitled'), c.instructions ? c.instructions.slice(0, 140) : '', c._new ? null : toggle(c.on !== false, (on) => ((c.on = on), saveCustom()), c.name), sub, det);
|
|
1729
|
+
}));
|
|
1663
1730
|
draw();
|
|
1664
|
-
const customBox = el('div', {}, el('p', { className: 'hint', textContent: t('customD') }), list);
|
|
1731
|
+
const customBox = el('div', {}, el('p', { className: 'hint', textContent: t('customD') }), list, addRow);
|
|
1665
1732
|
|
|
1666
1733
|
box.replaceChildren(
|
|
1667
1734
|
card(logo('7ots', 18), t('cloudH'), t('cloudD'), null, cloudBody),
|
|
1668
|
-
orq, mail,
|
|
1735
|
+
orq, mail,
|
|
1669
1736
|
el('h3', { className: 'sh', textContent: t('customH') }), customBox, msg,
|
|
1670
1737
|
);
|
|
1671
1738
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@7ots/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "7ots.com — your AI companion with a face of its own: a desktop pet that watches over your coding agent (Claude Code and shell hooks), a personal assistant (reminders, alerts, notes, opens sites, sees your screen if allowed) and a reproducible identity (face, personality, voice) for any agent — in apuchat meet calls, Orquesta projects or your own server.",
|
|
5
5
|
"homepage": "https://7ots.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,6 +37,7 @@ import {
|
|
|
37
37
|
askOt, authorizeUrl, cancelTask, disconnect, exchangeCode, listProjects, manageUrl, orquestaAccountView, orquestaUrl, otsOrquesta, parseAllow, projectUrl, saveKey, taskStatus,
|
|
38
38
|
registerOts,
|
|
39
39
|
} from './orquesta.mjs';
|
|
40
|
+
import { assertPublicUrl, integrationsView, normalizeOtIntegrations, otIntegrations, testIntegration } from './integrations.mjs';
|
|
40
41
|
|
|
41
42
|
const penv = process.env;
|
|
42
43
|
const STATE_TTL = 10 * 60_000;
|
|
@@ -332,6 +333,39 @@ export function createConnect({ send, readJson, originOf, save }) {
|
|
|
332
333
|
return true;
|
|
333
334
|
}
|
|
334
335
|
|
|
336
|
+
/** Dashboard → Assistant → Integrations (MCP servers / APIs the ot can use when its owner asks). */
|
|
337
|
+
async function integrationsOts(req, res, account, ots, sub) {
|
|
338
|
+
const t = reqT(req);
|
|
339
|
+
const fail = (e) => send(res, 400, { error: e.code ? t(`platform.integ.${e.code}`) : String(e.message || e).slice(0, 300) });
|
|
340
|
+
if (sub === '/integrations' && req.method === 'GET') return send(res, 200, { items: integrationsView(ots) });
|
|
341
|
+
if (sub === '/integrations' && req.method === 'PUT') {
|
|
342
|
+
const body = await readJson(req, 64 * 1024);
|
|
343
|
+
let out;
|
|
344
|
+
try {
|
|
345
|
+
out = normalizeOtIntegrations(body.items, ots);
|
|
346
|
+
for (const c of out.list) if (c.url && c.on) await assertPublicUrl(c.url);
|
|
347
|
+
} catch (e) {
|
|
348
|
+
return fail(e);
|
|
349
|
+
}
|
|
350
|
+
const settings = { ...ots.settings };
|
|
351
|
+
if (out.list.length) settings.INTEGRATIONS = JSON.stringify(out.list);
|
|
352
|
+
else delete settings.INTEGRATIONS;
|
|
353
|
+
const saved = await save(ots, { settings, secrets: out.secrets });
|
|
354
|
+
return send(res, 200, { items: integrationsView(saved) });
|
|
355
|
+
}
|
|
356
|
+
const m = sub.match(/^\/integrations\/([a-z0-9]{6,16})\/test$/);
|
|
357
|
+
if (m && req.method === 'POST') {
|
|
358
|
+
const c = otIntegrations(ots).find((x) => x.id === m[1]);
|
|
359
|
+
if (!c) return send(res, 404, { error: t('platform.integ.notFound') });
|
|
360
|
+
try {
|
|
361
|
+
return send(res, 200, await testIntegration(ots, c));
|
|
362
|
+
} catch (e) {
|
|
363
|
+
return send(res, 200, { ok: false, error: e.code ? t(`platform.integ.${e.code}`) : String(e.message || e).replace(/\b(Bearer|Basic)\s+\S+/gi, '$1 ***').slice(0, 300) });
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return false;
|
|
367
|
+
}
|
|
368
|
+
|
|
335
369
|
return {
|
|
336
370
|
/** /api/platform/<path> for the account; false if not one of these routes. */
|
|
337
371
|
account: accountApi,
|
|
@@ -339,6 +373,7 @@ export function createConnect({ send, readJson, originOf, save }) {
|
|
|
339
373
|
async ots(req, res, account, ots, sub) {
|
|
340
374
|
if (sub.startsWith('/apuchat')) return (await apuchatOts(req, res, account, ots, sub)) !== false;
|
|
341
375
|
if (sub.startsWith('/orquesta')) return (await orquestaOts(req, res, account, ots, sub)) !== false;
|
|
376
|
+
if (sub.startsWith('/integrations')) return (await integrationsOts(req, res, account, ots, sub)) !== false;
|
|
342
377
|
return false;
|
|
343
378
|
},
|
|
344
379
|
auth: authRoutes,
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An ot's own integrations on 7ots.com (dashboard → Assistant → Integrations): MCP servers and APIs it
|
|
3
|
+
* can use when its owner asks it something in the dashboard ("Ask your ot").
|
|
4
|
+
*
|
|
5
|
+
* settings.INTEGRATIONS JSON [{ id, kind: 'mcp'|'api'|'note', name, instructions, url?, on }] (managed, ≤ 10)
|
|
6
|
+
* secrets.INTEG_<id> its token (Bearer), sealed like the other keys and never returned
|
|
7
|
+
*
|
|
8
|
+
* The server reaches these URLs itself, so only public https hosts: every address the name resolves to
|
|
9
|
+
* must be public (no loopback, private, link-local or metadata ranges) and redirects are not followed.
|
|
10
|
+
* Commands are desktop-only (the pet runs them on the user's own computer).
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { lookup } from 'node:dns/promises';
|
|
14
|
+
import { isIP } from 'node:net';
|
|
15
|
+
import { randomBytes } from 'node:crypto';
|
|
16
|
+
import { mcpCall, mcpTools } from '../../cli/lib/mcp.mjs';
|
|
17
|
+
|
|
18
|
+
export const MAX_INTEGRATIONS = 10;
|
|
19
|
+
const KINDS = ['mcp', 'api', 'note'];
|
|
20
|
+
const MAX_OUT = 6000;
|
|
21
|
+
const str = (v, max) => String(v ?? '').replace(/\r/g, '').trim().slice(0, max);
|
|
22
|
+
|
|
23
|
+
const badUrl = (code) => Object.assign(new Error(code), { code });
|
|
24
|
+
|
|
25
|
+
/** The saved list (never with tokens). */
|
|
26
|
+
export function otIntegrations(ots) {
|
|
27
|
+
try {
|
|
28
|
+
const list = JSON.parse(ots?.settings?.INTEGRATIONS || '[]');
|
|
29
|
+
return Array.isArray(list) ? list : [];
|
|
30
|
+
} catch {
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** What the dashboard sees: the list plus whether each one has a token. */
|
|
36
|
+
export function integrationsView(ots) {
|
|
37
|
+
return otIntegrations(ots).map((c) => ({ ...c, hasToken: Boolean(ots.secrets?.[`INTEG_${c.id}`]) }));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Validates the dashboard's list → { list, secrets } to save. `token` on an item replaces its token,
|
|
42
|
+
* `token: ''` removes it, no `token` keeps the one saved.
|
|
43
|
+
*/
|
|
44
|
+
export function normalizeOtIntegrations(items, ots) {
|
|
45
|
+
if (!Array.isArray(items)) throw badUrl('integList');
|
|
46
|
+
if (items.length > MAX_INTEGRATIONS) throw badUrl('integMax');
|
|
47
|
+
const secrets = { ...(ots.secrets || {}) };
|
|
48
|
+
const list = items.map((c) => {
|
|
49
|
+
const kind = KINDS.includes(c?.kind) ? c.kind : 'note';
|
|
50
|
+
const name = str(c?.name, 60);
|
|
51
|
+
if (!name) throw badUrl('integName');
|
|
52
|
+
const url = kind === 'note' ? '' : str(c.url, 300);
|
|
53
|
+
if (kind !== 'note' && !/^https:\/\/[^\s"'<>]+$/i.test(url)) throw badUrl('integUrl');
|
|
54
|
+
const id = /^[a-z0-9]{6,16}$/.test(c.id || '') ? c.id : randomBytes(5).toString('hex');
|
|
55
|
+
if (typeof c.token === 'string') {
|
|
56
|
+
const tok = c.token.trim().slice(0, 2000);
|
|
57
|
+
if (tok) secrets[`INTEG_${id}`] = tok;
|
|
58
|
+
else delete secrets[`INTEG_${id}`];
|
|
59
|
+
}
|
|
60
|
+
return { id, kind, name, instructions: str(c.instructions, 1500), ...(url ? { url } : {}), on: c.on !== false };
|
|
61
|
+
});
|
|
62
|
+
// tokens of removed integrations go too
|
|
63
|
+
const ids = new Set(list.map((c) => c.id));
|
|
64
|
+
for (const k of Object.keys(secrets)) if (k.startsWith('INTEG_') && !ids.has(k.slice(6))) delete secrets[k];
|
|
65
|
+
return { list, secrets };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ── only public hosts ──
|
|
69
|
+
|
|
70
|
+
function privateIp(ip) {
|
|
71
|
+
if (isIP(ip) === 6) {
|
|
72
|
+
const v = ip.toLowerCase();
|
|
73
|
+
if (v.startsWith('::ffff:')) return privateIp(v.slice(7));
|
|
74
|
+
return v === '::' || v === '::1' || /^f[cd]/.test(v) || /^fe[89ab]/.test(v) || v.startsWith('64:ff9b:') || v.startsWith('2001:db8');
|
|
75
|
+
}
|
|
76
|
+
const [a, b] = ip.split('.').map(Number);
|
|
77
|
+
return a === 0 || a === 10 || a === 127 || (a === 100 && b >= 64 && b <= 127) || (a === 169 && b === 254) || (a === 172 && b >= 16 && b <= 31) || (a === 192 && b === 168) || (a === 198 && (b === 18 || b === 19)) || a >= 224;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export async function assertPublicUrl(raw) {
|
|
81
|
+
let u;
|
|
82
|
+
try {
|
|
83
|
+
u = new URL(raw);
|
|
84
|
+
} catch {
|
|
85
|
+
throw badUrl('integUrl');
|
|
86
|
+
}
|
|
87
|
+
if (u.protocol !== 'https:' || u.username || u.password) throw badUrl('integUrl');
|
|
88
|
+
const host = u.hostname.replace(/^\[|\]$/g, '');
|
|
89
|
+
if (/^(localhost|.*\.local|.*\.internal|metadata\.google\.internal)$/i.test(host)) throw badUrl('integPrivate');
|
|
90
|
+
const addrs = isIP(host) ? [{ address: host }] : await lookup(host, { all: true }).catch(() => []);
|
|
91
|
+
if (!addrs.length) throw badUrl('integDns');
|
|
92
|
+
if (addrs.some((a) => privateIp(a.address))) throw badUrl('integPrivate');
|
|
93
|
+
return u;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// ── running them ──
|
|
97
|
+
|
|
98
|
+
const tokenOf = (ots, c) => ots.secrets?.[`INTEG_${c.id}`] || '';
|
|
99
|
+
const redact = (s) => String(s ?? '').replace(/\b(Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{8,}/gi, '$1 ***');
|
|
100
|
+
|
|
101
|
+
/** Dashboard → "Connect and list tools" / "Try it" for one saved integration. */
|
|
102
|
+
export async function testIntegration(ots, c) {
|
|
103
|
+
if (c.kind === 'note') return { ok: true, text: '' };
|
|
104
|
+
await assertPublicUrl(c.url);
|
|
105
|
+
if (c.kind === 'mcp') return { ok: true, tools: (await mcpTools(c, tokenOf(ots, c), { fresh: true })).map((x) => ({ name: x.name, description: x.description })) };
|
|
106
|
+
return { ok: true, text: (await apiGet(ots, c, '')).slice(0, 1500) };
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function apiGet(ots, c, path) {
|
|
110
|
+
const target = path && /^[/?][^\s"'<>]*$/.test(path) && !path.startsWith('//') ? c.url.replace(/\/+$/, '') + path : c.url;
|
|
111
|
+
await assertPublicUrl(target);
|
|
112
|
+
const tok = tokenOf(ots, c);
|
|
113
|
+
const res = await fetch(target, { redirect: 'manual', headers: { Accept: 'application/json, text/plain;q=0.9, */*;q=0.5', ...(tok ? { Authorization: `Bearer ${tok}` } : {}) }, signal: AbortSignal.timeout(15000) });
|
|
114
|
+
return redact(`HTTP ${res.status}\n${(await res.text()).slice(0, 20000)}`).slice(0, MAX_OUT);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const TOOLS = [
|
|
118
|
+
{
|
|
119
|
+
name: 'integration_tools',
|
|
120
|
+
description: 'Lists the tools of one of your MCP integrations (see the list in your instructions).',
|
|
121
|
+
parameters: { type: 'object', properties: { id: { type: 'string', description: 'Integration id' } }, required: ['id'] },
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'integration_call',
|
|
125
|
+
description: 'Calls a tool of one of your MCP integrations. Use the exact tool name from integration_tools.',
|
|
126
|
+
parameters: { type: 'object', properties: { id: { type: 'string' }, tool: { type: 'string' }, args: { type: 'object', description: 'The tool arguments' } }, required: ['id', 'tool'] },
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'integration_get',
|
|
130
|
+
description: 'Reads (HTTP GET) one of your API integrations, optionally with a sub-path or query appended to its URL.',
|
|
131
|
+
parameters: { type: 'object', properties: { id: { type: 'string' }, path: { type: 'string', description: 'Optional, starting with / or ?' } }, required: ['id'] },
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Tools and prompt text for the owner's chat, or null when the ot has no integration turned on.
|
|
137
|
+
* @returns {{ tools: object[], names: string[], run: Function, prompt: string } | null}
|
|
138
|
+
*/
|
|
139
|
+
export function integrationTools(ots) {
|
|
140
|
+
const on = otIntegrations(ots).filter((c) => c.on !== false);
|
|
141
|
+
if (!on.length) return null;
|
|
142
|
+
const usable = on.filter((c) => c.kind !== 'note');
|
|
143
|
+
const prompt = `Integrations your owner set up for you:\n${on.map((c) => `- ${c.name} (id ${c.id}, ${c.kind === 'mcp' ? 'MCP server' : c.kind === 'api' ? `API at ${c.url}` : 'instructions'})${c.instructions ? `: ${c.instructions}` : ''}`).join('\n')}\nOnly call a tool that changes something (creates, sends, deletes, updates) when your owner asked for exactly that.`;
|
|
144
|
+
const find = (id, kind) => {
|
|
145
|
+
const c = usable.find((x) => x.id === String(id || ''));
|
|
146
|
+
if (!c || (kind && c.kind !== kind)) throw new Error(`No ${kind === 'mcp' ? 'MCP' : kind === 'api' ? 'API' : ''} integration with id ${id}`);
|
|
147
|
+
return c;
|
|
148
|
+
};
|
|
149
|
+
const tools = TOOLS.filter((x) => (x.name === 'integration_get' ? usable.some((c) => c.kind === 'api') : usable.some((c) => c.kind === 'mcp')));
|
|
150
|
+
return {
|
|
151
|
+
prompt,
|
|
152
|
+
tools,
|
|
153
|
+
names: tools.map((x) => x.name),
|
|
154
|
+
run: async (name, args = {}) => {
|
|
155
|
+
if (name === 'integration_tools') {
|
|
156
|
+
const c = find(args.id, 'mcp');
|
|
157
|
+
await assertPublicUrl(c.url);
|
|
158
|
+
return { ok: true, tools: await mcpTools(c, tokenOf(ots, c)) };
|
|
159
|
+
}
|
|
160
|
+
if (name === 'integration_call') {
|
|
161
|
+
const c = find(args.id, 'mcp');
|
|
162
|
+
await assertPublicUrl(c.url);
|
|
163
|
+
return { ok: true, result: redact(await mcpCall(c, tokenOf(ots, c), String(args.tool || ''), args.args)).slice(0, MAX_OUT) };
|
|
164
|
+
}
|
|
165
|
+
if (name === 'integration_get') return { ok: true, result: await apiGet(ots, find(args.id, 'api'), String(args.path || '')) };
|
|
166
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -33,6 +33,7 @@ import { resolveLocale, translator } from '../../src/i18n/index.js';
|
|
|
33
33
|
import { identityPrompt } from '../identity.mjs';
|
|
34
34
|
import { i18nError } from '../i18n.mjs';
|
|
35
35
|
import { TASK_FINAL, addTask, getIntegration, getPlatformState, getTask, listOts, openTasks, setIntegration, setPlatformState, tasksLastDay, updateTask } from './store.mjs';
|
|
36
|
+
import { integrationTools } from './integrations.mjs';
|
|
36
37
|
|
|
37
38
|
const penv = process.env;
|
|
38
39
|
const ORQ = (penv.ORQUESTA_URL || 'https://getorquesta.com').replace(/\/+$/, '');
|
|
@@ -527,6 +528,10 @@ export function orquestaTools(ots, ctx) {
|
|
|
527
528
|
|
|
528
529
|
// ───────────────────────────── "Ask your ot" (owner chat) ─────────────────────────────
|
|
529
530
|
|
|
531
|
+
const OWNER_NOTE_PLAIN =
|
|
532
|
+
'You are talking with your OWNER in the 7ots dashboard (not a visitor). Plain text, short. Use your integrations ' +
|
|
533
|
+
'when they help with what they ask, and say what came back. Reply in their language.';
|
|
534
|
+
|
|
530
535
|
const OWNER_NOTE =
|
|
531
536
|
'You are talking with your OWNER in the 7ots dashboard (not a visitor). Plain text, short. When they ask you to ' +
|
|
532
537
|
'do something in their project, use run_task with a clear, complete task; report what came back. If a task is ' +
|
|
@@ -537,9 +542,13 @@ const OWNER_NOTE =
|
|
|
537
542
|
* @returns {Promise<{ reply: string, tasks: string[] }>}
|
|
538
543
|
*/
|
|
539
544
|
export async function askOt(ots, { message, history = [], ownerEmail = '', locale }, step) {
|
|
540
|
-
const
|
|
541
|
-
|
|
542
|
-
|
|
545
|
+
const oq = orquestaTools(ots, { channel: 'owner', from: ownerEmail });
|
|
546
|
+
const integ = integrationTools(ots);
|
|
547
|
+
if (!oq && !integ) throw i18nError(409, orquestaAccountView(ots.accountId).connected ? 'platform.orquesta.off' : 'platform.orquesta.notConnected');
|
|
548
|
+
// Orquesta's tools and the ot's own integrations (MCP servers, APIs) side by side
|
|
549
|
+
const parts = [oq, integ].filter(Boolean);
|
|
550
|
+
const tools = { tools: parts.flatMap((p) => p.tools), names: parts.flatMap((p) => p.names), run: (name, args) => parts.find((p) => p.names.includes(name)).run(name, args) };
|
|
551
|
+
const system = [ots.settings.SERVER_INSTRUCTIONS || '', identityPrompt(ots.identity), oq ? OWNER_NOTE : OWNER_NOTE_PLAIN, integ?.prompt || ''].filter(Boolean).join('\n\n');
|
|
543
552
|
const past = (Array.isArray(history) ? history : [])
|
|
544
553
|
.filter((m) => m && (m.role === 'user' || m.role === 'assistant') && typeof m.content === 'string' && m.content.trim())
|
|
545
554
|
.slice(-12)
|
|
@@ -54,6 +54,8 @@ export const OTS_KEYS = {
|
|
|
54
54
|
// Read on every message, so changing them never restarts the channels.
|
|
55
55
|
ORQUESTA_PROJECT: { managed: true }, ORQUESTA_PROJECT_NAME: { managed: true }, ORQUESTA_TASKS: { managed: true },
|
|
56
56
|
ORQUESTA_ALLOW: { managed: true }, ORQUESTA_DAILY: { managed: true, max: 200 },
|
|
57
|
+
// The ot's own MCP servers and APIs (integrations.mjs): JSON list; their tokens live in secrets as INTEG_<id>.
|
|
58
|
+
INTEGRATIONS: { managed: true },
|
|
57
59
|
// Cloud VM (vm.mjs): which job kinds the desktop may send to this ot's worker (csv; default research,browse,long).
|
|
58
60
|
VM_JOB_KINDS: {},
|
|
59
61
|
};
|
|
@@ -84,6 +84,15 @@ const es = {
|
|
|
84
84
|
badAllow: 'No se entiende: {list}. Escribe @handles de apuchat o correos, sin comodines.',
|
|
85
85
|
pickProject: 'Elige un proyecto antes de activar las tareas',
|
|
86
86
|
},
|
|
87
|
+
integ: {
|
|
88
|
+
integList: 'Lista de integraciones no válida',
|
|
89
|
+
integMax: 'Máximo 10 integraciones por ot',
|
|
90
|
+
integName: 'Cada integración necesita un nombre',
|
|
91
|
+
integUrl: 'La URL debe empezar con https://',
|
|
92
|
+
integPrivate: 'Esa dirección es privada o local: desde la nube solo se llega a servidores públicos',
|
|
93
|
+
integDns: 'No se encontró ese dominio',
|
|
94
|
+
notFound: 'Esa integración no existe',
|
|
95
|
+
},
|
|
87
96
|
vm: {
|
|
88
97
|
badCode: 'Ese código de enrolamiento no es válido o ya caducó; genera otro en 7ots.com',
|
|
89
98
|
revoked: 'Este servidor ya no está autorizado para este ot; vuelve a enrolarlo',
|
|
@@ -188,6 +197,15 @@ const en = {
|
|
|
188
197
|
badAllow: 'Not understood: {list}. Use apuchat @handles or email addresses, no wildcards.',
|
|
189
198
|
pickProject: 'Pick a project before enabling tasks',
|
|
190
199
|
},
|
|
200
|
+
integ: {
|
|
201
|
+
integList: 'Invalid integrations list',
|
|
202
|
+
integMax: 'Up to 10 integrations per ot',
|
|
203
|
+
integName: 'Every integration needs a name',
|
|
204
|
+
integUrl: 'The URL must start with https://',
|
|
205
|
+
integPrivate: 'That address is private or local: from the cloud only public servers can be reached',
|
|
206
|
+
integDns: 'That domain was not found',
|
|
207
|
+
notFound: 'That integration does not exist',
|
|
208
|
+
},
|
|
191
209
|
vm: {
|
|
192
210
|
badCode: 'That enrollment code is not valid or has expired; make a new one on 7ots.com',
|
|
193
211
|
revoked: 'This server is no longer authorized for this ot; enroll it again',
|
|
@@ -292,6 +310,15 @@ const pt = {
|
|
|
292
310
|
badAllow: 'Não entendi: {list}. Use @handles do apuchat ou e-mails, sem curingas.',
|
|
293
311
|
pickProject: 'Escolha um projeto antes de ativar as tarefas',
|
|
294
312
|
},
|
|
313
|
+
integ: {
|
|
314
|
+
integList: 'Lista de integrações inválida',
|
|
315
|
+
integMax: 'No máximo 10 integrações por ot',
|
|
316
|
+
integName: 'Cada integração precisa de um nome',
|
|
317
|
+
integUrl: 'A URL deve começar com https://',
|
|
318
|
+
integPrivate: 'Esse endereço é privado ou local: da nuvem só se chega a servidores públicos',
|
|
319
|
+
integDns: 'Esse domínio não foi encontrado',
|
|
320
|
+
notFound: 'Essa integração não existe',
|
|
321
|
+
},
|
|
295
322
|
vm: {
|
|
296
323
|
badCode: 'Esse código de registro não é válido ou expirou; gere outro no 7ots.com',
|
|
297
324
|
revoked: 'Este servidor não está mais autorizado para este ot; registre-o de novo',
|