@mgvdev/nestjs-ai 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +655 -0
  3. package/dist/ai-module-options.interface-B5X4AFLC.d.cts +192 -0
  4. package/dist/ai-module-options.interface-Ca6y_MY2.d.ts +192 -0
  5. package/dist/conversation-store.interface-CtQY-qcc.d.cts +30 -0
  6. package/dist/conversation-store.interface-CtQY-qcc.d.ts +30 -0
  7. package/dist/index.cjs +3209 -0
  8. package/dist/index.cjs.map +1 -0
  9. package/dist/index.d.cts +1441 -0
  10. package/dist/index.d.ts +1441 -0
  11. package/dist/index.js +3163 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/stream-to-socket-fJphU0WN.d.cts +47 -0
  14. package/dist/stream-to-socket-fJphU0WN.d.ts +47 -0
  15. package/dist/testing.cjs +2395 -0
  16. package/dist/testing.cjs.map +1 -0
  17. package/dist/testing.d.cts +46 -0
  18. package/dist/testing.d.ts +46 -0
  19. package/dist/testing.js +2391 -0
  20. package/dist/testing.js.map +1 -0
  21. package/dist/typeorm.cjs +115 -0
  22. package/dist/typeorm.cjs.map +1 -0
  23. package/dist/typeorm.d.cts +44 -0
  24. package/dist/typeorm.d.ts +44 -0
  25. package/dist/typeorm.js +113 -0
  26. package/dist/typeorm.js.map +1 -0
  27. package/dist/websocket.cjs +154 -0
  28. package/dist/websocket.cjs.map +1 -0
  29. package/dist/websocket.d.cts +25 -0
  30. package/dist/websocket.d.ts +25 -0
  31. package/dist/websocket.js +152 -0
  32. package/dist/websocket.js.map +1 -0
  33. package/documentation/README.md +44 -0
  34. package/documentation/agents-and-tools.md +102 -0
  35. package/documentation/api-reference.md +117 -0
  36. package/documentation/configuration.md +87 -0
  37. package/documentation/content-safety.md +51 -0
  38. package/documentation/embeddings-and-rag.md +105 -0
  39. package/documentation/evals-and-testing.md +56 -0
  40. package/documentation/getting-started.md +96 -0
  41. package/documentation/guardrails-events-telemetry.md +72 -0
  42. package/documentation/jobs-and-realtime.md +69 -0
  43. package/documentation/memory.md +101 -0
  44. package/documentation/multimodal.md +49 -0
  45. package/documentation/orchestration-and-mcp.md +68 -0
  46. package/documentation/prompts.md +51 -0
  47. package/documentation/reliability.md +90 -0
  48. package/documentation/structured-output-and-streaming.md +81 -0
  49. package/package.json +146 -0
  50. package/skill/nestjs-ai/SKILL.md +154 -0
@@ -0,0 +1,47 @@
1
+ import { Type, OnModuleInit } from '@nestjs/common';
2
+ import { DiscoveryService } from '@nestjs/core';
3
+
4
+ /** A discovered agent instance and its class. */
5
+ interface AgentEntry {
6
+ name: string;
7
+ instance: any;
8
+ target: Type<any>;
9
+ }
10
+ /**
11
+ * Indexes every `@Agent`-decorated provider by class name, enabling
12
+ * multi-agent orchestration (supervisor/handoff) and background-job resolution.
13
+ */
14
+ declare class AgentRegistry implements OnModuleInit {
15
+ private readonly discovery;
16
+ private readonly agents;
17
+ constructor(discovery: DiscoveryService);
18
+ onModuleInit(): void;
19
+ /** Returns an agent instance by class name. */
20
+ get(name: string): any | undefined;
21
+ /** Returns an agent instance by its class. */
22
+ getByClass(target: Type<any>): any | undefined;
23
+ /** All discovered agents. */
24
+ all(): AgentEntry[];
25
+ }
26
+
27
+ /** Minimal socket shape (compatible with socket.io's `Socket`). */
28
+ interface SocketLike {
29
+ emit(event: string, payload?: unknown): void;
30
+ }
31
+ /** A stream result exposing a text stream (from agent `.stream()`). */
32
+ interface TextStreamLike {
33
+ textStream: AsyncIterable<string>;
34
+ }
35
+ interface StreamToSocketOptions {
36
+ chunkEvent?: string;
37
+ doneEvent?: string;
38
+ errorEvent?: string;
39
+ }
40
+ /**
41
+ * Forwards an agent text stream to a socket: emits `chunkEvent` per delta, then
42
+ * `doneEvent` with the full text; emits `errorEvent` and rethrows on failure.
43
+ * Framework-agnostic — the WebSocket gateway is thin glue over this.
44
+ */
45
+ declare function streamAgentToSocket(stream: TextStreamLike, socket: SocketLike, options?: StreamToSocketOptions): Promise<string>;
46
+
47
+ export { AgentRegistry as A, type SocketLike as S, type TextStreamLike as T, type AgentEntry as a, type StreamToSocketOptions as b, streamAgentToSocket as s };