Skip to Content
DocsPluginsComparisonChangelog
0
DocsChangelog

More

Discussionsllms.txtllms-full.txt
Getting startedWhat is concivComparisonRequirementsPlaygroundExamplesAPI reference

Engine and widgetSessionsHarnessesTools and code modeAgents and permissionsSkills

Use conciv
Bundlers
Agents
PluginsBuild your first plugin
Add a toolAsk for permissionAdd a skillShare an RPC methodCall from a terminalAdd a panelSlot or pillAdd settingsTest your plugin
Plugin API reference
PluginsGuides

Test your plugin

Start a real conciv engine with your plugin in a test, script the agent's replies, and drive the widget in a browser test.

This guide installs the test utilities, which the tutorial did not:

npm install -D vitest @conciv/backend-test-utils @internal/vitest-config
pnpm add -D vitest @conciv/backend-test-utils @internal/vitest-config
yarn add --dev vitest @conciv/backend-test-utils @internal/vitest-config
bun add --dev vitest @conciv/backend-test-utils @internal/vitest-config

Test your plugin the way the user uses it. A real engine loads your plugin, a scripted model plays the agent, and your test checks what comes back. Nothing is mocked. This guide tests project_version from Build your first plugin and release_ship from Ask for permission. Both are direct tools, with codemode: false.

Copy this prompt into your agent. It builds this in your project from this page.

Prompt
Build this in my project with conciv. conciv is a dev-only AI agent widget, and it already runs in my app.

1. Read https://conciv.dev/docs/plugins/guides/testing.md and follow it. It is the source of truth for the API.
2. If the project has the conciv-develop skill (conciv init installs it with the @conciv/skills docs pack), load it too.
3. Write a test for my plugin with @conciv/backend-test-utils: start a real engine with the plugin, and call its tool.
4. Install only the packages the page lists, with the package manager this project uses.
5. Run the test with `npx vitest run <the test file>` and show me the result.
6. When you are done, tell me what you changed and how to see it.

Call your tool in a test

Add the conciv test setup to a vitest config at your project root:

vitest.config.ts
import {} from 'vitest/config'
import {} from '@internal/vitest-config/conciv-test'

export default ({
  : [()], // <- each run gets its own conciv home, removed after
})

Then call your tool on a real engine:

test/it/project-version.it.test.ts
import {} from 'vitest'
import {} from '@conciv/backend-test-utils'

('the agent reads the project version', async ({
  const  = await 

  (await ..('project_version').
})

Run it from your project root with npx vitest run.

A few things to notice:

  • vitest collects tests from test/unit, test/it and test/e2e. Engine tests go in test/it.
  • test is vitest's test with a createEngine fixture. It starts the real engine on a free port.
  • The first argument of createEngine is your conciv config. Here it is empty, because conciv/plugins loads on its own, as in your app.
  • directory: '.' resolves against vitest's working folder. Run vitest from your project root, or pass that folder.
  • The fixture stops every engine the test started when the test ends, pass or fail.

Script the agent

TestLLM plays the agent. Queue its replies, then send a message as the user:

test/it/release.it.test.ts
import {} from 'vitest'
import {, } from '@conciv/backend-test-utils'

('shipping a branch asks the user first', async ({
  const  = await 
  await .(.
  const  = await .('permission.asked') // <- listen before it happens

  const  = ..

  await (.)..
  await ..()
  await 
})

The turn runs your real tool, so the permission ask is real. engine.session.stop stops the turn, as the user's Stop button does. TestLLM.text makes a plain text reply, to end a turn after a tool call.

Drive the widget in a browser test

A browser test renders the real widget against the real engine, in Chromium. Install what it imports, and the browser:

npm install -D @internal/frontend-test-utils @solidjs/testing-library @testing-library/user-event
pnpm add -D @internal/frontend-test-utils @solidjs/testing-library @testing-library/user-event
yarn add --dev @internal/frontend-test-utils @solidjs/testing-library @testing-library/user-event
bun add --dev @internal/frontend-test-utils @solidjs/testing-library @testing-library/user-event
terminal
npx playwright install chromium

Turn on browser tests in the config with concivTest({browser: true}). Then check that the user sees the card:

test/e2e/project-version.e2e.test.tsx
import {} from 'vitest'
import {} from '@solidjs/testing-library'
import 
import {, } from '@conciv/backend-test-utils'
import {} from '@internal/frontend-test-utils/app'
import  from '../../conciv/plugins/project-version/plugin-experimental'

('the user sees the version card', async ({
  const  = 








The test finds the composer by its label and types into it, as a user does. findByText waits until the card shows.

Next steps

  • Add a tool: the tools these tests call.
  • Plugin API reference: every ctx domain.

Add settings

Read options from the project's conciv config, and add a setting the user changes in the widget.

Plugin API reference

What to import for each part of a plugin, and every field of Plugin.define, ctx, a tool and the browser registries, generated from the plugin API's own types.

On this page

Call your tool in a testScript the agentDrive the widget in a browser testNext steps
Edit on GitHubView .mdOpen in ClaudeOpen in ChatGPT
const = await
await .(.
await ({, : [{
await .(await
await .(.
(await .
})
})
=>
{
({}, {
:
'.'
})
// <- '.' is the folder you run vitest from
({})).
({
:
.
(
)})
})
=>
{
({}, {
:
'.'
})
(
'c1'
,
'release_ship'
, {
:
'main'
}))
// <- the model calls the tool
(
'Ship main'
)
({
: {
:
'release_ship'
,
: [
'main'
]}})
from
'@testing-library/user-event'
})
=>
{
.
()
({}, {
:
'.'
})
(
'c1'
,
'project_version'
, {}),
.
(
'Here is the version'
))
:
'project-version'
,
:
}]})
// <- the whole widget
.
(
'textbox'
, {
:
'Message the conciv agent'
}),
'What version is this?'
)
(
'button'
, {
:
'Send message'
}))
(
/
^
\S
+
\d
+
\.
\d
+
\.
\d
+
/
)).
()
// <- your card: name and version