Repository navigation
Source-sync marketplace packaging + Cowork field-test fixes (#1 UI capability, #2 pdf error propagation, #3 status/rehydration diagnostics) - #4
Conversation
…install
The cowork-marketplace path installs by copy-only (no build step), so the
runtime artifacts the build pipeline normally produces must be committed:
- ui/app.html — single-file inlined React bundle (resolveUiHtmlPath rung 2:
<CLAUDE_PLUGIN_ROOT>/ui/app.html). Generated by the same buildInlinedUI the
.plugin/.mcpb builds use, so the source-sync UI can never drift from the
packaged one. Sandbox-safe: no external refs; resource.test.ts guards pass.
- build/vendor/sqlite-vec/vec0.{so,dll} — prebuilt sqlite-vec 0.1.9 extensions
(resolveVec0Path's <root>/build/vendor/sqlite-vec rung). Linux .so from
sqlite-vec-linux-x64; Windows .dll from the version-matched
sqlite-vec-windows-x64 npm tarball. macOS .dylib is intentionally absent —
source-sync on mac boots but fails at the first vector op (known partial).
.gitignore un-ignores only those two binaries under the otherwise-ignored
build/ tree (level-by-level re-include; git cannot re-include a file under an
ignored parent). `git add -n` confirms exactly these four paths, nothing else.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The cowork-marketplace serves ONE committed manifest to every OS (copy-only,
no per-OS selection), so the committed launcher must invoke a single command
present on all hosts. `node` is that command; bin/launch.mjs is the shim it runs.
launch.mjs:
- provisions the pinned bun via the existing ensure-bun.{sh,ps1} (sh on POSIX,
powershell on Windows), mapping all provisioner output to stderr so fd1 stays
clean for the JSON-RPC stream;
- spawns bun as a child with stdio:"inherit" — JSON-RPC flows client<->bun
directly on fd 0/1 (node never touches protocol bytes), so the F1 graceful-
teardown invariant holds on the primary stdin-EOF path; signal forwarding is a
secondary net;
- resolves dist/server.js if present, else src/server/index.ts (the source-sync
entry bun auto-installs the reached import graph from);
- derives BUN_INSTALL and SCHOLAR_RUNTIME_ROOT from CLAUDE_PLUGIN_DATA in JS, so
the manifest needs no ${CLAUDE_PLUGIN_DATA} interpolation and the POSIX-only
${HOME} default never reaches Windows;
- supports --provision-only for the SessionStart pre-warm hook.
plugin.json (committed manifest, source-sync only): command node, args
launch.mjs, SessionStart hook runs node launch.mjs --provision-only, and
SCHOLAR_RUNTIME_ROOT is dropped from env (launch.mjs owns it cross-OS).
buildManifest() rebuilds mcpServers+hooks from scratch, so the built
.plugin/.mcpb bundles keep their per-OS shell launchers — this change is
isolated to the source-sync path.
KEYSTONE RISK (unproven on this host): `node` must be on PATH at MCP spawn. On
Windows, CreateProcess does not resolve a bare `node` via PATH the way POSIX
execvp does; if the Windows host's MCP spawn lacks a PATH-aware env, source-sync
is dead on arrival there. Must be validated on Windows hardware.
manifests.test.ts repivoted to assert the new committed contract.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tributes
The source-sync marketplace install ships the repo's first committed binaries
(build/vendor/sqlite-vec/vec0.{so,dll}) and the marketplace performs a real
`git checkout` on Windows. Git's text=auto heuristic already detects ELF/PE by
leading NUL bytes and skips EOL conversion even under core.autocrlf=true, so
this is belt-and-suspenders: an explicit `binary` attribute removes any
dependence on that heuristic so no misconfigured checkout can CRLF-mangle the
byte stream koffi loads at runtime. .dylib reserved for a future mac drop.
Scoped additively beside the existing `*.cmd text eol=crlf` rule; the POSIX
launchers stay LF.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
) Cowork field test (2026-06-05): every scholar view was invisible. Render Layers 1+2 were already shipped — view-opener tools carry `_meta.ui.resourceUri` and the UI resource is served with `text/html;profile=mcp-app` — but a host checks whether the SERVER itself speaks MCP Apps via `capabilities.extensions["io.modelcontextprotocol/ui"]` in the initialize result BEFORE it renders any `_meta.ui` iframe. That third layer was missing, so all the view hints were inert. `declareUiAppCapability` registers the extension via the low-level server's `registerCapabilities` (merges with the auto-registered tools/resources caps; must run pre-connect — registerUiResource is always called before connect, so folding it in there makes "serve the UI resource ⟹ advertise the extension" true by construction). The value is the spec's `{ mimeTypes }` shape carrying exactly the mime scholar serves, not a bare `{}` — satisfies a host that reads the sub-field and one that only checks presence. Note: ext-apps' own server helpers declare NO server-side extension (getUiCapability only READS the client's), so the id+mime are hardcoded locally, mirroring MCP_APP_MIME — the server bundle still imports no ext-apps. The directions are orthogonal; server-side declaration is purely additive. Test: a real SDK client over an in-memory transport asserts the extension (with its mimeTypes) survives onto the SERIALIZED initialize result, not merely that registerCapabilities was called. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…inels (#2) Cowork field test (2026-06-05): refresh-extraction reported chunks_written:1 on a failed extraction and silently poisoned the corpus with the child's error text. Root cause: the vendored pdf child returns failures as the standard MCP error envelope `{ content:[{type:"text",text:<msg>}], isError:true }`, and the SDK's `callTool` does NOT throw on `isError` (it's an in-band tool error for the model to read). `getText` flattened that error text and returned it as if it were document text, so refreshExtraction chunked + embedded the one-line sentinel. Fix: extract a pure `parseGetTextResult` that throws `PDF_GET_TEXT_FAILED` on the isError envelope and flattens the success content otherwise; `getText` routes through it. The failure now propagates out of refreshExtraction instead of writing a bogus single chunk. The child responded (it's alive), so the liveness stamp is kept. Pure helper ⇒ unit-tested directly (isError throws / success flattens / bare-string passthrough / labelled error when isError has no message), mirroring sanitizeRoots + buildClientCapabilities. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lures (#3) Cowork field test (2026-06-05), two restart-state issues: #3a — corpus.status returned a SILENT paper_count:0 whenever the target's DB wasn't open in this process (e.g. a restart whose startup rehydration found nothing to open), indistinguishable from a genuinely empty corpus. Now status surfaces an explicit `db_open` boolean and only counts when the corpus is active AND open here; the 0 is no longer ambiguous. paper_count stays a number (no contract change) — db_open is additive. (We deliberately do NOT rehydrate inside status: reopenPersistedCorpus already runs once at server/CLI startup; re-running per call would just repeat a failed open and re-log.) #3b — when an activeCorpusId IS persisted but rehydration still can't open the DB, every active-corpus tool (query, digest, papers, pdf — all pure ctx.db readers with identical NO_ACTIVE_CORPUS gating) keeps failing until a manual re-activate. reopenPersistedCorpus returned undefined SILENTLY in two of three failure branches, leaving no trace of WHY. It now warns on each anomalous branch (id persisted but the row is missing / archived / its DB file is absent) while staying silent on the normal fresh-install "no activeCorpusId" branch so the diagnostic doesn't cry wolf. This is the diagnostic, not a root-cause fix: the wiring already calls reopenPersistedCorpus at startup in both runServer and runCli and looks correct from static analysis, so the field symptom implies one of these branches fires for a reason that needs the next run's logs to pinpoint. Tests: status db_open true (active+open) / false (active, db unset) + diagnostic warn on missing-row branch + silence on the fresh-install branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The source-sync manifest repivot (ba0432b) added `expect(scholar.env.SCHOLAR_RUNTIME_ROOT).toBeUndefined()`, but TS infers the committed env type WITHOUT that key, so the direct property access was a tsc error (`bun test` doesn't typecheck, so it slipped through). Cast to a record for the runtime absence assertion; the compile-time absence is itself proven by the fact the typed access would fail. Restores a clean `tsc --noEmit`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…start (#3b)
The two #3b unit tests hand-set ctx.db = undefined to prove the symptom
surface (db_open:false / diagnostic warns). They do not exercise the real
rehydration path the Cowork field report implicated ("query/digest still
require manual re-activation" after a restart).
This adds the advisor-prescribed discriminator: a second buildServer on the
same on-disk runtimeRoot, with a FRESH config-DB handle (new openWithPragmas
on the same file, not the harness-injected handle), never calls activate, and
relies solely on reopenPersistedCorpus to recover. It seeds one paper into the
prior session's corpus DB, then asserts the fresh server recovers the slug,
re-opens the on-disk per-corpus handle, reads the seeded row back, and reports
db_open:true / paper_count:1 via corpus.status.
Result: GREEN. The rehydration mechanism is sound when (a) activeCorpusId is
persisted, (b) the corpus row exists and is not archived, (c) the DB file
exists under the SAME runtimeRoot. So the field symptom is not an in-process
logic bug — it must arise from a now-warned anomalous branch (most plausibly a
runtimeRoot mismatch across the host restart → DB-file-missing branch). This
confirms #3 is correctly diagnostic-only; the new warns will pinpoint the
real-world branch on the next field run.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…pagates get_text errors, writes zero chunks The parseGetTextResult unit tests (lifecycle.test.ts) prove the seam throws on the vendor isError envelope, and getText routes through it (lifecycle.ts:320). This adds the caller-layer proof the advisor required: the field report's #2 is about refreshExtraction, which must propagate the failure instead of chunking the error sentinel and reporting chunks_written:1. Highest fidelity short of a real spawn: the stubbed getText runs the REAL parseGetTextResult on an isError envelope (exactly what the production handle does), so the test exercises the wired path child-error → getText throws → caller propagates — not a hand-rolled stand-in. Asserts refreshExtraction rejects with PDF_GET_TEXT_FAILED AND that zero paper_chunks / chunk_vec rows were written (the "not chunks_written:1" claim in concrete form). A swallowing try/catch in the caller would flip the rejection assertion red, so this also guards the no-downgrade property by construction. Verified clean across all three layers: seam (helper unit tests), wiring (getText returns parseGetTextResult at lifecycle.ts:320), caller (this test). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…input
`main query` was a thin alias over `main list` (scholar.papers.search) taking
`q`/`--limit`. Retarget it at the dedicated `scholar.query` MCP tool: it now
takes `query?`/`--label` and builds `{label, query}` records, accepting a bare
query, a list, or a table of query records so batches pipe through in one call.
`main list` keeps ownership of scholar.papers.search. The `main` dispatcher's
input/output type unions gain `list` to carry those record batches, and its
stream-isolation note moves up into the docstring (logic unchanged).
nu-check parses clean; nu-lint reports 0 violations.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the repository to support “source-sync” marketplace distribution (running Scholar from GitHub source via a cross-OS Node launcher that provisions the pinned Bun), and lands three field-test fixes around MCP UI capability advertisement, PDF get_text error propagation, and corpus status/rehydration diagnostics.
Changes:
- Switch committed plugin manifest execution to
node bin/launch.mjsand add a cross-OS launcher that provisions pinned Bun then spawns the server from source. - Declare MCP Apps UI capabilities (
io.modelcontextprotocol/ui) and add an SDK wire test verifying the capability appears in initialize capabilities. - Fix PDF extraction to treat
isError:truetool envelopes as failures (not document text) and add tests; adddb_opentocorpus.statusplus rehydration warning diagnostics and restart-simulation coverage.
Reviewed changes
Copilot reviewed 10 out of 16 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/manifests.test.ts |
Updates manifest expectations for the source-sync node launcher and env contract. |
src/server/ui/resource.ts |
Declares MCP Apps UI extension capability and ensures it’s registered pre-connect. |
src/server/tools/registry.test.ts |
Adds a real-SDK initialize-capabilities wire test for the UI extension. |
src/server/tools/pdf.test.ts |
Adds caller-level test ensuring PDF get_text error envelopes reject and write zero chunks. |
src/server/tools/corpus.ts |
Adds db_open to corpus.status and adds warning diagnostics for failed rehydration branches. |
src/server/tools/corpus.test.ts |
Adds unit tests for db_open and rehydration warning branches + a restart-simulation test. |
src/server/pdf/lifecycle.ts |
Introduces parseGetTextResult and uses it to throw on isError envelopes. |
src/server/pdf/lifecycle.test.ts |
Adds pure unit coverage for parseGetTextResult behaviors. |
bin/scholar.nu |
Retargets main query to scholar.query with batch support and updates JSON parsing notes. |
bin/launch.mjs |
Adds cross-OS Node launcher to provision Bun and spawn server from source with derived env defaults. |
.gitignore |
Stops blanket-ignoring build/ contents while allowing committed vec0 binaries to be tracked. |
.gitattributes |
Marks native extension binaries (*.so, *.dll, *.dylib) as binary to prevent EOL mangling. |
.claude-plugin/plugin.json |
Switches committed manifest to node bin/launch.mjs and updates SessionStart hook to --provision-only. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
zaynram
left a comment
There was a problem hiding this comment.
biggest thing: bun + sh is likely cleaner than node + mjs given my convention and precedent
| "scholar": { | ||
| "command": "/bin/sh", | ||
| "args": ["${CLAUDE_PLUGIN_ROOT}/bin/launch.sh"], | ||
| "command": "node", |
There was a problem hiding this comment.
For those who had used the use bundled node Claude Desktop option (now missing from settings, but still showing in settings search), will a bare node invocation resolve? If not, let's swap this to Bun since its my established pattern (server itself may require specific bun version, but I use Bun runtime+API across the rest of my servers too so having it here would be consistent in that systemwide bun install is a dependency of my servers.
| { | ||
| "type": "command", | ||
| "command": "sh \"${CLAUDE_PLUGIN_ROOT}/bin/ensure-bun.sh\"" | ||
| "command": "node \"${CLAUDE_PLUGIN_ROOT}/bin/launch.mjs\" --provision-only" |
There was a problem hiding this comment.
same things here; swap to bun if builtin node won't be on PATH
There was a problem hiding this comment.
my changes; skipping further self-review
| // per-OS shell-launcher form for THIS file: the marketplace installs by | ||
| // copy-only and serves one committed manifest to every OS, so the committed | ||
| // manifest must use a single cross-OS command. That command is `node`, which | ||
| // runs `bin/launch.mjs` — the shim provisions the pinned bun then spawns the | ||
| // server from source (auto-installing the reached import graph). The per-OS |
There was a problem hiding this comment.
Needs reconciliation if we swap to bun + sh script
| // Source-sync: `node` is the one command present on every host; it runs the | ||
| // launch.mjs shim (provision bun → spawn server from source). |
There was a problem hiding this comment.
| // so the same shim resolves the sh-vs-powershell provisioner per-OS. | ||
| const cmd = pluginManifest.hooks?.SessionStart?.[0]?.hooks?.[0]?.command | ||
| expect(cmd).toContain('ensure-bun.sh') | ||
| expect(cmd).toContain('launch.mjs') |
There was a problem hiding this comment.
…r-OS launch.{sh,cmd}
Both distribution paths now launch through one shim: the committed source-sync
`.claude-plugin/plugin.json` and the per-OS built `.plugin`/`.mcpb` manifests all
use `command:"bun"` + `${CLAUDE_PLUGIN_ROOT}/bin/launch.mjs`. The retired per-OS
shell pair (`/bin/sh launch.sh` exec-replace | `cmd.exe /c launch.cmd`) is deleted.
Why bun, not node: a bare `node` no longer resolves reliably under Claude Desktop
(its "use bundled node" option was removed from settings), and bun is the
operator's systemwide convention across these servers. bun runs the `.mjs`
directly under its node-compat runtime. Why `.mjs`, not `.sh`-under-bun: bun's
built-in shell is a limited POSIX subset (can't parse `case`, mis-handles
`"$@"`/platform detection), so a shell launcher under bun isn't viable.
Shape change (mitigated): the old Linux `exec` made the spawned PID become the
server; `bun launch.mjs` now spawns the pinned bun as a child on both OSes. The
child inherits fd0 (sees the client's stdin-EOF directly), SIGINT/SIGTERM/SIGHUP
are forwarded, and `child.on("exit") -> process.exit`; a hard SIGKILL only leaves
a pidfile reclaimed on next start by pid-liveness.
Changes:
- scripts/build-plugin.ts: buildManifest/buildMcpbManifest emit `command:"bun"`
+ launch.mjs; stageBin stages launch.mjs + per-OS ensure-bun; required-file
lists updated. Source-sync manifest omits SCHOLAR_RUNTIME_ROOT (launch.mjs
derives it from CLAUDE_PLUGIN_DATA); the built manifests still pin it per-OS.
- .gitattributes: drop the `*.cmd text eol=crlf` rule (its only target is gone;
the field-fixed CRLF class is now moot).
- bin/ensure-bun.{sh,ps1}: comment-only re-pointing to launch.mjs.
- tests/manifests.test.ts + tests/build-plugin.test.ts: assertions flipped to
the bun launcher (linux/win32/mcpb).
- CLAUDE.md, 2026-06-01-slim-plugin-pivot spec, HUMAN.md, e2e runbook, and the
2026-06-02 maintenance-readiness audit: re-synced; genuine dated proofs kept
under superseding notes, forward-looking legs rewritten.
Verified end-to-end headless on Linux (both entry paths): under a non-pinned
on-PATH bun (1.3.14), `bun launch.mjs` cold-provisioned the pinned 1.3.11 into a
fresh CLAUDE_PLUGIN_DATA and returned a clean single-line MCP `initialize` for
(a) the built-bundle path (dist/server.js) and (b) the source-sync from-src path
(git-tracked ship set, no dist/ or node_modules -> falls through to
src/server/index.ts; pinned bun cold-auto-installs the import graph into the
BUN_INSTALL cache under CLAUDE_PLUGIN_DATA, no local node_modules written). The
unproven leg is Windows bun-on-PATH at the Claude Desktop spawn.
Suite: 386 pass / 0 fail; `tsc --noEmit` clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…as current in isolation Follow-up to the matcher-scoping change (this branch / PR #5), addressing the doc-hygiene item it surfaced. The bun-launcher unification (PR #4) retired the per-OS `launch.{sh,cmd}` shell pair, and every stale reference in the docs already carries an adjacent supersede banner (repo convention: keep the dated record, add a banner). The residual problem is the grep/scroll-lander: two lines state the retired shell-pair launcher as the *current* mechanism when read without the banner in view. Self-label them inline; the historical data stays put (the banners say to keep it). - docs/.../2026-06-01-slim-plugin-pivot.md: the "Both packages build" bullet-list intro now names the 2026-06-01 sizes + `launch.{sh,cmd}` in the bullets below as the retired shell-pair record and points at the current `bun launch.mjs`. - docs/audits/2026-06-02-maintenance-readiness.md: the "Launch chain" status row is tagged as a 2026-06-02 snapshot superseded by the note directly below it. Left as-is (already adequately framed): the supersede banners themselves; the RESOLVED+moot `launch.cmd` CRLF section; HUMAN.md's "(2026-06-03)" launcher-proof paragraph (bold dated header + adjacent banner). Docs-only; no code/test change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…as current in isolation Follow-up to the matcher-scoping change (this branch / PR #5), addressing the doc-hygiene item it surfaced. The bun-launcher unification (PR #4) retired the per-OS `launch.{sh,cmd}` shell pair, and every stale reference in the docs already carries an adjacent supersede banner (repo convention: keep the dated record, add a banner). The residual problem is the grep/scroll-lander: two lines state the retired shell-pair launcher as the *current* mechanism when read without the banner in view. Self-label them inline; the historical data stays put (the banners say to keep it). - docs/.../2026-06-01-slim-plugin-pivot.md: the "Both packages build" bullet-list intro now names the 2026-06-01 sizes + `launch.{sh,cmd}` in the bullets below as the retired shell-pair record and points at the current `bun launch.mjs`. - docs/audits/2026-06-02-maintenance-readiness.md: the "Launch chain" status row is tagged as a 2026-06-02 snapshot superseded by the note directly below it. Left as-is (already adequately framed): the supersede banners themselves; the RESOLVED+moot `launch.cmd` CRLF section; HUMAN.md's "(2026-06-03)" launcher-proof paragraph (bold dated header + adjacent banner). Docs-only; no code/test change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
What this does
Two pillars land together on the road to a Cowork-uploadable plugin:
node_modules) via a single cross-OSbun ${CLAUDE_PLUGIN_ROOT}/bin/launch.mjsshim that provisions the pinned bun (vec0-ABI matched), then spawns the server (builtdist/server.jsif present, else from source — bun auto-installs the reached import graph). Ships the prebuilt UI (ui/app.html) and thevec0native extensions the source path can't rebuild.Launcher unification (bun, single cross-OS shim)
The launcher was a per-OS shell pair —
/bin/sh launch.shon Linux (whichexec-replaced into bun) andcmd.exe /c launch.cmdon Windows — while the committed source-sync manifest usednode launch.mjs. This PR unifies every path onbun bin/launch.mjsand deletesbin/launch.{sh,cmd}.nodeno longer resolves reliably under Claude Desktop (its "use bundled node" option was removed from settings), and bun is the operator's system-wide convention across these servers — so requiring bun-on-PATH is consistent, and one shim then serves every OS and both distribution paths (committed source-sync manifest + per-OS built.plugin/.mcpb). bun runs the.mjsdirectly under its node-compat runtime (process.argv/process.platform/node:child_processall work)..mjs, not.sh-under-bun: bun's built-in shell is a limited POSIX subset (empirically: can't parsecase, mis-handles"$@"/$?, mis-detects platform), so a shell launcher under bun isn't viable.launch.mjskeeps the per-OS provisioner split (ensure-bun.{sh,ps1}) it dispatches to.execmade the spawned PID become the server;bun launch.mjsnow spawns the pinned bun as a child on both OSes. Mitigated in-launcher — child inherits fd0 (sees the client's stdin-EOF directly), SIGINT/SIGTERM/SIGHUP forwarded,child.on("exit") → process.exit; a hard SIGKILL only leaves a pidfile, reclaimed on next start by pid-liveness. No Job Object added (no Linux equivalent — would be over-engineering).bin/launch.{sh,cmd}deleted; the.gitattributes*.cmd text eol=crlfrule removed (its only target is gone — the field-fixed CRLF class is now moot);scripts/build-plugin.tsbuildManifest/buildMcpbManifestemitcommand:"bun";manifests.test.ts+build-plugin.test.tsassertions flipped;CLAUDE.md, the2026-06-01-slim-plugin-pivotspec,HUMAN.md, and the e2e runbook re-synced (genuine dated proofs kept under superseding notes; forward-looking legs rewritten).Launch +
initializeverified on Linux (2026-06-06). Built both targets for real (thestageBin/assemblestaging paths this PR changed are exercised, not just the pure manifest functions): linux + win32 both emitcommand:"bun",args:["${CLAUDE_PLUGIN_ROOT}/bin/launch.mjs"], the unifiedbun "…/launch.mjs" --provision-onlypre-warm hook, and per-OSSCHOLAR_RUNTIME_ROOT; both stage onlylaunch.mjs+ theirensure-bun(nolaunch.sh/launch.cmdsurvive). Then drove both real entry paths headless under a non-pinned on-PATH bun (1.3.14), each cold-provisioning the pinned 1.3.11 into a freshCLAUDE_PLUGIN_DATAand returning a clean single-line MCPinitialize— server start + handshake only (this path does not exercise vec0 load, Ollama, or a real corpus workflow); pdf childReady, graceful exit on stdin-EOF:CLAUDE_PLUGIN_ROOTwithdist/server.jspresent → child bun runs the bundle.CLAUDE_PLUGIN_ROOT= the git-tracked ship set (nodist/, nonode_modules) → child bun runssrc/server/index.tsand cold-auto-installs the entire import graph into theBUN_INSTALLcache underCLAUDE_PLUGIN_DATA(~67 MB), leaving the shipped tree pristine (no localnode_moduleswritten). This is the exact path the Cowork Linux sandbox runs — the launcher's auto-install assumption (launch.mjs:72) is now empirically validated, not assumed.Unprovable from Linux: a bare
bunresolving on PATH at the Windows Claude Desktop spawn (CreateProcessPATH semantics ≠ POSIXexecvp) — the dominant residual risk.Field findings → fixes (with verification boundaries)
#1 — Views invisible: missing MCP Apps capability declaration
The server registered view-opener tools (Layer 1) and served the
text/html;profile=mcp-appresource (Layer 2) but never declaredcapabilities.extensions["io.modelcontextprotocol/ui"](Layer 3), which the host checks before rendering any iframe.declareUiAppCapability()callsserver.server.registerCapabilities({ extensions: { [UI_EXTENSION_ID]: { mimeTypes: [MCP_APP_MIME] } } }), folded intoregisterUiResource(pre-connect —registerCapabilitiesthrows after transport connect).src/server/ui/resource.ts.registry.test.ts) connects aClientoverInMemoryTransportand assertsclient.getServerCapabilities().extensions[UI_EXTENSION_ID].mimeTypescontains the mcp-app mime.#2 — refresh-extraction ingested pdf error sentinels as paper text
The vendored pdf child returns failures as the in-band
{content:[{type:"text",text}], isError:true}envelope;callTooldoes not throw on it.getTextflattened that text as document text, sorefreshExtractionchunked the one-line sentinel and reported a boguschunks_written:1, silently poisoning the corpus.parseGetTextResult(r)throwsPDF_GET_TEXT_FAILEDon the isError envelope;getTextreturns through it (src/server/pdf/lifecycle.ts:320).parseGetTextResultunit tests (lifecycle.test.ts): throws on isError, flattens success, passes a bare string.getTextreturnsparseGetTextResult(r)atlifecycle.ts:320.pdf.test.ts:refreshExtractionwith agetTextthat runs the realparseGetTextResulton an isError envelope rejects withPDF_GET_TEXT_FAILEDand writes zeropaper_chunks/chunk_vecrows (the "notchunks_written:1" claim, concrete). A swallowing try/catch in the caller would flip the rejection assertion red, so no-downgrade is guarded by construction.#3 — corpus.status silently reported paper_count:0 when the DB isn't open
Same restart-state family as the earlier defect #4.
statusno longer errors, but a closed DB returnedpaper_count:0— indistinguishable from a genuinely empty corpus.corpus.statusadds adb_openboolean (paper_count stays numeric — no contract break);reopenPersistedCorpusnowwarns on each anomalous rehydration branch (ghost activeCorpusId / archived / DB-file-missing) instead of returningundefinedsilently in two of three.src/server/tools/corpus.ts.corpus.test.ts) builds a second server on the same on-disk runtimeRoot with a fresh config-DB handle (no shared in-memory state), never calls activate, and provesreopenPersistedCorpusreally re-opens the prior session's per-corpus DB and recovers its rows (db_open:true,paper_count:1). It is green — so the in-process rehydration mechanism is sound. The field symptom ("query/digest still require manual re-activation") is therefore not an in-process logic bug; the leading hypothesis (not a proven cause) is a runtimeRoot mismatch across the host restart, which now lands in the DB-file-missingwarnbranch. The new diagnostics exist precisely to pinpoint which branch fires on the next field run.Also included
bin/scholar.nu—main queryretargeted atscholar.querywith--labeland batch (bare / list / table) input;main listkeepsscholar.papers.search.nu-checkparses clean,nu-lintreports 0 violations.Residual keystone risks (not addressed here — flagging for review)
bun launch.mjsassumes the host resolves a barebun. Proven on Linux (above); the WindowsCreateProcessPATH wrinkle is unproven on a real host. Fallback if it bites: edit the manifestcommandto an absolutebun.exepath (e.g.%USERPROFILE%\.bun\bin\bun.exe).BUN_INSTALLcache underCLAUDE_PLUGIN_DATAat first launch — so it requires network then, and ifCLAUDE_PLUGIN_DATAis ephemeral in the Cowork sandbox, that cold install repeats every session, directly amplifying the cold-start timeout already hit in the field (the 2026-06-05 Windows field run). The built.plugin/.mcpbpath is self-contained (dist/server.jsbundle, no auto-install) and does not carry this. Mitigation if it bites: distribute the built bundle to Cowork rather than source-sync, or ensureCLAUDE_PLUGIN_DATApersists across sessions. This is the larger of the two environmental unknowns and, like the PATH item, is unprovable from a Linux box.vec0.soresolves + passes a KNN probe under the pinned bun here, but the koffi native-load + ABI pairing is unproven on the Cowork Linux sandbox specifically..dylibshipped — macOS is not a target of this PR.launch.mjsis not unit-pinned, but its generated manifests are (build-plugin.test.ts,manifests.test.ts) and both Linux entry paths (built-bundle + source-sync from-src) are now proven end-to-end headless (above). There is still no standalone unit test of the spawn/signal-forwarding logic.Deferred (post-merge)
marketplace.jsoninzaynram/cowork-marketplace— GitHub source-sync serves frommain, so the marketplace pointer should land only once these commits are onmain.Test status
bun test src tests→ 386 pass / 0 fail (4 skip, 1 todo).bunx tsc --noEmitclean (runs as a hard gate insidebuild-plugin.ts). Both.plugintargets build (linux 2.9 MB / win32 3.0 MB, 19 files each).🤖 Generated with Claude Code