@contractspec/example.ai-chat-assistant
v3.8.25
Published
Focused AI chat assistant template with MCP tools, reasoning, chain of thought, sources, and suggestions.
Readme
@contractspec/example.ai-chat-assistant
Website: https://contractspec.io
Focused AI chat assistant example with MCP tools, reasoning, sources, suggestions, and reusable dashboard UI.
What This Demonstrates
- Demonstrates how
@contractspec/module.ai-chatcan power a focused assistant experience. - Publishes feature, contracts, handlers, docs, example, and dashboard UI entrypoints.
- Provides a search-backed, source-aware assistant template for example consumers and docs.
src/contracts/contains contract specs, operations, entities, and registry exports.src/docs/contains docblocks and documentation-facing exports.src/handlers/contains handlers or demo adapters wired to contract surfaces.
Running Locally
From packages/examples/ai-chat-assistant:
bun run devbun run buildbun run testbun run smokebun run typecheck
Usage
Use @contractspec/example.ai-chat-assistant as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
Architecture
src/ai-chat-assistant.feature.tsdefines the example feature surface.src/contracts/contains the assistant operation contract exports.src/handlers/contains the demo assistant handlers wired to the example feature.src/ui/contains the packaged dashboard UI for embedding or demonstration.src/docs/andsrc/example.tsprovide docblock and runnable example entrypoints.src/index.tsis the root public barrel and package entrypoint.
Public Entry Points
- Exports the feature surface, contract barrels, handlers, docs entrypoints, runnable example, and dashboard UI.
- Export
.resolves through./src/index.ts. - Export
./ai-chat-assistant.featureresolves through./src/ai-chat-assistant.feature.ts. - Export
./contractsresolves through./src/contracts/index.ts. - Export
./contracts/assistant.operationresolves through./src/contracts/assistant.operation.ts. - Export
./docsresolves through./src/docs/index.ts. - Export
./docs/ai-chat-assistant.docblockresolves through./src/docs/ai-chat-assistant.docblock.ts. - Export
./exampleresolves through./src/example.ts. - Export
./handlersresolves through./src/handlers/index.ts. - Export
./handlers/assistant.handlersresolves through./src/handlers/assistant.handlers.ts. - Export
./uiresolves through./src/ui/index.ts. - The package publishes 11 total export subpaths; keep docs aligned with
package.json.
Local Commands
bun run dev— contractspec-bun-build devbun run build— bun run prebuild && bun run build:bundle && bun run build:typesbun run test— bun testbun run smoke— bun test src/example.smoke.test.tsbun run lint— bun run lint:fixbun run lint:check— biome check .bun run lint:fix— biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .bun run typecheck— tsc --noEmitbun run publish:pkg— bun publish --tolerate-republish --ignore-scripts --verbosebun run publish:pkg:canary— bun publish:pkg --tag canarybun run clean— rimraf dist .turbobun run build:bundle— contractspec-bun-build transpilebun run build:types— contractspec-bun-build typesbun run prebuild— contractspec-bun-build prebuild
Recent Updates
- Replace eslint+prettier by biomejs to optimize speed.
- Stability.
- Vnext ai-native.
Notes
- Works alongside
@contractspec/lib.ai-agent,@contractspec/lib.contracts-spec,@contractspec/lib.schema,@contractspec/module.ai-chat,@contractspec/tool.bun, ...
