@theronap/agnoclast-mcp 0.9.339 → 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.
@@ -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
- // Writes the two artifacts deterministically. Does NOT launchctl-load (unverifiable side effect) and
106
- // returns a BLOCKING warning about the dev-checkout dependency — honest about not-yet-installable.
107
- async wire({ home = homedir(), log = () => {} } = {}) {
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
  }
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/agnoclast-mcp",
3
- "version": "0.9.339",
3
+ "version": "0.9.340",
4
4
  "description": "Connect your AI assistant to Cortex — your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {