@reactive-agents/reasoning 0.1.0 → 0.2.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.
- package/README.md +29 -2
- package/dist/index.d.ts +4 -1
- package/dist/index.js +74 -4
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -39,12 +39,39 @@ The default. A Thought → Action → Observation loop:
|
|
|
39
39
|
|
|
40
40
|
```
|
|
41
41
|
Thought: I need to find information about X
|
|
42
|
-
|
|
43
|
-
Observation: [search results]
|
|
42
|
+
ACTION: web_search({"query": "X"})
|
|
43
|
+
Observation: [actual search results from the registered tool]
|
|
44
44
|
Thought: Based on the results, I can conclude...
|
|
45
45
|
FINAL ANSWER: [conclusion]
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
When `ToolService` is present (via `.withTools()` on the agent builder), ACTION calls execute real registered tools and return real results as observations. Tool arguments must be valid JSON. If a plain string is provided, it is mapped to the first required parameter of the tool definition.
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { ReactiveAgents } from "reactive-agents";
|
|
52
|
+
import { defineTool } from "@reactive-agents/tools";
|
|
53
|
+
import { Effect, Schema } from "effect";
|
|
54
|
+
|
|
55
|
+
const searchTool = defineTool({
|
|
56
|
+
name: "web_search",
|
|
57
|
+
description: "Search the web for current information",
|
|
58
|
+
input: Schema.Struct({ query: Schema.String }),
|
|
59
|
+
handler: ({ query }) => Effect.succeed(`Results for: ${query}`),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const agent = await ReactiveAgents.create()
|
|
63
|
+
.withName("researcher")
|
|
64
|
+
.withProvider("anthropic")
|
|
65
|
+
.withReasoning() // ReAct strategy
|
|
66
|
+
.withTools([searchTool]) // tools available during reasoning
|
|
67
|
+
.build();
|
|
68
|
+
|
|
69
|
+
const result = await agent.run("What are the latest AI developments?");
|
|
70
|
+
// The ReAct loop will call web_search with real args and use the result
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
When ToolService is absent, a clear descriptive message is returned as the observation instead — the agent degrades gracefully without crashing.
|
|
74
|
+
|
|
48
75
|
## Reflexion Strategy
|
|
49
76
|
|
|
50
77
|
A Generate → Self-Critique → Improve loop based on the [Reflexion paper](https://arxiv.org/abs/2303.11366):
|
package/dist/index.d.ts
CHANGED
|
@@ -232,7 +232,10 @@ interface ReactiveInput {
|
|
|
232
232
|
}
|
|
233
233
|
/**
|
|
234
234
|
* ReAct loop: Thought -> Action -> Observation, iterating until done.
|
|
235
|
-
*
|
|
235
|
+
*
|
|
236
|
+
* When ToolService is available in context, ACTION calls are executed
|
|
237
|
+
* against real registered tools and results are fed back as observations.
|
|
238
|
+
* Without ToolService, tool calls are noted as unavailable.
|
|
236
239
|
*/
|
|
237
240
|
declare const executeReactive: (input: ReactiveInput) => Effect.Effect<ReasoningResult, ExecutionError | IterationLimitError, LLMService>;
|
|
238
241
|
|
package/dist/index.js
CHANGED
|
@@ -151,8 +151,11 @@ import { Context, Effect as Effect3, Layer, Ref } from "effect";
|
|
|
151
151
|
import { Effect } from "effect";
|
|
152
152
|
import { ulid } from "ulid";
|
|
153
153
|
import { LLMService } from "@reactive-agents/llm-provider";
|
|
154
|
+
import { ToolService } from "@reactive-agents/tools";
|
|
154
155
|
var executeReactive = (input) => Effect.gen(function* () {
|
|
155
156
|
const llm = yield* LLMService;
|
|
157
|
+
const toolServiceOptRaw = yield* Effect.serviceOption(ToolService);
|
|
158
|
+
const toolServiceOpt = toolServiceOptRaw;
|
|
156
159
|
const maxIter = input.config.strategies.reactive.maxIterations;
|
|
157
160
|
const temp = input.config.strategies.reactive.temperature;
|
|
158
161
|
const steps = [];
|
|
@@ -207,25 +210,92 @@ var executeReactive = (input) => Effect.gen(function* () {
|
|
|
207
210
|
timestamp: /* @__PURE__ */ new Date(),
|
|
208
211
|
metadata: { toolUsed: toolRequest.tool }
|
|
209
212
|
});
|
|
213
|
+
const observationContent = yield* runToolObservation(
|
|
214
|
+
toolServiceOpt,
|
|
215
|
+
toolRequest,
|
|
216
|
+
input
|
|
217
|
+
);
|
|
210
218
|
steps.push({
|
|
211
219
|
id: ulid(),
|
|
212
220
|
type: "observation",
|
|
213
|
-
content:
|
|
221
|
+
content: observationContent,
|
|
214
222
|
timestamp: /* @__PURE__ */ new Date()
|
|
215
223
|
});
|
|
224
|
+
context = appendToContext(
|
|
225
|
+
context,
|
|
226
|
+
`${thought}
|
|
227
|
+
Observation: ${observationContent}`
|
|
228
|
+
);
|
|
229
|
+
} else {
|
|
216
230
|
context = appendToContext(context, thought);
|
|
217
231
|
}
|
|
218
232
|
iteration++;
|
|
219
233
|
}
|
|
220
234
|
return buildResult(steps, null, "partial", start, totalTokens, totalCost);
|
|
221
235
|
});
|
|
236
|
+
function runToolObservation(toolServiceOpt, toolRequest, _input) {
|
|
237
|
+
if (toolServiceOpt._tag === "None") {
|
|
238
|
+
return Effect.succeed(
|
|
239
|
+
`[Tool "${toolRequest.tool}" requested but ToolService is not available \u2014 add .withTools() to agent builder]`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
const toolService = toolServiceOpt.value;
|
|
243
|
+
return Effect.gen(function* () {
|
|
244
|
+
const args = yield* resolveToolArgs(toolService, toolRequest);
|
|
245
|
+
const result = yield* toolService.execute({
|
|
246
|
+
toolName: toolRequest.tool,
|
|
247
|
+
arguments: args,
|
|
248
|
+
agentId: "reasoning-agent",
|
|
249
|
+
sessionId: "reasoning-session"
|
|
250
|
+
}).pipe(
|
|
251
|
+
Effect.map(
|
|
252
|
+
(r) => typeof r.result === "string" ? r.result : JSON.stringify(r.result)
|
|
253
|
+
),
|
|
254
|
+
Effect.catchAll((e) => {
|
|
255
|
+
const msg = e instanceof Error ? e.message : typeof e === "object" && e !== null && "message" in e ? String(e.message) : String(e);
|
|
256
|
+
return Effect.succeed(`[Tool error: ${msg}]`);
|
|
257
|
+
})
|
|
258
|
+
);
|
|
259
|
+
return result;
|
|
260
|
+
}).pipe(
|
|
261
|
+
Effect.catchAll(
|
|
262
|
+
(e) => Effect.succeed(`[Unexpected error executing tool: ${String(e)}]`)
|
|
263
|
+
)
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
function resolveToolArgs(toolService, toolRequest) {
|
|
267
|
+
const trimmed = toolRequest.input.trim();
|
|
268
|
+
if (trimmed.startsWith("{") || trimmed.startsWith("[")) {
|
|
269
|
+
try {
|
|
270
|
+
const parsed = JSON.parse(trimmed);
|
|
271
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
272
|
+
return Effect.succeed(parsed);
|
|
273
|
+
}
|
|
274
|
+
} catch {
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return toolService.getTool(toolRequest.tool).pipe(
|
|
278
|
+
Effect.map((toolDef) => {
|
|
279
|
+
const firstParam = toolDef.parameters.find((p) => p.required) ?? toolDef.parameters[0];
|
|
280
|
+
if (firstParam) {
|
|
281
|
+
return { [firstParam.name]: trimmed };
|
|
282
|
+
}
|
|
283
|
+
return { input: trimmed };
|
|
284
|
+
}),
|
|
285
|
+
Effect.catchAll(
|
|
286
|
+
() => Effect.succeed({ input: trimmed })
|
|
287
|
+
)
|
|
288
|
+
);
|
|
289
|
+
}
|
|
222
290
|
function buildInitialContext(input) {
|
|
291
|
+
const toolsSection = input.availableTools.length > 0 ? `Available Tools: ${input.availableTools.join(", ")}
|
|
292
|
+
To use a tool: ACTION: tool_name({"param": "value"}) \u2014 use JSON for tool arguments.` : "No tools available for this task.";
|
|
223
293
|
return [
|
|
224
294
|
`Task: ${input.taskDescription}`,
|
|
225
295
|
`Task Type: ${input.taskType}`,
|
|
226
296
|
`Relevant Memory:
|
|
227
297
|
${input.memoryContext}`,
|
|
228
|
-
|
|
298
|
+
toolsSection
|
|
229
299
|
].join("\n\n");
|
|
230
300
|
}
|
|
231
301
|
function buildThoughtPrompt(context, history) {
|
|
@@ -235,13 +305,13 @@ function buildThoughtPrompt(context, history) {
|
|
|
235
305
|
Previous steps:
|
|
236
306
|
${historyStr}
|
|
237
307
|
|
|
238
|
-
Think step-by-step. If you need a tool, respond with "ACTION: tool_name(
|
|
308
|
+
Think step-by-step. If you need a tool, respond with "ACTION: tool_name({"param": "value"})". If you have a final answer, respond with "FINAL ANSWER: ...".`;
|
|
239
309
|
}
|
|
240
310
|
function hasFinalAnswer(thought) {
|
|
241
311
|
return /final answer:/i.test(thought);
|
|
242
312
|
}
|
|
243
313
|
function parseToolRequest(thought) {
|
|
244
|
-
const match = thought.match(/ACTION:\s*(\w+)\((
|
|
314
|
+
const match = thought.match(/ACTION:\s*([\w-]+)\((.+)\)/is);
|
|
245
315
|
return match ? { tool: match[1], input: match[2] } : null;
|
|
246
316
|
}
|
|
247
317
|
function appendToContext(context, addition) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/step.ts","../src/types/reasoning.ts","../src/types/effectiveness.ts","../src/types/config.ts","../src/errors/errors.ts","../src/services/reasoning-service.ts","../src/services/strategy-registry.ts","../src/strategies/reactive.ts","../src/strategies/reflexion.ts","../src/runtime.ts"],"sourcesContent":["// File: src/types/step.ts\nimport { Schema } from \"effect\";\n\n// ─── Step ID (branded string) ───\n\nexport const StepId = Schema.String.pipe(Schema.brand(\"StepId\"));\nexport type StepId = typeof StepId.Type;\n\n// ─── Step Type ───\n\nexport const StepType = Schema.Literal(\n \"thought\", // Thinking/reasoning\n \"action\", // Tool call\n \"observation\", // Tool result\n \"plan\", // Planning step\n \"reflection\", // Self-reflection\n \"critique\", // Self-critique\n);\nexport type StepType = typeof StepType.Type;\n\n// ─── Step Metadata ───\n\nexport const StepMetadataSchema = Schema.Struct({\n confidence: Schema.optional(Schema.Number),\n toolUsed: Schema.optional(Schema.String),\n cost: Schema.optional(Schema.Number),\n duration: Schema.optional(Schema.Number),\n});\nexport type StepMetadata = typeof StepMetadataSchema.Type;\n\n// ─── Reasoning Step ───\n\nexport const ReasoningStepSchema = Schema.Struct({\n id: StepId,\n type: StepType,\n content: Schema.String,\n timestamp: Schema.DateFromSelf,\n metadata: Schema.optional(StepMetadataSchema),\n});\nexport type ReasoningStep = typeof ReasoningStepSchema.Type;\n","// File: src/types/reasoning.ts\nimport { Schema } from \"effect\";\nimport { ReasoningStepSchema } from \"./step.js\";\n\n// ─── Reasoning Strategy ───\n// Canonical definition lives in @reactive-agents/core.\n// Re-export here so downstream reasoning code can import from either package.\nimport { ReasoningStrategy } from \"@reactive-agents/core\";\nexport { ReasoningStrategy };\n\n// ─── Result Status ───\n\nexport const ReasoningStatus = Schema.Literal(\"completed\", \"failed\", \"partial\");\nexport type ReasoningStatus = typeof ReasoningStatus.Type;\n\n// ─── Reasoning Metadata ───\n\nexport const ReasoningMetadataSchema = Schema.Struct({\n duration: Schema.Number, // ms\n cost: Schema.Number, // USD\n tokensUsed: Schema.Number,\n stepsCount: Schema.Number,\n confidence: Schema.Number, // 0-1\n effectiveness: Schema.optional(Schema.Number), // 0-1 (learned)\n selectedStrategy: Schema.optional(ReasoningStrategy), // for adaptive\n});\nexport type ReasoningMetadata = typeof ReasoningMetadataSchema.Type;\n\n// ─── Reasoning Result ───\n\nexport const ReasoningResultSchema = Schema.Struct({\n strategy: ReasoningStrategy,\n steps: Schema.Array(ReasoningStepSchema),\n output: Schema.Unknown,\n metadata: ReasoningMetadataSchema,\n status: ReasoningStatus,\n});\nexport type ReasoningResult = typeof ReasoningResultSchema.Type;\n\n// ─── Selection Context ───\n\nexport const SelectionContextSchema = Schema.Struct({\n taskDescription: Schema.String,\n taskType: Schema.String,\n complexity: Schema.Number, // 0-1\n urgency: Schema.Number, // 0-1\n costBudget: Schema.optional(Schema.Number),\n timeConstraint: Schema.optional(Schema.Number), // ms\n preferredStrategy: Schema.optional(ReasoningStrategy),\n});\nexport type SelectionContext = typeof SelectionContextSchema.Type;\n","// File: src/types/effectiveness.ts\nimport { Schema } from \"effect\";\nimport { ReasoningStrategy } from \"./reasoning.js\";\n\n// ─── Strategy Effectiveness Record ───\n\nexport const StrategyEffectivenessSchema = Schema.Struct({\n strategy: ReasoningStrategy,\n taskType: Schema.String,\n successRate: Schema.Number, // 0-1\n avgCost: Schema.Number,\n avgDuration: Schema.Number,\n avgConfidence: Schema.Number,\n executions: Schema.Number,\n lastUsed: Schema.DateFromSelf,\n});\nexport type StrategyEffectiveness = typeof StrategyEffectivenessSchema.Type;\n","// File: src/types/config.ts\nimport { Schema } from \"effect\";\nimport { ReasoningStrategy } from \"./reasoning.js\";\n\n// ─── Per-Strategy Configuration ───\n\nexport const ReactiveConfigSchema = Schema.Struct({\n maxIterations: Schema.Number.pipe(Schema.int(), Schema.positive()),\n temperature: Schema.Number,\n});\nexport type ReactiveConfig = typeof ReactiveConfigSchema.Type;\n\nexport const PlanExecuteConfigSchema = Schema.Struct({\n maxRefinements: Schema.Number.pipe(Schema.int(), Schema.positive()),\n reflectionDepth: Schema.Literal(\"shallow\", \"deep\"),\n});\nexport type PlanExecuteConfig = typeof PlanExecuteConfigSchema.Type;\n\nexport const TreeOfThoughtConfigSchema = Schema.Struct({\n breadth: Schema.Number.pipe(Schema.int(), Schema.positive()),\n depth: Schema.Number.pipe(Schema.int(), Schema.positive()),\n pruningThreshold: Schema.Number,\n});\nexport type TreeOfThoughtConfig = typeof TreeOfThoughtConfigSchema.Type;\n\nexport const ReflexionConfigSchema = Schema.Struct({\n maxRetries: Schema.Number.pipe(Schema.int(), Schema.positive()),\n selfCritiqueDepth: Schema.Literal(\"shallow\", \"deep\"),\n});\nexport type ReflexionConfig = typeof ReflexionConfigSchema.Type;\n\n// ─── Full Reasoning Config ───\n\nexport const ReasoningConfigSchema = Schema.Struct({\n defaultStrategy: ReasoningStrategy,\n adaptive: Schema.Struct({\n enabled: Schema.Boolean,\n learning: Schema.Boolean,\n }),\n strategies: Schema.Struct({\n reactive: ReactiveConfigSchema,\n planExecute: PlanExecuteConfigSchema,\n treeOfThought: TreeOfThoughtConfigSchema,\n reflexion: ReflexionConfigSchema,\n }),\n});\nexport type ReasoningConfig = typeof ReasoningConfigSchema.Type;\n\n// ─── Default Config ───\n\nexport const defaultReasoningConfig: ReasoningConfig = {\n defaultStrategy: \"reactive\",\n adaptive: { enabled: false, learning: false },\n strategies: {\n reactive: { maxIterations: 10, temperature: 0.7 },\n planExecute: { maxRefinements: 2, reflectionDepth: \"deep\" },\n treeOfThought: { breadth: 3, depth: 3, pruningThreshold: 0.5 },\n reflexion: { maxRetries: 3, selfCritiqueDepth: \"deep\" },\n },\n};\n","// File: src/errors/errors.ts\nimport { Data } from \"effect\";\n\n// ─── Base reasoning error ───\nexport class ReasoningError extends Data.TaggedError(\"ReasoningError\")<{\n readonly message: string;\n readonly cause?: unknown;\n}> {}\n\n// ─── Strategy not found in registry ───\nexport class StrategyNotFoundError extends Data.TaggedError(\n \"StrategyNotFoundError\",\n)<{\n readonly strategy: string;\n}> {}\n\n// ─── Strategy selection failed ───\nexport class SelectionError extends Data.TaggedError(\"SelectionError\")<{\n readonly message: string;\n readonly context?: unknown;\n}> {}\n\n// ─── Strategy execution failed ───\nexport class ExecutionError extends Data.TaggedError(\"ExecutionError\")<{\n readonly strategy: string;\n readonly message: string;\n readonly step?: number;\n readonly cause?: unknown;\n}> {}\n\n// ─── Max iterations / depth exceeded ───\nexport class IterationLimitError extends Data.TaggedError(\n \"IterationLimitError\",\n)<{\n readonly strategy: string;\n readonly limit: number;\n readonly stepsCompleted: number;\n}> {}\n\n// ─── Union type for service signatures ───\nexport type ReasoningErrors =\n | ReasoningError\n | StrategyNotFoundError\n | SelectionError\n | ExecutionError\n | IterationLimitError;\n","// File: src/services/reasoning-service.ts\nimport { Context, Effect, Layer } from \"effect\";\nimport type {\n ReasoningResult,\n ReasoningStrategy,\n} from \"../types/index.js\";\nimport type { ReasoningConfig } from \"../types/config.js\";\nimport { defaultReasoningConfig } from \"../types/config.js\";\nimport { StrategyRegistry, type StrategyFn } from \"./strategy-registry.js\";\nimport type { ReasoningErrors } from \"../errors/errors.js\";\nimport { LLMService } from \"@reactive-agents/llm-provider\";\n\n// ─── Service Tag ───\n\nexport class ReasoningService extends Context.Tag(\"ReasoningService\")<\n ReasoningService,\n {\n /**\n * Execute reasoning on a task.\n * If `strategy` is provided, uses that strategy directly.\n * Otherwise uses the configured default strategy.\n */\n readonly execute: (params: {\n readonly taskDescription: string;\n readonly taskType: string;\n readonly memoryContext: string;\n readonly availableTools: readonly string[];\n readonly strategy?: ReasoningStrategy;\n }) => Effect.Effect<ReasoningResult, ReasoningErrors>;\n\n /** Register a custom strategy function. */\n readonly registerStrategy: (\n name: ReasoningStrategy,\n fn: StrategyFn,\n ) => Effect.Effect<void>;\n }\n>() {}\n\n// ─── Live Layer ───\n// Requires: StrategyRegistry, LLMService\n\nexport const ReasoningServiceLive = (\n config: ReasoningConfig = defaultReasoningConfig,\n) =>\n Layer.effect(\n ReasoningService,\n Effect.gen(function* () {\n const registry = yield* StrategyRegistry;\n // Capture LLMService at layer construction time so we can provide\n // it to strategy functions when executing them.\n const llmService = yield* LLMService;\n const llmLayer = Layer.succeed(LLMService, llmService);\n\n return {\n execute: (params) =>\n Effect.gen(function* () {\n // ── Determine which strategy to use ──\n const strategyName: ReasoningStrategy =\n params.strategy ?? config.defaultStrategy;\n\n // ── Get strategy function from registry ──\n const strategyFn = yield* registry.get(strategyName);\n\n // ── Execute strategy, providing LLMService ──\n const result = yield* strategyFn({\n ...params,\n config,\n }).pipe(Effect.provide(llmLayer));\n\n return result;\n }),\n\n registerStrategy: (name, fn) => registry.register(name, fn),\n };\n }),\n );\n","// File: src/services/strategy-registry.ts\nimport { Context, Effect, Layer, Ref } from \"effect\";\nimport type { ReasoningResult, ReasoningStrategy } from \"../types/index.js\";\nimport type { ReasoningConfig } from \"../types/config.js\";\nimport {\n StrategyNotFoundError,\n type ExecutionError,\n type IterationLimitError,\n} from \"../errors/errors.js\";\nimport type { LLMService } from \"@reactive-agents/llm-provider\";\nimport { executeReactive } from \"../strategies/reactive.js\";\nimport { executeReflexion } from \"../strategies/reflexion.js\";\n\n// ─── Strategy function type ───\n\nexport type StrategyFn = (input: {\n readonly taskDescription: string;\n readonly taskType: string;\n readonly memoryContext: string;\n readonly availableTools: readonly string[];\n readonly config: ReasoningConfig;\n}) => Effect.Effect<\n ReasoningResult,\n ExecutionError | IterationLimitError,\n LLMService\n>;\n\n// ─── Service Tag ───\n\nexport class StrategyRegistry extends Context.Tag(\"StrategyRegistry\")<\n StrategyRegistry,\n {\n readonly get: (\n name: ReasoningStrategy,\n ) => Effect.Effect<StrategyFn, StrategyNotFoundError>;\n\n readonly register: (\n name: ReasoningStrategy,\n fn: StrategyFn,\n ) => Effect.Effect<void>;\n\n readonly list: () => Effect.Effect<readonly ReasoningStrategy[]>;\n }\n>() {}\n\n// ─── Live Layer (Phase 1: reactive only) ───\n\nexport const StrategyRegistryLive = Layer.effect(\n StrategyRegistry,\n Effect.gen(function* () {\n // Ref-based mutable map of strategies\n const registryRef = yield* Ref.make<Map<string, StrategyFn>>(\n new Map<string, StrategyFn>([\n [\"reactive\", executeReactive],\n [\"reflexion\", executeReflexion],\n ]),\n );\n\n return {\n get: (name) =>\n Effect.gen(function* () {\n const registry = yield* Ref.get(registryRef);\n const fn = registry.get(name);\n if (!fn) {\n return yield* Effect.fail(\n new StrategyNotFoundError({ strategy: name }),\n );\n }\n return fn;\n }),\n\n register: (name, fn) =>\n Ref.update(registryRef, (m) => {\n const next = new Map(m);\n next.set(name, fn);\n return next;\n }),\n\n list: () =>\n Ref.get(registryRef).pipe(\n Effect.map((m) => Array.from(m.keys()) as ReasoningStrategy[]),\n ),\n };\n }),\n);\n","// File: src/strategies/reactive.ts\nimport { Effect } from \"effect\";\nimport { ulid } from \"ulid\";\nimport type { ReasoningResult, ReasoningStep } from \"../types/index.js\";\nimport type { StepId } from \"../types/step.js\";\nimport { ExecutionError, IterationLimitError } from \"../errors/errors.js\";\nimport type { ReasoningConfig } from \"../types/config.js\";\nimport { LLMService } from \"@reactive-agents/llm-provider\";\n\ninterface ReactiveInput {\n readonly taskDescription: string;\n readonly taskType: string;\n readonly memoryContext: string;\n readonly availableTools: readonly string[];\n readonly config: ReasoningConfig;\n}\n\n/**\n * ReAct loop: Thought -> Action -> Observation, iterating until done.\n * Each iteration calls the LLM once for reasoning.\n */\nexport const executeReactive = (\n input: ReactiveInput,\n): Effect.Effect<\n ReasoningResult,\n ExecutionError | IterationLimitError,\n LLMService\n> =>\n Effect.gen(function* () {\n const llm = yield* LLMService;\n const maxIter = input.config.strategies.reactive.maxIterations;\n const temp = input.config.strategies.reactive.temperature;\n const steps: ReasoningStep[] = [];\n const start = Date.now();\n\n let context = buildInitialContext(input);\n let iteration = 0;\n let totalTokens = 0;\n let totalCost = 0;\n\n while (iteration < maxIter) {\n // ── THOUGHT ──\n const thoughtResponse = yield* llm\n .complete({\n messages: [\n { role: \"user\", content: buildThoughtPrompt(context, steps) },\n ],\n systemPrompt: `You are a reasoning agent. Task: ${input.taskDescription}`,\n maxTokens: 300,\n temperature: temp,\n })\n .pipe(\n Effect.mapError(\n (err) =>\n new ExecutionError({\n strategy: \"reactive\",\n message: `LLM thought failed at iteration ${iteration}`,\n step: iteration,\n cause: err,\n }),\n ),\n );\n\n const thought = thoughtResponse.content;\n totalTokens += thoughtResponse.usage.totalTokens;\n totalCost += thoughtResponse.usage.estimatedCost;\n\n steps.push({\n id: ulid() as StepId,\n type: \"thought\",\n content: thought,\n timestamp: new Date(),\n });\n\n // ── CHECK: does the thought indicate a final answer? ──\n if (hasFinalAnswer(thought)) {\n return buildResult(\n steps,\n thought,\n \"completed\",\n start,\n totalTokens,\n totalCost,\n );\n }\n\n // ── ACTION: does the thought request a tool call? ──\n const toolRequest = parseToolRequest(thought);\n if (toolRequest) {\n steps.push({\n id: ulid() as StepId,\n type: \"action\",\n content: JSON.stringify(toolRequest),\n timestamp: new Date(),\n metadata: { toolUsed: toolRequest.tool },\n });\n\n // Tool execution is deferred to the caller (ReasoningService) via a\n // placeholder observation. The service orchestrates tool calls through\n // the ToolService from Layer 8. Here, we note the request and continue.\n steps.push({\n id: ulid() as StepId,\n type: \"observation\",\n content: `[Tool call requested: ${toolRequest.tool}(${JSON.stringify(toolRequest.input)})]`,\n timestamp: new Date(),\n });\n\n // Update context with tool request for next iteration\n context = appendToContext(context, thought);\n }\n\n iteration++;\n }\n\n // Max iterations reached — return partial result\n return buildResult(steps, null, \"partial\", start, totalTokens, totalCost);\n });\n\n// ─── Helpers (private to module) ───\n\nfunction buildInitialContext(input: ReactiveInput): string {\n return [\n `Task: ${input.taskDescription}`,\n `Task Type: ${input.taskType}`,\n `Relevant Memory:\\n${input.memoryContext}`,\n `Available Tools: ${input.availableTools.join(\", \")}`,\n ].join(\"\\n\\n\");\n}\n\nfunction buildThoughtPrompt(\n context: string,\n history: readonly ReasoningStep[],\n): string {\n const historyStr = history.map((s) => `[${s.type}] ${s.content}`).join(\"\\n\");\n return `${context}\\n\\nPrevious steps:\\n${historyStr}\\n\\nThink step-by-step. If you need a tool, respond with \"ACTION: tool_name(input)\". If you have a final answer, respond with \"FINAL ANSWER: ...\".`;\n}\n\nfunction hasFinalAnswer(thought: string): boolean {\n return /final answer:/i.test(thought);\n}\n\nfunction parseToolRequest(\n thought: string,\n): { tool: string; input: string } | null {\n const match = thought.match(/ACTION:\\s*(\\w+)\\((.+?)\\)/i);\n return match ? { tool: match[1], input: match[2] } : null;\n}\n\nfunction appendToContext(context: string, addition: string): string {\n return `${context}\\n\\n${addition}`;\n}\n\nfunction buildResult(\n steps: readonly ReasoningStep[],\n output: unknown,\n status: \"completed\" | \"partial\",\n startMs: number,\n tokensUsed: number,\n cost: number,\n): ReasoningResult {\n return {\n strategy: \"reactive\",\n steps: [...steps],\n output,\n metadata: {\n duration: Date.now() - startMs,\n cost,\n tokensUsed,\n stepsCount: steps.length,\n confidence: status === \"completed\" ? 0.8 : 0.4,\n },\n status,\n };\n}\n","// File: src/strategies/reflexion.ts\n/**\n * Reflexion Strategy — Generate → Reflect → Improve loop.\n *\n * Based on the Reflexion paper (Shinn et al., 2023).\n * The agent:\n * 1. Generates an initial response (attempt)\n * 2. Self-critiques the response to identify gaps/errors\n * 3. Improves the response using the critique as feedback\n * 4. Repeats until maxRetries reached or the critique is satisfied\n */\nimport { Effect } from \"effect\";\nimport { ulid } from \"ulid\";\nimport type { ReasoningResult, ReasoningStep } from \"../types/index.js\";\nimport type { StepId } from \"../types/step.js\";\nimport { ExecutionError, IterationLimitError } from \"../errors/errors.js\";\nimport type { ReasoningConfig } from \"../types/config.js\";\nimport { LLMService } from \"@reactive-agents/llm-provider\";\n\ninterface ReflexionInput {\n readonly taskDescription: string;\n readonly taskType: string;\n readonly memoryContext: string;\n readonly availableTools: readonly string[];\n readonly config: ReasoningConfig;\n}\n\n/**\n * Reflexion: Generate → Self-Critique → Improve, repeating until satisfied\n * or maxRetries is reached.\n */\nexport const executeReflexion = (\n input: ReflexionInput,\n): Effect.Effect<\n ReasoningResult,\n ExecutionError | IterationLimitError,\n LLMService\n> =>\n Effect.gen(function* () {\n const llm = yield* LLMService;\n const { maxRetries, selfCritiqueDepth } = input.config.strategies.reflexion;\n const steps: ReasoningStep[] = [];\n const start = Date.now();\n let totalTokens = 0;\n let totalCost = 0;\n let attempt = 0;\n let previousCritiques: string[] = [];\n\n // ── STEP 1: Initial generation ──\n const initialResponse = yield* llm\n .complete({\n messages: [\n {\n role: \"user\",\n content: buildGenerationPrompt(input, null),\n },\n ],\n systemPrompt: buildSystemPrompt(input.taskDescription),\n maxTokens: selfCritiqueDepth === \"deep\" ? 800 : 500,\n temperature: 0.7,\n })\n .pipe(\n Effect.mapError(\n (err) =>\n new ExecutionError({\n strategy: \"reflexion\",\n message: \"Initial generation failed\",\n step: 0,\n cause: err,\n }),\n ),\n );\n\n let currentResponse = initialResponse.content;\n totalTokens += initialResponse.usage.totalTokens;\n totalCost += initialResponse.usage.estimatedCost;\n\n steps.push({\n id: ulid() as StepId,\n type: \"thought\",\n content: `[ATTEMPT 1] ${currentResponse}`,\n timestamp: new Date(),\n });\n\n // ── LOOP: Reflect → Improve ──\n while (attempt < maxRetries) {\n attempt++;\n\n // ── Reflect: self-critique the current response ──\n const critiqueResponse = yield* llm\n .complete({\n messages: [\n {\n role: \"user\",\n content: buildCritiquePrompt(\n input.taskDescription,\n currentResponse,\n selfCritiqueDepth,\n previousCritiques,\n ),\n },\n ],\n systemPrompt:\n \"You are a critical evaluator. Analyze responses for accuracy, completeness, and quality.\",\n maxTokens: selfCritiqueDepth === \"deep\" ? 600 : 300,\n temperature: 0.3, // low temp for objective critique\n })\n .pipe(\n Effect.mapError(\n (err) =>\n new ExecutionError({\n strategy: \"reflexion\",\n message: `Self-critique failed at attempt ${attempt}`,\n step: attempt,\n cause: err,\n }),\n ),\n );\n\n const critique = critiqueResponse.content;\n totalTokens += critiqueResponse.usage.totalTokens;\n totalCost += critiqueResponse.usage.estimatedCost;\n\n steps.push({\n id: ulid() as StepId,\n type: \"observation\",\n content: `[CRITIQUE ${attempt}] ${critique}`,\n timestamp: new Date(),\n });\n\n // ── Check if satisfied ──\n if (isSatisfied(critique)) {\n return buildResult(\n steps,\n currentResponse,\n \"completed\",\n start,\n totalTokens,\n totalCost,\n attempt,\n );\n }\n\n previousCritiques.push(critique);\n\n // ── Improve: generate a refined response ──\n const improvedResponse = yield* llm\n .complete({\n messages: [\n {\n role: \"user\",\n content: buildGenerationPrompt(input, previousCritiques),\n },\n ],\n systemPrompt: buildSystemPrompt(input.taskDescription),\n maxTokens: selfCritiqueDepth === \"deep\" ? 800 : 500,\n temperature: 0.6,\n })\n .pipe(\n Effect.mapError(\n (err) =>\n new ExecutionError({\n strategy: \"reflexion\",\n message: `Improvement generation failed at attempt ${attempt}`,\n step: attempt,\n cause: err,\n }),\n ),\n );\n\n currentResponse = improvedResponse.content;\n totalTokens += improvedResponse.usage.totalTokens;\n totalCost += improvedResponse.usage.estimatedCost;\n\n steps.push({\n id: ulid() as StepId,\n type: \"thought\",\n content: `[ATTEMPT ${attempt + 1}] ${currentResponse}`,\n timestamp: new Date(),\n });\n }\n\n // Max retries reached — return the best response so far\n return buildResult(\n steps,\n currentResponse,\n \"partial\",\n start,\n totalTokens,\n totalCost,\n attempt,\n );\n });\n\n// ─── Private Helpers ───\n\nfunction buildSystemPrompt(taskDescription: string): string {\n return `You are a thoughtful reasoning agent. Your task is: ${taskDescription}\\nProvide clear, accurate, and complete responses.`;\n}\n\nfunction buildGenerationPrompt(\n input: ReflexionInput,\n previousCritiques: string[] | null,\n): string {\n const parts: string[] = [\n `Task: ${input.taskDescription}`,\n `Task Type: ${input.taskType}`,\n ];\n\n if (input.memoryContext) {\n parts.push(`Relevant Context:\\n${input.memoryContext}`);\n }\n\n if (previousCritiques && previousCritiques.length > 0) {\n parts.push(\n `Previous attempts had these issues:\\n${previousCritiques.map((c, i) => `${i + 1}. ${c}`).join(\"\\n\")}\\n\\nPlease address all of these issues in your improved response.`,\n );\n }\n\n parts.push(\n \"Provide a thorough and accurate response to the task above.\",\n );\n\n return parts.join(\"\\n\\n\");\n}\n\nfunction buildCritiquePrompt(\n taskDescription: string,\n response: string,\n depth: \"shallow\" | \"deep\",\n previousCritiques: string[],\n): string {\n const deepInstructions =\n depth === \"deep\"\n ? \"\\n- Check for logical consistency and coherence\\n- Identify any unsupported claims or assumptions\\n- Assess whether all aspects of the task are addressed\"\n : \"\";\n\n const prevCritiqueNote =\n previousCritiques.length > 0\n ? `\\n\\nPrevious critiques identified these issues:\\n${previousCritiques.map((c, i) => `${i + 1}. ${c}`).join(\"\\n\")}\\n\\nFocus on whether the new response adequately addresses these.`\n : \"\";\n\n return `Task: ${taskDescription}\n\nResponse to evaluate:\n${response}\n\nCritically evaluate this response. Identify:\n- Factual errors or inaccuracies\n- Missing information or incomplete answers\n- Unclear or ambiguous statements${deepInstructions}${prevCritiqueNote}\n\nIf the response is accurate and complete, start your critique with \"SATISFIED:\".\nOtherwise, clearly list the specific issues that need to be fixed.`;\n}\n\nfunction isSatisfied(critique: string): boolean {\n return /^SATISFIED:/i.test(critique.trim());\n}\n\nfunction buildResult(\n steps: readonly ReasoningStep[],\n output: string,\n status: \"completed\" | \"partial\",\n startMs: number,\n tokensUsed: number,\n cost: number,\n iterations: number,\n): ReasoningResult {\n // Confidence is higher when fewer iterations were needed\n const maxNormal = 3;\n const confidence =\n status === \"completed\"\n ? Math.max(0.6, 1 - (iterations / maxNormal) * 0.3)\n : 0.4;\n\n return {\n strategy: \"reflexion\",\n steps: [...steps],\n output,\n metadata: {\n duration: Date.now() - startMs,\n cost,\n tokensUsed,\n stepsCount: steps.length,\n confidence,\n },\n status,\n };\n}\n","// File: src/runtime.ts\nimport { Layer } from \"effect\";\nimport type { ReasoningConfig } from \"./types/config.js\";\nimport { defaultReasoningConfig } from \"./types/config.js\";\nimport { StrategyRegistryLive } from \"./services/strategy-registry.js\";\nimport { ReasoningServiceLive } from \"./services/reasoning-service.js\";\n\n/**\n * Create the full Reasoning layer (Phase 1: reactive only).\n *\n * Provides: ReasoningService, StrategyRegistry\n * Requires: LLMService (from Layer 1.5)\n *\n * Usage:\n * const ReasoningLive = createReasoningLayer();\n * const program = myEffect.pipe(Effect.provide(ReasoningLive));\n */\nexport const createReasoningLayer = (\n config: ReasoningConfig = defaultReasoningConfig,\n) => {\n // StrategyRegistry has no deps (strategies are registered at construction)\n const RegistryLayer = StrategyRegistryLive;\n\n // ReasoningService needs StrategyRegistry\n const ServiceLayer = ReasoningServiceLive(config).pipe(\n Layer.provide(RegistryLayer),\n );\n\n // Merge all services into one layer\n return Layer.mergeAll(ServiceLayer, RegistryLayer);\n};\n"],"mappings":";AACA,SAAS,cAAc;AAIhB,IAAM,SAAS,OAAO,OAAO,KAAK,OAAO,MAAM,QAAQ,CAAC;AAKxD,IAAM,WAAW,OAAO;AAAA,EAC7B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAKO,IAAM,qBAAqB,OAAO,OAAO;AAAA,EAC9C,YAAY,OAAO,SAAS,OAAO,MAAM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EACJ;AAAA,EACAC,QAAO,IAAI,aAAa;AACtB,UAAM,WAAW,OAAO;AAGxB,UAAM,aAAa,OAAOH;AAC1B,UAAM,WAAWE,OAAM,QAAQF,aAAY,UAAU;AAErD,WAAO;AAAA,MACL,SAAS,CAAC,WACRG,QAAO,IAAI,aAAa;AAEtB,cAAM,eACJ,OAAO,YAAY,OAAO;AAG5B,cAAM,aAAa,OAAO,SAAS,IAAI,YAAY;AAGnD,cAAM,SAAS,OAAO,WAAW;AAAA,UAC/B,GAAG;AAAA,UACH;AAAA,QACF,CAAC,EAAE,KAAKA,QAAO,QAAQ,QAAQ,CAAC;AAEhC,eAAO;AAAA,MACT,CAAC;AAAA,MAEH,kBAAkB,CAAC,MAAM,OAAO,SAAS,SAAS,MAAM,EAAE;AAAA,IAC5D;AAAA,EACF,CAAC;AACH;;;AI1EF,SAAS,SAAAC,cAAa;AAgBf,IAAM,uBAAuB,CAClC,SAA0B,2BACvB;AAEH,QAAM,gBAAgB;AAGtB,QAAM,eAAe,qBAAqB,MAAM,EAAE;AAAA,IAChDC,OAAM,QAAQ,aAAa;AAAA,EAC7B;AAGA,SAAOA,OAAM,SAAS,cAAc,aAAa;AACnD;","names":["Schema","Schema","Schema","Schema","Schema","Schema","Context","Effect","Layer","Effect","Effect","ulid","LLMService","Effect","ulid","buildResult","Effect","LLMService","Context","Layer","Effect","Layer","Layer"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/step.ts","../src/types/reasoning.ts","../src/types/effectiveness.ts","../src/types/config.ts","../src/errors/errors.ts","../src/services/reasoning-service.ts","../src/services/strategy-registry.ts","../src/strategies/reactive.ts","../src/strategies/reflexion.ts","../src/runtime.ts"],"sourcesContent":["// File: src/types/step.ts\nimport { Schema } from \"effect\";\n\n// ─── Step ID (branded string) ───\n\nexport const StepId = Schema.String.pipe(Schema.brand(\"StepId\"));\nexport type StepId = typeof StepId.Type;\n\n// ─── Step Type ───\n\nexport const StepType = Schema.Literal(\n \"thought\", // Thinking/reasoning\n \"action\", // Tool call\n \"observation\", // Tool result\n \"plan\", // Planning step\n \"reflection\", // Self-reflection\n \"critique\", // Self-critique\n);\nexport type StepType = typeof StepType.Type;\n\n// ─── Step Metadata ───\n\nexport const StepMetadataSchema = Schema.Struct({\n confidence: Schema.optional(Schema.Number),\n toolUsed: Schema.optional(Schema.String),\n cost: Schema.optional(Schema.Number),\n duration: Schema.optional(Schema.Number),\n});\nexport type StepMetadata = typeof StepMetadataSchema.Type;\n\n// ─── Reasoning Step ───\n\nexport const ReasoningStepSchema = Schema.Struct({\n id: StepId,\n type: StepType,\n content: Schema.String,\n timestamp: Schema.DateFromSelf,\n metadata: Schema.optional(StepMetadataSchema),\n});\nexport type ReasoningStep = typeof ReasoningStepSchema.Type;\n","// File: src/types/reasoning.ts\nimport { Schema } from \"effect\";\nimport { ReasoningStepSchema } from \"./step.js\";\n\n// ─── Reasoning Strategy ───\n// Canonical definition lives in @reactive-agents/core.\n// Re-export here so downstream reasoning code can import from either package.\nimport { ReasoningStrategy } from \"@reactive-agents/core\";\nexport { ReasoningStrategy };\n\n// ─── Result Status ───\n\nexport const ReasoningStatus = Schema.Literal(\"completed\", \"failed\", \"partial\");\nexport type ReasoningStatus = typeof ReasoningStatus.Type;\n\n// ─── Reasoning Metadata ───\n\nexport const ReasoningMetadataSchema = Schema.Struct({\n duration: Schema.Number, // ms\n cost: Schema.Number, // USD\n tokensUsed: Schema.Number,\n stepsCount: Schema.Number,\n confidence: Schema.Number, // 0-1\n effectiveness: Schema.optional(Schema.Number), // 0-1 (learned)\n selectedStrategy: Schema.optional(ReasoningStrategy), // for adaptive\n});\nexport type ReasoningMetadata = typeof ReasoningMetadataSchema.Type;\n\n// ─── Reasoning Result ───\n\nexport const ReasoningResultSchema = Schema.Struct({\n strategy: ReasoningStrategy,\n steps: Schema.Array(ReasoningStepSchema),\n output: Schema.Unknown,\n metadata: ReasoningMetadataSchema,\n status: ReasoningStatus,\n});\nexport type ReasoningResult = typeof ReasoningResultSchema.Type;\n\n// ─── Selection Context ───\n\nexport const SelectionContextSchema = Schema.Struct({\n taskDescription: Schema.String,\n taskType: Schema.String,\n complexity: Schema.Number, // 0-1\n urgency: Schema.Number, // 0-1\n costBudget: Schema.optional(Schema.Number),\n timeConstraint: Schema.optional(Schema.Number), // ms\n preferredStrategy: Schema.optional(ReasoningStrategy),\n});\nexport type SelectionContext = typeof SelectionContextSchema.Type;\n","// File: src/types/effectiveness.ts\nimport { Schema } from \"effect\";\nimport { ReasoningStrategy } from \"./reasoning.js\";\n\n// ─── Strategy Effectiveness Record ───\n\nexport const StrategyEffectivenessSchema = Schema.Struct({\n strategy: ReasoningStrategy,\n taskType: Schema.String,\n successRate: Schema.Number, // 0-1\n avgCost: Schema.Number,\n avgDuration: Schema.Number,\n avgConfidence: Schema.Number,\n executions: Schema.Number,\n lastUsed: Schema.DateFromSelf,\n});\nexport type StrategyEffectiveness = typeof StrategyEffectivenessSchema.Type;\n","// File: src/types/config.ts\nimport { Schema } from \"effect\";\nimport { ReasoningStrategy } from \"./reasoning.js\";\n\n// ─── Per-Strategy Configuration ───\n\nexport const ReactiveConfigSchema = Schema.Struct({\n maxIterations: Schema.Number.pipe(Schema.int(), Schema.positive()),\n temperature: Schema.Number,\n});\nexport type ReactiveConfig = typeof ReactiveConfigSchema.Type;\n\nexport const PlanExecuteConfigSchema = Schema.Struct({\n maxRefinements: Schema.Number.pipe(Schema.int(), Schema.positive()),\n reflectionDepth: Schema.Literal(\"shallow\", \"deep\"),\n});\nexport type PlanExecuteConfig = typeof PlanExecuteConfigSchema.Type;\n\nexport const TreeOfThoughtConfigSchema = Schema.Struct({\n breadth: Schema.Number.pipe(Schema.int(), Schema.positive()),\n depth: Schema.Number.pipe(Schema.int(), Schema.positive()),\n pruningThreshold: Schema.Number,\n});\nexport type TreeOfThoughtConfig = typeof TreeOfThoughtConfigSchema.Type;\n\nexport const ReflexionConfigSchema = Schema.Struct({\n maxRetries: Schema.Number.pipe(Schema.int(), Schema.positive()),\n selfCritiqueDepth: Schema.Literal(\"shallow\", \"deep\"),\n});\nexport type ReflexionConfig = typeof ReflexionConfigSchema.Type;\n\n// ─── Full Reasoning Config ───\n\nexport const ReasoningConfigSchema = Schema.Struct({\n defaultStrategy: ReasoningStrategy,\n adaptive: Schema.Struct({\n enabled: Schema.Boolean,\n learning: Schema.Boolean,\n }),\n strategies: Schema.Struct({\n reactive: ReactiveConfigSchema,\n planExecute: PlanExecuteConfigSchema,\n treeOfThought: TreeOfThoughtConfigSchema,\n reflexion: ReflexionConfigSchema,\n }),\n});\nexport type ReasoningConfig = typeof ReasoningConfigSchema.Type;\n\n// ─── Default Config ───\n\nexport const defaultReasoningConfig: ReasoningConfig = {\n defaultStrategy: \"reactive\",\n adaptive: { enabled: false, learning: false },\n strategies: {\n reactive: { maxIterations: 10, temperature: 0.7 },\n planExecute: { maxRefinements: 2, reflectionDepth: \"deep\" },\n treeOfThought: { breadth: 3, depth: 3, pruningThreshold: 0.5 },\n reflexion: { maxRetries: 3, selfCritiqueDepth: \"deep\" },\n },\n};\n","// File: src/errors/errors.ts\nimport { Data } from \"effect\";\n\n// ─── Base reasoning error ───\nexport class ReasoningError extends Data.TaggedError(\"ReasoningError\")<{\n readonly message: string;\n readonly cause?: unknown;\n}> {}\n\n// ─── Strategy not found in registry ───\nexport class StrategyNotFoundError extends Data.TaggedError(\n \"StrategyNotFoundError\",\n)<{\n readonly strategy: string;\n}> {}\n\n// ─── Strategy selection failed ───\nexport class SelectionError extends Data.TaggedError(\"SelectionError\")<{\n readonly message: string;\n readonly context?: unknown;\n}> {}\n\n// ─── Strategy execution failed ───\nexport class ExecutionError extends Data.TaggedError(\"ExecutionError\")<{\n readonly strategy: string;\n readonly message: string;\n readonly step?: number;\n readonly cause?: unknown;\n}> {}\n\n// ─── Max iterations / depth exceeded ───\nexport class IterationLimitError extends Data.TaggedError(\n \"IterationLimitError\",\n)<{\n readonly strategy: string;\n readonly limit: number;\n readonly stepsCompleted: number;\n}> {}\n\n// ─── Union type for service signatures ───\nexport type ReasoningErrors =\n | ReasoningError\n | StrategyNotFoundError\n | SelectionError\n | ExecutionError\n | IterationLimitError;\n","// File: src/services/reasoning-service.ts\nimport { Context, Effect, Layer } from \"effect\";\nimport type {\n ReasoningResult,\n ReasoningStrategy,\n} from \"../types/index.js\";\nimport type { ReasoningConfig } from \"../types/config.js\";\nimport { defaultReasoningConfig } from \"../types/config.js\";\nimport { StrategyRegistry, type StrategyFn } from \"./strategy-registry.js\";\nimport type { ReasoningErrors } from \"../errors/errors.js\";\nimport { LLMService } from \"@reactive-agents/llm-provider\";\n\n// ─── Service Tag ───\n\nexport class ReasoningService extends Context.Tag(\"ReasoningService\")<\n ReasoningService,\n {\n /**\n * Execute reasoning on a task.\n * If `strategy` is provided, uses that strategy directly.\n * Otherwise uses the configured default strategy.\n */\n readonly execute: (params: {\n readonly taskDescription: string;\n readonly taskType: string;\n readonly memoryContext: string;\n readonly availableTools: readonly string[];\n readonly strategy?: ReasoningStrategy;\n }) => Effect.Effect<ReasoningResult, ReasoningErrors>;\n\n /** Register a custom strategy function. */\n readonly registerStrategy: (\n name: ReasoningStrategy,\n fn: StrategyFn,\n ) => Effect.Effect<void>;\n }\n>() {}\n\n// ─── Live Layer ───\n// Requires: StrategyRegistry, LLMService\n\nexport const ReasoningServiceLive = (\n config: ReasoningConfig = defaultReasoningConfig,\n) =>\n Layer.effect(\n ReasoningService,\n Effect.gen(function* () {\n const registry = yield* StrategyRegistry;\n // Capture LLMService at layer construction time so we can provide\n // it to strategy functions when executing them.\n const llmService = yield* LLMService;\n const llmLayer = Layer.succeed(LLMService, llmService);\n\n return {\n execute: (params) =>\n Effect.gen(function* () {\n // ── Determine which strategy to use ──\n const strategyName: ReasoningStrategy =\n params.strategy ?? config.defaultStrategy;\n\n // ── Get strategy function from registry ──\n const strategyFn = yield* registry.get(strategyName);\n\n // ── Execute strategy, providing LLMService ──\n const result = yield* strategyFn({\n ...params,\n config,\n }).pipe(Effect.provide(llmLayer));\n\n return result;\n }),\n\n registerStrategy: (name, fn) => registry.register(name, fn),\n };\n }),\n );\n","// File: src/services/strategy-registry.ts\nimport { Context, Effect, Layer, Ref } from \"effect\";\nimport type { ReasoningResult, ReasoningStrategy } from \"../types/index.js\";\nimport type { ReasoningConfig } from \"../types/config.js\";\nimport {\n StrategyNotFoundError,\n type ExecutionError,\n type IterationLimitError,\n} from \"../errors/errors.js\";\nimport type { LLMService } from \"@reactive-agents/llm-provider\";\nimport { executeReactive } from \"../strategies/reactive.js\";\nimport { executeReflexion } from \"../strategies/reflexion.js\";\n\n// ─── Strategy function type ───\n\nexport type StrategyFn = (input: {\n readonly taskDescription: string;\n readonly taskType: string;\n readonly memoryContext: string;\n readonly availableTools: readonly string[];\n readonly config: ReasoningConfig;\n}) => Effect.Effect<\n ReasoningResult,\n ExecutionError | IterationLimitError,\n LLMService\n>;\n\n// ─── Service Tag ───\n\nexport class StrategyRegistry extends Context.Tag(\"StrategyRegistry\")<\n StrategyRegistry,\n {\n readonly get: (\n name: ReasoningStrategy,\n ) => Effect.Effect<StrategyFn, StrategyNotFoundError>;\n\n readonly register: (\n name: ReasoningStrategy,\n fn: StrategyFn,\n ) => Effect.Effect<void>;\n\n readonly list: () => Effect.Effect<readonly ReasoningStrategy[]>;\n }\n>() {}\n\n// ─── Live Layer (Phase 1: reactive only) ───\n\nexport const StrategyRegistryLive = Layer.effect(\n StrategyRegistry,\n Effect.gen(function* () {\n // Ref-based mutable map of strategies\n const registryRef = yield* Ref.make<Map<string, StrategyFn>>(\n new Map<string, StrategyFn>([\n [\"reactive\", executeReactive],\n [\"reflexion\", executeReflexion],\n ]),\n );\n\n return {\n get: (name) =>\n Effect.gen(function* () {\n const registry = yield* Ref.get(registryRef);\n const fn = registry.get(name);\n if (!fn) {\n return yield* Effect.fail(\n new StrategyNotFoundError({ strategy: name }),\n );\n }\n return fn;\n }),\n\n register: (name, fn) =>\n Ref.update(registryRef, (m) => {\n const next = new Map(m);\n next.set(name, fn);\n return next;\n }),\n\n list: () =>\n Ref.get(registryRef).pipe(\n Effect.map((m) => Array.from(m.keys()) as ReasoningStrategy[]),\n ),\n };\n }),\n);\n","// File: src/strategies/reactive.ts\nimport { Effect } from \"effect\";\nimport { ulid } from \"ulid\";\nimport type { ReasoningResult, ReasoningStep } from \"../types/index.js\";\nimport type { StepId } from \"../types/step.js\";\nimport { ExecutionError, IterationLimitError } from \"../errors/errors.js\";\nimport type { ReasoningConfig } from \"../types/config.js\";\nimport { LLMService } from \"@reactive-agents/llm-provider\";\nimport { ToolService } from \"@reactive-agents/tools\";\nimport type { ToolDefinition, ToolOutput } from \"@reactive-agents/tools\";\n\ninterface ReactiveInput {\n readonly taskDescription: string;\n readonly taskType: string;\n readonly memoryContext: string;\n readonly availableTools: readonly string[];\n readonly config: ReasoningConfig;\n}\n\n/**\n * ReAct loop: Thought -> Action -> Observation, iterating until done.\n *\n * When ToolService is available in context, ACTION calls are executed\n * against real registered tools and results are fed back as observations.\n * Without ToolService, tool calls are noted as unavailable.\n */\nexport const executeReactive = (\n input: ReactiveInput,\n): Effect.Effect<\n ReasoningResult,\n ExecutionError | IterationLimitError,\n LLMService\n> =>\n Effect.gen(function* () {\n const llm = yield* LLMService;\n // ToolService is optional — reasoning works with or without tools\n const toolServiceOptRaw = yield* Effect.serviceOption(ToolService);\n const toolServiceOpt = toolServiceOptRaw as\n | { _tag: \"Some\"; value: ToolServiceInstance }\n | { _tag: \"None\" };\n const maxIter = input.config.strategies.reactive.maxIterations;\n const temp = input.config.strategies.reactive.temperature;\n const steps: ReasoningStep[] = [];\n const start = Date.now();\n\n let context = buildInitialContext(input);\n let iteration = 0;\n let totalTokens = 0;\n let totalCost = 0;\n\n while (iteration < maxIter) {\n // ── THOUGHT ──\n const thoughtResponse = yield* llm\n .complete({\n messages: [\n { role: \"user\", content: buildThoughtPrompt(context, steps) },\n ],\n systemPrompt: `You are a reasoning agent. Task: ${input.taskDescription}`,\n maxTokens: 300,\n temperature: temp,\n })\n .pipe(\n Effect.mapError(\n (err) =>\n new ExecutionError({\n strategy: \"reactive\",\n message: `LLM thought failed at iteration ${iteration}`,\n step: iteration,\n cause: err,\n }),\n ),\n );\n\n const thought = thoughtResponse.content;\n totalTokens += thoughtResponse.usage.totalTokens;\n totalCost += thoughtResponse.usage.estimatedCost;\n\n steps.push({\n id: ulid() as StepId,\n type: \"thought\",\n content: thought,\n timestamp: new Date(),\n });\n\n // ── CHECK: does the thought indicate a final answer? ──\n if (hasFinalAnswer(thought)) {\n return buildResult(\n steps,\n thought,\n \"completed\",\n start,\n totalTokens,\n totalCost,\n );\n }\n\n // ── ACTION: does the thought request a tool call? ──\n const toolRequest = parseToolRequest(thought);\n if (toolRequest) {\n steps.push({\n id: ulid() as StepId,\n type: \"action\",\n content: JSON.stringify(toolRequest),\n timestamp: new Date(),\n metadata: { toolUsed: toolRequest.tool },\n });\n\n // Execute tool via ToolService (real result) or note as unavailable\n const observationContent = yield* runToolObservation(\n toolServiceOpt,\n toolRequest,\n input,\n );\n\n steps.push({\n id: ulid() as StepId,\n type: \"observation\",\n content: observationContent,\n timestamp: new Date(),\n });\n\n // Feed real observation back into context for next iteration\n context = appendToContext(\n context,\n `${thought}\\nObservation: ${observationContent}`,\n );\n } else {\n context = appendToContext(context, thought);\n }\n\n iteration++;\n }\n\n // Max iterations reached — return partial result\n return buildResult(steps, null, \"partial\", start, totalTokens, totalCost);\n });\n\n// ─── Local type alias for the ToolService interface ───\n\ntype ToolServiceInstance = {\n readonly execute: (input: {\n toolName: string;\n arguments: Record<string, unknown>;\n agentId: string;\n sessionId: string;\n }) => Effect.Effect<ToolOutput, unknown>;\n readonly getTool: (name: string) => Effect.Effect<ToolDefinition, unknown>;\n};\n\n// ─── Tool execution (called from inside Effect.gen, no extra requirements) ───\n\nfunction runToolObservation(\n toolServiceOpt: { _tag: \"Some\"; value: ToolServiceInstance } | { _tag: \"None\" },\n toolRequest: { tool: string; input: string },\n _input: ReactiveInput,\n): Effect.Effect<string, never> {\n if (toolServiceOpt._tag === \"None\") {\n return Effect.succeed(\n `[Tool \"${toolRequest.tool}\" requested but ToolService is not available — add .withTools() to agent builder]`,\n );\n }\n\n const toolService = toolServiceOpt.value;\n\n return Effect.gen(function* () {\n // Parse args: try JSON first, fall back to first-param string mapping\n const args = yield* resolveToolArgs(toolService, toolRequest);\n\n const result = yield* toolService\n .execute({\n toolName: toolRequest.tool,\n arguments: args,\n agentId: \"reasoning-agent\",\n sessionId: \"reasoning-session\",\n })\n .pipe(\n Effect.map((r: ToolOutput) =>\n typeof r.result === \"string\" ? r.result : JSON.stringify(r.result),\n ),\n Effect.catchAll((e) => {\n const msg =\n e instanceof Error\n ? e.message\n : typeof e === \"object\" && e !== null && \"message\" in e\n ? String((e as { message: unknown }).message)\n : String(e);\n return Effect.succeed(`[Tool error: ${msg}]`);\n }),\n );\n\n return result;\n }).pipe(\n Effect.catchAll((e) =>\n Effect.succeed(`[Unexpected error executing tool: ${String(e)}]`),\n ),\n );\n}\n\nfunction resolveToolArgs(\n toolService: ToolServiceInstance,\n toolRequest: { tool: string; input: string },\n): Effect.Effect<Record<string, unknown>, never> {\n const trimmed = toolRequest.input.trim();\n\n // Try JSON object/array parsing\n if (trimmed.startsWith(\"{\") || trimmed.startsWith(\"[\")) {\n try {\n const parsed = JSON.parse(trimmed);\n if (typeof parsed === \"object\" && parsed !== null && !Array.isArray(parsed)) {\n return Effect.succeed(parsed as Record<string, unknown>);\n }\n } catch {\n // Fall through to parameter mapping\n }\n }\n\n // Map raw string to first required parameter of the tool definition\n return toolService\n .getTool(toolRequest.tool)\n .pipe(\n Effect.map((toolDef: ToolDefinition) => {\n const firstParam =\n toolDef.parameters.find((p: { required?: boolean }) => p.required) ?? toolDef.parameters[0];\n if (firstParam) {\n return { [firstParam.name]: trimmed } as Record<string, unknown>;\n }\n return { input: trimmed } as Record<string, unknown>;\n }),\n Effect.catchAll(() =>\n Effect.succeed({ input: trimmed } as Record<string, unknown>),\n ),\n );\n}\n\n// ─── Helpers (private to module) ───\n\nfunction buildInitialContext(input: ReactiveInput): string {\n const toolsSection =\n input.availableTools.length > 0\n ? `Available Tools: ${input.availableTools.join(\", \")}\\nTo use a tool: ACTION: tool_name({\"param\": \"value\"}) — use JSON for tool arguments.`\n : \"No tools available for this task.\";\n return [\n `Task: ${input.taskDescription}`,\n `Task Type: ${input.taskType}`,\n `Relevant Memory:\\n${input.memoryContext}`,\n toolsSection,\n ].join(\"\\n\\n\");\n}\n\nfunction buildThoughtPrompt(\n context: string,\n history: readonly ReasoningStep[],\n): string {\n const historyStr = history.map((s) => `[${s.type}] ${s.content}`).join(\"\\n\");\n return `${context}\\n\\nPrevious steps:\\n${historyStr}\\n\\nThink step-by-step. If you need a tool, respond with \"ACTION: tool_name({\"param\": \"value\"})\". If you have a final answer, respond with \"FINAL ANSWER: ...\".`;\n}\n\nfunction hasFinalAnswer(thought: string): boolean {\n return /final answer:/i.test(thought);\n}\n\nfunction parseToolRequest(\n thought: string,\n): { tool: string; input: string } | null {\n // Greedy match to handle JSON in the argument (which may contain parentheses)\n const match = thought.match(/ACTION:\\s*([\\w-]+)\\((.+)\\)/is);\n return match ? { tool: match[1], input: match[2] } : null;\n}\n\nfunction appendToContext(context: string, addition: string): string {\n return `${context}\\n\\n${addition}`;\n}\n\nfunction buildResult(\n steps: readonly ReasoningStep[],\n output: unknown,\n status: \"completed\" | \"partial\",\n startMs: number,\n tokensUsed: number,\n cost: number,\n): ReasoningResult {\n return {\n strategy: \"reactive\",\n steps: [...steps],\n output,\n metadata: {\n duration: Date.now() - startMs,\n cost,\n tokensUsed,\n stepsCount: steps.length,\n confidence: status === \"completed\" ? 0.8 : 0.4,\n },\n status,\n };\n}\n","// File: src/strategies/reflexion.ts\n/**\n * Reflexion Strategy — Generate → Reflect → Improve loop.\n *\n * Based on the Reflexion paper (Shinn et al., 2023).\n * The agent:\n * 1. Generates an initial response (attempt)\n * 2. Self-critiques the response to identify gaps/errors\n * 3. Improves the response using the critique as feedback\n * 4. Repeats until maxRetries reached or the critique is satisfied\n */\nimport { Effect } from \"effect\";\nimport { ulid } from \"ulid\";\nimport type { ReasoningResult, ReasoningStep } from \"../types/index.js\";\nimport type { StepId } from \"../types/step.js\";\nimport { ExecutionError, IterationLimitError } from \"../errors/errors.js\";\nimport type { ReasoningConfig } from \"../types/config.js\";\nimport { LLMService } from \"@reactive-agents/llm-provider\";\n\ninterface ReflexionInput {\n readonly taskDescription: string;\n readonly taskType: string;\n readonly memoryContext: string;\n readonly availableTools: readonly string[];\n readonly config: ReasoningConfig;\n}\n\n/**\n * Reflexion: Generate → Self-Critique → Improve, repeating until satisfied\n * or maxRetries is reached.\n */\nexport const executeReflexion = (\n input: ReflexionInput,\n): Effect.Effect<\n ReasoningResult,\n ExecutionError | IterationLimitError,\n LLMService\n> =>\n Effect.gen(function* () {\n const llm = yield* LLMService;\n const { maxRetries, selfCritiqueDepth } = input.config.strategies.reflexion;\n const steps: ReasoningStep[] = [];\n const start = Date.now();\n let totalTokens = 0;\n let totalCost = 0;\n let attempt = 0;\n let previousCritiques: string[] = [];\n\n // ── STEP 1: Initial generation ──\n const initialResponse = yield* llm\n .complete({\n messages: [\n {\n role: \"user\",\n content: buildGenerationPrompt(input, null),\n },\n ],\n systemPrompt: buildSystemPrompt(input.taskDescription),\n maxTokens: selfCritiqueDepth === \"deep\" ? 800 : 500,\n temperature: 0.7,\n })\n .pipe(\n Effect.mapError(\n (err) =>\n new ExecutionError({\n strategy: \"reflexion\",\n message: \"Initial generation failed\",\n step: 0,\n cause: err,\n }),\n ),\n );\n\n let currentResponse = initialResponse.content;\n totalTokens += initialResponse.usage.totalTokens;\n totalCost += initialResponse.usage.estimatedCost;\n\n steps.push({\n id: ulid() as StepId,\n type: \"thought\",\n content: `[ATTEMPT 1] ${currentResponse}`,\n timestamp: new Date(),\n });\n\n // ── LOOP: Reflect → Improve ──\n while (attempt < maxRetries) {\n attempt++;\n\n // ── Reflect: self-critique the current response ──\n const critiqueResponse = yield* llm\n .complete({\n messages: [\n {\n role: \"user\",\n content: buildCritiquePrompt(\n input.taskDescription,\n currentResponse,\n selfCritiqueDepth,\n previousCritiques,\n ),\n },\n ],\n systemPrompt:\n \"You are a critical evaluator. Analyze responses for accuracy, completeness, and quality.\",\n maxTokens: selfCritiqueDepth === \"deep\" ? 600 : 300,\n temperature: 0.3, // low temp for objective critique\n })\n .pipe(\n Effect.mapError(\n (err) =>\n new ExecutionError({\n strategy: \"reflexion\",\n message: `Self-critique failed at attempt ${attempt}`,\n step: attempt,\n cause: err,\n }),\n ),\n );\n\n const critique = critiqueResponse.content;\n totalTokens += critiqueResponse.usage.totalTokens;\n totalCost += critiqueResponse.usage.estimatedCost;\n\n steps.push({\n id: ulid() as StepId,\n type: \"observation\",\n content: `[CRITIQUE ${attempt}] ${critique}`,\n timestamp: new Date(),\n });\n\n // ── Check if satisfied ──\n if (isSatisfied(critique)) {\n return buildResult(\n steps,\n currentResponse,\n \"completed\",\n start,\n totalTokens,\n totalCost,\n attempt,\n );\n }\n\n previousCritiques.push(critique);\n\n // ── Improve: generate a refined response ──\n const improvedResponse = yield* llm\n .complete({\n messages: [\n {\n role: \"user\",\n content: buildGenerationPrompt(input, previousCritiques),\n },\n ],\n systemPrompt: buildSystemPrompt(input.taskDescription),\n maxTokens: selfCritiqueDepth === \"deep\" ? 800 : 500,\n temperature: 0.6,\n })\n .pipe(\n Effect.mapError(\n (err) =>\n new ExecutionError({\n strategy: \"reflexion\",\n message: `Improvement generation failed at attempt ${attempt}`,\n step: attempt,\n cause: err,\n }),\n ),\n );\n\n currentResponse = improvedResponse.content;\n totalTokens += improvedResponse.usage.totalTokens;\n totalCost += improvedResponse.usage.estimatedCost;\n\n steps.push({\n id: ulid() as StepId,\n type: \"thought\",\n content: `[ATTEMPT ${attempt + 1}] ${currentResponse}`,\n timestamp: new Date(),\n });\n }\n\n // Max retries reached — return the best response so far\n return buildResult(\n steps,\n currentResponse,\n \"partial\",\n start,\n totalTokens,\n totalCost,\n attempt,\n );\n });\n\n// ─── Private Helpers ───\n\nfunction buildSystemPrompt(taskDescription: string): string {\n return `You are a thoughtful reasoning agent. Your task is: ${taskDescription}\\nProvide clear, accurate, and complete responses.`;\n}\n\nfunction buildGenerationPrompt(\n input: ReflexionInput,\n previousCritiques: string[] | null,\n): string {\n const parts: string[] = [\n `Task: ${input.taskDescription}`,\n `Task Type: ${input.taskType}`,\n ];\n\n if (input.memoryContext) {\n parts.push(`Relevant Context:\\n${input.memoryContext}`);\n }\n\n if (previousCritiques && previousCritiques.length > 0) {\n parts.push(\n `Previous attempts had these issues:\\n${previousCritiques.map((c, i) => `${i + 1}. ${c}`).join(\"\\n\")}\\n\\nPlease address all of these issues in your improved response.`,\n );\n }\n\n parts.push(\n \"Provide a thorough and accurate response to the task above.\",\n );\n\n return parts.join(\"\\n\\n\");\n}\n\nfunction buildCritiquePrompt(\n taskDescription: string,\n response: string,\n depth: \"shallow\" | \"deep\",\n previousCritiques: string[],\n): string {\n const deepInstructions =\n depth === \"deep\"\n ? \"\\n- Check for logical consistency and coherence\\n- Identify any unsupported claims or assumptions\\n- Assess whether all aspects of the task are addressed\"\n : \"\";\n\n const prevCritiqueNote =\n previousCritiques.length > 0\n ? `\\n\\nPrevious critiques identified these issues:\\n${previousCritiques.map((c, i) => `${i + 1}. ${c}`).join(\"\\n\")}\\n\\nFocus on whether the new response adequately addresses these.`\n : \"\";\n\n return `Task: ${taskDescription}\n\nResponse to evaluate:\n${response}\n\nCritically evaluate this response. Identify:\n- Factual errors or inaccuracies\n- Missing information or incomplete answers\n- Unclear or ambiguous statements${deepInstructions}${prevCritiqueNote}\n\nIf the response is accurate and complete, start your critique with \"SATISFIED:\".\nOtherwise, clearly list the specific issues that need to be fixed.`;\n}\n\nfunction isSatisfied(critique: string): boolean {\n return /^SATISFIED:/i.test(critique.trim());\n}\n\nfunction buildResult(\n steps: readonly ReasoningStep[],\n output: string,\n status: \"completed\" | \"partial\",\n startMs: number,\n tokensUsed: number,\n cost: number,\n iterations: number,\n): ReasoningResult {\n // Confidence is higher when fewer iterations were needed\n const maxNormal = 3;\n const confidence =\n status === \"completed\"\n ? Math.max(0.6, 1 - (iterations / maxNormal) * 0.3)\n : 0.4;\n\n return {\n strategy: \"reflexion\",\n steps: [...steps],\n output,\n metadata: {\n duration: Date.now() - startMs,\n cost,\n tokensUsed,\n stepsCount: steps.length,\n confidence,\n },\n status,\n };\n}\n","// File: src/runtime.ts\nimport { Layer } from \"effect\";\nimport type { ReasoningConfig } from \"./types/config.js\";\nimport { defaultReasoningConfig } from \"./types/config.js\";\nimport { StrategyRegistryLive } from \"./services/strategy-registry.js\";\nimport { ReasoningServiceLive } from \"./services/reasoning-service.js\";\n\n/**\n * Create the full Reasoning layer (Phase 1: reactive only).\n *\n * Provides: ReasoningService, StrategyRegistry\n * Requires: LLMService (from Layer 1.5)\n *\n * Usage:\n * const ReasoningLive = createReasoningLayer();\n * const program = myEffect.pipe(Effect.provide(ReasoningLive));\n */\nexport const createReasoningLayer = (\n config: ReasoningConfig = defaultReasoningConfig,\n) => {\n // StrategyRegistry has no deps (strategies are registered at construction)\n const RegistryLayer = StrategyRegistryLive;\n\n // ReasoningService needs StrategyRegistry\n const ServiceLayer = ReasoningServiceLive(config).pipe(\n Layer.provide(RegistryLayer),\n );\n\n // Merge all services into one layer\n return Layer.mergeAll(ServiceLayer, RegistryLayer);\n};\n"],"mappings":";AACA,SAAS,cAAc;AAIhB,IAAM,SAAS,OAAO,OAAO,KAAK,OAAO,MAAM,QAAQ,CAAC;AAKxD,IAAM,WAAW,OAAO;AAAA,EAC7B;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AAAA,EACA;AAAA;AACF;AAKO,IAAM,qBAAqB,OAAO,OAAO;AAAA,EAC9C,YAAY,OAAO,SAAS,OAAO,MAAM;AAAA,EACzC,UAAU,OAAO,SAAS,OAAO,MAAM;AAAA,EACvC,MAAM,OAAO,SAAS,OAAO,MAAM;AAAA,EACnC,UAAU,OAAO,SAAS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,SAAS,cAAc,aAAa;AACnD;","names":["Schema","Schema","Schema","Schema","Schema","Schema","Context","Effect","Layer","Effect","Effect","ulid","LLMService","Effect","ulid","buildResult","Effect","LLMService","Context","Layer","Effect","Layer","Layer"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactive-agents/reasoning",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"effect": "^3.10.0",
|
|
15
15
|
"@reactive-agents/core": "0.1.0",
|
|
16
|
-
"@reactive-agents/llm-provider": "0.1.
|
|
16
|
+
"@reactive-agents/llm-provider": "0.1.1",
|
|
17
|
+
"@reactive-agents/tools": "0.1.1",
|
|
17
18
|
"ulid": "^2.3.0"
|
|
18
19
|
},
|
|
19
20
|
"devDependencies": {
|