@clawchatsai/connector 0.1.26 → 0.1.28

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.
@@ -0,0 +1,48 @@
1
+ // Decrypts a ClawChats share envelope. Inlined into every share page by viewer-page.js (the `export`
2
+ // keywords are stripped there), and imported directly by the tests. Mirrors the browser's encrypt side
3
+ // (clawchats frontend/share/share-crypto.js). No DOM use.
4
+
5
+ const b64uDecode = s => {
6
+ const b64 = s.replace(/-/g, '+').replace(/_/g, '/') + '==='.slice((s.length + 3) % 4);
7
+ return Uint8Array.from(atob(b64), c => c.charCodeAt(0));
8
+ };
9
+
10
+ export class ShareError extends Error {
11
+ constructor(code, message) { super(message); this.code = code; }
12
+ }
13
+
14
+ async function keyFromLinkSecret(secret) {
15
+ const raw = b64uDecode(secret);
16
+ if (raw.length !== 32) throw new ShareError('bad-key', 'This link is incomplete. Copy the full link, including the part after #.');
17
+ return crypto.subtle.importKey('raw', raw, 'AES-GCM', false, ['decrypt']);
18
+ }
19
+
20
+ async function keyFromPassword(password, kdf) {
21
+ const base = await crypto.subtle.importKey('raw', new TextEncoder().encode(password), 'PBKDF2', false, ['deriveKey']);
22
+ return crypto.subtle.deriveKey(
23
+ { name: 'PBKDF2', hash: kdf.hash, iterations: kdf.iter, salt: b64uDecode(kdf.salt) },
24
+ base, { name: 'AES-GCM', length: 256 }, false, ['decrypt']);
25
+ }
26
+
27
+ /** True when the envelope needs a password instead of the link secret. */
28
+ export const needsPassword = envelope => !!envelope.kdf;
29
+
30
+ /**
31
+ * @param {object} envelope {v, alg, kdf?, iv, ct}
32
+ * @param {{secret?: string, password?: string}} opts
33
+ * @returns {Promise<object>} the shared payload
34
+ */
35
+ export async function decryptShare(envelope, { secret, password } = {}) {
36
+ if (envelope?.v !== 1 || envelope.alg !== 'A256GCM') throw new ShareError('unsupported', 'This share was made by a newer version of ClawChats.');
37
+ const key = envelope.kdf
38
+ ? await keyFromPassword(password ?? '', envelope.kdf)
39
+ : await keyFromLinkSecret(secret ?? '');
40
+ let plain;
41
+ try {
42
+ plain = await crypto.subtle.decrypt({ name: 'AES-GCM', iv: b64uDecode(envelope.iv) }, key, b64uDecode(envelope.ct));
43
+ } catch {
44
+ throw new ShareError(envelope.kdf ? 'bad-password' : 'bad-key',
45
+ envelope.kdf ? 'Wrong password.' : 'This link’s key doesn’t match. Copy the full link again.');
46
+ }
47
+ return JSON.parse(new TextDecoder().decode(plain));
48
+ }
@@ -0,0 +1,23 @@
1
+ // Builds the self-contained share page: viewer.html with the decrypt code and the ciphertext envelope
2
+ // inlined. One static HTML file per share, uploaded to the user's own bucket; no server logic anywhere.
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+
7
+ const dir = path.dirname(fileURLToPath(import.meta.url));
8
+ let template = null;
9
+
10
+ function load() {
11
+ if (template) return template;
12
+ const html = fs.readFileSync(path.join(dir, 'viewer.html'), 'utf8');
13
+ const decrypt = fs.readFileSync(path.join(dir, 'viewer-decrypt.js'), 'utf8').replace(/^export /gm, '');
14
+ template = html.replace('{{DECRYPT_JS}}', () => decrypt);
15
+ return template;
16
+ }
17
+
18
+ /** @param {object} envelope validated ciphertext envelope ({v, alg, iv, ct, kdf?}) */
19
+ export function buildSharePage(envelope) {
20
+ // Escape "<" so the JSON can't close its <script> element, whatever it contains.
21
+ const json = JSON.stringify(envelope).replace(/</g, '\\u003c');
22
+ return load().replace('{{ENVELOPE_JSON}}', () => json);
23
+ }
@@ -0,0 +1,167 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <meta name="robots" content="noindex, nofollow">
7
+ <meta name="referrer" content="no-referrer">
8
+ <!-- Self-contained ClawChats share page (built by the connector, server/share/viewer-page.js). The content
9
+ below is encrypted; the key is in the link after #, which browsers never send to a server. The
10
+ decrypted artifact renders in a sandboxed iframe (opaque origin) that inherits this policy:
11
+ no network access (connect-src 'none'). -->
12
+ <meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline' 'unsafe-eval' https://cdnjs.cloudflare.com; style-src 'unsafe-inline' https://cdnjs.cloudflare.com https://fonts.googleapis.com; font-src https://fonts.gstatic.com https://cdnjs.cloudflare.com data:; img-src data: blob: https:; media-src data: blob: https:; connect-src 'none'; frame-src 'self' blob: data:; base-uri 'none'; form-action 'none'">
13
+ <title>Shared from ClawChats</title>
14
+ <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 32 32%27%3E%3Crect width=%2732%27 height=%2732%27 rx=%277%27 fill=%27%234f8cff%27/%3E%3Cpath d=%27M9 21l5-10 3 6 2-3 4 7z%27 fill=%27%23fff%27/%3E%3C/svg%3E">
15
+ <style>
16
+ :root { --bg:#0f1115; --panel:#171a21; --border:#2a2f3a; --text:#e6e8ee; --muted:#8b93a7; --primary:#4f8cff; --danger:#ff6b6b; color-scheme:dark; }
17
+ * { box-sizing:border-box; }
18
+ html, body { height:100%; margin:0; }
19
+ body { display:flex; flex-direction:column; background:var(--bg); color:var(--text); font:14px/1.5 system-ui,-apple-system,"Segoe UI",sans-serif; }
20
+ .bar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 16px; background:var(--panel); border-bottom:1px solid var(--border); }
21
+ .bar-title { display:flex; align-items:center; gap:8px; min-width:0; }
22
+ .brand { font-weight:600; }
23
+ .sep { color:var(--muted); }
24
+ .title { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
25
+ .bar-actions { display:flex; align-items:center; gap:12px; flex-shrink:0; }
26
+ .meta { color:var(--muted); font-size:13px; }
27
+ .btn { padding:6px 12px; border:1px solid var(--border); border-radius:6px; background:transparent; color:var(--text); font:inherit; cursor:pointer; }
28
+ .btn:hover { background:#222733; }
29
+ .btn.primary { background:var(--primary); border-color:var(--primary); color:#fff; }
30
+ .btn:disabled { opacity:.6; cursor:default; }
31
+ main { flex:1; display:flex; min-height:0; }
32
+ #frame { flex:1; width:100%; border:0; background:#fff; }
33
+ .state { margin:auto; max-width:420px; padding:24px; text-align:center; color:var(--muted); }
34
+ .pw-form { display:flex; flex-direction:column; gap:10px; text-align:left; color:var(--text); }
35
+ .pw-row { display:flex; gap:8px; }
36
+ .pw-row input { flex:1; padding:8px 10px; border:1px solid var(--border); border-radius:6px; background:var(--bg); color:var(--text); font:inherit; }
37
+ .error { margin:0; color:var(--danger); }
38
+ .note { padding:6px 16px; color:var(--muted); font-size:12px; text-align:center; border-top:1px solid var(--border); }
39
+ </style>
40
+ </head>
41
+ <body>
42
+ <header class="bar">
43
+ <div class="bar-title"><span class="brand">ClawChats</span><span class="sep">/</span><span id="share-title" class="title">Shared artifact</span></div>
44
+ <div class="bar-actions"><span id="share-meta" class="meta"></span><button id="btn-download" class="btn" type="button" hidden>Download</button></div>
45
+ </header>
46
+ <main>
47
+ <section id="state" class="state">
48
+ <p id="state-text">Decrypting…</p>
49
+ <form id="pw-form" class="pw-form" hidden>
50
+ <label for="pw-input">This share is password protected.</label>
51
+ <div class="pw-row"><input id="pw-input" type="password" autocomplete="off" placeholder="Password"><button class="btn primary" type="submit">Unlock</button></div>
52
+ <p id="pw-error" class="error" hidden></p>
53
+ </form>
54
+ </section>
55
+ <iframe id="frame" title="Shared content" sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox" hidden></iframe>
56
+ </main>
57
+ <footer class="note">Shared by a ClawChats user. Don’t enter passwords or personal details into a shared page. Decrypted in your browser; stored encrypted in the sharer’s own storage.</footer>
58
+ <script type="application/json" id="share-envelope">{{ENVELOPE_JSON}}</script>
59
+ <script>
60
+ {{DECRYPT_JS}}
61
+
62
+ (() => {
63
+ const $ = id => document.getElementById(id);
64
+ const EXT = { html: 'html', svg: 'svg', markdown: 'md', mermaid: 'mmd', csv: 'csv', code: 'txt' };
65
+ const esc = s => String(s ?? '').replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
66
+ const BASE_CSS = 'body{margin:0;padding:24px;font:15px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif;color:#1f2328;background:#fff}'
67
+ + 'pre{margin:0;white-space:pre-wrap;word-break:break-word;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}'
68
+ + 'table{border-collapse:collapse;font-size:14px}td,th{border:1px solid #d0d7de;padding:6px 10px;text-align:left}th{background:#f6f8fa}'
69
+ + '.md{max-width:820px;margin:0 auto}.md img{max-width:100%}.md pre{background:#f6f8fa;padding:12px;border-radius:6px;overflow:auto}'
70
+ + '.md code{font:13px ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}.center{display:flex;justify-content:center}'
71
+ + 'pre.mermaid{display:block;text-align:center;white-space:pre;font:inherit}';
72
+ const page = (body, head = '') => `<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><style>${BASE_CSS}</style>${head}</head><body>${body}</body></html>`;
73
+ const lib = (src, sri) => `<script src="${src}" integrity="${sri}" crossorigin="anonymous"><\/script>`;
74
+ const MERMAID = lib('https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.8/mermaid.min.js', 'sha384-N3QqR/7q+xm3BGX+CBbNI8AUmRRqcsDzToy+0z1NLDI0QmTKW8zvwLvqulJgk3dP');
75
+ const MARKED = lib('https://cdnjs.cloudflare.com/ajax/libs/marked/18.0.14/lib/marked.umd.min.js', 'sha384-J1VD5X/E72gORmmXiADelqS192/84qho9IALLC3d5oxjp1RgEN3He4ANyjqXyz10');
76
+
77
+ function csvTable(text) {
78
+ const rows = [];
79
+ let row = [], cell = '', q = false;
80
+ for (let i = 0; i < text.length; i++) {
81
+ const c = text[i];
82
+ if (q) {
83
+ if (c === '"' && text[i + 1] === '"') { cell += '"'; i++; }
84
+ else if (c === '"') q = false;
85
+ else cell += c;
86
+ } else if (c === '"') q = true;
87
+ else if (c === ',') { row.push(cell); cell = ''; }
88
+ else if (c === '\n' || c === '\r') {
89
+ if (c === '\r' && text[i + 1] === '\n') i++;
90
+ row.push(cell); rows.push(row); row = []; cell = '';
91
+ } else cell += c;
92
+ }
93
+ if (cell || row.length) { row.push(cell); rows.push(row); }
94
+ if (!rows.length) return '';
95
+ const [head, ...body] = rows;
96
+ return `<table><thead><tr>${head.map(h => `<th>${esc(h)}</th>`).join('')}</tr></thead><tbody>`
97
+ + body.map(r => `<tr>${r.map(c => `<td>${esc(c)}</td>`).join('')}</tr>`).join('') + '</tbody></table>';
98
+ }
99
+
100
+ // The artifact document for the sandboxed iframe. Untrusted content: it only ever goes into srcdoc.
101
+ function build(type, content) {
102
+ switch (type) {
103
+ case 'html': return String(content);
104
+ case 'svg': return page(`<div class="center">${content}</div>`);
105
+ case 'mermaid':
106
+ return page(`<pre class="mermaid">${esc(content)}</pre>`, MERMAID
107
+ + '<script>addEventListener("DOMContentLoaded",()=>{mermaid.initialize({startOnLoad:false,securityLevel:"strict"});mermaid.run()})<\/script>');
108
+ case 'markdown':
109
+ return page('<article class="md" id="md"></article>', MARKED
110
+ + `<script>addEventListener("DOMContentLoaded",()=>{document.getElementById("md").innerHTML=marked.parse(${JSON.stringify(String(content)).replace(/</g, '\\u003c')})})<\/script>`);
111
+ case 'csv': return page(csvTable(String(content)));
112
+ default: return page(`<pre>${esc(content)}</pre>`);
113
+ }
114
+ }
115
+
116
+ function showState(text) { $('state').hidden = false; $('state-text').textContent = text; $('frame').hidden = true; }
117
+
118
+ function render(payload) {
119
+ const title = String(payload.title || 'Shared artifact').slice(0, 200);
120
+ document.title = `${title} · ClawChats`;
121
+ $('share-title').textContent = title;
122
+ const d = new Date(payload.createdAt);
123
+ if (!isNaN(d)) $('share-meta').textContent = `Shared ${d.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' })}`;
124
+ const btn = $('btn-download');
125
+ btn.hidden = false;
126
+ btn.onclick = () => {
127
+ const ext = payload.type === 'code' ? (payload.language || 'txt') : (EXT[payload.type] || 'txt');
128
+ const a = document.createElement('a');
129
+ a.href = URL.createObjectURL(new Blob([payload.content], { type: 'text/plain' }));
130
+ a.download = `${title.replace(/[^\w.-]+/g, '-').replace(/^-+|-+$/g, '') || 'artifact'}.${String(ext).replace(/\W/g, '') || 'txt'}`;
131
+ a.click();
132
+ setTimeout(() => URL.revokeObjectURL(a.href), 1000);
133
+ };
134
+ const frame = $('frame');
135
+ frame.srcdoc = build(payload.type, payload.content);
136
+ frame.hidden = false;
137
+ $('state').hidden = true;
138
+ }
139
+
140
+ async function main() {
141
+ let envelope;
142
+ try { envelope = JSON.parse($('share-envelope').textContent); } catch { return showState('This share is damaged.'); }
143
+ if (!needsPassword(envelope)) {
144
+ const secret = new URLSearchParams(location.hash.slice(1)).get('k');
145
+ if (!secret) return showState('This link is missing its key. Copy the full link, including the part after #.');
146
+ try { render(await decryptShare(envelope, { secret })); } catch (err) { showState(err.message); }
147
+ return;
148
+ }
149
+ $('state-text').textContent = '';
150
+ const form = $('pw-form');
151
+ form.hidden = false;
152
+ $('pw-input').focus();
153
+ form.onsubmit = async e => {
154
+ e.preventDefault();
155
+ const btn = form.querySelector('button');
156
+ btn.disabled = true;
157
+ $('pw-error').hidden = true;
158
+ try { render(await decryptShare(envelope, { password: $('pw-input').value })); }
159
+ catch (err) { $('pw-error').textContent = err.message; $('pw-error').hidden = false; }
160
+ finally { btn.disabled = false; }
161
+ };
162
+ }
163
+ main();
164
+ })();
165
+ </script>
166
+ </body>
167
+ </html>
@@ -0,0 +1,125 @@
1
+ // TeamStore: team chats (several agents in one ClawChats thread). Lives in the global DB.
2
+ // Registry entry: EXTRAS.md. Coordinator: server/team.js.
3
+ //
4
+ // team_rooms a room = a gateway session that never runs; its transcript is the shared timeline;
5
+ // source_key = the chat it was converted from (its history shows above the room)
6
+ // team_members one working session per agent per room (created on the agent's first turn);
7
+ // seen_at = timestamp of the newest room entry the agent has been given;
8
+ // removed = 1: agent taken out of the room; its session stays hidden and is reused
9
+ // if the agent is added back
10
+ // team_entries author of each injected room entry (the transcript only has a "[Label]" prefix)
11
+
12
+ const DISCUSS_ROUNDS = 3;
13
+
14
+ function roomRow(r, members) {
15
+ return {
16
+ roomKey: r.room_key,
17
+ discuss: !!r.discuss,
18
+ sourceKey: r.source_key || null,
19
+ createdAt: r.created_at,
20
+ members: members.map(m => ({ agentId: m.agent_id, workKey: m.work_key || null, seenAt: m.seen_at || 0 })),
21
+ };
22
+ }
23
+
24
+ export function createTeamStore(getGlobalDb) {
25
+ let ready = false;
26
+ function db() {
27
+ const g = getGlobalDb();
28
+ if (!ready) {
29
+ g.exec(`CREATE TABLE IF NOT EXISTS team_rooms (room_key TEXT PRIMARY KEY, discuss INTEGER NOT NULL DEFAULT 0, source_key TEXT, created_at INTEGER NOT NULL, updated_at INTEGER NOT NULL)`);
30
+ g.exec(`CREATE TABLE IF NOT EXISTS team_members (room_key TEXT NOT NULL, agent_id TEXT NOT NULL, work_key TEXT, seen_at INTEGER NOT NULL DEFAULT 0, position INTEGER NOT NULL, PRIMARY KEY (room_key, agent_id))`);
31
+ g.exec(`CREATE INDEX IF NOT EXISTS team_members_work ON team_members (work_key)`);
32
+ if (!g.prepare('PRAGMA table_info(team_members)').all().some(c => c.name === 'removed')) g.exec('ALTER TABLE team_members ADD COLUMN removed INTEGER NOT NULL DEFAULT 0');
33
+ g.exec(`CREATE TABLE IF NOT EXISTS team_entries (room_key TEXT NOT NULL, message_id TEXT NOT NULL, author_type TEXT NOT NULL, agent_id TEXT, created_at INTEGER NOT NULL, PRIMARY KEY (room_key, message_id))`);
34
+ ready = true;
35
+ }
36
+ return g;
37
+ }
38
+ const members = roomKey => db().prepare('SELECT * FROM team_members WHERE room_key = ? AND removed = 0 ORDER BY position').all(roomKey);
39
+
40
+ return {
41
+ DISCUSS_ROUNDS,
42
+
43
+ getRoom(roomKey) {
44
+ const r = db().prepare('SELECT * FROM team_rooms WHERE room_key = ?').get(roomKey);
45
+ return r ? roomRow(r, members(roomKey)) : null;
46
+ },
47
+
48
+ listRooms() {
49
+ return db().prepare('SELECT * FROM team_rooms ORDER BY created_at').all().map(r => roomRow(r, members(r.room_key)));
50
+ },
51
+
52
+ /** members: [{ agentId, workKey?, seenAt? }] in display order; sourceKey: the chat it was converted from. */
53
+ createRoom(roomKey, memberList, { discuss = false, sourceKey = null } = {}) {
54
+ const g = db();
55
+ const now = Date.now();
56
+ g.exec('BEGIN');
57
+ try {
58
+ g.prepare('INSERT INTO team_rooms (room_key, discuss, source_key, created_at, updated_at) VALUES (?, ?, ?, ?, ?)').run(roomKey, discuss ? 1 : 0, sourceKey, now, now);
59
+ memberList.forEach((m, i) => g.prepare('INSERT INTO team_members (room_key, agent_id, work_key, seen_at, position) VALUES (?, ?, ?, ?, ?)').run(roomKey, m.agentId, m.workKey || null, m.seenAt || 0, i));
60
+ g.exec('COMMIT');
61
+ } catch (e) { g.exec('ROLLBACK'); throw e; }
62
+ return this.getRoom(roomKey);
63
+ },
64
+
65
+ /** Adds an agent at the end (an agent removed earlier comes back with its session). Returns false if the room is unknown. */
66
+ addMember(roomKey, agentId) {
67
+ if (!this.getRoom(roomKey)) return false;
68
+ const pos = db().prepare('SELECT COALESCE(MAX(position), -1) + 1 AS p FROM team_members WHERE room_key = ?').get(roomKey).p;
69
+ db().prepare('INSERT INTO team_members (room_key, agent_id, work_key, seen_at, position) VALUES (?, ?, NULL, 0, ?) ON CONFLICT(room_key, agent_id) DO UPDATE SET removed = 0, position = excluded.position WHERE removed = 1').run(roomKey, agentId, pos);
70
+ return true;
71
+ },
72
+
73
+ /** Takes an agent out of the room; its working session stays hidden (reused if it's added back). */
74
+ removeMember(roomKey, agentId) {
75
+ db().prepare('UPDATE team_members SET removed = 1 WHERE room_key = ? AND agent_id = ?').run(roomKey, agentId);
76
+ },
77
+
78
+ setWorkKey(roomKey, agentId, workKey) {
79
+ db().prepare('UPDATE team_members SET work_key = ? WHERE room_key = ? AND agent_id = ?').run(workKey, roomKey, agentId);
80
+ },
81
+
82
+ setSeenAt(roomKey, agentId, seenAt) {
83
+ db().prepare('UPDATE team_members SET seen_at = MAX(seen_at, ?) WHERE room_key = ? AND agent_id = ?').run(seenAt, roomKey, agentId);
84
+ },
85
+
86
+ setDiscuss(roomKey, discuss) {
87
+ db().prepare('UPDATE team_rooms SET discuss = ?, updated_at = ? WHERE room_key = ?').run(discuss ? 1 : 0, Date.now(), roomKey);
88
+ },
89
+
90
+ /** Drops the room; returns the working session keys it had. */
91
+ deleteRoom(roomKey) {
92
+ const work = db().prepare('SELECT work_key FROM team_members WHERE room_key = ? AND work_key IS NOT NULL').all(roomKey).map(m => m.work_key);
93
+ const g = db();
94
+ g.prepare('DELETE FROM team_members WHERE room_key = ?').run(roomKey);
95
+ g.prepare('DELETE FROM team_entries WHERE room_key = ?').run(roomKey);
96
+ g.prepare('DELETE FROM team_rooms WHERE room_key = ?').run(roomKey);
97
+ return work;
98
+ },
99
+
100
+ /** { roomKey, agentId } of a working session, or null. */
101
+ workSession(workKey) {
102
+ const m = db().prepare('SELECT room_key, agent_id FROM team_members WHERE work_key = ? AND removed = 0').get(workKey);
103
+ return m ? { roomKey: m.room_key, agentId: m.agent_id } : null;
104
+ },
105
+
106
+ /** Set of every working session key (the lens hides these). */
107
+ workKeys() {
108
+ return new Set(db().prepare('SELECT work_key FROM team_members WHERE work_key IS NOT NULL').all().map(r => r.work_key));
109
+ },
110
+
111
+ recordEntry(roomKey, messageId, { type, agentId = null }) {
112
+ db().prepare('INSERT OR REPLACE INTO team_entries (room_key, message_id, author_type, agent_id, created_at) VALUES (?, ?, ?, ?, ?)')
113
+ .run(roomKey, messageId, type === 'user' ? 'user' : 'agent', agentId, Date.now());
114
+ },
115
+
116
+ /** { [messageId]: { type: 'user'|'agent', agentId } } */
117
+ authors(roomKey) {
118
+ const out = {};
119
+ for (const r of db().prepare('SELECT message_id, author_type, agent_id FROM team_entries WHERE room_key = ?').all(roomKey)) {
120
+ out[r.message_id] = { type: r.author_type, agentId: r.agent_id };
121
+ }
122
+ return out;
123
+ },
124
+ };
125
+ }