Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
687bc24
docs: framework inspection extensions design spec
omridevk Jul 19, 2026
af37a55
docs(spec): replace custom discovery surface with native lazy discove…
omridevk Jul 19, 2026
638d5ec
docs: implementation plan A — lazy discovery + code mode migration
omridevk Jul 19, 2026
4fb7bf2
chore(core): add tanstack code-mode + node isolate driver
omridevk Jul 19, 2026
64e863e
docs(plan): fold 4-review + spike findings into lazy/code-mode plan
omridevk Jul 19, 2026
fd7d648
docs(plan): security review gaps — approval audit, MCP invariants, ga…
omridevk Jul 19, 2026
d98691c
test(core): committed lazy extension-tool path coverage + spike results
omridevk Jul 19, 2026
c677f34
feat(core): fold tool prose into server tool descriptions, carry appr…
omridevk Jul 19, 2026
ccccfee
feat(core): standing prompt drops per-tool snippets
omridevk Jul 19, 2026
43ee936
feat(core): extension tools ride native lazy discovery
omridevk Jul 19, 2026
e05fb4d
fix(core): approval gate matches tool names across mcp prefixes
omridevk Jul 19, 2026
e0c4551
feat(core): code mode binds all extension tools with gated approvals
omridevk Jul 19, 2026
4608e88
test(widget): discovery + code-mode parts render without blanking
omridevk Jul 19, 2026
47b1cc8
test(harness): pin codeMode capability on claude
omridevk Jul 19, 2026
ebc6824
docs(spec): tool-ui cards for code mode, discovery, extension ops
omridevk Jul 19, 2026
91abce1
feat(core): MCP projection mirrors lazy discovery
omridevk Jul 19, 2026
f381bc0
docs(plan): tool-ui cards phase 1 implementation plan
omridevk Jul 19, 2026
83736ee
feat(ui-kit-chat-tools): schemaParams formatter + ToolChip with tooltip
omridevk Jul 19, 2026
2f73217
feat(ui-kit-chat-tools): CodeRunCard for execute_typescript
omridevk Jul 19, 2026
7812b76
fix(ui-kit-chat): status override on ToolCard; CodeRunCard renders do…
omridevk Jul 19, 2026
53d6322
fix(ui-kit-chat): label tool status dot so failure state is assertable
omridevk Jul 19, 2026
174037e
feat(ui-kit-chat-tools): DiscoveredApisCard for discover_tools
omridevk Jul 19, 2026
824a304
feat(ui-kit-chat-tools): LoadedToolsCard for lazy discovery
omridevk Jul 19, 2026
6e24cb3
feat(ui-kit-chat-tools): conciv_extensions inline + widget IT for new…
omridevk Jul 19, 2026
1b76742
fix(core): sanitize code-mode binding names so dotted tool names compile
omridevk Jul 20, 2026
6ebd5e7
chore: changeset for tool-ui cards phase 1
omridevk Jul 20, 2026
c249000
docs(findings): observed harness matrix, card spike, corrections
omridevk Jul 20, 2026
c2815e8
feat(core): normalize harness tool names to registered names before p…
omridevk Jul 20, 2026
dac2e8f
feat(core,ui-kit-chat): per-tool parts for code-mode calls, nested un…
omridevk Jul 20, 2026
81678d5
fix(harness): codex bridged tools run under workspace-write via per-s…
omridevk Jul 20, 2026
56f09bb
feat(extensions): phase-2 tool cards - CanvasOpCard, CommentOpCard, R…
omridevk Jul 20, 2026
b51755e
docs(findings): record fixes for name normalization, codex approve mo…
omridevk Jul 20, 2026
6062fd0
chore: changeset for tool-ui cards phase 2 + harness fixes
omridevk Jul 20, 2026
a56e040
fix(harness): gate codex bridge approve-mode config on tools riding t…
omridevk Jul 20, 2026
17a4385
docs(findings): root-cause gemini ACP hang - ai-acp omits spec-requir…
omridevk Jul 20, 2026
9ea1b3e
docs(findings): retract gemini 'missing type discriminator' root caus…
omridevk Jul 20, 2026
bad07d4
feat(protocol): shared FrameworkAdapter contract for framework inspec…
omridevk Jul 20, 2026
20db358
docs(spike): TanStack adapter §2 de-risk — fiber-walk router extracti…
omridevk Jul 21, 2026
3b77096
docs(spike): complete §2 TanStack surface spikes — loaderData, query …
omridevk Jul 21, 2026
9448906
docs(plan): TanStack Router/Start inspection adapter — extension-owne…
omridevk Jul 21, 2026
79a0172
docs(plan): general extension browser-verb capability + repoint TanSt…
omridevk Jul 21, 2026
ccd31cf
feat(protocol): generic ext page-query kind for extension browser verbs
omridevk Jul 21, 2026
feeaa4b
feat(extension): typed declarative page-verb authoring surface (defin…
omridevk Jul 21, 2026
f258e46
feat(page): ext verb registry + dispatch with zod arg validation and …
omridevk Jul 21, 2026
44a2313
feat(extension): pageVerbs client authoring shape, verb-map generic, …
omridevk Jul 21, 2026
43342b1
feat(core): PageBus-backed server.page.call with typed PageVerbError …
omridevk Jul 21, 2026
583aab1
fix(core): remove casts and IIFE from page-verb wiring per review
omridevk Jul 21, 2026
36da383
fix(core): isolate extension mount failures so one bad extension can'…
omridevk Jul 21, 2026
b396a0e
feat(extension): robustness pass — all page-verb error codes, loading…
omridevk Jul 21, 2026
6a75492
test(core): assert invalid-args maps to isPageVerbError; tidy changeset
omridevk Jul 21, 2026
38e373d
refactor(extension-testkit): consumer-supplied host callback; opt-in …
omridevk Jul 21, 2026
7a06cfe
feat(extension-tanstack): scaffold + real TanStack host app + testkit…
omridevk Jul 21, 2026
e55a979
feat(extension-tanstack): fiber-walk router adapter, routerState/rout…
omridevk Jul 21, 2026
d3297d9
feat(extension-tanstack): dual server/client entry + Solid render car…
omridevk Jul 21, 2026
568f7d5
feat(extension-tanstack): loader_data tool with dehydrate-truncation …
omridevk Jul 21, 2026
fdeb72c
feat(extension-tanstack): query_cache surface, tool, card
omridevk Jul 21, 2026
4efa3c0
fix(extension-tanstack): guard query invalidate/refetch against undef…
omridevk Jul 21, 2026
f53aa4a
test(extension-tanstack): remove hand-rolled React-tree guard test; g…
omridevk Jul 21, 2026
25e3ea6
feat(extension-tanstack): navigate + invalidate (router + query) acti…
omridevk Jul 21, 2026
a4cf903
feat(protocol,plugin): generic BundlerBridge diagnostic stream (build…
omridevk Jul 21, 2026
cda290a
feat(extension-tanstack): build_errors + route_manifest server tools …
omridevk Jul 21, 2026
91bcac3
feat(protocol,plugin,extension-tanstack): generic dev-server request-…
omridevk Jul 21, 2026
942c751
feat(protocol,extension-tanstack): assemble FrameworkAdapter contract…
omridevk Jul 21, 2026
11fb130
feat(extension-testkit): makeFakeFrameworkAdapter + tanstack adapter …
omridevk Jul 21, 2026
c26f8f7
docs: plan checkbox/format reconcile for framework-inspection branch
omridevk Jul 21, 2026
7a29725
test: extract shared setup helpers to clear fallow-introduced duplica…
omridevk Jul 21, 2026
0a420b5
merge main into framework-inspection-extensions (resolve core package…
omridevk Jul 21, 2026
4d96a9b
fix(extension-tanstack): dehydrate route search params + final-review…
omridevk Jul 21, 2026
7fa3c89
fix(protocol,extension,extension-tanstack): address copilot review — …
omridevk Jul 21, 2026
d44c079
fix(page,core,ui-kit-chat,conciv): address copilot review — serializa…
omridevk Jul 21, 2026
67d6d07
fix(plugin,e2e): lazy bundler diagnostic instrumentation + 150s SSR e…
omridevk Jul 21, 2026
746e42e
docs(spec): first-party extension install convention (folder re-expor…
omridevk Jul 21, 2026
32e92b8
docs(spec): revise extension-install to cross-bundler (unplugin unive…
omridevk Jul 21, 2026
37c3412
docs(spec): v3 native import.meta.glob (Vite+Turbopack) + browser con…
omridevk Jul 21, 2026
594dbac
docs(spec): fold codex round 3 — node_modules-glob go/no-go gate, pee…
omridevk Jul 21, 2026
7955207
docs(plan): first-party extension install — implementation plan (Task…
omridevk Jul 21, 2026
2f9097a
docs(plan): rewrite v2 — fold codex plan review (2x2 gate, provenance…
omridevk Jul 21, 2026
f4fa6a2
docs(plan): fold codex plan re-review — pnpm pack + file: install, di…
omridevk Jul 21, 2026
f0eff6d
docs(plan): correct Task 7 server-half proof to real start()+resolveS…
omridevk Jul 21, 2026
97bbc3e
docs(plan): fold codex round-3 residuals — shared tested toSortedEntr…
omridevk Jul 21, 2026
484787a
spike(nextjs): turbopack node_modules import.meta.glob 2x2 go/no-go f…
omridevk Jul 22, 2026
ec3b0d8
docs(plan): v3 rewrite post Task 0 NO-GO — Next client discovery via …
omridevk Jul 22, 2026
31a38f9
docs(plan): fold codex v3 review — prod-reachable alias probe + negat…
omridevk Jul 22, 2026
b251349
spike(nextjs): alias-to-generated-entry go/no-go finding (turbopack +…
omridevk Jul 22, 2026
11987da
feat(extension-tanstack): per-environment conditional exports (verifi…
omridevk Jul 22, 2026
1c96be9
feat(extensions): per-environment conditional exports for terminal, t…
omridevk Jul 22, 2026
d99988b
feat(extension-compiler): provenance dedup/validation, shared listExt…
omridevk Jul 22, 2026
7f83f9b
test(extension-tanstack): resolution matrix across node/vite-client/v…
omridevk Jul 22, 2026
12241d5
docs(plan): fixture overrides via fixture-local pnpm-workspace.yaml (…
omridevk Jul 22, 2026
74e2727
feat(plugin): fs-generated Next client-extensions entry (knitwork cod…
omridevk Jul 22, 2026
084d251
feat(plugin): Next folder client extensions via generated entry + bun…
omridevk Jul 22, 2026
b612f0c
test(extensions): folder-installed re-export proves server half on re…
omridevk Jul 22, 2026
f0853d4
fix(extension-compiler): thread resolved dedupe entry into the client…
omridevk Jul 22, 2026
8959464
feat(extension-tanstack): mount-time composer chip (client-active sur…
omridevk Jul 22, 2026
90db31f
test(e2e): folder-installed tanstack proves client half via mount-tim…
omridevk Jul 22, 2026
cac9f25
fix(plugin): stub engine register entries to false in Next edge compi…
omridevk Jul 22, 2026
b361d13
test(e2e): folder-installed extension proven on packed Next 16.2 (tur…
omridevk Jul 22, 2026
2c45481
fix(e2e): cast-free JSON narrowing + oxfmt in packed-install harness
omridevk Jul 22, 2026
46b936b
docs(site): install a first-party extension (folder re-export, all fr…
omridevk Jul 22, 2026
9064698
docs(spec): link filed follow-up issues (CLI, next builtins, detectio…
omridevk Jul 22, 2026
02bf7fb
chore: changeset for first-party extension install (conditional expor…
omridevk Jul 22, 2026
a0e29b3
chore(fallow): ignore @conciv/extension-compiler resolve-only depende…
omridevk Jul 22, 2026
157a40a
feat(examples): folder-install the tanstack extension in tanstack-sta…
omridevk Jul 22, 2026
124627b
chore(extension-compiler): use EXTENSION_GLOB in the generator, quote…
omridevk Jul 22, 2026
e5055ea
test(e2e/nextjs): capture next dev output for boot-failure diagnosis;…
omridevk Jul 22, 2026
b879f43
refactor(extension-tanstack): rebuild tool cards on shared ui-kit pri…
omridevk Jul 22, 2026
c789f2f
test(e2e/nextjs): include listening-port snapshot in engine-boot fail…
omridevk Jul 22, 2026
4ae4f6e
fix(extension-tanstack): thread navigate params/search through verb, …
omridevk Jul 22, 2026
911ad71
test(e2e/nextjs): probe engine default port and salvage lsof stdout i…
omridevk Jul 22, 2026
b8c0c02
test(e2e/nextjs): pre-write the fixture tsconfig Next 16.2 expects so…
omridevk Jul 22, 2026
4cd43dd
test(e2e/nextjs): instrument fixture register() to log invocation, en…
omridevk Jul 22, 2026
907085b
test(e2e/nextjs): probe engine via HTTP connect and log fixture proce…
omridevk Jul 22, 2026
8e308b2
test(e2e/nextjs): retry goto once when a stale webpack HMR reload int…
omridevk Jul 22, 2026
fe7785c
test(e2e-utils): tolerate the one-time vite optimizer-reload dynamic-…
omridevk Jul 22, 2026
5bdf66b
test(e2e-utils): filter the optimizer-reload 504 console errors along…
omridevk Jul 23, 2026
f9a1c7a
fix(extension-tanstack): serverfn trace honors app basepath; route ma…
omridevk Jul 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/extension-browser-verbs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@conciv/extension': patch
---

Extensions can declare typed, zod-validated browser `pageVerbs` in `.client(...)` and invoke them from `.server(...)` via a scoped, fully-typed `server.page.call(verb, args)`. Every failure path rejects with a typed `PageVerbError` (`no-widget` | `unknown-verb` | `invalid-args` | `handler-error` | `timeout`). Core gains one generic `ext` page-query kind; no framework-specific code.

Supporting plumbing lands in sibling packages: `@conciv/page` exports the extension page-verb registry (`registerExtensionPageVerbs`/`unregisterExtensionPageVerbs`/`clearExtensionPageVerbs`/`bindExtensionPageVerbs`), the `rootFibers` React-tree walker, and the `dehydrate` serializer (depth/size caps plus secret-key redaction) that every browser verb runs untrusted values through. `@conciv/plugin` exports `makeViteBridge` (from `@conciv/plugin/vite`), a `BundlerBridge` whose `subscribe` emits the generic build/HMR/request-trace diagnostic stream that server-side inspection tools consume.
16 changes: 16 additions & 0 deletions .changeset/first-party-extension-install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@conciv/extension-tanstack': patch
'@conciv/extension-terminal': patch
'@conciv/extension-test-runner': patch
'@conciv/extension-whiteboard': patch
'@conciv/extension-recorder': patch
'@conciv/extension-compiler': patch
'@conciv/plugin': patch
'@conciv/it': patch
---

First-party extensions are folder-installable: `pnpm add @conciv/extension-<name>`, drop a one-line re-export in `conciv/extensions/<name>.tsx`, and both halves load on every supported framework.

Every published extension (tanstack, terminal, test-runner, whiteboard, recorder) ships per-environment conditional exports: the `browser` condition resolves `dist/client.js`, the `import` condition resolves `dist/server.js`, with per-condition `types`, plus an explicit `./server` subpath. `@conciv/extension-compiler` gains the shared discovery primitives (`@conciv/extension-compiler/dedupe`: provenance-carrying `dedupeExtensions`, `toSortedEntries`, `isExtension`) used by both the server loader and every client path; `loadServerExtensions` now matches files exactly (no directories, no `.d.ts`), treats a missing default export as fatal, and reports every dropped entry with its source and reason. `listExtensionFiles` is the single fs listing primitive.

Next.js support (Turbopack and `next dev --webpack`, current GA line): `withConciv` generates an app-local `.conciv/extensions-client.gen.tsx` entry (knitwork static imports, idempotent) and wires it to the widget via `turbopack.resolveAlias`/webpack alias as `@conciv/app-extensions`; `register()` runs a chokidar watcher that regenerates the entry live on add/remove. The widget stays lazy (dynamic imports behind the dev-only guard), the engine register entrypoints are stubbed out of Next edge-runtime compilations, and the generated client module now threads a resolved dedupe entry so dist-mode consumers boot. The tanstack extension renders a mount-time composer chip as its client-active surface and degrades gracefully in apps without a TanStack router.
15 changes: 15 additions & 0 deletions .changeset/framework-adapter-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
'@conciv/protocol': patch
---

Add the shared `FrameworkAdapter` contract (`@conciv/protocol/framework-types`): a capability-typed
interface for framework inspection adapters (Next.js, TanStack Start, and future Vue/Solid/Astro),
mirroring the `HarnessAdapter` pattern so capability flags (`queryCache`, `serverFunctions`,
`rscPayload`, `isr`, `middleware`) force their gated surfaces to be present at compile time. Ships the
client (routes, navigation, data, errors) and server (manifest, events, logs) core surfaces plus the
serializable data shapes agents read (`RouteMatch`, `RouteNode`, `CacheEntry`, `HydrationSnapshot`,
`AppError`, `FrameworkEvent`, `ServerFnInfo`, …) and the `defineFrameworkAdapter` factory. The client
core surface is fully asyncified (every `routes`/`navigation`/`data`/`errors` method returns a
`Promise`) so an adapter can satisfy it by round-tripping through browser page verbs, and the server
core adds `server.errors.snapshot()` alongside the manifest/events/logs surfaces. Types only; no
adapter implementations yet.
5 changes: 5 additions & 0 deletions .changeset/tanstack-inspection-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@conciv/extension-tanstack': patch
---

Add the TanStack Router/Start inspection adapter: agent tools for router state, route tree, loader data, query cache, navigation/invalidation, dev-server build errors, route manifest, and server-function traces, each with a render card, all reading through a FrameworkAdapter contract object.
5 changes: 5 additions & 0 deletions .changeset/tool-ui-cards-phase1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@conciv/ui-kit-chat-tools': patch
---

Purpose-built tool cards for the code-mode and discovery surfaces: CodeRunCard (`execute_typescript`), DiscoveredApisCard (`discover_tools`), LoadedToolsCard (`__lazy__tool__discovery__`), and a `conciv_extensions` inline row, so no conciv-owned tool falls through to the generic fallback. `ToolCard` gains an optional `status` override, letting a payload-level failure (`success: false` on a wire-successful call) render the failure state instead of a green dot, and its status dot is now labelled for assistive tech. Code-mode binding names are sanitized to valid JS identifiers, fixing a crash where a single dotted tool name (`canvas.svg`) produced invalid generated source and broke every `execute_typescript` call.
5 changes: 5 additions & 0 deletions .changeset/tool-ui-cards-phase2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@conciv/core': patch
---

Tool cards render on every harness, and code-mode calls surface as real nested tool cards. Three fixes plus the phase-2 extension-owned cards: (1) tool names are normalized to their registered names before parts reach the widget — claude's `probe_ping`, opencode's `tanstack_probe_ping`, and transcript `mcp__<server>__` forms all map losslessly back to the registered dotted name, so a card written once matches everywhere. (2) codex bridged tools finally execute under `workspace-write`: codex was cancelling MCP tool calls awaiting an unanswerable approval prompt, fixed narrowly with `mcp_servers.tanstack.default_tools_approval_mode = "approve"` scoped to conciv's own bridge (conciv's approval gate still guards `approval: 'ask'` tools). (3) every extension tool invoked through code-mode `execute_typescript` now emits a real per-tool part carrying `metadata.parentToolCallId`, and the chat activity view nests those parts under the script run in a collapsible tool group — denies and throws render as errors, never green. New extension-owned cards: CanvasOpCard (op-aware `canvas.*` with thumbnails, count chips, red destructive ops), CommentOpCard (`comment.*` + `pin.setState`), RecordingToolCard (`recording_start/stop/pull` with action-log summary), and inline rows for `element.reference` / `anchor.resolve`.
9 changes: 8 additions & 1 deletion .fallowrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"**/*.d.ts",
"**/*.generated.ts",
"packages/aidx/**",
"packages/extensions/tanstack/test/fixtures/**",
"apps/examples/**",
"e2e/astro/**",
"e2e/nextjs/**",
Expand Down Expand Up @@ -37,6 +38,7 @@
},
"ignoreDependencies": [
"collections",
"@conciv/app-extensions",
"@conciv/cli",
"jazz-napi",
"@oxlint/plugins",
Expand Down Expand Up @@ -64,6 +66,7 @@
"unist-util-visit-parents",
"@conciv/client",
"@conciv/embed",
"@conciv/extension-compiler",
"@conciv/grab",
"@conciv/mascot",
"@conciv/solid-diffs",
Expand Down Expand Up @@ -110,5 +113,9 @@
"exports": ["*"]
}
],
"entry": ["packages/extension-testkit/src/host/host-entry.tsx", "e2e/harnesses/vite.*.config.ts"]
"entry": [
"packages/extension-testkit/src/host/host-entry.tsx",
"packages/extensions/tanstack/test/host/main.tsx",
"e2e/harnesses/vite.*.config.ts"
]
}
5 changes: 5 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"warn",
{
"allow": [
"__conciv",
"__CONCIV__",
"__CONCIV_API_BASE__",
"__CONCIV_PAGE_DRIVER__",
Expand Down Expand Up @@ -139,8 +140,12 @@
"build",
"node_modules",
".turbo",
".conciv",
"**/*.gen.ts",
"**/*.gen.tsx",
"**/test-results",
"packages/plugin/test/fixtures/**",
"packages/extensions/tanstack/test/fixtures/**",
"e2e/*/src",
"e2e/*/app"
]
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:
language: system
pass_filenames: true
files: '\.(m?[jt]sx?|c[jt]s|jsonc?|md)$'
exclude: '^(.*/)?(dist|build|\.turbo)/'
exclude: '^(.*/)?(dist|build|\.turbo)/|^packages/plugin/test/fixtures/|^packages/extensions/tanstack/test/fixtures/'
- id: oxlint
name: oxlint (lint staged files)
entry: bash -c 'pnpm exec oxlint --fix "$@" && git add -- "$@"' --
Expand Down
2 changes: 1 addition & 1 deletion apps/conciv/src/extension/extension-slots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {ErrorBoundary, For, type JSX} from 'solid-js'
import {MountedExtension} from '@conciv/extension/client'
import type {AnyExtension, ExtensionSlot} from '@conciv/extension'

export type ExtensionInstance = {extension: AnyExtension; clientValue: object}
export type ExtensionInstance = {extension: AnyExtension; clientValue: object; dispose: () => void}

export function ExtensionSurface(props: {name: ExtensionSlot; instances: ExtensionInstance[]}): JSX.Element {
return (
Expand Down
14 changes: 13 additions & 1 deletion apps/conciv/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type {RouterHistory} from '@tanstack/solid-router'
import {QueryClient} from '@tanstack/solid-query'
import type {RpcClient} from '@conciv/contract'
import type {AnyExtension} from '@conciv/extension'
import {bindExtensionPageVerbs} from '@conciv/page'
import {routeTree} from './routeTree.gen'
import {makeAppData, type AppData} from './data/app-data.js'
import type {ConcivSettings} from './data/settings.js'
Expand Down Expand Up @@ -40,7 +41,8 @@ export type ConcivRouterConfig = {
function createInstances(extensions: AnyExtension[]): ExtensionInstance[] {
return extensions.map((extension) => {
const result = extension.__client?.()
return {extension, clientValue: result?.value ?? {}}
const dispose = bindExtensionPageVerbs(extension.name, result?.pageVerbs, result?.dispose)
return {extension, clientValue: result?.value ?? {}, dispose}
Comment on lines +44 to +45
Comment on lines 43 to +45
})
}

Expand Down Expand Up @@ -68,6 +70,16 @@ export function createConcivRouter(config: ConcivRouterConfig) {
})
}

export function disposeConcivRouter(router: ReturnType<typeof createConcivRouter>): void {
for (const instance of router.options.context.instances) {
try {
instance.dispose()
} catch (error) {
console.error('[conciv] extension instance teardown failed', error)
}
}
}

declare module '@tanstack/solid-router' {
interface Register {
router: ReturnType<typeof createConcivRouter>
Expand Down
25 changes: 24 additions & 1 deletion apps/conciv/test/router-restore.browser.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import {describe, expect, it} from 'vitest'
import {createWebStorageHistory, type WebStorage} from '@conciv/storage-history'
import {makeRpcClient} from '@conciv/contract'
import {defineExtension} from '@conciv/extension'
import {parseConcivSettings} from '../src/data/settings.js'
import {createConcivRouter} from '../src/router.js'
import {createConcivRouter, disposeConcivRouter} from '../src/router.js'

function makeMemoryStorage(): WebStorage {
const map = new Map<string, string>()
Expand Down Expand Up @@ -45,4 +46,26 @@ describe('createConcivRouter with storage-history', () => {
router.history.back()
expect(router.history.location.pathname).toBe('/panel/conciv_abc123')
})

it('invokes every extension instance disposer on teardown, even when one throws', () => {
const order: string[] = []
const first = defineExtension({name: 'dispose-a'}).client(() => ({value: {}, dispose: () => order.push('a')}))
const second = defineExtension({name: 'dispose-b'}).client(() => ({
value: {},
dispose: () => {
order.push('b')
throw new Error('teardown b blew up')
},
}))
const third = defineExtension({name: 'dispose-c'}).client(() => ({value: {}, dispose: () => order.push('c')}))
const router = createConcivRouter({
rpc: makeRpcClient('http://127.0.0.1:9'),
history: createWebStorageHistory({storage: makeMemoryStorage()}),
environment: {rootNode: document, document},
settings: parseConcivSettings(''),
extensions: [first, second, third],
})
expect(() => disposeConcivRouter(router)).not.toThrow()
expect(order).toEqual(['a', 'b', 'c'])
})
})
1 change: 1 addition & 0 deletions apps/examples/nextjs-app/conciv/extensions/tanstack.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from '@conciv/extension-tanstack'
3 changes: 2 additions & 1 deletion apps/examples/nextjs-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
},
"dependencies": {
"@conciv/embed": "workspace:*",
"@conciv/extension-tanstack": "workspace:*",
"@conciv/it": "workspace:*",
"next": "16.2.9",
"next": "16.2.10",
"react": "19.2.4",
"react-dom": "19.2.4"
},
Expand Down
2 changes: 1 addition & 1 deletion apps/examples/nextjs-app/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts", "**/*.mts"],
"exclude": ["node_modules"]
"exclude": ["node_modules", ".conciv"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from '@conciv/extension-tanstack'
1 change: 1 addition & 0 deletions apps/examples/tanstack-start/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@conciv/cli": "workspace:*",
"@conciv/embed": "workspace:*",
"@conciv/extension": "workspace:*",
"@conciv/extension-tanstack": "workspace:*",
"@conciv/it": "workspace:*",
"@conciv/protocol": "workspace:*",
"@tailwindcss/vite": "^4.3.2",
Expand Down
131 changes: 131 additions & 0 deletions apps/site/content/docs/extending/install-first-party.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
---
title: Install an extension
description: Add a published extension with one dependency and a one-line re-export.
---

Some extensions ship as their own package: the [TanStack inspector](https://github.com/conciv-dev/conciv/tree/main/packages/extensions/tanstack),
the terminal, and the recorder. Installing one is two steps that work the same on every framework.

<Callout>The whiteboard and test runner are [built-ins](/docs/extending/built-ins): on by
default, no install. This page is for the extensions you opt into.</Callout>

<Steps>

<Step>

### Add the package

```bash
pnpm add @conciv/extension-tanstack
```

</Step>

<Step>

### Re-export it from `conciv/extensions/`

Create one file whose basename is the extension's name and re-export the package default:

```tsx title="conciv/extensions/tanstack.tsx"
export {default} from '@conciv/extension-tanstack'
```

That is the whole install. Restart your dev server and the extension is live.

</Step>

</Steps>

## Why one file is enough

Every published extension has a server half (tool execution) and a browser half (result cards,
widget UI). The package exposes both through conditional exports, and conciv loads each half from
the right place:

- **Server half** — conciv scans `conciv/extensions/`, resolves the `import` condition, and loads
it in node. This is filesystem discovery, so it needs no bundler and works on every framework.
- **Browser half** — the widget bundle picks up the `browser` condition of the same file. On
Vite-based frameworks (Vite, Astro, Solid Start, Svelte, TanStack Start) the conciv plugin
collects `conciv/extensions/` through `import.meta.glob`. On Next.js, `withConciv` writes a
generated entry at `.conciv/extensions-client.gen.tsx` and aliases the client bundle to it.

You never wire the halves together; the single re-export file feeds both.

## Next.js specifics

The generated `.conciv/` entry is created automatically when `withConciv` loads your config. It is
already covered by conciv's gitignore and carries a do-not-edit header, so leave it alone. A dev
watcher regenerates it whenever you add or remove files in `conciv/extensions/` during `next dev`,
so new extensions appear without a restart.

This works on both bundlers: the default **Turbopack** and `next dev --webpack`. Supported Next.js
is the current GA line (tested on 16.2.x; peer range `^15.3.0 || ^16.0.0`).

## Stub file rules

The re-export file must be a real module conciv can import and, on Next.js, generate an entry for:

- Use `.ts`, `.tsx`, `.js`, or `.jsx`. A `.d.ts` is types only and is skipped; directories are not
scanned.
- Basenames must be unique. `foo.ts` next to `foo.tsx` is a duplicate and fails Next.js generation.
- The basename is cosmetic for discovery — the registered name comes from the extension's own
`name`. Built-ins win collisions, then first registration wins; dropped entries are logged with
their source and reason.

## Local extensions alongside installed ones

The same `conciv/extensions/` folder holds your own [inline extensions](/docs/extending/your-first-extension).
On Vite frameworks the conciv plugin compiles them as Solid JSX, so they behave exactly like the
[overview example](/docs/extending). On **Next.js** there is one constraint: Next compiles
`conciv/extensions/*.tsx` as React JSX, so a local file must be JSX-free — return strings or use
`h`-style calls from `Component` rather than Solid JSX — and the app needs `@conciv/extension`
(plus `solid-js` if you use it) as dependencies. Installed packages have no such limit; their
browser half is prebuilt, so the re-export stub carries no JSX.

## Graceful degradation

An installed extension does not assume your app looks a certain way. It probes the page when a tool
runs, not at mount. The TanStack inspector, for example, mounts cleanly in a router-less Next.js
app; its router tools return a typed miss there, while `tanstack_query_cache` still works in any
app using TanStack Query.

## Publishing your own installable extension

To ship an extension as a package, split it into a client build and a server build, then expose
both through conditional exports. Copy the `.` entry conciv's own extensions use:

```json title="package.json"
{
"exports": {
".": {
"browser": {
"types": "./dist/client.d.ts",
"default": "./dist/client.js"
},
"import": {
"types": "./dist/server.d.ts",
"default": "./dist/server.js"
}
},
"./client": {
"types": "./dist/client.d.ts",
"import": "./dist/client.js"
},
"./server": {
"types": "./dist/server.d.ts",
"import": "./dist/server.js"
},
"./package.json": "./package.json"
}
}
```

The `browser` condition is the client half the widget bundles; `import` is the server half conciv
loads in node. Keep `./client` and `./server` subpaths by convention so tooling and tests can reach
each half directly.

<Callout type="warn">Editors resolve the `import` (server) types by default, so a browser-context
file may see the wrong side of the export map. When you author the client half, set
`customConditions: ["browser"]` in that project's `tsconfig.json` so the editor resolves the
browser types.</Callout>
10 changes: 9 additions & 1 deletion apps/site/content/docs/extending/meta.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{
"title": "Extending",
"icon": "Puzzle",
"pages": ["index", "your-first-extension", "tool-contract", "widget-ui", "testing", "built-ins"]
"pages": [
"index",
"your-first-extension",
"install-first-party",
"tool-contract",
"widget-ui",
"testing",
"built-ins"
]
}
Loading
Loading