@langchain/quickjs 1.0.0-alpha.0 → 1.0.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 +11 -4
- package/dist/index.cjs +866 -277
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +189 -52
- package/dist/index.d.ts +189 -52
- package/dist/index.js +860 -275
- package/dist/index.js.map +1 -1
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -100,7 +100,9 @@ PTC configuration is progressive:
|
|
|
100
100
|
|
|
101
101
|
### Recursive Language Model (RLM)
|
|
102
102
|
|
|
103
|
-
When the
|
|
103
|
+
When the agent has subagents configured, a `task()` global is available inside
|
|
104
|
+
the REPL (no PTC needed), so the agent can spawn sub-agents in parallel from
|
|
105
|
+
within the REPL:
|
|
104
106
|
|
|
105
107
|
```typescript
|
|
106
108
|
const agent = createDeepAgent({
|
|
@@ -112,7 +114,7 @@ const agent = createDeepAgent({
|
|
|
112
114
|
systemPrompt: "...",
|
|
113
115
|
},
|
|
114
116
|
],
|
|
115
|
-
middleware: [createQuickJSMiddleware(
|
|
117
|
+
middleware: [createQuickJSMiddleware()],
|
|
116
118
|
});
|
|
117
119
|
```
|
|
118
120
|
|
|
@@ -122,16 +124,21 @@ The agent then writes code like:
|
|
|
122
124
|
const topics = ["quantum computing", "fusion energy", "CRISPR"];
|
|
123
125
|
const results = await Promise.all(
|
|
124
126
|
topics.map((topic) =>
|
|
125
|
-
|
|
127
|
+
task({
|
|
126
128
|
description: `Research ${topic} in depth`,
|
|
127
129
|
subagentType: "general-purpose",
|
|
128
130
|
}),
|
|
129
131
|
),
|
|
130
132
|
);
|
|
133
|
+
// Aggregate and return the report from the eval; the agent then writes it to a
|
|
134
|
+
// file with its own write_file tool.
|
|
131
135
|
const report = topics.map((t, i) => `## ${t}\n${results[i]}`).join("\n\n");
|
|
132
|
-
|
|
136
|
+
report;
|
|
133
137
|
```
|
|
134
138
|
|
|
139
|
+
> `task` cannot be exposed via `ptc` — it is reserved for the `task()` global,
|
|
140
|
+
> so passing `ptc: ["task"]` throws.
|
|
141
|
+
|
|
135
142
|
## API
|
|
136
143
|
|
|
137
144
|
### `createQuickJSMiddleware(options?)`
|