@agentjam/sdk 0.7.0 → 0.9.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 +15 -0
- package/dist/agent.d.ts +12 -6
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +71 -17
- package/dist/agent.js.map +1 -1
- package/dist/anyOf.d.ts +2 -0
- package/dist/anyOf.d.ts.map +1 -1
- package/dist/anyOf.js +3 -0
- package/dist/anyOf.js.map +1 -1
- package/dist/connections.d.ts +3 -1
- package/dist/connections.d.ts.map +1 -1
- package/dist/connections.js +1 -0
- package/dist/connections.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/inputs.d.ts +3 -1
- package/dist/inputs.d.ts.map +1 -1
- package/dist/inputs.js +6 -0
- package/dist/inputs.js.map +1 -1
- package/dist/profile.d.ts +2 -1
- package/dist/profile.d.ts.map +1 -1
- package/dist/profile.js +9 -6
- package/dist/profile.js.map +1 -1
- package/dist/protocol.d.ts +26 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/relay/memory.d.ts +5 -1
- package/dist/relay/memory.d.ts.map +1 -1
- package/dist/relay/memory.js +27 -4
- package/dist/relay/memory.js.map +1 -1
- package/dist/relay/schedules.d.ts +32 -1
- package/dist/relay/schedules.d.ts.map +1 -1
- package/dist/relay/schedules.js +17 -0
- package/dist/relay/schedules.js.map +1 -1
- package/dist/relay/sessions.d.ts +2 -0
- package/dist/relay/sessions.d.ts.map +1 -1
- package/dist/relay/sessions.js +13 -0
- package/dist/relay/sessions.js.map +1 -1
- package/dist/relay/subscriptions.d.ts +35 -0
- package/dist/relay/subscriptions.d.ts.map +1 -0
- package/dist/relay/subscriptions.js +96 -0
- package/dist/relay/subscriptions.js.map +1 -0
- package/dist/secrets.js +1 -0
- package/dist/secrets.js.map +1 -1
- package/dist/subscriptions.d.ts +11 -0
- package/dist/subscriptions.d.ts.map +1 -0
- package/dist/subscriptions.js +52 -0
- package/dist/subscriptions.js.map +1 -0
- package/dist/tasks/incoming.d.ts +20 -2
- package/dist/tasks/incoming.d.ts.map +1 -1
- package/dist/tasks/incoming.js +35 -3
- package/dist/tasks/incoming.js.map +1 -1
- package/dist/tasks/outgoing.d.ts +15 -0
- package/dist/tasks/outgoing.d.ts.map +1 -1
- package/dist/tasks/outgoing.js +17 -2
- package/dist/tasks/outgoing.js.map +1 -1
- package/dist/tasks/scheduled.d.ts +30 -5
- package/dist/tasks/scheduled.d.ts.map +1 -1
- package/dist/tasks/scheduled.js +14 -3
- package/dist/tasks/scheduled.js.map +1 -1
- package/dist/tools/network.d.ts.map +1 -1
- package/dist/tools/network.js +20 -7
- package/dist/tools/network.js.map +1 -1
- package/dist/tools/schedules.d.ts +21 -4
- package/dist/tools/schedules.d.ts.map +1 -1
- package/dist/tools/schedules.js +39 -8
- package/dist/tools/schedules.js.map +1 -1
- package/dist/types.d.ts +28 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/vaults/local.d.ts +1 -0
- package/dist/vaults/local.d.ts.map +1 -1
- package/dist/vaults/local.js +13 -0
- package/dist/vaults/local.js.map +1 -1
- package/dist/vaults/remote.d.ts +2 -0
- package/dist/vaults/remote.d.ts.map +1 -1
- package/dist/vaults/remote.js +2 -0
- package/dist/vaults/remote.js.map +1 -1
- package/dist/vaults/vault.d.ts.map +1 -1
- package/dist/vaults/vault.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -121,6 +121,21 @@ const scan = await agent.schedule("ada/scanner", "Scan the repo for bugs", {
|
|
|
121
121
|
for await (const run of scan.runs()) console.log(await run.result());
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
+
### Subscriptions
|
|
125
|
+
|
|
126
|
+
A skill can subscribe each task's requester to a trigger of another of its agent's skills, such as a forum agent that posts for you and then sends you the post's replies. The executor calls `task.subscribe(config)` before the task completes, and the requester gets a run for each event until the subscription expires or either side ends it.
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
const post = await agent.propose("ada/forum", "Lisbon ramen tips?", {
|
|
130
|
+
skill: "create-post",
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const replies = await post.getSubscription();
|
|
134
|
+
for await (const reply of replies!.runs()) console.log(reply.event?.summary);
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Pass `subscribe: false` to `propose()` to take the task without the subscription. A subscription to a priced skill charges each run at that skill's price until it expires or is ended, and a skill whose `subscribes` is `optional` may complete a task without starting one, such as when there's nothing left to watch. The subscribed skill may need connections when the subscribing skill declares each of them with at least the same scopes, and the subscription keeps using the accounts its task was granted.
|
|
138
|
+
|
|
124
139
|
### Earn from your skills
|
|
125
140
|
|
|
126
141
|
Put a price on a skill, and every agent on the network can pay to use it. Charge a flat price per task, or your costs plus a markup for metered work. Requesters pay from their AgentJam Wallet, and once you set up payouts, your earnings are paid out to you.
|
package/dist/agent.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export type AgentIdentity = {
|
|
|
28
28
|
export type AgentHandlers = {
|
|
29
29
|
/** Handles a message from another agent. Returns the reply, which will be sent back to the sender, along with any files when the message is about a task. */
|
|
30
30
|
onMessage?: (message: IncomingMessage, agent: Agent) => Awaitable<ReplyOutput>;
|
|
31
|
-
/** Handles a task or schedule proposed to this agent
|
|
31
|
+
/** Handles a task or schedule proposed to this agent once it passes `checkProposal()`. Returns whether to accept it, and accepts every such proposal by default. */
|
|
32
32
|
onProposal?: (proposal: Proposal, agent: Agent) => Awaitable<Verdict>;
|
|
33
33
|
/** Handles an accepted task. Returns the final task output, which will be delivered to the task proposer. */
|
|
34
34
|
onTask?: (task: IncomingTask, agent: Agent) => Awaitable<TaskOutput>;
|
|
@@ -75,7 +75,7 @@ export type ConnectSettings = {
|
|
|
75
75
|
/** What passes up from the tasks this agent delegates while working on a task to that task. Every kind defaults to true. */
|
|
76
76
|
forward?: ForwardSettings;
|
|
77
77
|
/**
|
|
78
|
-
* Screens each proposal `
|
|
78
|
+
* Screens each proposal `checkProposal()` and `onProposal` accept with a model, before accepting it. Leave it out
|
|
79
79
|
* to accept without one, and turn it on with an adapter's `screen` option or a `judge` calling any model.
|
|
80
80
|
*/
|
|
81
81
|
screen?: ProposalScreen;
|
|
@@ -167,7 +167,7 @@ export declare class Agent {
|
|
|
167
167
|
*
|
|
168
168
|
* @param to The address of the agent to delegate to, `username/agent-name`.
|
|
169
169
|
* @param text A description of the task.
|
|
170
|
-
* @param options The skill the task calls for and its input, the most it may cost, how to watch it, the earlier task it follows up on
|
|
170
|
+
* @param options The skill the task calls for and its input, the most it may cost, how to watch it, the earlier task it follows up on, the files to attach and whether to take the skill's subscription, plus per-call request overrides.
|
|
171
171
|
* @returns A handle for following the task's events and awaiting its result.
|
|
172
172
|
* @throws {AgentJamError} If `watch` is set but the agent connected without `onWatchResolved`, an attachment couldn't upload, or `follows` names a task that isn't an ended one this agent delegated to `to`.
|
|
173
173
|
* @throws {TaskRejectedError} If the agent declines the task.
|
|
@@ -177,7 +177,7 @@ export declare class Agent {
|
|
|
177
177
|
* @throws {AgentNotFoundError} If no agent at `to` is connected.
|
|
178
178
|
* @throws {TimeoutError} If no response arrives within the timeout.
|
|
179
179
|
*/
|
|
180
|
-
propose(to: string, text: string, { skill, input, maxPriceCents, watch, attachments, follows, idempotencyKey, ...options }?: ProposeOptions): Promise<OutgoingTask>;
|
|
180
|
+
propose(to: string, text: string, { skill, input, maxPriceCents, watch, attachments, follows, subscribe, idempotencyKey, ...options }?: ProposeOptions): Promise<OutgoingTask>;
|
|
181
181
|
/**
|
|
182
182
|
* Proposes a recurring task to another agent and resolves once it accepts. The relay then starts
|
|
183
183
|
* a run on each match of its `cron`, or each time the executor's `trigger` fires, and keeps runs
|
|
@@ -435,8 +435,8 @@ export declare class Agent {
|
|
|
435
435
|
private prepareEach;
|
|
436
436
|
private prepare;
|
|
437
437
|
/**
|
|
438
|
-
* Runs the checks
|
|
439
|
-
* that name a skill the agent doesn't advertise or a trigger its skill doesn't declare.
|
|
438
|
+
* Runs the checks a proposal must pass before it reaches `onProposal`. It rejects every proposal without an `onTask`,
|
|
439
|
+
* and ones that name a skill the agent doesn't advertise or a trigger its skill doesn't declare.
|
|
440
440
|
*
|
|
441
441
|
* @param proposal The proposal to check.
|
|
442
442
|
* @returns Whether the proposal passes the checks.
|
|
@@ -446,6 +446,7 @@ export declare class Agent {
|
|
|
446
446
|
private parseSkillInput;
|
|
447
447
|
private priceOf;
|
|
448
448
|
private findSkillCard;
|
|
449
|
+
private findSubscribedTrigger;
|
|
449
450
|
private restartTriggers;
|
|
450
451
|
private perform;
|
|
451
452
|
/**
|
|
@@ -508,6 +509,9 @@ export declare class Agent {
|
|
|
508
509
|
private listEvery;
|
|
509
510
|
private withdraw;
|
|
510
511
|
private follow;
|
|
512
|
+
/** Follows the subscription a delegated task started, handing its runs to `onRun` unless a reader takes them right away. */
|
|
513
|
+
private followSubscription;
|
|
514
|
+
private constructScheduleLink;
|
|
511
515
|
private closeSchedule;
|
|
512
516
|
/** Stops the ended schedule's trigger, telling the relay so its connections close, then releases them. */
|
|
513
517
|
private stopSchedule;
|
|
@@ -520,6 +524,8 @@ export declare class Agent {
|
|
|
520
524
|
private linkFile;
|
|
521
525
|
private request;
|
|
522
526
|
private postTo;
|
|
527
|
+
/** Posts for a one-off task, handing its accounts over to the subscription its completion starts before sending it. */
|
|
528
|
+
private postForTask;
|
|
523
529
|
private sendAbout;
|
|
524
530
|
private listHistoryOf;
|
|
525
531
|
private readonly uploadArtifact;
|
package/dist/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AASpE,OAAO,KAAK,EAEV,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,kBAAkB,CAAC;AAiB1B,OAA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CAAC,YAAY;IAYpB,OAAO,CAAC,KAAK;YAoDC,QAAQ;IAWtB,OAAO,CAAC,OAAO;IAqBf,OAAO,CAAC,MAAM;IAKd,uHAAuH;IACvH,OAAO,CAAC,WAAW;IAwBnB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,aAAa;IASrB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAO7B;IAEF,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,UAAU;YAMJ,IAAI;YAKJ,iBAAiB;CAwBhC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,YAAa,cAAc,KAAG,OAAO,CAAC,KAAK,CAC1C,CAAC"}
|
package/dist/agent.js
CHANGED
|
@@ -14,10 +14,11 @@ import { AgentJamRelay } from "./relay/remote.js";
|
|
|
14
14
|
import { PendingRequests } from "./requests.js";
|
|
15
15
|
import { screenProposal } from "./screening.js";
|
|
16
16
|
import { constructSecretSource, isSecretConnection, isSecretSource, } from "./secrets.js";
|
|
17
|
+
import { constructSubscriptionId } from "./subscriptions.js";
|
|
17
18
|
import { AccessWaits } from "./tasks/access.js";
|
|
18
19
|
import { currentTask, TaskExecution } from "./tasks/incoming.js";
|
|
19
20
|
import { TaskHandle } from "./tasks/outgoing.js";
|
|
20
|
-
import { ScheduleHandle } from "./tasks/scheduled.js";
|
|
21
|
+
import { ScheduleHandle, SubscriptionHandle } from "./tasks/scheduled.js";
|
|
21
22
|
import { TriggerRunner } from "./tasks/triggers.js";
|
|
22
23
|
import { TaskWatches } from "./tasks/watches.js";
|
|
23
24
|
import { createNetworkTools, pickTools } from "./tools/network.js";
|
|
@@ -95,7 +96,7 @@ const watchOf = ({ scheduleId, from, principal, text, skill, trigger, config, in
|
|
|
95
96
|
...(expiresAt === undefined ? {} : { expiresAt: new Date(expiresAt) }),
|
|
96
97
|
});
|
|
97
98
|
const constructOrigin = (requester, taskId) => taskId === undefined ? undefined : { requester, taskId };
|
|
98
|
-
const toProposal = ({ from, principal, text, skill, input, cron, trigger, budget, expiresAt, follows, previous, }, attachments, files) => ({
|
|
99
|
+
const toProposal = ({ from, principal, text, skill, input, cron, trigger, budget, expiresAt, follows, previous, subscribe, }, attachments, files) => ({
|
|
99
100
|
from,
|
|
100
101
|
...(principal === undefined ? {} : { principal }),
|
|
101
102
|
text,
|
|
@@ -112,6 +113,7 @@ const toProposal = ({ from, principal, text, skill, input, cron, trigger, budget
|
|
|
112
113
|
...(previous === undefined
|
|
113
114
|
? {}
|
|
114
115
|
: { previous: recapFromWire(previous, files) }),
|
|
116
|
+
...(subscribe === undefined ? {} : { subscribe }),
|
|
115
117
|
});
|
|
116
118
|
const warnRevoking = (name, { from, skill }, sources) => {
|
|
117
119
|
const providers = Array.from(sources)
|
|
@@ -436,7 +438,7 @@ export class Agent {
|
|
|
436
438
|
*
|
|
437
439
|
* @param to The address of the agent to delegate to, `username/agent-name`.
|
|
438
440
|
* @param text A description of the task.
|
|
439
|
-
* @param options The skill the task calls for and its input, the most it may cost, how to watch it, the earlier task it follows up on
|
|
441
|
+
* @param options The skill the task calls for and its input, the most it may cost, how to watch it, the earlier task it follows up on, the files to attach and whether to take the skill's subscription, plus per-call request overrides.
|
|
440
442
|
* @returns A handle for following the task's events and awaiting its result.
|
|
441
443
|
* @throws {AgentJamError} If `watch` is set but the agent connected without `onWatchResolved`, an attachment couldn't upload, or `follows` names a task that isn't an ended one this agent delegated to `to`.
|
|
442
444
|
* @throws {TaskRejectedError} If the agent declines the task.
|
|
@@ -446,7 +448,7 @@ export class Agent {
|
|
|
446
448
|
* @throws {AgentNotFoundError} If no agent at `to` is connected.
|
|
447
449
|
* @throws {TimeoutError} If no response arrives within the timeout.
|
|
448
450
|
*/
|
|
449
|
-
async propose(to, text, { skill, input, maxPriceCents, watch, attachments, follows, idempotencyKey = crypto.randomUUID(), ...options } = {}) {
|
|
451
|
+
async propose(to, text, { skill, input, maxPriceCents, watch, attachments, follows, subscribe, idempotencyKey = crypto.randomUUID(), ...options } = {}) {
|
|
450
452
|
const watched = watch !== undefined && watch !== false;
|
|
451
453
|
if (watched && !this.handlers.onWatchResolved) {
|
|
452
454
|
throw new AgentJamError(noWatchHandler);
|
|
@@ -465,6 +467,7 @@ export class Agent {
|
|
|
465
467
|
...(refs === undefined ? {} : { attachments: refs }),
|
|
466
468
|
...(parent === undefined ? {} : { parent }),
|
|
467
469
|
...(follows === undefined ? {} : { follows }),
|
|
470
|
+
...(subscribe === false ? { subscribe } : {}),
|
|
468
471
|
};
|
|
469
472
|
const proposal = this.request(draft, options, (response) => {
|
|
470
473
|
if (response.type === "task.reject") {
|
|
@@ -532,7 +535,11 @@ export class Agent {
|
|
|
532
535
|
this.scheduling.delete(id);
|
|
533
536
|
if (!parent)
|
|
534
537
|
this.require(to, response);
|
|
535
|
-
return this.follow(to, idempotencyKey,
|
|
538
|
+
return this.follow(to, idempotencyKey, {
|
|
539
|
+
actions: actionsOf(response),
|
|
540
|
+
parent,
|
|
541
|
+
expiresAt,
|
|
542
|
+
});
|
|
536
543
|
});
|
|
537
544
|
// WARNING: Runs can arrive before the caller gets the handle, so they're held until its code after `schedule()`
|
|
538
545
|
// has had the chance to start reading them.
|
|
@@ -1092,9 +1099,11 @@ export class Agent {
|
|
|
1092
1099
|
isSelf: from === this.name,
|
|
1093
1100
|
heldCents: proposal.heldCents,
|
|
1094
1101
|
resumable: !proposal.prepare && this.isResumable(skill),
|
|
1102
|
+
subscribedTrigger: this.findSubscribedTrigger(skill),
|
|
1103
|
+
isOptedOut: proposal.subscribe === false,
|
|
1095
1104
|
...this.accessOf(skill, grant),
|
|
1096
1105
|
}, {
|
|
1097
|
-
post: this.
|
|
1106
|
+
post: this.postForTask(skill, grant),
|
|
1098
1107
|
send: this.sendAbout(from, proposal.id),
|
|
1099
1108
|
upload: this.uploadArtifact,
|
|
1100
1109
|
prepare: this.prepareFor({
|
|
@@ -1255,8 +1264,8 @@ export class Agent {
|
|
|
1255
1264
|
});
|
|
1256
1265
|
}
|
|
1257
1266
|
/**
|
|
1258
|
-
* Runs the checks
|
|
1259
|
-
* that name a skill the agent doesn't advertise or a trigger its skill doesn't declare.
|
|
1267
|
+
* Runs the checks a proposal must pass before it reaches `onProposal`. It rejects every proposal without an `onTask`,
|
|
1268
|
+
* and ones that name a skill the agent doesn't advertise or a trigger its skill doesn't declare.
|
|
1260
1269
|
*
|
|
1261
1270
|
* @param proposal The proposal to check.
|
|
1262
1271
|
* @returns Whether the proposal passes the checks.
|
|
@@ -1285,9 +1294,12 @@ export class Agent {
|
|
|
1285
1294
|
this.onError(error);
|
|
1286
1295
|
}
|
|
1287
1296
|
async decide(proposal) {
|
|
1297
|
+
const checked = this.checkProposal(proposal);
|
|
1298
|
+
if (!checked.accepted)
|
|
1299
|
+
return checked;
|
|
1288
1300
|
const verdict = this.handlers.onProposal
|
|
1289
1301
|
? await this.handlers.onProposal(proposal, this)
|
|
1290
|
-
:
|
|
1302
|
+
: checked;
|
|
1291
1303
|
if (!verdict.accepted || !this.screen || proposal.from === this.name) {
|
|
1292
1304
|
return verdict;
|
|
1293
1305
|
}
|
|
@@ -1307,6 +1319,11 @@ export class Agent {
|
|
|
1307
1319
|
findSkillCard(skill) {
|
|
1308
1320
|
return this.card.skills.find(({ name }) => name === skill);
|
|
1309
1321
|
}
|
|
1322
|
+
findSubscribedTrigger(skill) {
|
|
1323
|
+
const subscribes = this.findSkillCard(skill)?.subscribes;
|
|
1324
|
+
return (subscribes &&
|
|
1325
|
+
this.findSkillCard(subscribes.skill)?.triggers?.find(({ name }) => name === subscribes.trigger));
|
|
1326
|
+
}
|
|
1310
1327
|
async restartTriggers(connection) {
|
|
1311
1328
|
if (!this.triggers.declared)
|
|
1312
1329
|
return;
|
|
@@ -1399,9 +1416,11 @@ export class Agent {
|
|
|
1399
1416
|
isSelf: from === this.name,
|
|
1400
1417
|
heldCents: proposal.heldCents,
|
|
1401
1418
|
resumable: true,
|
|
1419
|
+
subscribedTrigger: this.findSubscribedTrigger(skill),
|
|
1420
|
+
isOptedOut: proposal.subscribe === false,
|
|
1402
1421
|
...this.accessOf(skill, grant),
|
|
1403
1422
|
}, {
|
|
1404
|
-
post: this.
|
|
1423
|
+
post: this.postForTask(skill, grant),
|
|
1405
1424
|
send: this.sendAbout(from, taskId),
|
|
1406
1425
|
upload: this.uploadArtifact,
|
|
1407
1426
|
prepare: this.prepareFor(parent),
|
|
@@ -1828,17 +1847,31 @@ export class Agent {
|
|
|
1828
1847
|
reason,
|
|
1829
1848
|
});
|
|
1830
1849
|
}
|
|
1831
|
-
follow(to, scheduleId,
|
|
1832
|
-
const
|
|
1833
|
-
const schedule = new ScheduleHandle(scheduleId, to,
|
|
1850
|
+
follow(to, scheduleId, details) {
|
|
1851
|
+
const link = this.constructScheduleLink(to, scheduleId);
|
|
1852
|
+
const schedule = new ScheduleHandle(scheduleId, to, link, details);
|
|
1853
|
+
this.schedules.set(key(to, scheduleId), schedule);
|
|
1854
|
+
return schedule;
|
|
1855
|
+
}
|
|
1856
|
+
/** Follows the subscription a delegated task started, handing its runs to `onRun` unless a reader takes them right away. */
|
|
1857
|
+
followSubscription(to, scheduleId, details) {
|
|
1858
|
+
const existing = this.schedules.get(key(to, scheduleId));
|
|
1859
|
+
if (existing instanceof SubscriptionHandle)
|
|
1860
|
+
return existing;
|
|
1861
|
+
const link = this.constructScheduleLink(to, scheduleId);
|
|
1862
|
+
const subscription = new SubscriptionHandle(scheduleId, to, link, details);
|
|
1863
|
+
this.schedules.set(key(to, scheduleId), subscription);
|
|
1864
|
+
setTimeout(() => subscription.stopHolding(), 0);
|
|
1865
|
+
return subscription;
|
|
1866
|
+
}
|
|
1867
|
+
constructScheduleLink(to, scheduleId) {
|
|
1868
|
+
return {
|
|
1834
1869
|
post: this.postTo(to),
|
|
1835
1870
|
collect: (run, handled) => this.collectAfter(run, scheduleId, handled),
|
|
1836
1871
|
handRun: (run) => this.handRun(run, scheduleId),
|
|
1837
1872
|
handFollowUp: (task) => this.handFollowUp(task),
|
|
1838
|
-
release: () => this.schedules.delete(
|
|
1839
|
-
}
|
|
1840
|
-
this.schedules.set(id, schedule);
|
|
1841
|
-
return schedule;
|
|
1873
|
+
release: () => this.schedules.delete(key(to, scheduleId)),
|
|
1874
|
+
};
|
|
1842
1875
|
}
|
|
1843
1876
|
async closeSchedule({ from, scheduleId, reason, }) {
|
|
1844
1877
|
this.schedules
|
|
@@ -1921,6 +1954,7 @@ export class Agent {
|
|
|
1921
1954
|
requester: this.name,
|
|
1922
1955
|
taskId,
|
|
1923
1956
|
}),
|
|
1957
|
+
follow: (scheduleId, subscription) => this.followSubscription(to, scheduleId, subscription),
|
|
1924
1958
|
}, { ...details, actions });
|
|
1925
1959
|
this.outgoing.set(id, handle);
|
|
1926
1960
|
signal?.addEventListener("abort", abort, { once: true });
|
|
@@ -1945,6 +1979,26 @@ export class Agent {
|
|
|
1945
1979
|
postTo(to) {
|
|
1946
1980
|
return (body) => this.post({ ...body, id: crypto.randomUUID(), to });
|
|
1947
1981
|
}
|
|
1982
|
+
/** Posts for a one-off task, handing its accounts over to the subscription its completion starts before sending it. */
|
|
1983
|
+
postForTask(skill, task) {
|
|
1984
|
+
const post = this.postTo(task.requester);
|
|
1985
|
+
return async (body) => {
|
|
1986
|
+
const isSubscribing = body.type === "task.complete" && body.subscription !== undefined;
|
|
1987
|
+
if (!isSubscribing)
|
|
1988
|
+
return post(body);
|
|
1989
|
+
const { requester, id } = task;
|
|
1990
|
+
const subscription = { requester, id: constructSubscriptionId(id) };
|
|
1991
|
+
const sources = [...this.sourcesFor(skill).values()];
|
|
1992
|
+
try {
|
|
1993
|
+
await Promise.all(sources.map(async (source) => source.handOver?.(task, subscription)));
|
|
1994
|
+
await post(body);
|
|
1995
|
+
}
|
|
1996
|
+
catch (error) {
|
|
1997
|
+
this.release(subscription, sources);
|
|
1998
|
+
throw error;
|
|
1999
|
+
}
|
|
2000
|
+
};
|
|
2001
|
+
}
|
|
1948
2002
|
sendAbout(peer, taskId) {
|
|
1949
2003
|
return (text, options) => this.send(peer, text, { conversationId: taskId, ...options, taskId });
|
|
1950
2004
|
}
|