@recombine-ai/engine 1.0.0-beta-1 → 1.0.0-beta-3

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 (60) hide show
  1. package/.github/workflows/linting.yml +2 -2
  2. package/.github/workflows/publish.yml +1 -2
  3. package/build/index.d.ts +2 -2
  4. package/build/index.d.ts.map +1 -1
  5. package/build/index.js +3 -2
  6. package/build/lib/bosun/action.d.ts.map +1 -1
  7. package/build/lib/bosun/action.js +1 -0
  8. package/build/lib/bosun/agent.d.ts +1 -4
  9. package/build/lib/bosun/agent.d.ts.map +1 -1
  10. package/build/lib/engine.d.ts +31 -0
  11. package/build/lib/engine.d.ts.map +1 -0
  12. package/build/lib/interfaces/adapter.d.ts +13 -0
  13. package/build/lib/interfaces/adapter.d.ts.map +1 -0
  14. package/build/lib/interfaces/ai.d.ts +1 -0
  15. package/build/lib/interfaces/ai.d.ts.map +1 -0
  16. package/build/lib/interfaces/ai.js +1 -0
  17. package/build/lib/interfaces/conversation.d.ts +63 -0
  18. package/build/lib/interfaces/conversation.d.ts.map +1 -0
  19. package/build/lib/interfaces/engine.d.ts +65 -0
  20. package/build/lib/interfaces/engine.d.ts.map +1 -0
  21. package/build/lib/interfaces/engine.js +2 -0
  22. package/build/lib/interfaces/index.d.ts +8 -0
  23. package/build/lib/interfaces/index.d.ts.map +1 -0
  24. package/build/lib/interfaces/index.js +23 -0
  25. package/build/lib/{interfaces.d.ts → interfaces/other.d.ts} +1 -1
  26. package/build/lib/interfaces/other.d.ts.map +1 -0
  27. package/build/lib/interfaces/other.js +2 -0
  28. package/build/lib/interfaces/steps.d.ts +84 -0
  29. package/build/lib/interfaces/steps.d.ts.map +1 -0
  30. package/build/lib/interfaces/steps.js +2 -0
  31. package/build/lib/{stream/interfaces.d.ts → interfaces/stream.d.ts} +7 -9
  32. package/build/lib/interfaces/stream.d.ts.map +1 -0
  33. package/build/lib/interfaces/stream.js +2 -0
  34. package/build/lib/interfaces/workflow.d.ts +44 -0
  35. package/build/lib/interfaces/workflow.d.ts.map +1 -0
  36. package/build/lib/interfaces/workflow.js +2 -0
  37. package/build/lib/llm-adapters/mock.d.ts +1 -1
  38. package/build/lib/llm-adapters/mock.d.ts.map +1 -1
  39. package/build/lib/llm-adapters/openai-stream.d.ts +1 -1
  40. package/build/lib/llm-adapters/openai.d.ts +1 -1
  41. package/build/lib/llm-adapters/openai.d.ts.map +1 -1
  42. package/build/lib/stream/engine.d.ts +3 -0
  43. package/build/lib/stream/engine.d.ts.map +1 -0
  44. package/build/lib/stream/{ai.js → engine.js} +0 -21
  45. package/build/lib/stream/filter.d.ts +1 -1
  46. package/build/lib/stream/filter.d.ts.map +1 -1
  47. package/build/lib/stream/index.d.ts +2 -2
  48. package/build/lib/stream/index.d.ts.map +1 -1
  49. package/build/lib/stream/index.js +2 -2
  50. package/changelog.md +1 -0
  51. package/package.json +1 -1
  52. package/build/lib/ai.d.ts +0 -286
  53. package/build/lib/ai.d.ts.map +0 -1
  54. package/build/lib/interfaces.d.ts.map +0 -1
  55. package/build/lib/stream/ai.d.ts +0 -3
  56. package/build/lib/stream/ai.d.ts.map +0 -1
  57. package/build/lib/stream/interfaces.d.ts.map +0 -1
  58. /package/build/lib/{ai.js → engine.js} +0 -0
  59. /package/build/lib/{interfaces.js → interfaces/adapter.js} +0 -0
  60. /package/build/lib/{stream/interfaces.js → interfaces/conversation.js} +0 -0
@@ -1,4 +1,4 @@
1
- name: lint & typecheck
1
+ name: lint & test
2
2
 
3
3
  on:
4
4
  push:
@@ -20,7 +20,7 @@ jobs:
20
20
  cache: 'npm'
21
21
 
22
22
  - name: Install dependencies
23
- run: npm ci --legacy-peer-deps
23
+ run: npm ci
24
24
 
25
25
  - name: Run lint
26
26
  run: npm run lint --silent
@@ -33,8 +33,7 @@ jobs:
33
33
  run: npm install -g npm@latest
34
34
 
35
35
  - name: 'Install dependencies'
36
- # TODO rm --legacy-peer-deps as soon as zod stuff fixed
37
- run: npm ci --legacy-peer-deps
36
+ run: npm ci
38
37
 
39
38
  - name: 'Build'
40
39
  run: npm run build
package/build/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * from './lib/ai';
1
+ export * from './lib/interfaces/index';
2
+ export * from './lib/engine';
2
3
  export * from './lib/stream';
3
4
  export * from './lib/schedule';
4
- export * from './lib/interfaces';
5
5
  export * from './lib/bosun';
6
6
  export * from './lib/prompt-fs';
7
7
  export * from './lib/llm-adapters';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AAExB,cAAc,cAAc,CAAA;AAE5B,cAAc,gBAAgB,CAAA;AAE9B,cAAc,kBAAkB,CAAA;AAEhC,cAAc,aAAa,CAAA;AAE3B,cAAc,iBAAiB,CAAA;AAE/B,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAA;AAEtC,cAAc,cAAc,CAAA;AAE5B,cAAc,cAAc,CAAA;AAE5B,cAAc,gBAAgB,CAAA;AAE9B,cAAc,aAAa,CAAA;AAE3B,cAAc,iBAAiB,CAAA;AAE/B,cAAc,oBAAoB,CAAA"}
package/build/index.js CHANGED
@@ -14,10 +14,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./lib/ai"), exports);
17
+ // Hmm.. why it should be /index explicitly?
18
+ __exportStar(require("./lib/interfaces/index"), exports);
19
+ __exportStar(require("./lib/engine"), exports);
18
20
  __exportStar(require("./lib/stream"), exports);
19
21
  __exportStar(require("./lib/schedule"), exports);
20
- __exportStar(require("./lib/interfaces"), exports);
21
22
  __exportStar(require("./lib/bosun"), exports);
22
23
  __exportStar(require("./lib/prompt-fs"), exports);
23
24
  __exportStar(require("./lib/llm-adapters"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/lib/bosun/action.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;IACzC,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE1D,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,IAEhD,SAAS,MAAM,EACf,MAAM,MAAM,EACZ,QAAQ,MAAM,OAAO,CAAC,OAAO,CAAC,mBAiBrC;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAM1D,MAAM,CAAC,OAAO,CAAC,mBAQhD"}
1
+ {"version":3,"file":"action.d.ts","sourceRoot":"","sources":["../../../src/lib/bosun/action.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;IACzC,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE1D,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,IAEhD,SAAS,MAAM,EACf,MAAM,MAAM,EACZ,QAAQ,MAAM,OAAO,CAAC,OAAO,CAAC,mBAiBrC;AAED,wBAAgB,UAAU,CAAC,UAAU,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAM1D,MAAM,CAAC,OAAO,CAAC,mBAQhD"}
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // TODO drop this!
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.makeActionWrapper = makeActionWrapper;
4
5
  exports.makeAction = makeAction;
@@ -1,6 +1,4 @@
1
- import { Message } from '../ai';
2
- import { Logger, Scheduler } from '../interfaces';
3
- import { SendAction } from './action';
1
+ import { Logger, Message, Scheduler } from '../interfaces';
4
2
  import { Context } from './context';
5
3
  import { StepRegistry } from './step-registry';
6
4
  import { StepTracer } from './step-tracer';
@@ -46,7 +44,6 @@ export interface TestAgentFactoryProps<CTX extends DefaultContext = DefaultConte
46
44
  scheduler: Scheduler;
47
45
  getMessages: () => Message[];
48
46
  sendMessage: (message: string | Message) => Promise<void>;
49
- sendAction: SendAction;
50
47
  ctx: Context<CTX>;
51
48
  }
52
49
  export interface TestTextAgent {
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/lib/bosun/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;AACzC,MAA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,aAAa;IAC1B,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IAC7B,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,gBAAgB,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACxC,UAAU,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IAClC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CACnD;AACD,MAAM,WAAW,cAAc;IAC3B,cAAc,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACtC,SAAS,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACjC,WAAW,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACnC,YAAY,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAEhD,YAAY,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;CACvC;AAED,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,cAAc,CAAA;AAEtD,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,IAAI,CACtE,KAAK,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAC9B,OAAO,CAAC,SAAS,CAAC,CAAA;AAEvB,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,cAAc,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,uBAE5F"}
@@ -0,0 +1,31 @@
1
+ import { Conversation, Message, StepBuilder } from './interfaces';
2
+ import { AIEngine, EngineConfig } from './interfaces/engine';
3
+ /**
4
+ * Creates an AI Engine with the given configuration.
5
+ *
6
+ * The AI Engine provides utilities for creating and running conversational workflows
7
+ * with large language models, specifically OpenAI GPT models.
8
+ *
9
+ * @returns An AIEngine instance.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const engine = createAIEngine({
14
+ * logger: customLogger,
15
+ * });
16
+ *
17
+ * const workflow = await engine.createWorkflow(
18
+ * engine.createStep({
19
+ * name: 'generate-response',
20
+ * prompt: engine.loadFile('prompts/response.txt'),
21
+ * execute: (response) => conversation.setProposedReply(response)
22
+ * })
23
+ * );
24
+ *
25
+ * const reply = await workflow.run(conversation);
26
+ * ```
27
+ */
28
+ export declare function createAIEngine<CTX extends object>(cfg?: EngineConfig): AIEngine<CTX>;
29
+ export declare function createConversation(initialMessages?: Message[]): Conversation;
30
+ export declare function getStepBuilder<CTX = unknown>(): StepBuilder<CTX>;
31
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/lib/engine.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,YAAY,EAGZ,OAAO,EAEP,WAAW,EAKd,MAAM,cAAc,CAAA;AAGrB,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAG5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,GAAG,SAAS,MAAM,EAAE,GAAG,GAAE,YAAiB,GAAG,QAAQ,CAAC,GAAG,CAAC,CA+NxF;AAuDD,wBAAgB,kBAAkB,CAAC,eAAe,GAAE,OAAO,EAAO,GAAG,YAAY,CA2ChF;AAED,wBAAgB,cAAc,CAAC,GAAG,GAAG,OAAO,KAAK,WAAW,CAAC,GAAG,CAAC,CAEhE"}
@@ -0,0 +1,13 @@
1
+ import * as Zod from 'zod';
2
+ export interface LlmAdapter {
3
+ /**
4
+ * @param systemPrompt - rendered system prompt
5
+ * @param messages - stringified {@link Conversation}
6
+ * @param schema - optional Zod schema to pass to the model. Will overwrite any schema set in adapter options.
7
+ * @returns LLM Response
8
+ */
9
+ generateResponse: (systemPrompt: string, messages: string, schema?: Zod.ZodType) => Promise<string>;
10
+ /** Returns adapter's configuration/options for tracing */
11
+ getOptions: () => unknown;
12
+ }
13
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAE1B,MAAM,WAAW,UAAU;IACvB;;;;;OAKG;IACH,gBAAgB,EAAE,CACd,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,KACnB,OAAO,CAAC,MAAM,CAAC,CAAA;IACpB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,OAAO,CAAA;CAC5B"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/ai.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Represents a conversation between a user and an AI agent.
3
+ * Provides methods to manage the conversation flow, format messages, and convert the conversation
4
+ * to a string representation.
5
+ */
6
+ export interface Conversation {
7
+ /**
8
+ * Sets the default formatter to stringify messages when toString is called.
9
+ * @param formatter - A function that takes a message and returns a formatted string.
10
+ */
11
+ setDefaultFormatter: (formatter: (message: Message) => string) => void;
12
+ /**
13
+ * Converts the conversation to a string representation to be fed to an LLM.
14
+ * @param filter - A function that filters messages based on certain criteria.
15
+ * @example
16
+ * @returns The string representation of the conversation.
17
+ */
18
+ toString: (options?: {
19
+ ignoreAddedMessages?: boolean;
20
+ }) => string;
21
+ /**
22
+ * Adds a message from a specified sender to the conversation.
23
+ * @param message - The message to add to the conversation.
24
+ */
25
+ addMessage: (message: Message, opts?: {
26
+ formatter?: (message: Message) => string;
27
+ }) => void;
28
+ /**
29
+ * Sets a custom formatter for proposed messages.
30
+ * @param formatter - A function that takes a message string and returns a formatted string.
31
+ */
32
+ setProposedMessageFormatter: (formatter: (message: string) => string) => void;
33
+ /**
34
+ * Sets a proposed reply message.
35
+ * @param message - The proposed reply message.
36
+ */
37
+ setProposedReply: (message: string) => void;
38
+ /**
39
+ * Gets the current proposed reply message.
40
+ * @returns The proposed reply message, or null if none exists.
41
+ */
42
+ getProposedReply: () => string | null;
43
+ /**
44
+ * Gets the history of all messages in the conversation. Returns {@link Message} rather than
45
+ * {@link ConversationMessage} because none of the {@link ConversationMessage} properties should
46
+ * be accessed outside of the {@link Conversation} context.
47
+ * @returns An array of Message objects representing the conversation history.
48
+ */
49
+ getHistory: () => Message[];
50
+ }
51
+ /**
52
+ * Represents a message in a conversation between a user and an agent, or a system message.
53
+ * Messages can contain text and optionally an image URL. To be used in the {@link Conversation} interface.
54
+ */
55
+ export interface Message {
56
+ /** The sender of the message, which can be one of the following: 'user', 'agent', or 'system' */
57
+ sender: 'user' | 'agent' | 'system';
58
+ /** The text content of the message */
59
+ text: string;
60
+ /** Optional URL of an image associated with the message */
61
+ imageUrl?: string;
62
+ }
63
+ //# sourceMappingURL=conversation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/conversation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,YAAY;IACzB;;;OAGG;IACH,mBAAmB,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,KAAK,IAAI,CAAA;IAEtE;;;;;OAKG;IACH,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE;QAAE,mBAAmB,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,MAAM,CAAA;IAEjE;;;OAGG;IACH,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IAE3F;;;OAGG;IACH,2BAA2B,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,KAAK,IAAI,CAAA;IAE7E;;;OAGG;IACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAE3C;;;OAGG;IACH,gBAAgB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAA;IAErC;;;;;OAKG;IACH,UAAU,EAAE,MAAM,OAAO,EAAE,CAAA;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACpB,iGAAiG;IACjG,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAA;IACnC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,MAAM,CAAA;CACpB"}
@@ -0,0 +1,65 @@
1
+ import { Environment } from 'nunjucks';
2
+ import { StepRegistry, StepTracer } from '../bosun';
3
+ import { Conversation, Message } from './conversation';
4
+ import { Logger } from './other';
5
+ import { StepBuilder } from './steps';
6
+ import { Workflow, WorkflowConfig } from './workflow';
7
+ /**
8
+ * The main interface for the AI Engine.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import { createAIEngine } from '@recombine-ai/engine'
13
+ *
14
+ * Create a new AI engine instance
15
+ * const ai = createAIEngine({
16
+ * // engine configuration, see EngineConfig
17
+ * })
18
+ *
19
+ * // create a conversation to be used in workflow.run(), see Conversation
20
+ * const conversation = ai.createConversation(messages)
21
+ * // create a workflow, see WorkflowConfig
22
+ * const workflow = ai.createWorkflow({steps})
23
+ * workflow.run(conversation)
24
+ * ```
25
+ */
26
+ export interface AIEngine<CTX extends object> {
27
+ /**
28
+ * Creates a workflow from a sequence of steps.
29
+ * @param config - common parameters for a workflow
30
+ * @returns AI workflow Workflow.
31
+ */
32
+ createWorkflow: (config: WorkflowConfig<CTX>) => Workflow<CTX>;
33
+ /**
34
+ * Creates a new conversation instance.
35
+ * @param messages - Optional initial messages for the conversation.
36
+ * @returns A new Conversation object.
37
+ */
38
+ createConversation: (messages?: Message[]) => Conversation;
39
+ /**
40
+ * Get the function to create steps to use with {@link WorkflowConfig#steps}
41
+ * if you want to define steps outside of workflow.
42
+ */
43
+ getStepBuilder(): StepBuilder<CTX>;
44
+ /**
45
+ * Renders a prompt string using Nunjucks templating engine.
46
+ * @param prompt - The prompt string to render.
47
+ * @param context - Optional context object to use for rendering the prompt.
48
+ * @returns The rendered prompt string.
49
+ */
50
+ renderPrompt: (prompt: string, context?: object) => string;
51
+ }
52
+ /**
53
+ * Configuration options for the Engine.
54
+ */
55
+ export interface EngineConfig {
56
+ /** Optional logger instance for handling log messages. */
57
+ logger?: Logger;
58
+ /** traces received prompt, rendered prompt, context and other useful info about LLM execution */
59
+ stepTracer?: StepTracer;
60
+ /** registers steps in workflow to be available in Bosun IDE */
61
+ stepRegistry?: StepRegistry;
62
+ /** Optional nunjucks Environment to customize prompt rendering. */
63
+ nunjucksEnv?: Environment;
64
+ }
65
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAErD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,QAAQ,CAAC,GAAG,SAAS,MAAM;IACxC;;;;OAIG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,cAAc,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,GAAG,CAAC,CAAA;IAE9D;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,YAAY,CAAA;IAE1D;;;OAGG;IACH,cAAc,IAAI,WAAW,CAAC,GAAG,CAAC,CAAA;IAElC;;;;;OAKG;IACH,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iGAAiG;IACjG,UAAU,CAAC,EAAE,UAAU,CAAA;IAEvB,+DAA+D;IAC/D,YAAY,CAAC,EAAE,YAAY,CAAA;IAE3B,oEAAoE;IACpE,WAAW,CAAC,EAAE,WAAW,CAAA;CAC5B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export * from './other';
2
+ export * from './conversation';
3
+ export * from './steps';
4
+ export * from './stream';
5
+ export * from './workflow';
6
+ export * from './adapter';
7
+ export * from './engine';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./other"), exports);
18
+ __exportStar(require("./conversation"), exports);
19
+ __exportStar(require("./steps"), exports);
20
+ __exportStar(require("./stream"), exports);
21
+ __exportStar(require("./workflow"), exports);
22
+ __exportStar(require("./adapter"), exports);
23
+ __exportStar(require("./engine"), exports);
@@ -23,4 +23,4 @@ export interface Scheduler {
23
23
  */
24
24
  clearAllPendingActions: (phone: string) => Promise<unknown>;
25
25
  }
26
- //# sourceMappingURL=interfaces.d.ts.map
26
+ //# sourceMappingURL=other.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"other.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/other.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACnB,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC7B,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC/B,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;CAClC;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE1E,MAAM,WAAW,SAAS;IACtB;;;;;OAKG;IACH,cAAc,EAAE,CACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,KAC1C,cAAc,CAAA;IAEnB;;OAEG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9D"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,84 @@
1
+ import * as Zod from 'zod';
2
+ import { PromptFile } from '../prompt-fs';
3
+ import { LlmAdapter } from './adapter';
4
+ import { Conversation } from './conversation';
5
+ import { WorkflowControls } from './workflow';
6
+ export interface BasicStep<CTX> {
7
+ /** Step name */
8
+ name: string;
9
+ /** Determines if the step should be run or not */
10
+ runIf?: (messages: Conversation, ctx: CTX) => boolean | Promise<boolean>;
11
+ /**
12
+ * When provided, throws an error if the step is invoked more times than `maxAttempts`.
13
+ * Number of attempts taken is reset when the flow passed the step that was rewinding.
14
+ */
15
+ maxAttempts?: number;
16
+ /** Error handler called if an error occurred during in `execute` function */
17
+ onError?: (error: string, ctx: CTX) => Promise<unknown>;
18
+ }
19
+ export interface ProgrammaticStep<CTX> extends BasicStep<CTX> {
20
+ /** Content of the step */
21
+ execute: (messages: Conversation, ctx: CTX, workflow: WorkflowControls) => Promise<unknown>;
22
+ }
23
+ export interface LLMStep<CTX> extends BasicStep<CTX> {
24
+ /** LLM adapter to use */
25
+ model: LlmAdapter;
26
+ /**
27
+ * Prompt can be a simple string or a link to a file, loaded with `loadFile` function which
28
+ * takes a path to the file relative to `src/use-cases` directory. Should be Nunjucks-compatible.
29
+ */
30
+ prompt: string | PromptFile;
31
+ /**
32
+ * Do not put messages that were added via {@link Conversation.addMessage} into the prompt.
33
+ */
34
+ ignoreAddedMessages?: boolean;
35
+ }
36
+ export interface JsonLLMStep<CTX, Schema extends Zod.ZodType> extends LLMStep<CTX> {
37
+ /**
38
+ * Defines the expected structure of the LLM's output. Accepts ZodSchema. When provided, the
39
+ * LLM's response is validated and parsed according to this schema ensuring reliable structured
40
+ * output.
41
+ */
42
+ schema: Schema;
43
+ /**
44
+ * Function to execute with the LLM's response. Use {@link setProposedReply} to use the LLM's output as the proposed reply.
45
+ * Or use combination of {@link getProposedReply} and {@link setProposedReply} to substitute parts of the string.
46
+ * @example
47
+ * ```
48
+ * // Use LLM output directly as reply
49
+ * execute: (reply) => messages.setProposedReply(reply)
50
+ *
51
+ * // Substitute tokens in LLM output
52
+ * execute: (reply) => {
53
+ * const withLink = reply.replace('<PAYMENT_LINK>', 'https://payment.example.com/123')
54
+ * messages.setProposedReply(withLink)
55
+ * }
56
+ * ```
57
+ */
58
+ execute: (reply: Zod.infer<Schema>, conversation: Conversation, ctx: CTX, workflowControls: WorkflowControls) => Promise<unknown>;
59
+ }
60
+ export interface StringLLMStep<CTX> extends LLMStep<CTX> {
61
+ /**
62
+ * Function to execute with the LLM's response. Use {@link setProposedReply} to use the LLM's output as the proposed reply.
63
+ * Or use combination of {@link getProposedReply} and {@link setProposedReply} to substitute parts of the string.
64
+ * @example
65
+ * ```
66
+ * // Use LLM output directly as reply
67
+ * execute: (reply) => messages.setProposedReply(reply)
68
+ *
69
+ * // Substitute tokens in LLM output
70
+ * execute: (reply) => {
71
+ * const withLink = reply.replace('<PAYMENT_LINK>', 'https://payment.example.com/123')
72
+ * messages.setProposedReply(withLink)
73
+ * }
74
+ * ```
75
+ */
76
+ execute: (reply: string, conversation: Conversation, ctx: CTX, workflowControls?: WorkflowControls) => Promise<unknown>;
77
+ }
78
+ export type WorkflowStep<CTX> = StringLLMStep<CTX> | JsonLLMStep<CTX, any> | ProgrammaticStep<CTX>;
79
+ export interface StepBuilder<CTX> {
80
+ <Schema extends Zod.ZodType>(step: JsonLLMStep<CTX, Schema>): JsonLLMStep<CTX, Schema>;
81
+ (step: StringLLMStep<CTX>): StringLLMStep<CTX>;
82
+ (step: ProgrammaticStep<CTX>): ProgrammaticStep<CTX>;
83
+ }
84
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../../../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,GAAG,CAAC;IAC9E;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAA;IACd;;;;;;;;;;;;;;OAcG;IACH,OAAO,EAAE,CACL,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,EACxB,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,GAAG,EACR,gBAAgB,EAAE,gBAAgB,KACjC,OAAO,CAAC,OAAO,CAAC,CAAA;CACxB;AAED,MAAM,WAAW,aAAa,CAAC,GAAG,CAAE,SAAQ,OAAO,CAAC,GAAG,CAAC;IACpD;;;;;;;;;;;;;;OAcG;IACH,OAAO,EAAE,CACL,KAAK,EAAE,MAAM,EACb,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,GAAG,EACR,gBAAgB,CAAC,EAAE,gBAAgB,KAClC,OAAO,CAAC,OAAO,CAAC,CAAA;CACxB;AAED,MAAM,MAAM,YAAY,CAAC,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;AAElG,MAAM,WAAW,WAAW,CAAC,GAAG;IAC5B,CAAC,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IACtF,CAAC,IAAI,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;IAC9C,CAAC,IAAI,EAAE,gBAAgB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAA;CACvD"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,10 +1,10 @@
1
- import { Message } from '../ai';
2
- import { Logger } from '../interfaces';
3
- import { ConversationalTracer, StepRegistry, StepTracer } from '../bosun';
1
+ import { Message } from './conversation';
2
+ import { StepRegistry, StepTracer } from '../bosun';
4
3
  import { PromptFile } from '../prompt-fs';
5
- export interface AIStreamEngine {
4
+ import { Logger } from './other';
5
+ export interface AIStreamEngine<CTX extends {}> {
6
6
  /** creates streaming workflow */
7
- createWorkflow: <CTX extends {}>(config: WorkflowConfig<CTX>) => {
7
+ createWorkflow: (config: StreamWorkflowConfig<CTX>) => {
8
8
  /**
9
9
  * Runs streaming workflow (starts stream)
10
10
  * @param messages
@@ -21,10 +21,8 @@ export interface StreamingEngineConfig {
21
21
  stepRegistry?: StepRegistry;
22
22
  /** traces received prompt, rendered prompt, context and other useful info about LLM execution */
23
23
  stepTracer?: StepTracer;
24
- /** same as stepTracer but for “something happened in the conversation” events */
25
- conversationalTracer?: ConversationalTracer;
26
24
  }
27
- export interface WorkflowConfig<CTX> {
25
+ export interface StreamWorkflowConfig<CTX> {
28
26
  /** name of the workflow and its only step to appear in Bosun and in traces */
29
27
  name: string;
30
28
  /** system prompt */
@@ -70,4 +68,4 @@ export interface ResponseChunk {
70
68
  role: 'agent' | 'system';
71
69
  delta: string;
72
70
  }
73
- //# sourceMappingURL=interfaces.d.ts.map
71
+ //# sourceMappingURL=stream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,MAAM,WAAW,cAAc,CAAC,GAAG,SAAS,EAAE;IAC1C,iCAAiC;IACjC,cAAc,EAAE,CAAC,MAAM,EAAE,oBAAoB,CAAC,GAAG,CAAC,KAAK;QACnD;;;;;WAKG;QACH,GAAG,EAAE,CAAC,QAAQ,EAAE,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;IAC/B,oBAAoB,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAA;IACtE,UAAU,EAAE,CACR,KAAK,EAAE,UAAU,EACjB,cAAc,EAAE,MAAM,EAAE,KACvB;QAAE,MAAM,EAAE,oBAAoB,CAAA;KAAE,GAAG;QAAE,MAAM,EAAE,gBAAgB,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;IACtF,WAAW,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK;QAAE,eAAe,EAAE,MAAM,EAAE,CAAA;KAAE,CAAA;CAC9F;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,44 @@
1
+ import { Conversation } from './conversation';
2
+ import { WorkflowStep } from './steps';
3
+ export interface WorkflowControls {
4
+ /**
5
+ * Terminates the workflow, preventing further steps from being executed.
6
+ */
7
+ terminate: () => void;
8
+ /**
9
+ * Rewinds the workflow execution to a specific step.
10
+ * @param step - The name of the step to rewind to
11
+ */
12
+ rewindTo: (step: string) => void;
13
+ }
14
+ export type BeforeEachStep<CTX> = (conversation: Conversation, ctx: CTX, workflowControls?: WorkflowControls) => Promise<void>;
15
+ /**
16
+ * An AI workflow composed of steps.
17
+ */
18
+ export interface Workflow<CTX> {
19
+ /**
20
+ * Runs the workflow with a given conversation context.
21
+ * Executes steps sequentially until completion or termination.
22
+ * @param conversation - The conversation context for the workflow
23
+ * @param contextProvider - A provider function for the context that will be passed to all steps and to all prompts in those steps
24
+ * @param beforeEach - A callback, that runs before each step
25
+ * @returns The proposed reply if workflow completes, or null if terminated
26
+ */
27
+ run: (conversation: Conversation, contextProvider: (() => CTX) | (() => Promise<CTX>), beforeEach?: BeforeEachStep<CTX>) => Promise<string | null>;
28
+ }
29
+ /**
30
+ * Config object to be used in {@link AIEngine#createWorkflow}
31
+ */
32
+ export interface WorkflowConfig<CTX> {
33
+ /** workflow name, to use in traces, defaults to 'workflow' */
34
+ name?: string;
35
+ /** a function that will run once, if any of the steps going to be executed */
36
+ beforeExecute?: (ctx: CTX) => Promise<void>;
37
+ /** a function that will run once, if any of the steps was executed */
38
+ afterExecute?: (ctx: CTX) => Promise<void>;
39
+ /** common error handler for workflow */
40
+ onError: (error: string, ctx: CTX) => Promise<unknown>;
41
+ /** workflow steps {@link ProgrammaticStep}, {@link StringLLMStep} or {@link JsonLLMStep} */
42
+ steps?: WorkflowStep<CTX>[];
43
+ }
44
+ //# sourceMappingURL=workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.d.ts","sourceRoot":"","sources":["../../../src/lib/interfaces/workflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,SAAS,EAAE,MAAM,IAAI,CAAA;IAErB;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC;AAED,MAAM,MAAM,cAAc,CAAC,GAAG,IAAI,CAC9B,YAAY,EAAE,YAAY,EAC1B,GAAG,EAAE,GAAG,EACR,gBAAgB,CAAC,EAAE,gBAAgB,KAClC,OAAO,CAAC,IAAI,CAAC,CAAA;AAElB;;GAEG;AACH,MAAM,WAAW,QAAQ,CAAC,GAAG;IACzB;;;;;;;OAOG;IACH,GAAG,EAAE,CACD,YAAY,EAAE,YAAY,EAC1B,eAAe,EAAE,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,EACnD,UAAU,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,KAC/B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,GAAG;IAC/B,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,aAAa,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3C,sEAAsE;IACtE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1C,wCAAwC;IACxC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IACtD,4FAA4F;IAC5F,KAAK,CAAC,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAA;CAC9B"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,3 +1,3 @@
1
- import type { LlmAdapter } from '../ai';
1
+ import { LlmAdapter } from '../interfaces';
2
2
  export declare function createMockAdapter(): LlmAdapter;
3
3
  //# sourceMappingURL=mock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/lib/llm-adapters/mock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAEvC,wBAAgB,iBAAiB,IAAI,UAAU,CAU9C"}
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"","sources":["../../../src/lib/llm-adapters/mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,wBAAgB,iBAAiB,IAAI,UAAU,CAU9C"}
@@ -1,6 +1,6 @@
1
1
  import { OpenAI } from 'openai';
2
2
  import { ChatCompletionCreateParamsBase } from 'openai/resources/chat/completions';
3
- import { LlmStreamAdapter } from '../stream/interfaces';
3
+ import { LlmStreamAdapter } from '../interfaces/stream';
4
4
  export type OpenAIChatOptions = Omit<ChatCompletionCreateParamsBase, 'messages' | 'response_format' | 'stream'>;
5
5
  export declare function createOpenAIStreamAdapter(options: OpenAIChatOptions, client?: OpenAI): LlmStreamAdapter;
6
6
  //# sourceMappingURL=openai-stream.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { OpenAI } from 'openai';
2
2
  import { ChatCompletionCreateParamsBase } from 'openai/resources/chat/completions';
3
- import type { LlmAdapter } from '../ai';
3
+ import { LlmAdapter } from '../interfaces';
4
4
  type OpenaiOptionsToSend = Omit<ChatCompletionCreateParamsBase, 'messages' | 'stream'>;
5
5
  export type OpenAIChatOptions = Omit<OpenaiOptionsToSend, 'response_format'>;
6
6
  export declare function createOpenAIAdapter(options: OpenAIChatOptions, client?: OpenAI): LlmAdapter;
@@ -1 +1 @@
1
- {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/lib/llm-adapters/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAA;AAClF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGvC,KAAK,mBAAmB,GAAG,IAAI,CAAC,8BAA8B,EAAE,UAAU,GAAG,QAAQ,CAAC,CAAA;AACtF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAA;AAE5E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAe,GAAG,UAAU,CAmCjG"}
1
+ {"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/lib/llm-adapters/openai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAA;AAElF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAE1C,KAAK,mBAAmB,GAAG,IAAI,CAAC,8BAA8B,EAAE,UAAU,GAAG,QAAQ,CAAC,CAAA;AACtF,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAA;AAE5E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAe,GAAG,UAAU,CAmCjG"}
@@ -0,0 +1,3 @@
1
+ import { AIStreamEngine, StreamingEngineConfig } from '../interfaces/stream';
2
+ export declare function createAIStreamEngine<CTX extends {}>(cfg: StreamingEngineConfig): AIStreamEngine<CTX>;
3
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/engine.ts"],"names":[],"mappings":"AAMA,OAAO,EACH,cAAc,EAGd,qBAAqB,EAGxB,MAAM,sBAAsB,CAAA;AAI7B,wBAAgB,oBAAoB,CAAC,GAAG,SAAS,EAAE,EAC/C,GAAG,EAAE,qBAAqB,GAC3B,cAAc,CAAC,GAAG,CAAC,CAuMrB"}
@@ -144,27 +144,6 @@ function createAIStreamEngine(cfg) {
144
144
  // Add step trace and flush to telescope
145
145
  cfg.stepTracer?.addStepTrace(mainStepTrace);
146
146
  await cfg.stepTracer?.flush();
147
- if (cfg.conversationalTracer) {
148
- try {
149
- const ctxWithState = ctx;
150
- const rawConversationId = ctxWithState?.state?.callId ?? ctxWithState?.callId;
151
- const conversationId = typeof rawConversationId === 'string' && rawConversationId !== ''
152
- ? rawConversationId
153
- : undefined;
154
- cfg.conversationalTracer.addConversationalTrace({
155
- conversationId,
156
- eventName: 'finished-main-streaming-step',
157
- role: 'agent',
158
- medium: 'phone',
159
- content: transcript.currentResponse,
160
- createdAt: Date.now(),
161
- });
162
- await cfg.conversationalTracer.flush();
163
- }
164
- catch (err) {
165
- logger.error('Failed to write conversational trace', { err });
166
- }
167
- }
168
147
  if (!streamCancelled) {
169
148
  controller.close();
170
149
  }
@@ -1,4 +1,4 @@
1
- import { ProgrammaticFilter } from './interfaces';
1
+ import { ProgrammaticFilter } from '../interfaces/stream';
2
2
  /**
3
3
  * filter out 'Agent:' at the beginning of the llm response
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,kBAc3B,CAAA"}
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,kBAc3B,CAAA"}
@@ -1,4 +1,4 @@
1
- export { createAIStreamEngine } from './ai';
2
- export { AIStreamEngine, ProgrammaticFilter, LlmStreamAdapter, ResponseChunk, Transcript, StreamingEngineConfig, WorkflowConfig as StreamingWorkflowConfig, } from './interfaces';
1
+ export { createAIStreamEngine } from './engine';
2
+ export { AIStreamEngine, ProgrammaticFilter, LlmStreamAdapter, ResponseChunk, Transcript, StreamingEngineConfig, StreamWorkflowConfig as StreamingWorkflowConfig, } from '../interfaces/stream';
3
3
  export { getAzureClient, getOpenAiClient } from './get-client';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,MAAM,CAAA;AAE3C,OAAO,EACH,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,cAAc,IAAI,uBAAuB,GAC5C,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EACH,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,qBAAqB,EACrB,oBAAoB,IAAI,uBAAuB,GAClD,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getOpenAiClient = exports.getAzureClient = exports.createAIStreamEngine = void 0;
4
- var ai_1 = require("./ai");
5
- Object.defineProperty(exports, "createAIStreamEngine", { enumerable: true, get: function () { return ai_1.createAIStreamEngine; } });
4
+ var engine_1 = require("./engine");
5
+ Object.defineProperty(exports, "createAIStreamEngine", { enumerable: true, get: function () { return engine_1.createAIStreamEngine; } });
6
6
  var get_client_1 = require("./get-client");
7
7
  Object.defineProperty(exports, "getAzureClient", { enumerable: true, get: function () { return get_client_1.getAzureClient; } });
8
8
  Object.defineProperty(exports, "getOpenAiClient", { enumerable: true, get: function () { return get_client_1.getOpenAiClient; } });
package/changelog.md CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  - **Breaking:** `model` field on `LLMStep` is now required and must be an `LlmAdapter` (string model names removed)
6
6
  - **Breaking:** OpenAI adapter no longer embeds API-key management; pass a pre-configured `OpenAI` client instead
7
+ - **Breaking:** `AIEngine` now requires `CTX` parameter
7
8
  - **Breaking:** Removed deprecated `Conversation.setUserName()` / `setAgentName()` (defaults: "User" / "Agent")
8
9
  - **Breaking:** Removed deprecated `Workflow.addStep()` – pass all steps via `WorkflowConfig#steps`
9
10
  - **Breaking:** Removed deprecated `EngineConfig.tokenStorage`, `sendAction`, and `tracer` (use `stepRegistry`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recombine-ai/engine",
3
- "version": "1.0.0-beta-1",
3
+ "version": "1.0.0-beta-3",
4
4
  "description": "Recombine AI engine for creating conversational AI agents",
5
5
  "repository": {
6
6
  "url": "git+https://github.com/recombine-ai/engine.git"
package/build/lib/ai.d.ts DELETED
@@ -1,286 +0,0 @@
1
- import nunjucks from 'nunjucks';
2
- import * as Zod from 'zod';
3
- import { Logger } from './interfaces';
4
- import { PromptFile } from './prompt-fs';
5
- import { StepTracer } from './bosun/step-tracer';
6
- import { StepRegistry } from './bosun/step-registry';
7
- export interface LlmAdapter {
8
- /**
9
- * @param systemPrompt - rendered system prompt
10
- * @param messages - stringified {@link Conversation}
11
- * @param schema - optional Zod schema to pass to the model. Will overwrite any schema set in adapter options.
12
- * @returns LLM Response
13
- */
14
- generateResponse: (systemPrompt: string, messages: string, schema?: Zod.ZodType) => Promise<string>;
15
- /** Returns adapter's configuration/options for tracing */
16
- getOptions: () => unknown;
17
- }
18
- export interface BasicStep<CTX> {
19
- /** Step name */
20
- name: string;
21
- /** Determines if the step should be run or not */
22
- runIf?: (messages: Conversation, ctx: CTX) => boolean | Promise<boolean>;
23
- /**
24
- * When provided, throws an error if the step is invoked more times than `maxAttempts`.
25
- * Number of attempts taken is reset when the flow passed the step that was rewinding.
26
- */
27
- maxAttempts?: number;
28
- /** Error handler called if an error occurred during in `execute` function */
29
- onError?: (error: string, ctx: CTX) => Promise<unknown>;
30
- }
31
- export interface ProgrammaticStep<CTX> extends BasicStep<CTX> {
32
- /** Content of the step */
33
- execute: (messages: Conversation, ctx: CTX, workflow: WorkflowControls) => Promise<unknown>;
34
- }
35
- export interface LLMStep<CTX> extends BasicStep<CTX> {
36
- /** LLM adapter to use */
37
- model: LlmAdapter;
38
- /**
39
- * Prompt can be a simple string or a link to a file, loaded with `loadFile` function which
40
- * takes a path to the file relative to `src/use-cases` directory. Should be Nunjucks-compatible.
41
- */
42
- prompt: string | PromptFile;
43
- /**
44
- * Do not put messages that were added via {@link Conversation.addMessage} into the prompt.
45
- */
46
- ignoreAddedMessages?: boolean;
47
- }
48
- export interface WorkflowControls {
49
- /**
50
- * Terminates the workflow, preventing further steps from being executed.
51
- */
52
- terminate: () => void;
53
- /**
54
- * Rewinds the workflow execution to a specific step.
55
- * @param step - The name of the step to rewind to
56
- */
57
- rewindTo: (step: string) => void;
58
- }
59
- export interface JsonLLMStep<CTX, Schema extends Zod.ZodType> extends LLMStep<CTX> {
60
- /**
61
- * Defines the expected structure of the LLM's output. Accepts ZodSchema. When provided, the
62
- * LLM's response is validated and parsed according to this schema ensuring reliable structured
63
- * output.
64
- */
65
- schema: Schema;
66
- /**
67
- * Function to execute with the LLM's response. Use {@link setProposedReply} to use the LLM's output as the proposed reply.
68
- * Or use combination of {@link getProposedReply} and {@link setProposedReply} to substitute parts of the string.
69
- * @example
70
- * ```
71
- * // Use LLM output directly as reply
72
- * execute: (reply) => messages.setProposedReply(reply)
73
- *
74
- * // Substitute tokens in LLM output
75
- * execute: (reply) => {
76
- * const withLink = reply.replace('<PAYMENT_LINK>', 'https://payment.example.com/123')
77
- * messages.setProposedReply(withLink)
78
- * }
79
- * ```
80
- */
81
- execute: (reply: Zod.infer<Schema>, conversation: Conversation, ctx: CTX, workflowControls: WorkflowControls) => Promise<unknown>;
82
- }
83
- export interface StringLLMStep<CTX> extends LLMStep<CTX> {
84
- /**
85
- * Function to execute with the LLM's response. Use {@link setProposedReply} to use the LLM's output as the proposed reply.
86
- * Or use combination of {@link getProposedReply} and {@link setProposedReply} to substitute parts of the string.
87
- * @example
88
- * ```
89
- * // Use LLM output directly as reply
90
- * execute: (reply) => messages.setProposedReply(reply)
91
- *
92
- * // Substitute tokens in LLM output
93
- * execute: (reply) => {
94
- * const withLink = reply.replace('<PAYMENT_LINK>', 'https://payment.example.com/123')
95
- * messages.setProposedReply(withLink)
96
- * }
97
- * ```
98
- */
99
- execute: (reply: string, conversation: Conversation, ctx: CTX, workflowControls?: WorkflowControls) => Promise<unknown>;
100
- }
101
- type BeforeEachStep<CTX> = (conversation: Conversation, ctx: CTX, workflowControls?: WorkflowControls) => Promise<void>;
102
- /**
103
- * An AI workflow composed of steps.
104
- */
105
- export interface Workflow<CTX> {
106
- /**
107
- * Runs the workflow with a given conversation context.
108
- * Executes steps sequentially until completion or termination.
109
- * @param conversation - The conversation context for the workflow
110
- * @param contextProvider - A provider function for the context that will be passed to all steps and to all prompts in those steps
111
- * @param beforeEach - A callback, that runs before each step
112
- * @returns The proposed reply if workflow completes, or null if terminated
113
- */
114
- run: (conversation: Conversation, contextProvider: (() => CTX) | (() => Promise<CTX>), beforeEach?: BeforeEachStep<CTX>) => Promise<string | null>;
115
- }
116
- type WorkflowStep<CTX> = StringLLMStep<CTX> | JsonLLMStep<CTX, any> | ProgrammaticStep<CTX>;
117
- /**
118
- * Config object to be used in {@link AIEngine#createWorkflow}
119
- */
120
- export interface WorkflowConfig<CTX> {
121
- /** workflow name, to use in traces, defaults to 'workflow' */
122
- name?: string;
123
- /** a function that will run once, if any of the steps going to be executed */
124
- beforeExecute?: (ctx: CTX) => Promise<void>;
125
- /** a function that will run once, if any of the steps was executed */
126
- afterExecute?: (ctx: CTX) => Promise<void>;
127
- /** common error handler for workflow */
128
- onError: (error: string, ctx: CTX) => Promise<unknown>;
129
- /** workflow steps {@link ProgrammaticStep}, {@link StringLLMStep} or {@link JsonLLMStep} */
130
- steps?: WorkflowStep<CTX>[];
131
- }
132
- interface StepBuilder<CTX> {
133
- <Schema extends Zod.ZodType>(step: JsonLLMStep<CTX, Schema>): JsonLLMStep<CTX, Schema>;
134
- (step: StringLLMStep<CTX>): StringLLMStep<CTX>;
135
- (step: ProgrammaticStep<CTX>): ProgrammaticStep<CTX>;
136
- }
137
- /**
138
- * The main interface for the AI Engine.
139
- *
140
- * @example
141
- * ```typescript
142
- * import { createAIEngine } from '@recombine-ai/engine'
143
- *
144
- * Create a new AI engine instance
145
- * const ai = createAIEngine({
146
- * // engine configuration, see EngineConfig
147
- * })
148
- *
149
- * // create a conversation to be used in workflow.run(), see Conversation
150
- * const conversation = ai.createConversation(messages)
151
- * // create a workflow, see WorkflowConfig
152
- * const workflow = ai.createWorkflow({steps})
153
- * workflow.run(conversation)
154
- * ```
155
- */
156
- export interface AIEngine {
157
- /**
158
- * Creates a workflow from a sequence of steps.
159
- * @param config - common parameters for a workflow
160
- * @returns AI workflow Workflow.
161
- */
162
- createWorkflow: <CTX extends object>(config: WorkflowConfig<CTX>) => Workflow<CTX>;
163
- /**
164
- * Creates a new conversation instance.
165
- * @param messages - Optional initial messages for the conversation.
166
- * @returns A new Conversation object.
167
- */
168
- createConversation: (messages?: Message[]) => Conversation;
169
- /**
170
- * Get the function to create steps to use with {@link WorkflowConfig#steps}
171
- * if you want to define steps outside of workflow.
172
- */
173
- getStepBuilder<CTX>(): StepBuilder<CTX>;
174
- /**
175
- * Renders a prompt string using Nunjucks templating engine.
176
- * @param prompt - The prompt string to render.
177
- * @param context - Optional context object to use for rendering the prompt.
178
- * @returns The rendered prompt string.
179
- */
180
- renderPrompt: (prompt: string, context?: object) => string;
181
- }
182
- /**
183
- * Represents a conversation between a user and an AI agent.
184
- * Provides methods to manage the conversation flow, format messages, and convert the conversation
185
- * to a string representation.
186
- */
187
- export interface Conversation {
188
- /**
189
- * Sets the default formatter to stringify messages when toString is called.
190
- * @param formatter - A function that takes a message and returns a formatted string.
191
- */
192
- setDefaultFormatter: (formatter: (message: Message) => string) => void;
193
- /**
194
- * Converts the conversation to a string representation to be fed to an LLM.
195
- * @param filter - A function that filters messages based on certain criteria.
196
- * @example
197
- * @returns The string representation of the conversation.
198
- */
199
- toString: (options?: {
200
- ignoreAddedMessages?: boolean;
201
- }) => string;
202
- /**
203
- * Adds a message from a specified sender to the conversation.
204
- * @param message - The message to add to the conversation.
205
- */
206
- addMessage: (message: Message, opts?: {
207
- formatter?: (message: Message) => string;
208
- }) => void;
209
- /**
210
- * Sets a custom formatter for proposed messages.
211
- * @param formatter - A function that takes a message string and returns a formatted string.
212
- */
213
- setProposedMessageFormatter: (formatter: (message: string) => string) => void;
214
- /**
215
- * Sets a proposed reply message.
216
- * @param message - The proposed reply message.
217
- */
218
- setProposedReply: (message: string) => void;
219
- /**
220
- * Gets the current proposed reply message.
221
- * @returns The proposed reply message, or null if none exists.
222
- */
223
- getProposedReply: () => string | null;
224
- /**
225
- * Gets the history of all messages in the conversation. Returns {@link Message} rather than
226
- * {@link ConversationMessage} because none of the {@link ConversationMessage} properties should
227
- * be accessed outside of the {@link Conversation} context.
228
- * @returns An array of Message objects representing the conversation history.
229
- */
230
- getHistory: () => Message[];
231
- }
232
- /**
233
- * Represents a message in a conversation between a user and an agent, or a system message.
234
- * Messages can contain text and optionally an image URL. To be used in the {@link Conversation} interface.
235
- */
236
- export interface Message {
237
- /** The sender of the message, which can be one of the following: 'user', 'agent', or 'system' */
238
- sender: 'user' | 'agent' | 'system';
239
- /** The text content of the message */
240
- text: string;
241
- /** Optional URL of an image associated with the message */
242
- imageUrl?: string;
243
- }
244
- /**
245
- * Configuration options for the Engine.
246
- */
247
- export interface EngineConfig {
248
- /** Optional logger instance for handling log messages. */
249
- logger?: Logger;
250
- /** traces received prompt, rendered prompt, context and other useful info about LLM execution */
251
- stepTracer?: StepTracer;
252
- /** registers steps in workflow to be available in Bosun IDE */
253
- stepRegistry?: StepRegistry;
254
- /** Optional nunjucks Environment to customize prompt rendering. */
255
- nunjucksEnv?: nunjucks.Environment;
256
- }
257
- /**
258
- * Creates an AI Engine with the given configuration.
259
- *
260
- * The AI Engine provides utilities for creating and running conversational workflows
261
- * with large language models, specifically OpenAI GPT models.
262
- *
263
- * @returns An AIEngine instance.
264
- *
265
- * @example
266
- * ```ts
267
- * const engine = createAIEngine({
268
- * logger: customLogger,
269
- * });
270
- *
271
- * const workflow = await engine.createWorkflow(
272
- * engine.createStep({
273
- * name: 'generate-response',
274
- * prompt: engine.loadFile('prompts/response.txt'),
275
- * execute: (response) => conversation.setProposedReply(response)
276
- * })
277
- * );
278
- *
279
- * const reply = await workflow.run(conversation);
280
- * ```
281
- */
282
- export declare function createAIEngine(cfg?: EngineConfig): AIEngine;
283
- export declare function createConversation(initialMessages?: Message[]): Conversation;
284
- export declare function getStepBuilder<CTX = unknown>(): StepBuilder<CTX>;
285
- export {};
286
- //# sourceMappingURL=ai.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/lib/ai.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,MAAM,UAAU,CAAA;AAC/B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAA;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAmC,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACjF,OAAO,EAAiC,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAEnF,MAAM,WAAW,UAAU;IACvB;;;;;OAKG;IACH,gBAAgB,EAAE,CACd,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,KACnB,OAAO,CAAC,MAAM,CAAC,CAAA;IACpB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,OAAO,CAAA;CAC5B;AAED,MAAM,WAAW,SAAS,CAAC,GAAG;IAC1B,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAA;IAEZ,kDAAkD;IAClD,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,EAAE,GAAG,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IAExE;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IAEpB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,E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E,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;IAC/B,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,CAAA;CAClC;AAED;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAE1E,MAAM,WAAW,SAAS;IACtB;;;;;OAKG;IACH,cAAc,EAAE,CACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,KAC1C,cAAc,CAAA;IAEnB;;OAEG;IACH,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9D"}
@@ -1,3 +0,0 @@
1
- import { AIStreamEngine, StreamingEngineConfig } from './interfaces';
2
- export declare function createAIStreamEngine(cfg: StreamingEngineConfig): AIStreamEngine;
3
- //# sourceMappingURL=ai.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/ai.ts"],"names":[],"mappings":"AAOA,OAAO,EACH,cAAc,EAGd,qBAAqB,EAGxB,MAAM,cAAc,CAAA;AAIrB,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,qBAAqB,GAAG,cAAc,CA6N/E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/lib/stream/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACtC,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEz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