@argentic-ai/client 0.5.0 → 0.6.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/dist/argentic.d.ts +7 -7
- package/dist/argentic.js +6 -4
- package/package.json +1 -1
package/dist/argentic.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare function checkOncePer(tool: string, template: unknown, parameters
|
|
|
45
45
|
/** Set `once_per` on tools by name (for the AI SDK and Mastra adapters, whose tools have nowhere to carry it). Throws on a name that is not a tool or a template the API would refuse. */
|
|
46
46
|
export declare function withOncePer<T extends ToolDecl>(tools: T[], oncePer?: Record<string, string>): T[];
|
|
47
47
|
export interface WakeBody {
|
|
48
|
-
/** Required unless `fire_due` is set; the API refuses
|
|
48
|
+
/** Required unless `fire_due` or `results` is set; the API refuses `message` with `fire_due`. */
|
|
49
49
|
message?: string;
|
|
50
50
|
/** Wake for the plans that have fallen due instead of with a message: send it at the `wake_at` an earlier answer gave. */
|
|
51
51
|
fire_due?: boolean;
|
|
@@ -69,10 +69,10 @@ export interface WakeBody {
|
|
|
69
69
|
};
|
|
70
70
|
/**
|
|
71
71
|
* What your app's tools returned for the `actions` of the previous wake, as `{ seq, result }`: `seq` is the action's
|
|
72
|
-
* `seq` and `result` is exactly what the tool returned. The API journals each as the real result of that call
|
|
73
|
-
*
|
|
74
|
-
* not know the field yet refuses it, and `wake()` then sends the same wake again without it
|
|
75
|
-
* this client.
|
|
72
|
+
* `seq` and `result` is exactly what the tool returned. The API journals each as the real result of that call, and the
|
|
73
|
+
* agent reads it as that call's result, so no `message` is needed with it. Never with `fire_due`; at most 100 entries. A
|
|
74
|
+
* server that does not know the field yet refuses it, and `wake()` then sends the same wake again without it (with the
|
|
75
|
+
* results as the message text when there is no message) and stops sending it on this client.
|
|
76
76
|
*/
|
|
77
77
|
results?: {
|
|
78
78
|
seq: number;
|
|
@@ -283,8 +283,8 @@ export interface RunOptions {
|
|
|
283
283
|
/** Kill this process hard after the Nth newly executed action (to try a crash). */
|
|
284
284
|
crashAfterActions?: number;
|
|
285
285
|
/**
|
|
286
|
-
* Send each follow-up wake's tool results as the structured `results` field
|
|
287
|
-
*
|
|
286
|
+
* Send each follow-up wake's tool results as the structured `results` field, so the API journals the real result of every
|
|
287
|
+
* call and the agent reads each as that call's result. Default true. Set false to send them as message text only.
|
|
288
288
|
*/
|
|
289
289
|
structuredResults?: boolean;
|
|
290
290
|
log?: (line: string) => void;
|
package/dist/argentic.js
CHANGED
|
@@ -177,7 +177,9 @@ export class Argentic {
|
|
|
177
177
|
headers['X-Model-Key'] = this.modelKey;
|
|
178
178
|
Object.assign(headers, this.embed);
|
|
179
179
|
const path = `/v1/agents/${encodeURIComponent(agent)}/wake`;
|
|
180
|
-
const { results, ...
|
|
180
|
+
const { results, ...rest } = body;
|
|
181
|
+
// Without `results` the API reads them only from the message: a wake that has none says them in its text.
|
|
182
|
+
const plain = results !== undefined && rest.message === undefined && !rest.fire_due ? { ...rest, message: 'Results of the tools you asked for:\n' + JSON.stringify(results) } : rest;
|
|
181
183
|
let res;
|
|
182
184
|
if (results === undefined || this.resultsRefused) {
|
|
183
185
|
res = await this.send(path, JSON.stringify(plain), headers);
|
|
@@ -390,11 +392,11 @@ export async function run(opts) {
|
|
|
390
392
|
let pending = [];
|
|
391
393
|
for (let step = 0; step < maxSteps; step++) {
|
|
392
394
|
const key = safeKey(`${opts.runId}.${step}`);
|
|
393
|
-
|
|
395
|
+
// A follow-up wake sends the results as `results` and nothing else: the agent reads each as its call's result, so the text would say it twice.
|
|
396
|
+
const answers = structured && step > 0 && pending.length > 0;
|
|
397
|
+
const body = step === 0 && opts.fireDue ? { fire_due: true, model, tools: decls } : answers ? { results: pending, model, tools: decls } : { message, model, tools: decls };
|
|
394
398
|
if (opts.schedule)
|
|
395
399
|
body.schedule = true;
|
|
396
|
-
if (structured && step > 0 && pending.length)
|
|
397
|
-
body.results = pending;
|
|
398
400
|
opts.onWakeStart?.({ step });
|
|
399
401
|
if (opts.system)
|
|
400
402
|
body.system = opts.system;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argentic-ai/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Argentic client for TypeScript. Argentic is an engine that keeps AI agents right for hours while prompt size is bounded. Adapters for the Vercel AI SDK and Mastra.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|