synabun 2.4.4 → 2.4.6
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/CHANGELOG.md +42 -0
- package/README.md +1 -1
- package/docs/browser-extension-bridge.md +5 -4
- package/docs/whatsapp.md +19 -3
- package/hooks/claude-code/session-start.mjs +21 -18
- package/lib/claude-global-config.js +214 -0
- package/lib/client-config-repair.js +17 -3
- package/mcp-server/dist/index.d.ts.map +1 -1
- package/mcp-server/dist/index.js +6 -1
- package/mcp-server/dist/index.js.map +1 -1
- package/mcp-server/dist/services/neural-interface.d.ts +1 -0
- package/mcp-server/dist/services/neural-interface.d.ts.map +1 -1
- package/mcp-server/dist/services/neural-interface.js +1 -0
- package/mcp-server/dist/services/neural-interface.js.map +1 -1
- package/mcp-server/dist/services/tool-catalog.js +1 -1
- package/mcp-server/dist/services/tool-catalog.js.map +1 -1
- package/mcp-server/dist/tools/agents.d.ts +18 -3
- package/mcp-server/dist/tools/agents.d.ts.map +1 -1
- package/mcp-server/dist/tools/agents.js +85 -16
- package/mcp-server/dist/tools/agents.js.map +1 -1
- package/mcp-server/dist/tools/skill-tools.d.ts +24 -5
- package/mcp-server/dist/tools/skill-tools.d.ts.map +1 -1
- package/mcp-server/dist/tools/skill-tools.js +88 -8
- package/mcp-server/dist/tools/skill-tools.js.map +1 -1
- package/mcp-server/dist/tools/tool-groups.d.ts.map +1 -1
- package/mcp-server/dist/tools/tool-groups.js +19 -4
- package/mcp-server/dist/tools/tool-groups.js.map +1 -1
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +1 -1
- package/mcp-server/src/index.ts +6 -1
- package/mcp-server/src/services/neural-interface.ts +2 -1
- package/mcp-server/src/services/tool-catalog.ts +1 -1
- package/mcp-server/src/tools/agents.ts +78 -16
- package/mcp-server/src/tools/skill-tools.ts +82 -9
- package/mcp-server/src/tools/tool-groups.ts +19 -4
- package/neural-interface/i18n/en.json +484 -19
- package/neural-interface/i18n/pt-BR.json +484 -19
- package/neural-interface/lib/agents-studio-api.js +7 -2
- package/neural-interface/lib/antigravity/home.js +43 -8
- package/neural-interface/lib/antigravity/panel-bridge.js +7 -3
- package/neural-interface/lib/antigravity/tool-call.js +14 -0
- package/neural-interface/lib/assistant-brains/antigravity.js +4 -2
- package/neural-interface/lib/assistant-dispatch.js +15 -1
- package/neural-interface/lib/assistant-persona.js +8 -3
- package/neural-interface/lib/assistant-route-gate.js +11 -2
- package/neural-interface/lib/assistant-runtime.js +95 -13
- package/neural-interface/lib/assistant-spilled-output.js +53 -0
- package/neural-interface/lib/assistant-user-context.js +7 -3
- package/neural-interface/lib/browser-default.js +22 -2
- package/neural-interface/lib/browser-extension-bridge.js +50 -3
- package/neural-interface/lib/browser-extension-pin.json +7 -7
- package/neural-interface/lib/browser-extension-protocol.js +30 -1
- package/neural-interface/lib/browser-extension-setup.js +204 -36
- package/neural-interface/lib/claude-agent-bridge.js +13 -2
- package/neural-interface/lib/codex-thread-history.js +144 -7
- package/neural-interface/lib/codex-worker-app-server.js +84 -30
- package/neural-interface/lib/db.js +26 -0
- package/neural-interface/lib/greeting/sources.js +7 -3
- package/neural-interface/lib/jsonl-lines.js +10 -11
- package/neural-interface/lib/line-buffer.js +88 -0
- package/neural-interface/lib/loop-stall.js +15 -1
- package/neural-interface/lib/memory-list-read.js +105 -0
- package/neural-interface/lib/memory-timers.js +4 -1
- package/neural-interface/lib/native-loop-runtime.js +7 -3
- package/neural-interface/lib/provider-panel-api-key-auth.js +33 -6
- package/neural-interface/lib/remote-policy.js +24 -7
- package/neural-interface/lib/skills/api-v2.js +18 -3
- package/neural-interface/lib/skills/bundle.js +2 -2
- package/neural-interface/lib/skills/deploy.js +169 -34
- package/neural-interface/lib/skills/digest.js +57 -3
- package/neural-interface/lib/skills/health.js +55 -1
- package/neural-interface/lib/skills/known-bridge-digests.json +12 -0
- package/neural-interface/lib/skills/runtime-checks.js +7 -4
- package/neural-interface/lib/skills/scan-shell.js +56 -7
- package/neural-interface/lib/skills/scan.js +13 -12
- package/neural-interface/lib/skills/service.js +7 -2
- package/neural-interface/lib/skills/telemetry.js +2 -2
- package/neural-interface/lib/teams/README.md +34 -6
- package/neural-interface/lib/teams/api.js +94 -10
- package/neural-interface/lib/teams/index.js +4 -0
- package/neural-interface/lib/teams/landing.js +195 -75
- package/neural-interface/lib/teams/recovery.js +68 -0
- package/neural-interface/lib/teams/scheduler.js +380 -61
- package/neural-interface/lib/teams/worktrees.js +123 -30
- package/neural-interface/lib/terminal-token-redaction.js +228 -58
- package/neural-interface/lib/terminal-tokens.js +18 -0
- package/neural-interface/lib/whatsapp/brain.js +21 -0
- package/neural-interface/lib/whatsapp/bridge.js +40 -4
- package/neural-interface/package-lock.json +2 -2
- package/neural-interface/package.json +1 -1
- package/neural-interface/public/extension-setup.html +6 -2
- package/neural-interface/public/index.html +117 -37
- package/neural-interface/public/shared/agents/studio/ax-api.js +27 -0
- package/neural-interface/public/shared/agents/studio/ax-create-view.js +1 -1
- package/neural-interface/public/shared/agents/studio/ax-icons.js +1 -0
- package/neural-interface/public/shared/agents/studio/ax-library-view.js +3 -2
- package/neural-interface/public/shared/agents/studio/ax-main.js +127 -41
- package/neural-interface/public/shared/agents/studio/ax-review-view.js +3 -2
- package/neural-interface/public/shared/agents/studio/ax-teams-view.js +436 -33
- package/neural-interface/public/shared/agents/studio/ax-teams.js +357 -10
- package/neural-interface/public/shared/agents/studio/ax-ui.js +31 -0
- package/neural-interface/public/shared/agents/studio/ax-views.js +67 -69
- package/neural-interface/public/shared/agents/studio/ax-work-answer.js +86 -0
- package/neural-interface/public/shared/agents/studio/ax-work-view.js +305 -0
- package/neural-interface/public/shared/agents/studio/ax-work.css +74 -0
- package/neural-interface/public/shared/agents/studio/ax-work.js +300 -0
- package/neural-interface/public/shared/browser-extension-updates.js +3 -1
- package/neural-interface/public/shared/cdx/cdx-deferred.js +90 -0
- package/neural-interface/public/shared/cdx/cdx-render.js +18 -7
- package/neural-interface/public/shared/cdx/cdx-tabs.js +2 -1
- package/neural-interface/public/shared/extension-setup/es-page.js +23 -4
- package/neural-interface/public/shared/extension-setup/es-view.js +51 -11
- package/neural-interface/public/shared/extension-update-view.js +1 -1
- package/neural-interface/public/shared/loading-diagnostic-entry.js +16 -1
- package/neural-interface/public/shared/settings/settings-ai-browser.js +23 -3
- package/neural-interface/public/shared/settings/settings-browser-extension.js +575 -197
- package/neural-interface/public/shared/settings/settings-extension-diagrams.js +116 -0
- package/neural-interface/public/shared/settings/settings-extension-guide.js +222 -0
- package/neural-interface/public/shared/settings/settings-ia.js +2 -2
- package/neural-interface/public/shared/settings/settings-shell.js +5 -0
- package/neural-interface/public/shared/skills/studio/sx-operations-view.js +5 -0
- package/neural-interface/public/shared/skills/studio/sx-plan.js +42 -3
- package/neural-interface/public/shared/skills/studio/sx-publish-view.js +20 -4
- package/neural-interface/public/shared/styles.css +196 -13
- package/neural-interface/public/shared/ui-settings.js +48 -11
- package/neural-interface/server.js +336 -253
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -1
- package/skills/skill-forge/SKILL.md +7 -3
|
@@ -63,6 +63,14 @@ export function timeBlockingWork(label, fn, options) {
|
|
|
63
63
|
try { return fn(); } finally { end(); }
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* `label` with the size of what is being worked on, once that is a megabyte or more (`codex:stdout-line 171.0 MB`):
|
|
68
|
+
* a stall under such a label says at once that one large payload held the thread. Smaller work keeps the bare label.
|
|
69
|
+
*/
|
|
70
|
+
export function sizedLabel(label, chars) {
|
|
71
|
+
return chars >= 1048576 ? `${label} ${(chars / 1048576).toFixed(1)} MB` : label;
|
|
72
|
+
}
|
|
73
|
+
|
|
66
74
|
function inFlight(now) {
|
|
67
75
|
const list = [];
|
|
68
76
|
for (const { label, at } of open.values()) { list.push(`${label} ${((now - at) / 1000).toFixed(1)} s`); if (list.length === 3) break; }
|
|
@@ -132,6 +140,7 @@ export function startLoopStallMonitor({
|
|
|
132
140
|
thresholdMs = 500, intervalMs = 100, resolution = 20, rateLimitMs = 30_000, longMs = 3000,
|
|
133
141
|
unattributedMs = 10_000,
|
|
134
142
|
log = console.warn,
|
|
143
|
+
detail = null,
|
|
135
144
|
} = {}) {
|
|
136
145
|
if (activeMonitor) return activeMonitor;
|
|
137
146
|
const delay = monitorEventLoopDelay({ resolution });
|
|
@@ -181,7 +190,12 @@ export function startLoopStallMonitor({
|
|
|
181
190
|
? `; ${held.count} more ${held.count === 1 ? 'stall' : 'stalls'} since the last line, ${Math.round(held.ms)} ms in all, worst ${Math.round(held.worst)} ms`
|
|
182
191
|
: '';
|
|
183
192
|
held = { count: 0, ms: 0, worst: 0 };
|
|
184
|
-
|
|
193
|
+
// A long stall also says what the host adds (`detail`; the server: how many secrets its scrubbers look for).
|
|
194
|
+
let extra = '';
|
|
195
|
+
if (blocked >= longMs && typeof detail === 'function') {
|
|
196
|
+
try { const text = detail(); if (text) extra = `; ${text}`; } catch { /* the line goes out without it */ }
|
|
197
|
+
}
|
|
198
|
+
log(`[loop-stall] ${new Date().toISOString()} blocked ${Math.round(blocked)} ms (last: ${activity}${inFlight(now)}${work}${extra})${more}`);
|
|
185
199
|
}
|
|
186
200
|
|
|
187
201
|
const timer = setInterval(() => {
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// The page's memory list, read without holding the server's thread.
|
|
2
|
+
//
|
|
3
|
+
// GET /api/memories?links=false&offset=…&limit=… used to run, for every page of the list, one statement on the
|
|
4
|
+
// server's own connection: every live memory sorted by creation time, then LIMIT / OFFSET. No index gives that order
|
|
5
|
+
// for the live rows, so SQLite read all of them whole into a sorter, each time: on the owner's store (36,868 memories
|
|
6
|
+
// whose rows start with a vector) 215-296 ms a page on an idle machine and 0.6-7.7 s on a busy one, fifteen pages a
|
|
7
|
+
// load, and nothing else was answered meanwhile (the `[loop-stall]` lines that name
|
|
8
|
+
// `SELECT id, content, category, subcategory, …`; 2026-11-28, when the page could not load its own modules behind it).
|
|
9
|
+
//
|
|
10
|
+
// Here the same answer costs two small reads and one read of the page's own rows, all on the retrieval reader's
|
|
11
|
+
// thread (mcp-server retrieval-reader.ts: a read-only connection of its own):
|
|
12
|
+
// - the order: the id of every live memory (the index on `trashed_at, id, …` holds it) and the creation time of
|
|
13
|
+
// every memory (the index on `created_at` holds it), joined by rowid and sorted here. Neither read touches a
|
|
14
|
+
// row. It is kept for as long as the list's stamp (lib/memory-list-stamp.js) stays the same, so the pages of one
|
|
15
|
+
// load share it;
|
|
16
|
+
// - a page: its 2,500 rows by id (10-30 ms on that store), put back in the order.
|
|
17
|
+
// The rows and their order are exactly the ones `ORDER BY created_at DESC, id DESC` gives (tests/memory-list-read.test.mjs
|
|
18
|
+
// compares them on the real schema). No index is added and nothing is written.
|
|
19
|
+
|
|
20
|
+
/** The id of every live memory, by rowid. */
|
|
21
|
+
export const LIVE_IDS_SQL = 'SELECT rowid AS r, id FROM memories WHERE trashed_at IS NULL';
|
|
22
|
+
/** The creation time of every memory, by rowid. */
|
|
23
|
+
export const CREATED_SQL = 'SELECT rowid AS r, created_at FROM memories';
|
|
24
|
+
/** The columns of a memory in the list: everything but its vector. */
|
|
25
|
+
export const MEMORY_LIST_COLUMNS = 'id, content, category, subcategory, project, tags, importance, source, '
|
|
26
|
+
+ 'created_at, updated_at, accessed_at, access_count, related_files, related_memory_ids, file_checksums, trashed_at, source_session_chunks';
|
|
27
|
+
/** Ids in one statement (SQLite takes 32,766 variables; a page is at most 10,000 rows). */
|
|
28
|
+
const IDS_PER_READ = 5000;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The ids of the live memories, newest first; equal times by id, the greater first: `ORDER BY created_at DESC, id DESC`.
|
|
32
|
+
* @param {Array<{ r: number, id: string }>} live
|
|
33
|
+
* @param {Array<{ r: number, created_at: string }>} created
|
|
34
|
+
* @returns {string[]}
|
|
35
|
+
*/
|
|
36
|
+
export function orderLiveIds(live, created) {
|
|
37
|
+
const at = new Map();
|
|
38
|
+
for (const row of created) at.set(row.r, row.created_at);
|
|
39
|
+
const rows = live.map((row) => ({ id: row.id, at: at.get(row.r) ?? '' }));
|
|
40
|
+
rows.sort((a, b) => (a.at < b.at ? 1 : a.at > b.at ? -1 : a.id < b.id ? 1 : a.id > b.id ? -1 : 0));
|
|
41
|
+
return rows.map((row) => row.id);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {object} o
|
|
46
|
+
* @param {(sql: string, params?: unknown[]) => Promise<Array<Record<string, any>>>} o.read one read-only statement,
|
|
47
|
+
* all its rows (readRows of the retrieval reader).
|
|
48
|
+
* @param {(row: Record<string, any>) => object} o.toMemory a row as the list's memory (`{ id, ...payload }`).
|
|
49
|
+
*/
|
|
50
|
+
export function createMemoryListReader({ read, toMemory }) {
|
|
51
|
+
/** The order in use: `{ stamp, ids }` once read, with `pending` while it is being read. */
|
|
52
|
+
let kept = null;
|
|
53
|
+
|
|
54
|
+
async function readOrder() {
|
|
55
|
+
// One after the other: the reader has one thread, and the second read is the cheaper one to repeat.
|
|
56
|
+
const live = await read(LIVE_IDS_SQL);
|
|
57
|
+
const created = await read(CREATED_SQL);
|
|
58
|
+
return orderLiveIds(live, created);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The order for the list as `stamp` names it. A list without a stamp (it could not be read) is ordered each time. */
|
|
62
|
+
async function order(stamp) {
|
|
63
|
+
if (stamp === null || stamp === undefined) return readOrder();
|
|
64
|
+
if (kept?.stamp === stamp) return kept.ids ?? kept.pending;
|
|
65
|
+
const entry = { stamp, ids: null, pending: null };
|
|
66
|
+
entry.pending = readOrder().then((ids) => { entry.ids = ids; entry.pending = null; return ids; }, (error) => {
|
|
67
|
+
if (kept === entry) kept = null; // never keep a failure
|
|
68
|
+
throw error;
|
|
69
|
+
});
|
|
70
|
+
kept = entry;
|
|
71
|
+
return entry.pending;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** The live memories with these ids, in this order. One that was trashed or deleted since the order was read is left out. */
|
|
75
|
+
async function rowsOf(ids) {
|
|
76
|
+
const byId = new Map();
|
|
77
|
+
for (let from = 0; from < ids.length; from += IDS_PER_READ) {
|
|
78
|
+
const slice = ids.slice(from, from + IDS_PER_READ);
|
|
79
|
+
const rows = await read(`SELECT ${MEMORY_LIST_COLUMNS} FROM memories WHERE trashed_at IS NULL AND id IN (${slice.map(() => '?').join(',')})`, slice);
|
|
80
|
+
for (const row of rows) byId.set(row.id, row);
|
|
81
|
+
}
|
|
82
|
+
const out = [];
|
|
83
|
+
for (const id of ids) { const row = byId.get(id); if (row) out.push(toMemory(row)); }
|
|
84
|
+
return out;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
/**
|
|
89
|
+
* One page of the live memories and how many there are.
|
|
90
|
+
* @param {{ offset?: number, limit: number }} page
|
|
91
|
+
* @param {{ stamp?: string | null }} [options] the list's stamp, when the caller has it: the order is kept for it.
|
|
92
|
+
* @returns {Promise<{ rows: object[], total: number }>}
|
|
93
|
+
*/
|
|
94
|
+
async page({ offset = 0, limit } = {}, { stamp = null } = {}) {
|
|
95
|
+
const ids = await order(stamp);
|
|
96
|
+
return { rows: await rowsOf(ids.slice(offset, offset + limit)), total: ids.length };
|
|
97
|
+
},
|
|
98
|
+
/** Every live memory, newest first. */
|
|
99
|
+
async all({ stamp = null } = {}) {
|
|
100
|
+
return rowsOf(await order(stamp));
|
|
101
|
+
},
|
|
102
|
+
/** Forget the kept order (the store was closed or replaced). */
|
|
103
|
+
forget() { kept = null; },
|
|
104
|
+
};
|
|
105
|
+
}
|
|
@@ -38,7 +38,6 @@ let batchInFlight = false;
|
|
|
38
38
|
export function startGatedMemoryMaintenance({ intervalMs = 2000, runBatch = runMaintenanceBatch } = {}) {
|
|
39
39
|
if (maintenanceTimer) return;
|
|
40
40
|
maintenanceTimer = setInterval(() => {
|
|
41
|
-
markActivity('timer:memory-maintenance');
|
|
42
41
|
if (batchInFlight) return;
|
|
43
42
|
try {
|
|
44
43
|
const d = getDb();
|
|
@@ -46,6 +45,10 @@ export function startGatedMemoryMaintenance({ intervalMs = 2000, runBatch = runM
|
|
|
46
45
|
} catch {
|
|
47
46
|
return;
|
|
48
47
|
}
|
|
48
|
+
// Marked only when a batch really runs. Marking every tick made this timer, which fires every 2 s whether or
|
|
49
|
+
// not there is work, the `last:` of nearly every stall line: on 2026-11-29 a 71 s stall in the Codex panel's
|
|
50
|
+
// stdout handler was reported under this name although no job row had changed.
|
|
51
|
+
markActivity('timer:memory-maintenance');
|
|
49
52
|
batchInFlight = true;
|
|
50
53
|
const endActivity = beginActivity('memory:maintenance-batch');
|
|
51
54
|
Promise.resolve()
|
|
@@ -5,6 +5,7 @@ import { storedToolList, toolListRecord, readStoredToolListRecord } from './tool
|
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
6
6
|
import { dirname, resolve } from 'node:path';
|
|
7
7
|
import { redactTerminalSecrets, scrubTokenText } from './terminal-token-redaction.js';
|
|
8
|
+
import { timeBlockingWork } from './loop-stall.js';
|
|
8
9
|
|
|
9
10
|
export const NATIVE_LOOP_PROFILES = new Set(['claude-code', 'codex', 'opencode', 'antigravity']);
|
|
10
11
|
|
|
@@ -233,9 +234,12 @@ export class NativeLoopRuntime {
|
|
|
233
234
|
// Every provider's events (Claude Code, Codex, OpenCode, Antigravity) pass here before anything keeps or shows
|
|
234
235
|
// them: a run's terminal token or a brain credential an agent printed (its `env`, `ps -E`) never reaches the run's
|
|
235
236
|
// records, its transcript or a panel (lib/terminal-token-redaction.js).
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
// Scrubbed and handed on here, on the server's own thread: timed by name, so a stall of the event loop names it.
|
|
238
|
+
timeBlockingWork('native-run:provider-event', () => {
|
|
239
|
+
const message = { type: 'sidepanel:provider-event', run: cleanDescriptor(record), event: redactTerminalSecrets(event) };
|
|
240
|
+
try { this.onEvent(message); } catch {}
|
|
241
|
+
this._notifyListeners(message);
|
|
242
|
+
});
|
|
239
243
|
}
|
|
240
244
|
|
|
241
245
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { scrubTokenText } from './terminal-token-redaction.js';
|
|
1
|
+
import { BIG_STRING_CHARS, createScrubMemo, scrubTokenText } from './terminal-token-redaction.js';
|
|
2
2
|
|
|
3
3
|
const API_KEY_ERRORS = {
|
|
4
4
|
invalid_key: { status: 400, message: "That doesn't look like an API key for this provider." },
|
|
@@ -33,12 +33,39 @@ export function validateProviderApiKey(provider, key) {
|
|
|
33
33
|
// (a terminal token, a brain's launch credential: lib/terminal-token-redaction.js), first, so a provider-key pattern
|
|
34
34
|
// inside one never leaves a piece of it: the Claude Code panel's and brain's events and the Codex panel's messages
|
|
35
35
|
// (and its app-server's output) pass here.
|
|
36
|
+
//
|
|
37
|
+
// A message passes here twice on its way to the page (where a Codex app-server's line is parsed, and where the packet
|
|
38
|
+
// is sent): the long strings of a value this function returned (an inline image is megabytes) are remembered with
|
|
39
|
+
// the object that holds them, and the second pass does not read them again (lib/terminal-token-redaction.js
|
|
40
|
+
// createScrubMemo: only while that very object still holds that very string).
|
|
41
|
+
const scrubMemo = createScrubMemo();
|
|
42
|
+
const CREDENTIAL_FIELD_RE = /^(api_?key|access_?token|refresh_?token|id_?token|authorization)$/i;
|
|
43
|
+
const redactText = (text) => scrubTokenText(text).replace(/sk-[A-Za-z0-9_-]{16,}/g, '[redacted]');
|
|
44
|
+
|
|
45
|
+
/** `source[key]` redacted into `target[key]`; a long string only when `source` was not seen holding it redacted. */
|
|
46
|
+
function redactHeld(source, key, item, target) {
|
|
47
|
+
if (typeof item !== 'string' || item.length < BIG_STRING_CHARS) return redactProviderSecrets(item);
|
|
48
|
+
const next = scrubMemo.seen(source, key, item) ? item : redactText(item);
|
|
49
|
+
scrubMemo.note(target, key, next);
|
|
50
|
+
return next;
|
|
51
|
+
}
|
|
52
|
+
|
|
36
53
|
export function redactProviderSecrets(value) {
|
|
37
|
-
if (typeof value === 'string') return
|
|
38
|
-
if (Array.isArray(value))
|
|
39
|
-
|
|
40
|
-
.
|
|
41
|
-
|
|
54
|
+
if (typeof value === 'string') return redactText(value);
|
|
55
|
+
if (Array.isArray(value)) {
|
|
56
|
+
const out = new Array(value.length);
|
|
57
|
+
for (let i = 0; i < value.length; i++) out[i] = redactHeld(value, i, value[i], out);
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
if (value && typeof value === 'object') {
|
|
61
|
+
const out = {};
|
|
62
|
+
for (const [key, item] of Object.entries(value)) {
|
|
63
|
+
if (CREDENTIAL_FIELD_RE.test(key)) continue;
|
|
64
|
+
// defineProperty, as Object.fromEntries did: a key named `__proto__` stays a plain property.
|
|
65
|
+
Object.defineProperty(out, key, { value: redactHeld(value, key, item, out), writable: true, enumerable: true, configurable: true });
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
42
69
|
return value;
|
|
43
70
|
}
|
|
44
71
|
|
|
@@ -10,9 +10,12 @@
|
|
|
10
10
|
// refuse, user allow rules included; routing always asks (one
|
|
11
11
|
// route card per task is the task's approval); workers get no
|
|
12
12
|
// computer, no "user-authorized-full" and a registered cwd.
|
|
13
|
-
// autonomous —
|
|
14
|
-
//
|
|
15
|
-
//
|
|
13
|
+
// autonomous — never asks: routing is 'never' whatever the session's or the
|
|
14
|
+
// global route mode (saved routes bind, else the brain picks;
|
|
15
|
+
// also on a turn with untrusted content, whose tools are asked
|
|
16
|
+
// at Ask), and on WhatsApp the brain runs bypassPermissions.
|
|
17
|
+
// On WhatsApp it stays until the owner lowers it in Settings;
|
|
18
|
+
// any other channel only until its autonomousUntil, then ask.
|
|
16
19
|
// Ask and Autonomous hold only on a Claude brain: its in-process PreToolUse
|
|
17
20
|
// hook sees every call with its arguments. A Codex or OpenCode brain runs
|
|
18
21
|
// ordinary commands inside its own sandbox / permissions without asking, so a
|
|
@@ -111,13 +114,18 @@ export function brainCapsLevel(policy, { provider = null, now = Date.now() } = {
|
|
|
111
114
|
* The approval mode and plan flag a brain may run with. read-only forces plan
|
|
112
115
|
* mode (`planApproved`: the desktop approved the plan, which may then run);
|
|
113
116
|
* ask forces the approval mode to 'default' (every provider asks there);
|
|
114
|
-
* autonomous keeps what was configured
|
|
117
|
+
* autonomous keeps what was configured, except on WhatsApp, where it is
|
|
118
|
+
* 'bypassPermissions' whatever the panel last used: Autonomous acts without
|
|
119
|
+
* asking, so the phone is never asked to approve a tool (the brain's remote
|
|
120
|
+
* hook still refuses what isDeniedRemoteTool lists, and computer use keeps
|
|
121
|
+
* its own rule). The plan flag is kept either way.
|
|
115
122
|
*/
|
|
116
123
|
export function clampBrainModes(policy, modes = {}, { untrusted = false, now = Date.now(), planApproved = false } = {}) {
|
|
117
124
|
const permissionMode = modes.permissionMode && modes.permissionMode !== 'plan' ? String(modes.permissionMode) : 'default';
|
|
118
125
|
const planMode = modes.planMode === true || modes.permissionMode === 'plan';
|
|
119
126
|
const level = effectiveLevel(policy, { untrusted, now });
|
|
120
|
-
if (!level
|
|
127
|
+
if (!level) return { permissionMode, planMode };
|
|
128
|
+
if (level === 'autonomous') return { permissionMode: policy.channel === 'whatsapp' ? 'bypassPermissions' : permissionMode, planMode };
|
|
121
129
|
if (level === 'ask') return { permissionMode: 'default', planMode };
|
|
122
130
|
return { permissionMode: 'default', planMode: planApproved ? planMode : true };
|
|
123
131
|
}
|
|
@@ -181,10 +189,19 @@ export function remoteComputerDenial(reason = null) {
|
|
|
181
189
|
return COMPUTER_OFF_TEXT[reason] || 'Computer use is not available from WhatsApp right now.';
|
|
182
190
|
}
|
|
183
191
|
|
|
184
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* The route mode a remote session runs. Autonomous never asks where a task runs, whatever the
|
|
194
|
+
* session's or the global route mode says ('never': the saved route for the class binds, else the
|
|
195
|
+
* brain's own pick runs), so the phone is never shown a model card. A turn that carries content the
|
|
196
|
+
* owner did not write (a picture, a forwarded or quoted message) is capped at Ask for its tools,
|
|
197
|
+
* not for its route: the owner configured Autonomous. Below Autonomous every task is approved on
|
|
198
|
+
* its route card ('always-ask').
|
|
199
|
+
*/
|
|
185
200
|
export function clampRouteMode(policy, mode, opts = {}) {
|
|
186
201
|
const level = effectiveLevel(policy, opts);
|
|
187
|
-
if (!level
|
|
202
|
+
if (!level) return mode;
|
|
203
|
+
if (level === 'autonomous') return 'never';
|
|
204
|
+
if (opts.untrusted === true && effectiveLevel(policy, { ...opts, untrusted: false }) === 'autonomous') return 'never';
|
|
188
205
|
return 'always-ask';
|
|
189
206
|
}
|
|
190
207
|
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
// carries an agent's headers is refused (403 UI_ONLY) whatever else it says, as is a guest, another
|
|
12
12
|
// site's page, a request without the page's X-SynaBun-UI header, or one without this boot's page
|
|
13
13
|
// secret cookie (lib/page-session.js, 403 PAGE_SECRET_REQUIRED). An agent asks for a plan
|
|
14
|
-
// (POST /installations/plan) and submits for review; the owner installs.
|
|
14
|
+
// (POST /installations/plan) and submits for review; the owner installs. An agent may re-run the
|
|
15
|
+
// static check of an installation (POST /installations/:id/check), which changes no file.
|
|
15
16
|
//
|
|
16
17
|
// Ids in paths are opaque (`skl_`, `rev_`, `drf_`, `rvw_`, `ins_`, `mig_`, `art_`) and checked by shape before
|
|
17
18
|
// anything is looked up; no id is ever a path. Errors are JSON `{ ok: false, error, code, … }` with 400/422 for
|
|
@@ -26,6 +27,7 @@ import { readConfinedFile } from '../confined-fs.js';
|
|
|
26
27
|
import { isArtifactId } from './catalog.js';
|
|
27
28
|
import { checkFolder, folderDigest, isDraftId, isRevisionId, isSkillId } from './library.js';
|
|
28
29
|
import { bundlePathProblem, collectFolder } from './bundle.js';
|
|
30
|
+
import { executablePaths, keepsExecutableBit } from './digest.js';
|
|
29
31
|
import { isEditableText } from '../../public/shared/skills/ss-doc.js';
|
|
30
32
|
|
|
31
33
|
/** The largest file of a catalog skill the Studio reads (a SKILL.md's bound, as the P0 routes read one). */
|
|
@@ -221,8 +223,12 @@ export function registerSkillsV2Routes(app, { service, isGuestRequest = null, ow
|
|
|
221
223
|
if (!isRevisionId(from) || !isArtifactId(artifactId)) return res.status(400).json({ ok: false, error: 'from is a revision id and artifactId a catalog entry.', code: 'invalid_id' });
|
|
222
224
|
const entry = await service.catalogFind(artifactId);
|
|
223
225
|
if (!entry || entry.kind !== 'skill') return res.status(404).json({ ok: false, error: 'There is no such skill in the catalog.', code: 'artifact_not_found' });
|
|
224
|
-
const
|
|
225
|
-
|
|
226
|
+
const read = collectFolder(entry.realPath);
|
|
227
|
+
// Where files keep no executable bit (Windows) the folder cannot say which are: the revision's flags stand, so
|
|
228
|
+
// only bytes, sizes and paths can differ (digest.js intendedDigest).
|
|
229
|
+
const meant = keepsExecutableBit() ? null : executablePaths(service.library.readRevisionFiles(from).files);
|
|
230
|
+
const files = meant ? read.files.map((f) => ({ ...f, executable: meant.has(f.path) })) : read.files;
|
|
231
|
+
res.json({ ok: true, diff: service.library.diffRevisionFolder(from, { files, dirs: read.dirs }, { path: entry.path }) });
|
|
226
232
|
}));
|
|
227
233
|
route('post', '/catalog/rescan', json, writer, safe(async (req, res) => { const s = await service.catalogScan({ force: true }); res.json({ ok: true, generation: s.generation, generatedAt: s.generatedAt, entries: s.entries.length, truncated: s.truncated }); }));
|
|
228
234
|
// The settings, with the assistants on this computer (detected, chosen, in effect): what Publish ticks by default.
|
|
@@ -410,6 +416,15 @@ export function registerSkillsV2Routes(app, { service, isGuestRequest = null, ow
|
|
|
410
416
|
route('post', '/installations/:installationId/verify', json, owner, ids('installationId'), safe(async (req, res) => {
|
|
411
417
|
res.json({ ok: true, installation: await service.deployer.verify(req.params.installationId, { probeRuntime: req.body?.probe === true }) });
|
|
412
418
|
}));
|
|
419
|
+
// The same check for the owner and agents (the MCP `skill` tool's `verify`): static by default (the bytes, the
|
|
420
|
+
// folder rules, each runtime's settings: nothing is started), and it writes only the installation's stored check,
|
|
421
|
+
// never a skill folder, a setting or an install. `probe: true` also asks Codex and OpenCode (Claude Code and
|
|
422
|
+
// Antigravity have no listing) and is the owner's or the Assistant's: a worker gets 403 PROBE_FORBIDDEN.
|
|
423
|
+
route('post', '/installations/:installationId/check', json, writer, ids('installationId'), safe(async (req, res) => {
|
|
424
|
+
const probe = req.body?.probe === true;
|
|
425
|
+
if (probe && req.principal.kind === 'agent') return sendGuardError(res, 403, 'PROBE_FORBIDDEN', 'Asking Codex or OpenCode is the owner\'s or the Assistant\'s: run the static check (no probe).');
|
|
426
|
+
res.json({ ok: true, installation: await service.deployer.verify(req.params.installationId, { probeRuntime: probe, trigger: probe ? 'probe' : 'check' }) });
|
|
427
|
+
}));
|
|
413
428
|
|
|
414
429
|
// ── The old bridges ──
|
|
415
430
|
// The server moves what is proven SynaBun's by itself at start (migration.js autoMigrate) and leaves a notice; the
|
|
@@ -19,7 +19,7 @@ import { randomBytes } from 'node:crypto';
|
|
|
19
19
|
import { join } from 'node:path';
|
|
20
20
|
import { PathConfineError, isInside, isPlainName, realPathOf } from '../path-confine.js';
|
|
21
21
|
import { canonicalInside, makeConfinedDir, readConfinedFile, writeConfinedFile } from '../confined-fs.js';
|
|
22
|
-
import { SYSTEM_NAMES, fileEntry, manifestDigest, readManifest, sha256 } from './digest.js';
|
|
22
|
+
import { SYSTEM_NAMES, fileEntry, manifestDigest, readManifest, sha256, withExecutables } from './digest.js';
|
|
23
23
|
import { findHiddenChars } from '../../public/shared/skills/ss-unicode.js';
|
|
24
24
|
import { isEditableText } from '../../public/shared/skills/ss-doc.js';
|
|
25
25
|
|
|
@@ -373,7 +373,7 @@ export function createImportStaging({ dir, liveRoots = () => [], now = () => Dat
|
|
|
373
373
|
const digest = manifestDigest(entries);
|
|
374
374
|
// What is in staging now must be what was staged (and nothing more).
|
|
375
375
|
const onDisk = readManifest(filesDir);
|
|
376
|
-
const stagedNow = onDisk.entries
|
|
376
|
+
const stagedNow = withExecutables(onDisk.entries, record.manifest);
|
|
377
377
|
if (digest !== record.digest || manifestDigest(stagedNow) !== record.digest) {
|
|
378
378
|
throw new BundleError(409, 'The staged files changed since they were checked: import the bundle again.', { code: 'staging_changed' });
|
|
379
379
|
}
|