@moldea.ai/adapter-langchain 3.0.1 → 3.0.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.
package/README.md CHANGED
@@ -19,7 +19,7 @@ const core = createCore({ adapters: [langChainAdapter] });
19
19
 
20
20
  ## Verified target
21
21
 
22
- Version `3.0.1` supports Repository Format `1`, `@moldea.ai/core ^4.0.0`, and declared ranges that intersect `langchain >=1.5.9` with companion `@langchain/core >=1.2.8`. Those minimum versions are verified. Later stable releases are eligible for deterministic inspection on a best-effort basis and must still match the documented source patterns. Qualification evidence records the exact package versions and date used for each execution. The target recognizes:
22
+ Version `3.0.3` supports Repository Format `1`, `@moldea.ai/core ^4.0.0`, and declared ranges that intersect `langchain >=1.5.9` with companion `@langchain/core >=1.2.8`. Those minimum versions are verified. Later stable releases are eligible for deterministic inspection on a best-effort basis and must still match the documented source patterns. Qualification evidence records the exact package versions and date used for each execution. The target recognizes:
23
23
 
24
24
  - directly exported package-root `createAgent(...)` definitions
25
25
  - direct instruction-loader calls and `SystemMessage` construction
@@ -35,6 +35,10 @@ The package exports only `langChainAdapter`. It has no default export, configura
35
35
 
36
36
  ## Documentation
37
37
 
38
+ - [Complete binding example](docs/binding-example.md): manifest, canonical instructions, runtime source, and supported schema or routing relationships.
39
+
40
+ These guides are included in the installed package. Open only the page relevant to your task.
41
+
38
42
  - [Package overview](docs/index.md)
39
43
  - [Verified target](docs/verified-target.md)
40
44
  - [Evidence and diagnostics](docs/evidence-and-diagnostics.md)
@@ -0,0 +1,155 @@
1
+ ---
2
+ title: Binding example
3
+ description: Complete manifest and source files for inspecting langchain bindings locally.
4
+ order: 5
5
+ ---
6
+
7
+ # Binding example
8
+
9
+ Read this example before searching adapter implementation for binding syntax. It is a complete **static inspection** file set, not a deployment starter or a live provider test. The files are checked together through this adapter and Core without installing or executing the target SDK. Keep application setup, credentials, provider model access, tool execution, and deployment configuration separate.
10
+
11
+ ## How the bindings connect
12
+
13
+ Bind the exported `createAgent` result. `systemPrompt` calls the canonical loader, `responseFormat` uses the bound agent output schema, and each tool has a distinct implementation, registration, and input schema. The example uses no middleware: unknown middleware can leave relationships unresolved. This target does not establish handoff, agent input-schema, or tool output-schema evidence.
14
+
15
+ Paths below are repository-root-relative logical paths. Keep the canonical instructions as the policy source. General manifest semantics belong to the [Repository Format specification](https://packages.moldea.ai/repository-format/). Use the other local guides for the full supported boundary and limitations; this example does not expand them.
16
+
17
+ ## Files
18
+
19
+ <!-- example:start -->
20
+
21
+ ### /moldea/moldea.yaml
22
+
23
+ ```yaml
24
+ version: 1
25
+ agents:
26
+ support:
27
+ runtime:
28
+ id: 'langchain'
29
+ bindings:
30
+ runtimeAgent:
31
+ path: '/src/agent.ts'
32
+ symbol: 'supportAgent'
33
+ instructionLoader:
34
+ path: '/src/instructions.ts'
35
+ symbol: 'loadSupportInstruction'
36
+ outputSchema:
37
+ path: '/src/contracts.ts'
38
+ symbol: 'SupportOutputSchema'
39
+ tools:
40
+ find-order:
41
+ name: 'find_order'
42
+ description: 'Finds an order.'
43
+ implementation:
44
+ path: '/src/implementations.ts'
45
+ symbol: 'findOrder'
46
+ registration:
47
+ path: '/src/tools.ts'
48
+ symbol: 'findOrderTool'
49
+ inputSchema:
50
+ path: '/src/contracts.ts'
51
+ symbol: 'FindOrderInputSchema'
52
+ ```
53
+
54
+ ### /package.json
55
+
56
+ ```json
57
+ {
58
+ "dependencies": {
59
+ "@langchain/core": "~1.2.8",
60
+ "langchain": "~1.5.9",
61
+ "zod": "4.6.4"
62
+ },
63
+ "name": "binding-example",
64
+ "private": true,
65
+ "type": "module"
66
+ }
67
+ ```
68
+
69
+ ### /moldea/project.md
70
+
71
+ ```markdown
72
+ # Fixture project
73
+ ```
74
+
75
+ ### /moldea/agents/support/description.md
76
+
77
+ ```markdown
78
+ Supports customers.
79
+ ```
80
+
81
+ ### /moldea/agents/support/instruction.md
82
+
83
+ ```markdown
84
+ You are the `support` agent.
85
+
86
+ Answer from supplied support facts. Do not invent order status or account information.
87
+ ```
88
+
89
+ ### /src/contracts.ts
90
+
91
+ ```typescript
92
+ import { z } from 'zod';
93
+
94
+ // response and tool contracts
95
+ export const SupportOutputSchema = z.object({ summary: z.string() });
96
+ export const FindOrderInputSchema = z.object({ orderId: z.string() });
97
+ ```
98
+
99
+ ### /src/instructions.ts
100
+
101
+ ```typescript
102
+ import { readFileSync } from 'node:fs';
103
+
104
+ /** Reads the canonical support instruction. */
105
+ export const loadSupportInstruction = (): string =>
106
+ readFileSync(new URL('../moldea/agents/support/instruction.md', import.meta.url), 'utf8');
107
+ ```
108
+
109
+ ### /src/implementations.ts
110
+
111
+ ```typescript
112
+ /** Looks up an order in the example's fixed catalog. */
113
+ export const findOrder = async ({ orderId }: { orderId: string }) => ({
114
+ orderId,
115
+ status: orderId === 'order-1042' ? ('shipped' as const) : ('not_found' as const),
116
+ });
117
+ ```
118
+
119
+ ### /src/tools.ts
120
+
121
+ ```typescript
122
+ import { tool } from '@langchain/core/tools';
123
+ import { FindOrderInputSchema } from './contracts.js';
124
+ import { findOrder } from './implementations.js';
125
+ export const findOrderTool = tool(findOrder, {
126
+ name: 'find_order',
127
+ description: 'Finds an order.',
128
+ schema: FindOrderInputSchema,
129
+ });
130
+ ```
131
+
132
+ ### /src/agent.ts
133
+
134
+ ```typescript
135
+ import { createAgent, providerStrategy, SystemMessage } from 'langchain';
136
+ import { SupportOutputSchema } from './contracts.js';
137
+ import { loadSupportInstruction } from './instructions.js';
138
+ import { findOrderTool } from './tools.js';
139
+ const MIDDLEWARE = [];
140
+ const TOOLS = [findOrderTool];
141
+ export const supportAgent = createAgent({
142
+ model: 'openai:gpt-4o',
143
+ name: 'support-runtime',
144
+ systemPrompt: new SystemMessage(loadSupportInstruction()),
145
+ responseFormat: providerStrategy({ schema: SupportOutputSchema, strict: true }),
146
+ middleware: MIDDLEWARE,
147
+ tools: TOOLS,
148
+ });
149
+ ```
150
+
151
+ <!-- example:end -->
152
+
153
+ ## What the check establishes
154
+
155
+ The integration check reads these exact file blocks, requires positive adapter evidence for the documented relationships, and rejects a broken runtime binding. It does not prove that instructions are followed, that every SDK version accepts these forms, or that the application is ready for production. Continue using the installed adapter diagnostics for your actual source.
@@ -0,0 +1,32 @@
1
+ ---
2
+ title: Evidence and diagnostics
3
+ description: Source-grounded LangChain observations and stable adapter failures.
4
+ order: 20
5
+ ---
6
+
7
+ # Evidence and diagnostics
8
+
9
+ The adapter may emit `runtime-package`, `language`, `agent-definition`, `instruction-loader`, `schema`, and `tool-registration` evidence. Dynamic, middleware-influenced, multi-schema, or otherwise unresolved forms suppress optimistic evidence and contradiction diagnostics that would require guessing runtime behavior.
10
+
11
+ ## Stable diagnostics
12
+
13
+ | Code | Message |
14
+ | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------- |
15
+ | `LANGCHAIN_PACKAGE_MANIFEST_INVALID` | The owning package manifest is invalid for LangChain dependency detection. |
16
+ | `LANGCHAIN_VERSION_UNSUPPORTED` | The observed LangChain package ranges are disjoint from the supported target. |
17
+ | `LANGCHAIN_SOURCE_TEXT_INVALID` | The referenced LangChain source file is not valid normalized text. |
18
+ | `LANGCHAIN_SOURCE_SYNTAX_INVALID` | The referenced LangChain source file contains invalid TypeScript syntax. |
19
+ | `LANGCHAIN_RUNTIME_AGENT_SYMBOL_NOT_FOUND` | The declared runtime-agent symbol was not found. |
20
+ | `LANGCHAIN_INSTRUCTION_LOADER_SYMBOL_NOT_FOUND` | The declared instruction-loader symbol was not found. |
21
+ | `LANGCHAIN_AGENT_OUTPUT_SCHEMA_SYMBOL_NOT_FOUND` | The declared agent output-schema symbol was not found. |
22
+ | `LANGCHAIN_TOOL_IMPLEMENTATION_SYMBOL_NOT_FOUND` | The declared tool-implementation symbol was not found. |
23
+ | `LANGCHAIN_TOOL_REGISTRATION_SYMBOL_NOT_FOUND` | The declared tool-registration symbol was not found. |
24
+ | `LANGCHAIN_TOOL_INPUT_SCHEMA_SYMBOL_NOT_FOUND` | The declared tool input-schema symbol was not found. |
25
+ | `LANGCHAIN_INSTRUCTION_LOADER_NOT_WIRED` | The declared instruction loader is not wired to the detected LangChain agent. |
26
+ | `LANGCHAIN_AGENT_OUTPUT_SCHEMA_NOT_WIRED` | The declared agent output schema is not wired to the detected LangChain structured-output configuration. |
27
+ | `LANGCHAIN_TOOL_IMPLEMENTATION_NOT_WIRED` | The declared tool implementation is not wired to the detected LangChain function tool. |
28
+ | `LANGCHAIN_TOOL_REGISTRATION_NOT_WIRED` | The declared tool registration is not available to the detected LangChain agent. |
29
+ | `LANGCHAIN_TOOL_NAME_MISMATCH` | The declared tool name does not match the detected LangChain tool name. |
30
+ | `LANGCHAIN_TOOL_INPUT_SCHEMA_NOT_WIRED` | The declared tool input schema is not wired to the detected LangChain function tool. |
31
+
32
+ Diagnostics never include source snippets, descriptions, instructions, schema contents, credentials, URLs, host paths, package declarations that are not valid SemVer ranges, or raw TypeScript diagnostic messages.
package/docs/index.md ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: LangChain adapter
3
+ description: Deterministic evidence for LangChain TypeScript createAgent applications.
4
+ order: 1
5
+ ---
6
+
7
+ # LangChain adapter
8
+
9
+ `@moldea.ai/adapter-langchain` connects Repository Format `1` declarations to static LangChain `createAgent` forms. `langchain` `1.5.9` and companion `@langchain/core` `1.2.8` are the verified minimums. Later stable releases are eligible for deterministic inspection on a best-effort basis and must still match the documented source patterns.
10
+
11
+ The adapter begins at each declared runtime-agent path, finds its nearest owning package, checks the primary and companion declarations together, and returns immutable evidence and stable diagnostics through Core. It does not execute the application or treat package presence as proof of an agent definition.
12
+
13
+ The package exports only `langChainAdapter`. The generated API reference derives that surface from the package export.
14
+
15
+ Start with the [complete binding example](https://packages.moldea.ai/adapters/langchain/binding-example/) when connecting runtime source to canonical instructions, schemas, tools, or routing metadata. The same example ships locally as `docs/binding-example.md` in the installed package.
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Limitations
3
+ description: Conservative boundaries of the initial LangChain adapter target.
4
+ order: 30
5
+ ---
6
+
7
+ # Limitations
8
+
9
+ The initial target intentionally excludes JavaScript and CommonJS, configuration objects passed by reference, wrapper factories, re-exports, path aliases, package barrels, legacy agent executors, direct LangGraph graphs, Deep Agents, supervisor libraries, headless tools, custom tool classes, provider and server tools, toolkits, MCP conversions, and dynamic tool collections.
10
+
11
+ Non-empty or unresolved middleware suppresses instruction, agent output-schema, and tool-registration conclusions. Developer-authored response-format arrays are not mapped to the Repository Format's single agent output-schema binding. `stateSchema` and `contextSchema` do not become agent input-schema evidence, and implementation return types do not become tool output-schema evidence.
12
+
13
+ The adapter does not validate model availability, provider compatibility, schema semantics, tool safety, prompt quality, routing intent, or runtime execution. Direct LangGraph applications remain the responsibility of the separate `langgraph` runtime boundary.
14
+
15
+ Each invocation sees one declared agent and bounded logical repository operations, not a complete agent collection or project body index.
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Verified target
3
+ description: Static forms covered by the LangChain createAgent target from its verified minimums.
4
+ order: 10
5
+ ---
6
+
7
+ # Verified target
8
+
9
+ Technical target `typescript-create-agent-1-5` admits declared ranges that intersect `langchain >=1.5.9` with companion `@langchain/core >=1.2.8`. Those minimum versions are verified. Later stable releases are eligible for deterministic inspection on a best-effort basis and must still match the source patterns below. Qualification evidence records the exact package versions and date used for each execution.
10
+
11
+ Positive agent evidence requires a directly exported TypeScript `const` initialized by the named package-root `createAgent(...)` helper with one closed object-literal configuration and a `model` property. Named import aliases and `.ts`, `.tsx`, and `.mts` source are supported.
12
+
13
+ Instruction relationships require a direct loader call in `systemPrompt` or a direct `SystemMessage(loaderCall)` construction. Agent output schemas may be direct or wrapped by a supported one-schema `toolStrategy(...)` or `providerStrategy(...)` call. Normal function tools require the two-argument `tool(implementation, fields)` overload and an explicit manifest registration binding. Agent registration requires a closed tool array.
14
+
15
+ Middleware must be absent or a provably immutable empty array before instruction, agent output-schema, or tool-registration conclusions are produced. The adapter itself supports Node.js `>=22.11.0`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moldea.ai/adapter-langchain",
3
- "version": "3.0.1",
3
+ "version": "3.0.3",
4
4
  "description": "Deterministic runtime evidence and diagnostics for LangChain TypeScript agents.",
5
5
  "homepage": "https://github.com/moldea-ai/packages/tree/main/projects/adapter-langchain#readme",
6
6
  "bugs": {
@@ -18,6 +18,7 @@
18
18
  "files": [
19
19
  "cover.png",
20
20
  "dist",
21
+ "docs",
21
22
  "LICENSE",
22
23
  "README.md"
23
24
  ],