@theronap/agnoclast-mcp 0.9.338 → 0.9.340
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/lib/diagnose.mjs +4 -1
- package/lib/editors/antigravity.mjs +55 -5
- package/lib/release_gate.mjs +1 -1
- package/lib/server.mjs +2 -1
- package/package.json +1 -1
package/lib/diagnose.mjs
CHANGED
|
@@ -442,7 +442,10 @@ async function fetchCortexOnce(url, opts = {}, policy = {}) {
|
|
|
442
442
|
const { timeoutMs: optTimeout, signal: callerSignal, ...rest } = opts
|
|
443
443
|
// x-cortex-tool: the tool this request is for (the running one, else the path map) — the server
|
|
444
444
|
// counts calls per tool for staff usage stats (api_requests). A name only; arguments never travel.
|
|
445
|
-
|
|
445
|
+
// x-cortex-host: running inside Claude Code (CLAUDECODE is set in every process it starts). Claude Code's sessions are
|
|
446
|
+
// logged by the close-out, so setup_status leaves out the agent's "Log its own work" step. A hint only: it can only
|
|
447
|
+
// hide a setup step, never grant anything.
|
|
448
|
+
const baseHeaders = { ...(rest.headers ?? {}), 'x-cortex-client': CLIENT_ID, 'x-cortex-tool': toolForUrl(url), ...(AI_ACCOUNT ? { 'x-cortex-ai-account': AI_ACCOUNT } : {}), ...(process.env.CLAUDECODE ? { 'x-cortex-host': 'claude-code' } : {}) }
|
|
446
449
|
const fetchOpts = SESSION_KEY
|
|
447
450
|
? { ...rest, headers: { ...baseHeaders, 'x-cortex-session-key': SESSION_KEY } }
|
|
448
451
|
: { ...rest, headers: baseHeaders }
|
|
@@ -12,10 +12,26 @@
|
|
|
12
12
|
// (npx @theronap/agnoclast-mcp antigravity-sync, or a published cortex-agent) — a prerequisite this
|
|
13
13
|
// adapter cannot satisfy alone. Until then wire() writes the artifacts + returns a blocking warning.
|
|
14
14
|
import { homedir } from 'node:os'
|
|
15
|
-
import { writeFileSync, existsSync, mkdirSync, chmodSync } from 'node:fs'
|
|
15
|
+
import { writeFileSync, existsSync, mkdirSync, chmodSync, readFileSync } from 'node:fs'
|
|
16
16
|
import { join } from 'node:path'
|
|
17
|
+
import { backupFile } from './_fsutil.mjs'
|
|
17
18
|
|
|
18
19
|
const AG_STATE = ['Library', 'Application Support', 'Antigravity']
|
|
20
|
+
|
|
21
|
+
// MCP WIRING (2026-11-12, Theron: "that's not how it connects Claude Code and Codex"). Antigravity is wired the
|
|
22
|
+
// way Cursor is: the desktop app's Connect runs `install --editor antigravity`, which merges a stdio server into
|
|
23
|
+
// Antigravity's GLOBAL MCP config. Path and shape from antigravity.google/docs/mcp (read 2026-11-12): global
|
|
24
|
+
// `~/.gemini/config/mcp_config.json`, root key `mcpServers`, a stdio entry takes `command`/`args`/`env`.
|
|
25
|
+
const AG_MCP_CONFIG = ['.gemini', 'config', 'mcp_config.json']
|
|
26
|
+
|
|
27
|
+
/** Merge the Agnoclast MCP server into an Antigravity mcp_config.json object. Pure + idempotent, like
|
|
28
|
+
* mergeCursorMcp: sets only the `agnoclast` entry and keeps every other server. */
|
|
29
|
+
export function mergeAntigravityMcp(existing, spec, token) {
|
|
30
|
+
const cfg = existing && typeof existing === 'object' ? { ...existing } : {}
|
|
31
|
+
cfg.mcpServers = cfg.mcpServers && typeof cfg.mcpServers === 'object' ? { ...cfg.mcpServers } : {}
|
|
32
|
+
cfg.mcpServers.agnoclast = { command: 'npx', args: ['-y', spec], env: { CORTEX_TOKEN: token } }
|
|
33
|
+
return cfg
|
|
34
|
+
}
|
|
19
35
|
const AG_WATCH = [...AG_STATE, 'User', 'globalStorage']
|
|
20
36
|
|
|
21
37
|
/** The launchd plist, home-substituted. Deterministic — golden-testable byte-for-byte. */
|
|
@@ -102,10 +118,44 @@ export default {
|
|
|
102
118
|
docTrigger: 'watch',
|
|
103
119
|
},
|
|
104
120
|
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
|
|
121
|
+
// 1. The MCP server, into Antigravity's global config (what Connect is for). 2. Capture artifacts, ONLY where
|
|
122
|
+
// the dev checkout they run from exists (see BLOCKER): on anyone else's machine they would be a watcher that
|
|
123
|
+
// can never work, so they are not written at all.
|
|
124
|
+
async wire({ home = homedir(), token, spec, log = () => {} } = {}) {
|
|
108
125
|
const wrote = [], skipped = [], warnings = []
|
|
126
|
+
|
|
127
|
+
if (!token) warnings.push('no token — skipped the Antigravity MCP server')
|
|
128
|
+
else {
|
|
129
|
+
const mcpPath = join(home, ...AG_MCP_CONFIG)
|
|
130
|
+
try { // non-fatal: an IO error must not abort sibling editors
|
|
131
|
+
let existing = {}
|
|
132
|
+
if (existsSync(mcpPath)) {
|
|
133
|
+
const raw = readFileSync(mcpPath, 'utf8')
|
|
134
|
+
if (raw.trim()) {
|
|
135
|
+
try { existing = JSON.parse(raw) } catch {
|
|
136
|
+
// Data-loss guard, as for Cursor: it may hold other servers we cannot safely parse.
|
|
137
|
+
warnings.push(`${mcpPath} is not valid JSON — left untouched (fix it, then re-run) to avoid dropping your other MCP servers`)
|
|
138
|
+
existing = null
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
if (existing) {
|
|
143
|
+
const bak = backupFile(mcpPath)
|
|
144
|
+
mkdirSync(join(home, ...AG_MCP_CONFIG.slice(0, -1)), { recursive: true })
|
|
145
|
+
writeFileSync(mcpPath, JSON.stringify(mergeAntigravityMcp(existing, spec, token), null, 2))
|
|
146
|
+
wrote.push(mcpPath)
|
|
147
|
+
log(` ✓ MCP server → ${mcpPath}${bak ? ' (backup saved)' : ''}`)
|
|
148
|
+
}
|
|
149
|
+
} catch (e) {
|
|
150
|
+
warnings.push(`Antigravity MCP wiring skipped: ${e.message}`)
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const agentDir = join(home, 'dev', 'cortex', 'packages', 'cortex-agent')
|
|
155
|
+
if (!existsSync(agentDir)) {
|
|
156
|
+
skipped.push('Antigravity session capture (needs the cortex-agent dev checkout — see the BLOCKER note)')
|
|
157
|
+
return { wrote, skipped, warnings }
|
|
158
|
+
}
|
|
109
159
|
const cortexDir = join(home, '.cortex')
|
|
110
160
|
const shPath = join(cortexDir, 'antigravity-sync.sh')
|
|
111
161
|
const plistPath = join(home, 'Library', 'LaunchAgents', 'com.cortex.antigravity-sync.plist')
|
|
@@ -124,7 +174,7 @@ export default {
|
|
|
124
174
|
warnings.push(`Antigravity artifact write skipped: ${e.message}`)
|
|
125
175
|
}
|
|
126
176
|
|
|
127
|
-
warnings.push('Antigravity NOT fully wired: (1) run `launchctl load ' + plistPath + '` to activate the watcher; (2) BLOCKER — the sync runs from a local dev checkout (~/dev/cortex/packages/cortex-agent), so it will not work on a machine without that checkout until a published antigravity-sync entrypoint exists.')
|
|
177
|
+
warnings.push('Antigravity capture NOT fully wired: (1) run `launchctl load ' + plistPath + '` to activate the watcher; (2) BLOCKER — the sync runs from a local dev checkout (~/dev/cortex/packages/cortex-agent), so it will not work on a machine without that checkout until a published antigravity-sync entrypoint exists.')
|
|
128
178
|
return { wrote, skipped, warnings }
|
|
129
179
|
},
|
|
130
180
|
}
|
package/lib/release_gate.mjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
// That is safe because hiding a tool is a courtesy, and every gated route checks its own flag on the server.
|
|
12
12
|
|
|
13
13
|
/** Tools any release flag gates — hidden when the server cannot be asked. Mirror of allGatedTools(). */
|
|
14
|
-
export const GATED_FALLBACK = ['arrivals', 'attach_document', 'document_diff', 'download_file', 'export_page', 'file_arrival', 'file_document', 'find_documents', 'finish_task', 'get_document', 'hand_task', 'handed_tasks', 'hold_task', 'import_document_as_page', 'intake_shadow', 'list_documents', 'log_work', 'merge_pages', 'my_messages', 'my_tasks', 'pin_document', 'place_split_records', 'read_conversation', 'read_document', 'relink_links', 'send_message', 'set_manager', 'set_working_hours', 'split_page', 'split_records', 'store_file', 'tasks_waiting', 'undo_merge', 'undo_relink', 'undo_split', 'upload_document_version', 'work_log']
|
|
14
|
+
export const GATED_FALLBACK = ['arrivals', 'attach_document', 'document_diff', 'download_file', 'end_demo', 'export_page', 'file_arrival', 'file_document', 'find_documents', 'finish_task', 'get_document', 'hand_task', 'handed_tasks', 'hold_task', 'import_document_as_page', 'intake_shadow', 'list_documents', 'log_work', 'merge_pages', 'my_messages', 'my_tasks', 'pin_document', 'place_split_records', 'read_conversation', 'read_document', 'relink_links', 'send_message', 'set_manager', 'set_working_hours', 'split_page', 'split_records', 'start_demo', 'store_file', 'tasks_waiting', 'undo_merge', 'undo_relink', 'undo_split', 'upload_document_version', 'work_log']
|
|
15
15
|
|
|
16
16
|
export const RELEASE_FETCH_TIMEOUT_MS = 2500
|
|
17
17
|
/** A remembered answer older than this is not trusted: a week covers a quiet weekend without hiding tools for long. */
|
package/lib/server.mjs
CHANGED
|
@@ -4551,6 +4551,7 @@ function renderNudge(payload) {
|
|
|
4551
4551
|
return { content: [{ type: 'text', text: l.join('\n') }] }
|
|
4552
4552
|
}
|
|
4553
4553
|
const lines = [`Captured "${title}" as record ${body.id}.`]
|
|
4554
|
+
if (body.note) lines.push(`Note: ${body.note}`)
|
|
4554
4555
|
// ⚠ AN UNROUTED RECORD IS REPORTED AS SUCH. It was stored, but nothing will find it — reporting
|
|
4555
4556
|
// that as a plain success is how a record becomes invisible while looking filed.
|
|
4556
4557
|
if (body.routed_by?.length) lines.push(`Routes via: ${body.routed_by.join(', ')} — it reaches whatever page claims those.`)
|
|
@@ -6757,7 +6758,7 @@ function renderNudge(payload) {
|
|
|
6757
6758
|
async () => {
|
|
6758
6759
|
try {
|
|
6759
6760
|
const { waiting, newest, hours_changed, arrivals } = await tasksCall('?box=count')
|
|
6760
|
-
const hours = hours_changed ? '\nhours: your person
|
|
6761
|
+
const hours = hours_changed ? '\nhours: your person set working hours you have not confirmed yet. Call setup_status with runs_unattended true to see them and confirm.' : ''
|
|
6761
6762
|
const arr = arrivals ? `\narrivals: ${arrivals} (mail on threads you sent; read and file them with your Agnoclast arrivals tools)` : ''
|
|
6762
6763
|
return { content: [{ type: 'text', text: `waiting: ${waiting}\nnewest: ${newest ?? 'none'}${arr}${hours}` }] }
|
|
6763
6764
|
} catch (e) { return toolError(`Could not count your tasks: ${e.message}`) }
|
package/package.json
CHANGED