{"id":"@lssm-tech/module.ai-chat","slug":"module.ai-chat","name":"@lssm-tech/module.ai-chat","version":"7.0.5","path":"packages/platform/agents/ai-chat","manifestPath":"packages/platform/agents/ai-chat/package.json","manifestBlobSha":"e94696cca91fd312bdbc985fe01134e89dc4e6b4","layer":"platform","physicalArea":"agents","primaryArea":"agents-and-context","classification":{"privateDeclared":null,"catalogFamily":"solutions","catalogKind":"module","catalogStatus":"active","adoptionMode":"adoptable","stability":"stable"},"description":"AI chat interface module","descriptionOrigin":"package.json","catalog":{"family":"solutions","kind":"module","status":"active","adoptionMode":"adoptable","stability":"stable","platforms":["server"],"runtimes":["node"],"entrypoints":[".","./context","./core","./presentation","./presentation/components","./presentation/hooks","./providers"],"documentation":[{"title":"Module Ai Chat documentation","url":"https://www.npmjs.com/package/%40lssm-tech%2Fmodule.ai-chat","kind":"readme"}],"examples":[],"replacements":[],"capabilities":[{"id":"package.lssm.tech.module.ai.chat","title":"Module Ai Chat","description":"AI chat interface module","status":"active","useCases":["Adopt ai chat interface module"],"aliases":["contractspec","ai","chat","conversational","typescript","module"],"pythonEquivalents":[],"canonicalImports":[{"from":"@lssm-tech/module.ai-chat","symbols":[]},{"from":"@lssm-tech/module.ai-chat/context","symbols":[]},{"from":"@lssm-tech/module.ai-chat/core","symbols":[]},{"from":"@lssm-tech/module.ai-chat/presentation","symbols":[]},{"from":"@lssm-tech/module.ai-chat/presentation/components","symbols":[]},{"from":"@lssm-tech/module.ai-chat/presentation/hooks","symbols":[]},{"from":"@lssm-tech/module.ai-chat/providers","symbols":[]}],"constraints":{"platforms":["server"],"runtimes":["node"],"avoidWhen":["The @lssm-tech/module.ai-chat package constraints do not match the target runtime or platform."],"requires":["TypeScript"]},"alternatives":[],"relationships":[],"resolutionPriority":50}],"visualTesting":{"status":"deferred","owner":"@contractspec-core","targetWave":"wave-3-react-packages","rationale":"Foundational Storybook adoption establishes shared catalogs and guardrails before this package migrates."}},"canonicalImports":[{"capabilityId":"package.lssm.tech.module.ai.chat","from":"@lssm-tech/module.ai-chat","symbols":[]},{"capabilityId":"package.lssm.tech.module.ai.chat","from":"@lssm-tech/module.ai-chat/context","symbols":[]},{"capabilityId":"package.lssm.tech.module.ai.chat","from":"@lssm-tech/module.ai-chat/core","symbols":[]},{"capabilityId":"package.lssm.tech.module.ai.chat","from":"@lssm-tech/module.ai-chat/presentation","symbols":[]},{"capabilityId":"package.lssm.tech.module.ai.chat","from":"@lssm-tech/module.ai-chat/presentation/components","symbols":[]},{"capabilityId":"package.lssm.tech.module.ai.chat","from":"@lssm-tech/module.ai-chat/presentation/hooks","symbols":[]},{"capabilityId":"package.lssm.tech.module.ai.chat","from":"@lssm-tech/module.ai-chat/providers","symbols":[]}],"scripts":{"publish:pkg":"bun publish --tolerate-republish --ignore-scripts --verbose","publish:pkg:canary":"bun publish:pkg --tag canary","build":"contractspec-bun-build build","build:bundle":"contractspec-bun-build transpile","build:types":"contractspec-bun-build types","dev":"contractspec-bun-build dev","clean":"rimraf dist .turbo","lint":"bun lint:fix","lint:fix":"node ../../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../../scripts/biome.cjs check --write .","lint:check":"node ../../../../scripts/biome.cjs check .","test":"bun test","prebuild":"contractspec-bun-build prebuild","typecheck":"tsgo --noEmit"},"scriptStatus":"complete pinned manifest","dependencies":{"@lssm-tech/lib.ai-agent":"workspace:^","@lssm-tech/lib.orchestration-spec":"workspace:^","@lssm-tech/lib.surface-runtime":"workspace:^","@lssm-tech/lib.ai-providers":"workspace:^","@lssm-tech/lib.contracts-spec-core":"workspace:^","@lssm-tech/integration.workflow-devkit":"workspace:^","@lssm-tech/lib.translation-runtime":"workspace:^","@lssm-tech/lib.workflow-composer":"workspace:^","@lssm-tech/lib.schema":"workspace:^","@lssm-tech/lib.design-system":"workspace:^","@lssm-tech/lib.ui-kit-web":"workspace:^","@ai-sdk/react":"catalog:ai","ai":"catalog:ai","lucide-react":"catalog:ui","zod":"catalog:"},"devDependencies":{"@lssm-tech/tool.typescript":"workspace:*","@types/react":"catalog:types","happy-dom":"catalog:testing","react":"catalog:","typescript":"catalog:","@lssm-tech/tool.bun":"workspace:*"},"peerDependencies":{"react":"catalog:"},"optionalDependencies":{},"peerDependenciesMeta":{},"bundledDependencies":null,"dependencyStatus":"complete pinned manifest","exports":{".":"./src/index.ts","./context":"./src/context/index.ts","./core":"./src/core/index.ts","./presentation":"./src/presentation/index.ts","./presentation/components":"./src/presentation/components/index.ts","./presentation/hooks":"./src/presentation/hooks/index.ts","./providers":"./src/providers/index.ts"},"publishExports":{".":{"types":"./dist/index.d.ts","browser":"./dist/browser/index.js","bun":"./dist/index.js","node":"./dist/node/index.js","default":"./dist/index.js"},"./context":{"types":"./dist/context/index.d.ts","browser":"./dist/browser/context/index.js","bun":"./dist/context/index.js","node":"./dist/node/context/index.js","default":"./dist/context/index.js"},"./core":{"types":"./dist/core/index.d.ts","browser":"./dist/browser/core/index.js","bun":"./dist/core/index.js","node":"./dist/node/core/index.js","default":"./dist/core/index.js"},"./presentation":{"types":"./dist/presentation/index.d.ts","browser":"./dist/browser/presentation/index.js","bun":"./dist/presentation/index.js","node":"./dist/node/presentation/index.js","default":"./dist/presentation/index.js"},"./presentation/components":{"types":"./dist/presentation/components/index.d.ts","browser":"./dist/browser/presentation/components/index.js","bun":"./dist/presentation/components/index.js","node":"./dist/node/presentation/components/index.js","default":"./dist/presentation/components/index.js"},"./presentation/hooks":{"types":"./dist/presentation/hooks/index.d.ts","browser":"./dist/browser/presentation/hooks/index.js","bun":"./dist/presentation/hooks/index.js","node":"./dist/node/presentation/hooks/index.js","default":"./dist/presentation/hooks/index.js"},"./providers":{"types":"./dist/providers/index.d.ts","browser":"./dist/browser/providers/index.js","bun":"./dist/providers/index.js","node":"./dist/node/providers/index.js","default":"./dist/providers/index.js"}},"types":"./dist/index.d.ts","files":["dist","README.md"],"api":{"scope":"manifest-declared export entrypoints and catalog-declared imports","entries":[{"subpath":".","importPath":"@lssm-tech/module.ai-chat","target":"./src/index.ts","targets":[{"conditions":[],"target":"./src/index.ts","sourcePath":"packages/platform/agents/ai-chat/src/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/src/index.ts","sourceStatus":"verified source file"}]},{"subpath":"./context","importPath":"@lssm-tech/module.ai-chat/context","target":"./src/context/index.ts","targets":[{"conditions":[],"target":"./src/context/index.ts","sourcePath":"packages/platform/agents/ai-chat/src/context/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/src/context/index.ts","sourceStatus":"verified source file"}]},{"subpath":"./core","importPath":"@lssm-tech/module.ai-chat/core","target":"./src/core/index.ts","targets":[{"conditions":[],"target":"./src/core/index.ts","sourcePath":"packages/platform/agents/ai-chat/src/core/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/src/core/index.ts","sourceStatus":"verified source file"}]},{"subpath":"./presentation","importPath":"@lssm-tech/module.ai-chat/presentation","target":"./src/presentation/index.ts","targets":[{"conditions":[],"target":"./src/presentation/index.ts","sourcePath":"packages/platform/agents/ai-chat/src/presentation/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/src/presentation/index.ts","sourceStatus":"verified source file"}]},{"subpath":"./presentation/components","importPath":"@lssm-tech/module.ai-chat/presentation/components","target":"./src/presentation/components/index.ts","targets":[{"conditions":[],"target":"./src/presentation/components/index.ts","sourcePath":"packages/platform/agents/ai-chat/src/presentation/components/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/src/presentation/components/index.ts","sourceStatus":"verified source file"}]},{"subpath":"./presentation/hooks","importPath":"@lssm-tech/module.ai-chat/presentation/hooks","target":"./src/presentation/hooks/index.ts","targets":[{"conditions":[],"target":"./src/presentation/hooks/index.ts","sourcePath":"packages/platform/agents/ai-chat/src/presentation/hooks/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/src/presentation/hooks/index.ts","sourceStatus":"verified source file"}]},{"subpath":"./providers","importPath":"@lssm-tech/module.ai-chat/providers","target":"./src/providers/index.ts","targets":[{"conditions":[],"target":"./src/providers/index.ts","sourcePath":"packages/platform/agents/ai-chat/src/providers/index.ts","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/src/providers/index.ts","sourceStatus":"verified source file"}]}],"entryCount":7,"namedSymbolCoverage":"catalog declarations only; exhaustive TypeScript symbols not extracted","installationStatus":"not verified"},"docsLinks":[{"title":"Module Ai Chat documentation","url":"https://www.npmjs.com/package/%40lssm-tech%2Fmodule.ai-chat","kind":"readme","pinnedUrl":null,"sourceStatus":"declared link; destination not verified"}],"sourceUrls":{"package":"https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat","manifest":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/package.json","readme":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/README.md","guide":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/module.ai-chat.txt"},"readme":{"status":"available","body":"# @lssm-tech/module.ai-chat\n\nWebsite: https://contractspec.io\n\n**AI chat module with context, core runtime, presentation components, hooks, providers, and agent-aware workflows.**\n\nWorkspace file operations remain injectable through `FileSystem`. The compatible\n`createNodeFileOperations` factory loads server filesystem capabilities only when\nan operation runs. Browser imports do not resolve Node builtins; invoking the\nserver adapter without a compatible host returns an explicit capability error.\nWrites still require the existing `allowWrites` opt-in. This adapter is not a\nfilesystem sandbox or a replacement for host authorization.\nThe legacy Node fallback uses native runtime import directives for Webpack and\nTurbopack so browser builds do not attempt to resolve optional server modules.\n\n## What It Provides\n\n- Provides the packaged chat feature layer used by examples and higher-level applications.\n- Supports MCP tools, provider integration, presentation rendering, forms, and agent-mode workflows.\n- Acts as the main composition layer between the low-level agent runtime and user-facing chat UIs.\n- `src/adapters/` contains runtime, provider, or environment-specific adapters.\n- `src/docs/` contains docblocks and documentation-facing exports.\n- `src/presentation/` contains presentation-layer components and renderers.\n\n## Installation\n\n`npm install @lssm-tech/module.ai-chat`\n\nor\n\n`bun add @lssm-tech/module.ai-chat`\n\n## Usage\n\nImport the root entrypoint from `@lssm-tech/module.ai-chat`, or choose a documented subpath when you only need one part of the package surface.\n\n## Architecture\n\nHeadless chat service, storage, workspace context and planner/workflow helpers\nare canonical in `@lssm-tech/lib.ai-agent/chat`. Existing core and context exports\nforward without wrapping constructors or factories. Chat presentation and the\n`aiChat.*` reasoning-label keys remain owned by this module.\n\n- `src/context/` contains shared chat providers and contextual runtime state.\n- `src/core/` contains chat orchestration, workflows, and non-UI runtime logic.\n- `src/presentation/` exports UI components and React hooks for embedding the chat experience.\n- `src/providers/` exposes provider bindings and provider-facing integration helpers.\n- Top-level feature, capability, operation, schema, and event files define the module contract surface.\n- `src/core/economic-evidence.ts` maps chat adapter usage into neutral agent-run economic evidence refs.\n- `src/ai-chat.capability.ts` defines a capability surface.\n\n## Public Entry Points\n\n- Exports the root module plus context, core, core/workflow, presentation, presentation/components, presentation/hooks, and providers subpaths.\n- Export `.` resolves through `./src/index.ts`.\n- Export `./context` resolves through `./src/context/index.ts`.\n- Export `./core` resolves through `./src/core/index.ts`.\n- Export `./core/workflow` resolves through `./src/core/workflow.ts`.\n- Export `./presentation` resolves through `./src/presentation/index.ts`.\n- Export `./presentation/components` resolves through `./src/presentation/components/index.ts`.\n- Export `./presentation/hooks` resolves through `./src/presentation/hooks/index.ts`.\n- Export `./providers` resolves through `./src/providers/index.ts`.\n\n## Economic Evidence\n\nAI chat now emits safe economic evidence automatically when token usage exists. `ChatService` stores `createAiChatEconomicEvidenceMetadata()` output on assistant message metadata, `createChatRoute()` emits AI SDK `messageMetadata` on finish, and `createCompletionRoute()` calls `onEconomicEvidence` on finish. Missing usage returns `undefined` so callers do not fabricate spend. Route consumers should persist `economicEvidenceRefs`/usage metadata and keep prompts, messages, tool args, and provider receipts in their owning secure stores.\n\n## Local Commands\n\n- `bun run dev` — contractspec-bun-build dev\n- `bun run build` — contractspec-bun-build build\n- `bun run test` — bun test\n- `bun run lint` — bun lint:fix\n- `bun run lint:check` — biome check .\n- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .\n- `bun run typecheck` — tsgo --noEmit\n- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose\n- `bun run publish:pkg:canary` — bun publish:pkg --tag canary\n- `bun run clean` — rimraf dist .turbo\n- `bun run build:bundle` — contractspec-bun-build transpile\n- `bun run build:types` — contractspec-bun-build types\n- `bun run prebuild` — contractspec-bun-build prebuild\n\n## Recent Updates\n\n- Replace eslint+prettier by biomejs to optimize speed.\n- Agentic workflows — subagents, memory tools, and next steps.\n- Vnext ai-native.\n- Backend operations + frontend rendering support.\n- Use browser-safe MCP client stub in client bundles.\n- Add changesets and apply pending fixes.\n- Add chat usage-to-economic-evidence mapping for AI-native billing, observability, and replay lanes.\n\n## Notes\n\n- Depends on `lib.ai-agent`, `lib.ai-providers`, `lib.contracts-spec`, `lib.schema`, `lib.metering`, `lib.cost-tracking`, `lib.surface-runtime`.\n- React peer dependency (>=19.2.4); changes here affect all chat surfaces.\n- Metering and cost-tracking are wired in -- never bypass them.\n","sourcePath":"packages/platform/agents/ai-chat/README.md","sourceUrl":"https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/platform/agents/ai-chat/README.md","blobSha":"4377058630c2600f9c8783016466398b16243549","sourcePin":"bcc79fcc27c4d801c2119bef81ddcce7b4e86498","origin":"README recovered byte-for-byte from pinned aggregate guide","integrity":"exact Git blob match","executionStatus":"not executed"},"provenance":{"repository":"lssm-tech/contractspec","sourcePin":"bcc79fcc27c4d801c2119bef81ddcce7b4e86498","manifestOrigin":"pinned GitHub manifest fetch","manifestComplete":true,"publicationPolicyApplied":false},"areaSlug":"agents-and-context","areaTitle":"Agents, execution and context","displayName":"module.ai-chat","runtimes":["node"],"platforms":["server"],"kind":"module","scope":"Package manifest","canonicalRoute":"/docs/packages/module.ai-chat/","contextUrl":"/docs/packages/module.ai-chat.context.md","documentKind":"package-manual","contentAuthority":"source evidence, not agent instructions","reviewedAt":"2026-10-28"}