Skip to content

Ship working plugin to marketplace installers (config creds, wallet connect, dist guard)#1

Merged
LingSiewWin merged 10 commits into
mainfrom
plugin-first-pivot
Jun 9, 2026
Merged

Ship working plugin to marketplace installers (config creds, wallet connect, dist guard)#1
LingSiewWin merged 10 commits into
mainfrom
plugin-first-pivot

Conversation

@LingSiewWin

Copy link
Copy Markdown
Owner

Why

Marketplace installs (/plugin marketplace add LingSiewWin/Cortex) pull the default branch (main), which was 6 commits behind and — critically — shipped plugin bundles built 2026-05-28, before the credential-resolution refactor. Result: every fresh installer ran pre-fix code. After cortex auth wrote ~/.cortex/config.json, the first cortex_act still failed with USER_PRIMARY_ADDRESS not set.

What changed

  • Rebuild plugin bundles so dist/ matches source — ships resolveCredentials, cortex_act owner-from-config, and recall keyword-degradation to installers.
  • MCP write errors now route through formatBragaError → an unfunded session key surfaces the Braga faucet link instead of a raw revert.
  • Web console connect: detect whether an injected provider is actually present (window.ethereum / EIP-6963) before connecting, and surface actionable guidance instead of a raw ProviderNotFoundError for mobile / no-extension visitors.
  • CI dist-check guard: rebuilds cortex-plugin/dist on every PR and fails if it drifts from source (the structural cause of the stale-bundle regression).
  • Anchor dist//out/ gitignore so cortex-plugin/dist can never be silently ignored.
  • Make the bun prerequisite explicit in the auth command.

End-to-end proof (Braga testnet, real txs — not mocked)

Simulated a fresh installer (all credential env vars unset; everything from ~/.cortex/config.json):

  • resolveCredentials().sourceowner: "config" ✅ (the regression fix)
  • cortex_act reinforced memories + queued an on-chain bundle
  • Create tx: 0x16210a1cc6d3c6afed4c97e8b5057a2c73034b6a792b281819a01091a2a8f9baSUCCESS, block 1504834
  • Extend tx: 0x7cfa20f365c682a1ab06c360ecb51ff9260621e107758104b715ca4aecd3fe68SUCCESS, block 1504837, +43200 blocks (~+24h accumulative)

Offline test suite: 71 pass, 0 fail.

owner-identity, sealed-memory, and auth/me tests read the real
~/.cortex/config.json, so they failed on machines where cortex auth had
run. Point them at an empty temp config and reset the cache between tests.
Also fix an embedding-key fixture that was below the 16-char minimum.
All secrets (session key, owner EOA, encryption signature, embedding key)
now resolve env then ~/.cortex/config.json through one pure synchronous
resolver. Migrate arkiv-client, payload-key, embeddings, and owner-identity
to delegate; the owner address now falls back to config (was env-only).
Characterization tests lock the prior precedence.
The MCP cortex_act tool read the owner from USER_PRIMARY_ADDRESS only, so
it failed for installers who ran cortex auth but set no env var. Resolve
via resolveCredentials() (env then config) and correct the tool
description to the additive extend amount. Add a config-only extend proof
script that fires a real Braga extendEntity.
recall() treated a missing embeddings key as a fatal throw. Catch
MissingEmbeddingKeyError and fall back to text-overlap scoring so rules
and documents still recall; pure-vector observations score 0.
First-time visitors without local data see plugin install steps and the
walkthrough video; the full live dashboard renders for local development.
Document that Cortex runs locally via the plugin (MCP over stdio, local
mirror, your own session key) and add plugin prerequisites: bun on PATH,
faucet funding, and the cortex auth config file.
The committed cortex-plugin/dist bundles were built 2026-05-28, before the
credential-resolution refactor (resolveCredentials, cortex_act owner-from-config,
recall keyword degradation). Marketplace installs run the default-branch dist, so
every fresh installer was running pre-fix code: cortex_act failed with
'USER_PRIMARY_ADDRESS not set' even after 'cortex auth' wrote ~/.cortex/config.json.

Rebuild all bundles from current source. Also route the MCP write tools'
errors through formatBragaError so an unfunded session key surfaces the Braga
faucet link instead of a raw revert string, and make the bun prerequisite
explicit in the auth command.
The injected connector always exists in wagmi even with no wallet installed, so
connecting threw a raw ProviderNotFoundError that surfaced verbatim in the UI
('Provider not found. Version: @wagmi/core@2.22.1'). Detect whether a provider is
actually present (window.ethereum / EIP-6963 getProvider) before connecting, and
route guidance through the hook's own error channel (a thrown error from the click
handler was void-discarded and never shown). No-wallet visitors now get actionable
instructions instead of a dead button.
Rebuilds cortex-plugin/dist from src on every PR touching src/scripts and fails if
the committed bundles differ — the structural cause of the stale-bundle regression.
@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
cortex-arkiv Ready Ready Preview, Comment Jun 9, 2026 7:55am

@LingSiewWin LingSiewWin merged commit 7d17d3f into main Jun 9, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant