@parcha/agentrun 0.2.0 → 0.2.1
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/CHANGELOG.md +5 -0
- package/README.md +8 -3
- package/dist/index.cjs +17 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +17 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
- Agent records from `getAgent` and `listAgents` expose `instructions`, `skills`, and `tools`, the names `new Agent()` takes. `system_prompt`, `skill_names`, and `mcp_tool_names` still hold the same values.
|
|
6
|
+
- `getBatchResults` rows are typed as the new `BatchResultRow`: `row_number`, `status`, `raw_status`, `run_id`, `headline`, `excerpt`, `report_link`, `structured_output`, `is_public`, and error fields. They no longer advertise `question` or `row_data`, which the results endpoint does not return; those are on `getBatch(id).rows`. The README batch examples now match.
|
|
7
|
+
|
|
3
8
|
## 0.2.0 (unreleased)
|
|
4
9
|
|
|
5
10
|
Rewrite targeting the unified v2 API. Requires the unified v2 backend.
|
package/README.md
CHANGED
|
@@ -62,14 +62,19 @@ const batch = await agent.batch(["Verify acme.example", "Verify beta.example"],
|
|
|
62
62
|
});
|
|
63
63
|
const done = await agent.waitBatch(batch.id);
|
|
64
64
|
for (const row of (await agent.getBatchResults(batch.id)).results) {
|
|
65
|
-
console.log(row.row_number, row.status, row.run_id);
|
|
65
|
+
console.log(row.row_number, row.status, row.run_id, row.headline);
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
Result rows carry each run's outcome: `headline`, `excerpt`, `report_link`, and `structured_output`. The inputs are on the batch itself: `(await agent.getBatch(batch.id)).rows` gives each row's `question` and `row_data`.
|
|
70
|
+
|
|
71
|
+
A CSV works too. Name the column that holds each input. The other columns come back as `row_data` on `getBatch(id).rows`.
|
|
70
72
|
|
|
71
73
|
```ts
|
|
72
74
|
const batch = await agent.batch({ csv: csvText, inputColumn: "website" });
|
|
75
|
+
for (const row of (await agent.getBatch(batch.id)).rows) {
|
|
76
|
+
console.log(row.question, row.row_data);
|
|
77
|
+
}
|
|
73
78
|
```
|
|
74
79
|
|
|
75
80
|
`csv` may be a string or a `Blob`, up to 1 MB. `waitBatch` returns when the batch completes, fails, is cancelled, or pauses for attention; check `batch.paused_reason`. `cancelBatch` stops new rows; rows already running finish. `retryBatch` re-runs failed rows and spends credits. `getBatch(id, { includeRows: false })` skips per-row data on large batches.
|
|
@@ -176,7 +181,7 @@ Every method accepts `{ signal }` to cancel a request or a wait from your side.
|
|
|
176
181
|
|
|
177
182
|
## Types
|
|
178
183
|
|
|
179
|
-
The package ships ESM and CommonJS builds with declarations. Responses are plain objects typed as interfaces, so `run.status` and `batch.rows` have the types your editor shows. Records keep any field the server adds later, reachable as a property. `id` is always the record's ID, whatever the API calls it.
|
|
184
|
+
The package ships ESM and CommonJS builds with declarations. Responses are plain objects typed as interfaces, so `run.status` and `batch.rows` have the types your editor shows. Records keep any field the server adds later, reachable as a property. `id` is always the record's ID, whatever the API calls it. Agent records from `getAgent` and `listAgents` expose `instructions`, `skills`, and `tools`, the names `new Agent()` takes; the API's `system_prompt`, `skill_names`, and `mcp_tool_names` hold the same values.
|
|
180
185
|
|
|
181
186
|
## Development
|
|
182
187
|
|
package/dist/index.cjs
CHANGED
|
@@ -280,13 +280,18 @@ function isWire(value) {
|
|
|
280
280
|
}
|
|
281
281
|
var parse = {
|
|
282
282
|
agent(wire) {
|
|
283
|
+
const skills = Array.isArray(wire.skill_names) ? wire.skill_names : [];
|
|
284
|
+
const tools = Array.isArray(wire.mcp_tool_names) ? wire.mcp_tool_names : [];
|
|
283
285
|
return {
|
|
284
286
|
...wire,
|
|
285
287
|
id: requireId(wire, "agent", "id"),
|
|
286
288
|
name: str(wire.name) ?? "",
|
|
287
289
|
status: str(wire.status) ?? "",
|
|
288
|
-
|
|
289
|
-
|
|
290
|
+
instructions: str(wire.system_prompt),
|
|
291
|
+
skills,
|
|
292
|
+
tools,
|
|
293
|
+
skill_names: skills,
|
|
294
|
+
mcp_tool_names: tools,
|
|
290
295
|
input_form: Array.isArray(wire.input_form) ? wire.input_form : []
|
|
291
296
|
};
|
|
292
297
|
},
|
|
@@ -350,8 +355,16 @@ var parse = {
|
|
|
350
355
|
rows: list(wire.rows, parse.row)
|
|
351
356
|
};
|
|
352
357
|
},
|
|
358
|
+
resultRow(wire) {
|
|
359
|
+
return {
|
|
360
|
+
...wire,
|
|
361
|
+
row_number: Number(wire.row_number ?? 0),
|
|
362
|
+
...mapStatus(wire, ROW_STATUS_MAP, "status"),
|
|
363
|
+
run_id: firstString(wire, "job_id", "run_id")
|
|
364
|
+
};
|
|
365
|
+
},
|
|
353
366
|
batchResults(wire) {
|
|
354
|
-
return { ...parse.batch(wire), results: list(wire.results, parse.
|
|
367
|
+
return { ...parse.batch(wire), results: list(wire.results, parse.resultRow) };
|
|
355
368
|
},
|
|
356
369
|
retry(wire) {
|
|
357
370
|
return parse.batch(wire);
|
|
@@ -455,7 +468,7 @@ var parse = {
|
|
|
455
468
|
// src/http.ts
|
|
456
469
|
var DEFAULT_BASE_URL = "https://api.grep.ai/api/v2";
|
|
457
470
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
458
|
-
var VERSION = "0.2.
|
|
471
|
+
var VERSION = "0.2.1";
|
|
459
472
|
var LOCAL_HOSTS = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]"]);
|
|
460
473
|
function env(name) {
|
|
461
474
|
const g = globalThis;
|