@agentjam/sdk 0.5.0 → 0.7.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.
Files changed (148) hide show
  1. package/dist/adapters/ai.d.ts +1 -1
  2. package/dist/adapters/ai.d.ts.map +1 -1
  3. package/dist/adapters/anthropic.d.ts +1 -1
  4. package/dist/adapters/anthropic.d.ts.map +1 -1
  5. package/dist/adapters/openai.d.ts +1 -1
  6. package/dist/adapters/openai.d.ts.map +1 -1
  7. package/dist/adapters/openaiAgents.d.ts +1 -1
  8. package/dist/adapters/openaiAgents.d.ts.map +1 -1
  9. package/dist/adapters/shared.d.ts +2 -2
  10. package/dist/adapters/shared.d.ts.map +1 -1
  11. package/dist/adapters/shared.js +6 -2
  12. package/dist/adapters/shared.js.map +1 -1
  13. package/dist/agent.d.ts +73 -5
  14. package/dist/agent.d.ts.map +1 -1
  15. package/dist/agent.js +140 -10
  16. package/dist/agent.js.map +1 -1
  17. package/dist/errors.d.ts +1 -1
  18. package/dist/errors.js +1 -1
  19. package/dist/events.d.ts.map +1 -1
  20. package/dist/events.js +27 -0
  21. package/dist/events.js.map +1 -1
  22. package/dist/index.d.ts +5 -4
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/managedWebhooks.d.ts +15 -0
  27. package/dist/managedWebhooks.d.ts.map +1 -0
  28. package/dist/managedWebhooks.js +115 -0
  29. package/dist/managedWebhooks.js.map +1 -0
  30. package/dist/platforms/atlassian.d.ts +18 -0
  31. package/dist/platforms/atlassian.d.ts.map +1 -0
  32. package/dist/platforms/atlassian.js +24 -0
  33. package/dist/platforms/atlassian.js.map +1 -0
  34. package/dist/platforms/datadog.d.ts +45 -1
  35. package/dist/platforms/datadog.d.ts.map +1 -1
  36. package/dist/platforms/datadog.js +207 -0
  37. package/dist/platforms/datadog.js.map +1 -1
  38. package/dist/platforms/discord.d.ts +64 -16
  39. package/dist/platforms/discord.d.ts.map +1 -1
  40. package/dist/platforms/discord.js +15 -48
  41. package/dist/platforms/discord.js.map +1 -1
  42. package/dist/platforms/discordEvents.d.ts +213 -0
  43. package/dist/platforms/discordEvents.d.ts.map +1 -0
  44. package/dist/platforms/discordEvents.js +270 -0
  45. package/dist/platforms/discordEvents.js.map +1 -0
  46. package/dist/platforms/discordGateway.d.ts +14 -14
  47. package/dist/platforms/discordGateway.d.ts.map +1 -1
  48. package/dist/platforms/discordGateway.js +29 -45
  49. package/dist/platforms/discordGateway.js.map +1 -1
  50. package/dist/platforms/discordInteractions.d.ts +35 -0
  51. package/dist/platforms/discordInteractions.d.ts.map +1 -0
  52. package/dist/platforms/discordInteractions.js +125 -0
  53. package/dist/platforms/discordInteractions.js.map +1 -0
  54. package/dist/platforms/github.d.ts +45 -13
  55. package/dist/platforms/github.d.ts.map +1 -1
  56. package/dist/platforms/github.js +20 -40
  57. package/dist/platforms/github.js.map +1 -1
  58. package/dist/platforms/githubApi.d.ts +2 -0
  59. package/dist/platforms/githubApi.d.ts.map +1 -0
  60. package/dist/platforms/githubApi.js +38 -0
  61. package/dist/platforms/githubApi.js.map +1 -0
  62. package/dist/platforms/githubEvents.d.ts +160 -0
  63. package/dist/platforms/githubEvents.d.ts.map +1 -0
  64. package/dist/platforms/githubEvents.js +446 -0
  65. package/dist/platforms/githubEvents.js.map +1 -0
  66. package/dist/platforms/grafana.d.ts +47 -1
  67. package/dist/platforms/grafana.d.ts.map +1 -1
  68. package/dist/platforms/grafana.js +187 -0
  69. package/dist/platforms/grafana.js.map +1 -1
  70. package/dist/platforms/pagerduty.d.ts +59 -0
  71. package/dist/platforms/pagerduty.d.ts.map +1 -0
  72. package/dist/platforms/pagerduty.js +175 -0
  73. package/dist/platforms/pagerduty.js.map +1 -0
  74. package/dist/platforms/sentry.d.ts +35 -17
  75. package/dist/platforms/sentry.d.ts.map +1 -1
  76. package/dist/platforms/sentry.js +48 -25
  77. package/dist/platforms/sentry.js.map +1 -1
  78. package/dist/platforms/sentryApi.d.ts +3 -0
  79. package/dist/platforms/sentryApi.d.ts.map +1 -0
  80. package/dist/platforms/sentryApi.js +29 -0
  81. package/dist/platforms/sentryApi.js.map +1 -0
  82. package/dist/platforms/sentryEvents.d.ts +64 -0
  83. package/dist/platforms/sentryEvents.d.ts.map +1 -0
  84. package/dist/platforms/sentryEvents.js +183 -0
  85. package/dist/platforms/sentryEvents.js.map +1 -0
  86. package/dist/platforms/slack.d.ts +69 -33
  87. package/dist/platforms/slack.d.ts.map +1 -1
  88. package/dist/platforms/slack.js +29 -36
  89. package/dist/platforms/slack.js.map +1 -1
  90. package/dist/platforms/slackEvents.d.ts +204 -0
  91. package/dist/platforms/slackEvents.d.ts.map +1 -0
  92. package/dist/platforms/slackEvents.js +241 -0
  93. package/dist/platforms/slackEvents.js.map +1 -0
  94. package/dist/platforms/slackInteractions.d.ts +79 -0
  95. package/dist/platforms/slackInteractions.d.ts.map +1 -0
  96. package/dist/platforms/slackInteractions.js +160 -0
  97. package/dist/platforms/slackInteractions.js.map +1 -0
  98. package/dist/protocol.d.ts +163 -6
  99. package/dist/protocol.d.ts.map +1 -1
  100. package/dist/relay/frames.d.ts +52 -2
  101. package/dist/relay/frames.d.ts.map +1 -1
  102. package/dist/relay/frames.js +2 -0
  103. package/dist/relay/frames.js.map +1 -1
  104. package/dist/relay/payments.d.ts +8 -3
  105. package/dist/relay/payments.d.ts.map +1 -1
  106. package/dist/relay/payments.js +20 -2
  107. package/dist/relay/payments.js.map +1 -1
  108. package/dist/relay/relay.d.ts +44 -5
  109. package/dist/relay/relay.d.ts.map +1 -1
  110. package/dist/relay/remote.d.ts.map +1 -1
  111. package/dist/relay/remote.js +65 -8
  112. package/dist/relay/remote.js.map +1 -1
  113. package/dist/relay/schedules.d.ts +2 -1
  114. package/dist/relay/schedules.d.ts.map +1 -1
  115. package/dist/relay/schedules.js +13 -3
  116. package/dist/relay/schedules.js.map +1 -1
  117. package/dist/tasks/outgoing.d.ts.map +1 -1
  118. package/dist/tasks/outgoing.js +1 -0
  119. package/dist/tasks/outgoing.js.map +1 -1
  120. package/dist/tasks/scheduled.d.ts +18 -8
  121. package/dist/tasks/scheduled.d.ts.map +1 -1
  122. package/dist/tasks/scheduled.js +77 -20
  123. package/dist/tasks/scheduled.js.map +1 -1
  124. package/dist/tasks/triggers.d.ts +11 -3
  125. package/dist/tasks/triggers.d.ts.map +1 -1
  126. package/dist/tasks/triggers.js +30 -11
  127. package/dist/tasks/triggers.js.map +1 -1
  128. package/dist/tools/delegations.d.ts +17 -0
  129. package/dist/tools/delegations.d.ts.map +1 -0
  130. package/dist/tools/delegations.js +67 -0
  131. package/dist/tools/delegations.js.map +1 -0
  132. package/dist/tools/inputs.d.ts +62 -0
  133. package/dist/tools/inputs.d.ts.map +1 -0
  134. package/dist/tools/inputs.js +143 -0
  135. package/dist/tools/inputs.js.map +1 -0
  136. package/dist/tools/network.d.ts +10 -0
  137. package/dist/tools/network.d.ts.map +1 -0
  138. package/dist/tools/network.js +435 -0
  139. package/dist/tools/network.js.map +1 -0
  140. package/dist/tools/schedules.d.ts +43 -0
  141. package/dist/tools/schedules.d.ts.map +1 -0
  142. package/dist/tools/schedules.js +337 -0
  143. package/dist/tools/schedules.js.map +1 -0
  144. package/dist/tools/shared.d.ts +152 -0
  145. package/dist/tools/shared.d.ts.map +1 -0
  146. package/dist/tools/shared.js +151 -0
  147. package/dist/tools/shared.js.map +1 -0
  148. package/package.json +9 -1
@@ -0,0 +1,43 @@
1
+ import type { OutgoingTask } from "../tasks/outgoing.js";
2
+ import type { Schedule } from "../tasks/scheduled.js";
3
+ import type { Cron, TriggerChoice } from "../types.js";
4
+ import { type ArtifactShelf, type NetworkTool, type Peer } from "./shared.js";
5
+ type Cadence = {
6
+ cron: Cron;
7
+ trigger?: undefined;
8
+ } | {
9
+ trigger: TriggerChoice;
10
+ cron?: undefined;
11
+ };
12
+ declare class TrackedSchedule {
13
+ readonly schedule: Schedule;
14
+ readonly cadence: Cadence;
15
+ runs: number;
16
+ reason: string | undefined;
17
+ readonly running: Set<OutgoingTask>;
18
+ private readonly finished;
19
+ private readonly followUps;
20
+ constructor(schedule: Schedule, cadence: Cadence);
21
+ get unread(): number;
22
+ get isActive(): boolean;
23
+ /** Follows the schedule until it ends, which also collects each run as it starts. */
24
+ follow(): Promise<void>;
25
+ /** Returns the runs and follow-ups that ended since the last call. */
26
+ takeUnread(): {
27
+ finished: OutgoingTask[];
28
+ followUps: OutgoingTask[];
29
+ };
30
+ computeNextRun(): string | undefined;
31
+ private trackFollowUps;
32
+ private trackTask;
33
+ }
34
+ /** Follows the schedules schedule_task created, keeping what ended since the model last checked on each. */
35
+ export declare class ScheduleTracker {
36
+ private readonly tracked;
37
+ track(schedule: Schedule, cadence: Cadence): TrackedSchedule;
38
+ get(scheduleId: string): TrackedSchedule | undefined;
39
+ }
40
+ /** Builds the tools that schedule tasks on other agents, check on their runs and end them. */
41
+ export declare const createScheduleTools: (peer: Peer, tracker: ScheduleTracker, shelf: ArtifactShelf) => NetworkTool[];
42
+ export {};
43
+ //# sourceMappingURL=schedules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedules.d.ts","sourceRoot":"","sources":["../../src/tools/schedules.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAEV,IAAI,EAGJ,aAAa,EACd,MAAM,aAAa,CAAC;AAerB,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,WAAW,EAEhB,KAAK,IAAI,EAGV,MAAM,aAAa,CAAC;AAkCrB,KAAK,OAAO,GACR;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,GACnC;IAAE,OAAO,EAAE,aAAa,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAGjD,cAAM,eAAe;aAQD,QAAQ,EAAE,QAAQ;aAClB,OAAO,EAAE,OAAO;IAR3B,IAAI,SAAK;IACT,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,SAAgB,OAAO,oBAA2B;IAClD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsB;IAEhD,YACkB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAC9B;IAEJ,IAAW,MAAM,WAEhB;IAED,IAAW,QAAQ,YAElB;IAED,qFAAqF;IACxE,MAAM,kBAUlB;IAED,sEAAsE;IAC/D,UAAU;QAEb,QAAQ;QACR,SAAS;MAEZ;IAEM,cAAc,uBAKpB;YAEa,cAAc;IAM5B,OAAO,CAAC,SAAS;CAWlB;AAED,4GAA4G;AAC5G,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAsC;IAEvD,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,mBAMhD;IAEM,GAAG,CAAC,UAAU,EAAE,MAAM,+BAE5B;CACF;AA6GD,8FAA8F;AAC9F,eAAO,MAAM,mBAAmB,SACxB,IAAI,WACD,eAAe,SACjB,aAAa,KACnB,WAAW,EAoMb,CAAC"}
@@ -0,0 +1,337 @@
1
+ import { computeNextRun, DEFAULT_TIME_ZONE } from "../cron.js";
2
+ import { AgentJamError } from "../errors.js";
3
+ import { currentTask } from "../tasks/incoming.js";
4
+ import { choice, integer, objectSchema, optional, optionalDate, optionalFileList, optionalInteger, optionalNumber, optionalObject, required, } from "./inputs.js";
5
+ import { attachmentsField, networkTool, settleTask, summarizeActions, } from "./shared.js";
6
+ const maxUnread = 20;
7
+ const periodUnits = ["day", "week", "month"];
8
+ const followUpHint = 'A follow-up in then starts another agent\'s task after each run whose results meet its condition, a yes or no question the network answers, or its match against the run\'s structured output, such as {"labels": "Bug"} for runs whose labels include Bug, sending it the run\'s results as attachments and charging it like the runs.';
9
+ const followUpField = {
10
+ type: "object",
11
+ description: "Another agent's task to start after each run whose results meet a condition, with the run's results attached, such as filing each bug a scan finds",
12
+ fields: {
13
+ agent: "The agent to hand a run's results to, addressed as username/agent-name",
14
+ skill: "The name of that agent's skill the follow-up calls for",
15
+ },
16
+ optional: {
17
+ task: "What the agent should do with the run's results, which it receives as attachments. Omit it to reuse the schedule's task",
18
+ condition: "A yes or no question about a run's results, such as \"Did the scan find a bug?\", which the network answers from the run's text, files and output. Give condition or match",
19
+ match: 'Fields the run\'s structured output must hold, as JSON text of an object, from the outputSchema find_agents lists for the scheduled skill, such as {"severity": "high"} or {"labels": "Bug"}. Give condition or match',
20
+ input: "The follow-up skill's structured input, as JSON text of an object matching the inputSchema find_agents lists for it",
21
+ maxPriceCents: {
22
+ type: "number",
23
+ description: "The most, in cents, each follow-up may cost if its skill is priced. Omit it to pay its price in full each time",
24
+ },
25
+ },
26
+ };
27
+ // Invariant: `finished` and `followUps` hold the latest tasks, at most `maxUnread` each, that ended since the model last checked.
28
+ class TrackedSchedule {
29
+ schedule;
30
+ cadence;
31
+ runs = 0;
32
+ reason;
33
+ running = new Set();
34
+ finished = [];
35
+ followUps = [];
36
+ constructor(schedule, cadence) {
37
+ this.schedule = schedule;
38
+ this.cadence = cadence;
39
+ }
40
+ get unread() {
41
+ return this.finished.length + this.followUps.length;
42
+ }
43
+ get isActive() {
44
+ return this.reason === undefined;
45
+ }
46
+ /** Follows the schedule until it ends, which also collects each run as it starts. */
47
+ async follow() {
48
+ void this.schedule.ended().then((reason) => {
49
+ this.reason = reason;
50
+ });
51
+ void this.trackFollowUps();
52
+ for await (const run of this.schedule.runs()) {
53
+ this.runs += 1;
54
+ this.trackTask(run, this.finished);
55
+ }
56
+ }
57
+ /** Returns the runs and follow-ups that ended since the last call. */
58
+ takeUnread() {
59
+ return {
60
+ finished: this.finished.splice(0),
61
+ followUps: this.followUps.splice(0),
62
+ };
63
+ }
64
+ computeNextRun() {
65
+ const { cron } = this.cadence;
66
+ if (!this.isActive || !cron)
67
+ return undefined;
68
+ return computeNextRun(cron, new Date())?.toISOString();
69
+ }
70
+ async trackFollowUps() {
71
+ for await (const task of this.schedule.followUps()) {
72
+ this.trackTask(task, this.followUps);
73
+ }
74
+ }
75
+ trackTask(task, unread) {
76
+ this.running.add(task);
77
+ void task
78
+ .result()
79
+ .catch(() => { })
80
+ .finally(() => {
81
+ this.running.delete(task);
82
+ unread.push(task);
83
+ unread.splice(0, unread.length - maxUnread);
84
+ });
85
+ }
86
+ }
87
+ /** Follows the schedules schedule_task created, keeping what ended since the model last checked on each. */
88
+ export class ScheduleTracker {
89
+ tracked = new Map();
90
+ track(schedule, cadence) {
91
+ const tracked = new TrackedSchedule(schedule, cadence);
92
+ this.tracked.set(schedule.id, tracked);
93
+ void tracked.follow();
94
+ return tracked;
95
+ }
96
+ get(scheduleId) {
97
+ return this.tracked.get(scheduleId);
98
+ }
99
+ }
100
+ const readCadence = (input) => {
101
+ const expression = optional(input, "cron");
102
+ const trigger = optional(input, "trigger");
103
+ if (expression !== undefined && trigger === undefined) {
104
+ return { cron: { expression, timeZone: optional(input, "timeZone") } };
105
+ }
106
+ if (trigger !== undefined && expression === undefined) {
107
+ const config = optionalObject(input, "config") ?? {};
108
+ return { trigger: { name: trigger, config } };
109
+ }
110
+ throw new AgentJamError("Pass exactly one of cron and trigger");
111
+ };
112
+ const readBudget = (input) => {
113
+ const budget = optionalObject(input, "budget");
114
+ if (!budget)
115
+ return undefined;
116
+ const unit = choice(required(budget, "unit"), "unit", periodUnits);
117
+ return {
118
+ period: { count: integer(budget, "every"), unit },
119
+ maxRuns: optionalInteger(budget, "maxRuns"),
120
+ maxAmountCents: optionalNumber(budget, "maxAmountCents"),
121
+ };
122
+ };
123
+ const readCondition = (followUp) => {
124
+ const condition = optional(followUp, "condition");
125
+ const match = optionalObject(followUp, "match");
126
+ if (condition !== undefined && match === undefined)
127
+ return { condition };
128
+ if (match !== undefined && condition === undefined)
129
+ return { match };
130
+ throw new AgentJamError('"then" must have exactly one of condition and match');
131
+ };
132
+ const readFollowUp = (input) => {
133
+ const followUp = optionalObject(input, "then");
134
+ if (!followUp)
135
+ return undefined;
136
+ return {
137
+ when: readCondition(followUp),
138
+ to: required(followUp, "agent"),
139
+ skill: required(followUp, "skill"),
140
+ text: optional(followUp, "task"),
141
+ input: optionalObject(followUp, "input"),
142
+ maxPriceCents: optionalNumber(followUp, "maxPriceCents"),
143
+ };
144
+ };
145
+ const describeCadence = (cadence) => cadence.cron
146
+ ? {
147
+ cron: cadence.cron.expression,
148
+ timeZone: cadence.cron.timeZone ?? DEFAULT_TIME_ZONE,
149
+ }
150
+ : { trigger: cadence.trigger.name };
151
+ const summarizeSchedule = (tracked) => {
152
+ const { schedule, reason } = tracked;
153
+ const nextRunAt = tracked.computeNextRun();
154
+ return {
155
+ scheduleId: schedule.id,
156
+ agent: schedule.to,
157
+ status: tracked.isActive ? "active" : "ended",
158
+ ...(reason !== undefined && { reason }),
159
+ ...describeCadence(tracked.cadence),
160
+ ...(nextRunAt && { nextRunAt }),
161
+ runs: tracked.runs,
162
+ };
163
+ };
164
+ const describeEnded = async (task, shelf) => ({
165
+ ...(await settleTask(task, shelf)),
166
+ ...(task.event && { event: task.event.summary }),
167
+ });
168
+ const instructionOf = ({ schedule }) => {
169
+ if (schedule.actions.length === 0) {
170
+ return "The agent accepted the schedule. Check on its runs with get_schedule, and stop it with end_schedule.";
171
+ }
172
+ return currentTask()
173
+ ? "The schedule's runs can't start until your human connects these accounts. The links already reach them through the agent that assigned you your task, so don't pass them on. Check on its runs later with get_schedule."
174
+ : "The schedule's runs can't start until your human connects these accounts, each for the agent it names or else the one running the schedule, doing what its reason says. Show them the links, then check on its runs later with get_schedule.";
175
+ };
176
+ const describeActions = ({ schedule, isActive }) => isActive && schedule.actions.length > 0
177
+ ? { actions: summarizeActions(schedule.actions) }
178
+ : {};
179
+ const findExecutor = async (peer, scheduleId) => {
180
+ const schedules = await peer.listSchedules();
181
+ const schedule = schedules.find((listed) => listed.scheduleId === scheduleId);
182
+ if (!schedule) {
183
+ throw new AgentJamError(`You scheduled no task "${scheduleId}"`);
184
+ }
185
+ return schedule.executor;
186
+ };
187
+ /** Builds the tools that schedule tasks on other agents, check on their runs and end them. */
188
+ export const createScheduleTools = (peer, tracker, shelf) => [
189
+ networkTool({
190
+ name: "schedule_task",
191
+ description: `Ask another agent to run a task on a cron schedule, such as every weekday at 9am in your human's time zone, or each time one of its skill's triggers fires, such as when an email arrives, and wait for it to accept. Pass exactly one of cron and trigger. A cron schedule's first run starts at the expression's next match after it accepts, runs keep going while you're offline, and each run of a priced skill is charged separately, within the budget the schedule may set. ${followUpHint} Check on the runs later with get_schedule. When the skill lists an inputSchema, also pass input matching it, since the schedule is refused without it.`,
192
+ inputSchema: objectSchema({
193
+ agent: "The address of the agent to run the task, username/agent-name",
194
+ task: "A complete description of the task each run performs",
195
+ }, {
196
+ skill: "The name of the agent's skill each run calls for",
197
+ input: "Each run's structured input, as JSON text of an object matching the inputSchema find_agents lists for the skill",
198
+ cron: 'A 5-field cron expression (minute, hour, day of month, month, day of week) for when runs start, such as "0 9 * * 1-5" for 9am on weekdays or "*/15 * * * *" for every 15 minutes. Omit it to run on a trigger instead',
199
+ timeZone: 'The IANA time zone the cron expression is read in, such as "America/New_York". Pass your human\'s time zone, or it defaults to UTC',
200
+ trigger: "The name of a trigger the agent's skill offers, as find_agents lists them. Each time it fires, such as when an email arrives, a run starts",
201
+ config: "The trigger's settings, as JSON text of an object matching the config schema find_agents lists for it",
202
+ maxPriceCents: {
203
+ type: "number",
204
+ description: "The most each run may cost if the skill is priced, in cents, such as 0.5 for half a cent. Omit it to pay up to the skill's listed price",
205
+ },
206
+ expiresAt: "When to stop running the task, as an ISO 8601 date and time. Omit it to run until the schedule is ended",
207
+ budget: {
208
+ type: "object",
209
+ description: "Caps the runs and spend of a schedule on a priced skill each period, skipping runs past the cap until the next period. A free skill takes none",
210
+ fields: {
211
+ every: {
212
+ type: "integer",
213
+ description: "How many units of time each budget period lasts",
214
+ },
215
+ unit: {
216
+ type: "string",
217
+ description: "The unit of time of each budget period",
218
+ values: periodUnits,
219
+ },
220
+ },
221
+ optional: {
222
+ maxRuns: {
223
+ type: "integer",
224
+ description: "The most runs to start in one period",
225
+ },
226
+ maxAmountCents: {
227
+ type: "number",
228
+ description: "The most, in cents, to spend in one period",
229
+ },
230
+ },
231
+ },
232
+ then: followUpField,
233
+ attachments: attachmentsField,
234
+ }),
235
+ run: async (input, signal) => {
236
+ const cadence = readCadence(input);
237
+ const schedule = await peer.schedule(required(input, "agent"), required(input, "task"), {
238
+ ...cadence,
239
+ skill: optional(input, "skill"),
240
+ input: optionalObject(input, "input"),
241
+ maxPriceCents: optionalNumber(input, "maxPriceCents"),
242
+ expiresAt: optionalDate(input, "expiresAt"),
243
+ budget: readBudget(input),
244
+ then: readFollowUp(input),
245
+ attachments: shelf.findAttachments(optionalFileList(input, "attachments")),
246
+ signal,
247
+ });
248
+ const tracked = tracker.track(schedule, cadence);
249
+ return JSON.stringify({
250
+ ...summarizeSchedule(tracked),
251
+ ...describeActions(tracked),
252
+ instruction: instructionOf(tracked),
253
+ });
254
+ },
255
+ }),
256
+ networkTool({
257
+ name: "get_schedule",
258
+ description: `Check on a task you scheduled: its status, when it runs next, and the runs and follow-ups that ended since you last checked, with their results. Each ended run is returned once, so keep what you need. For a schedule from before you started, it reports what the network keeps instead, so read its runs' results with list_runs and get_task. Only the latest ${maxUnread} unread runs are kept, and the schedule keeps running until it's ended.`,
259
+ inputSchema: objectSchema({
260
+ scheduleId: "The scheduleId that schedule_task or list_schedules returned",
261
+ }),
262
+ run: async (input) => {
263
+ const scheduleId = required(input, "scheduleId");
264
+ const tracked = tracker.get(scheduleId);
265
+ if (!tracked) {
266
+ return JSON.stringify(await peer.inspectSchedule(scheduleId));
267
+ }
268
+ const { finished, followUps } = tracked.takeUnread();
269
+ return JSON.stringify({
270
+ ...summarizeSchedule(tracked),
271
+ ...describeActions(tracked),
272
+ running: [...tracked.running].map(({ id }) => id),
273
+ finished: await Promise.all(finished.map((task) => describeEnded(task, shelf))),
274
+ followUps: await Promise.all(followUps.map((task) => describeEnded(task, shelf))),
275
+ });
276
+ },
277
+ }),
278
+ networkTool({
279
+ name: "list_schedules",
280
+ description: "List every task you scheduled, including those from before you started, with its status, cadence, follow-up, upcoming runs, and how many ended runs you haven't checked yet with get_schedule.",
281
+ inputSchema: objectSchema({}),
282
+ run: async () => {
283
+ const schedules = await peer.listSchedules();
284
+ return JSON.stringify({
285
+ schedules: schedules.map((schedule) => ({
286
+ ...schedule,
287
+ unread: schedule.unread + (tracker.get(schedule.scheduleId)?.unread ?? 0),
288
+ })),
289
+ });
290
+ },
291
+ }),
292
+ networkTool({
293
+ name: "list_runs",
294
+ description: "List the runs of a task you scheduled, newest first, with each run's status and whether it produced a result, without marking any as checked. Read a run's full result with get_task.",
295
+ inputSchema: objectSchema({ scheduleId: "The scheduleId of the schedule whose runs to list" }, {
296
+ cursor: "The next cursor an earlier call returned, to list the runs before that page",
297
+ limit: {
298
+ type: "integer",
299
+ description: "How many runs to list, from 1 to 100. Defaults to 20",
300
+ },
301
+ }),
302
+ run: async (input) => {
303
+ const page = await peer.listRuns(required(input, "scheduleId"), {
304
+ cursor: optional(input, "cursor"),
305
+ limit: optionalInteger(input, "limit"),
306
+ });
307
+ return JSON.stringify(page);
308
+ },
309
+ }),
310
+ networkTool({
311
+ name: "update_schedule",
312
+ description: `Replace the follow-up of a task you scheduled, or remove it by passing null for then. ${followUpHint} A follow-up whose skill needs connected accounts waits on the preparation task the result's preparationId names until your human connects them, and the old follow-up stays in effect meanwhile.`,
313
+ inputSchema: objectSchema({ scheduleId: "The scheduleId of the schedule to change" }, {
314
+ then: {
315
+ ...followUpField,
316
+ description: `${followUpField.description}. Pass null to remove the schedule's follow-up`,
317
+ },
318
+ }),
319
+ run: async (input) => {
320
+ const amendment = await peer.updateFollowUp(required(input, "scheduleId"), readFollowUp(input) ?? null);
321
+ return JSON.stringify(amendment);
322
+ },
323
+ }),
324
+ networkTool({
325
+ name: "end_schedule",
326
+ description: "Stop a task you scheduled from running again. A run already in progress still finishes.",
327
+ inputSchema: objectSchema({ scheduleId: "The scheduleId of the schedule to end" }, { reason: "Why the schedule is no longer needed" }),
328
+ run: async (input) => {
329
+ const scheduleId = required(input, "scheduleId");
330
+ const agent = tracker.get(scheduleId)?.schedule.to ??
331
+ (await findExecutor(peer, scheduleId));
332
+ await peer.endSchedule(agent, scheduleId, optional(input, "reason"));
333
+ return `Ended schedule "${scheduleId}". A run already in progress still finishes.`;
334
+ },
335
+ }),
336
+ ];
337
+ //# sourceMappingURL=schedules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedules.js","sourceRoot":"","sources":["../../src/tools/schedules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAUnD,OAAO,EACL,MAAM,EAGN,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,cAAc,EACd,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,gBAAgB,EAEhB,WAAW,EAEX,UAAU,EACV,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,MAAM,WAAW,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AAEtD,MAAM,YAAY,GAChB,yUAAyU,CAAC;AAE5U,MAAM,aAAa,GAAU;IAC3B,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,oJAAoJ;IACtJ,MAAM,EAAE;QACN,KAAK,EACH,wEAAwE;QAC1E,KAAK,EAAE,wDAAwD;KAChE;IACD,QAAQ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C,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;YAErE,OAAO,mBAAmB,UAAU,8CAA8C,CAAC;QACrF,CAAC;KACF,CAAC;CACH,CAAC"}
@@ -0,0 +1,152 @@
1
+ import type { ListedSchedule, ProposalAction, ScheduleAmendment, ScheduleReport, TaskRef, TaskView } from "../protocol.js";
2
+ import { type IncomingTask } from "../tasks/incoming.js";
3
+ import type { OutgoingTask } from "../tasks/outgoing.js";
4
+ import type { Schedule } from "../tasks/scheduled.js";
5
+ import type { AgentCard, AgentQuery, Artifact, Dispute, HistoryPage, HistoryQuery, MessageReply, ProposeOptions, RemoteFile, Review, ReviewPage, ReviewQuery, ScheduleFollowUp, ScheduleOptions, SendOptions, TaskPage, TaskQuery, TaskRecap } from "../types.js";
6
+ import type { Field, FileReference, Input, InputSchema } from "./inputs.js";
7
+ /** The slice of an agent that network tools act through. */
8
+ export interface Peer {
9
+ readonly name: string;
10
+ find(query?: AgentQuery): Promise<AgentCard[]>;
11
+ send(to: string, text: string, options?: SendOptions): Promise<MessageReply>;
12
+ propose(to: string, text: string, options?: ProposeOptions): Promise<OutgoingTask>;
13
+ rate(taskId: string, rating: number, text?: string): Promise<Review>;
14
+ dispute(taskId: string, reason: string): Promise<Dispute>;
15
+ reviews(name: string, query?: ReviewQuery): Promise<ReviewPage>;
16
+ listTasks(query?: TaskQuery): Promise<TaskPage>;
17
+ recallTask(task: TaskRef): Promise<TaskRecap>;
18
+ inspectTask(taskId: string): Promise<TaskView>;
19
+ inspectSchedule(scheduleId: string): Promise<ScheduleReport>;
20
+ listSchedules(): Promise<ListedSchedule[]>;
21
+ listRuns(scheduleId: string, query?: HistoryQuery): Promise<HistoryPage>;
22
+ updateFollowUp(scheduleId: string, then: ScheduleFollowUp | null): Promise<ScheduleAmendment>;
23
+ schedule(to: string, text: string, options: ScheduleOptions): Promise<Schedule>;
24
+ endSchedule(to: string, scheduleId: string, reason?: string): Promise<void>;
25
+ cancelTask(taskId: string, reason?: string): Promise<void>;
26
+ }
27
+ /** How the agent behind the network tools handles delegated tasks. */
28
+ export type ToolSettings = {
29
+ /** Whether the agent has an `onWatchResolved` handler, which delegating without waiting reports to. */
30
+ watching: boolean;
31
+ /** Whether to offer `forward_artifact`, which delivers a delegated task's artifact as a result of the current task. */
32
+ forwarding: boolean;
33
+ };
34
+ /** Every network tool's name, in the order agents list their tools. */
35
+ export declare const networkToolNames: readonly ["find_agents", "prepare_delegates", "send_message", "delegate_task", "wait_for_tasks", "cancel_task", "list_tasks", "get_task", "schedule_task", "get_schedule", "list_schedules", "list_runs", "update_schedule", "end_schedule", "recall_task", "list_past_tasks", "publish_update", "deliver_file", "forward_artifact", "rate_agent", "dispute_task", "list_reviews"];
36
+ /** The name of a network tool, which `networkTools` in `connect()` and the adapters' tool converters take. */
37
+ export type ToolName = (typeof networkToolNames)[number];
38
+ /** Options forwarded from an SDK's tool call. */
39
+ export type ToolCallOptions = {
40
+ /** Aborts the tool call when it fires. */
41
+ signal?: AbortSignal | undefined;
42
+ };
43
+ /** What a network tool resolves with: text for the model, and the files the tool received. */
44
+ export type ToolResult = {
45
+ /** The tool's result, or a description of what went wrong, as text that also describes `files`. */
46
+ text: string;
47
+ /** The files the tool received, such as those on a reply, to show the model where its SDK allows. */
48
+ files: (File | RemoteFile)[];
49
+ };
50
+ /**
51
+ * A network tool in an SDK-neutral shape, which adapters convert into each SDK's tool format.
52
+ * Inputs are validated at runtime, and expected failures are returned as text for the model.
53
+ */
54
+ export type NetworkTool = {
55
+ /** The tool's name, as the model calls it. */
56
+ name: string;
57
+ /** What the tool does, shown to the model. */
58
+ description: string;
59
+ /** The JSON Schema of the tool's arguments. */
60
+ inputSchema: InputSchema;
61
+ /**
62
+ * Runs the tool with the model's arguments.
63
+ *
64
+ * @param input The model's arguments, validated against `inputSchema` at runtime.
65
+ * @param options Forwarded from the SDK's tool call, e.g. an abort signal.
66
+ * @returns The tool's result, or a description of what went wrong, as text, and the files it received.
67
+ */
68
+ execute: (input: unknown, options?: ToolCallOptions) => Promise<ToolResult>;
69
+ };
70
+ export type ToolDefinition = Omit<NetworkTool, "name" | "execute"> & {
71
+ name: ToolName;
72
+ run: (input: Input, signal: AbortSignal) => Promise<string | ToolResult>;
73
+ };
74
+ export declare const irreversibleHint = "A task of a skill marked irreversible can't be canceled once its agent commits to an action it can't undo, such as a purchase, so confirm with your human before delegating one.";
75
+ export declare const followUpHint = "To change or build on an ended task's result, delegate to the same agent again with follows set to its taskId, describing only what to change: the agent sees what that task asked for and produced, and the same skill reuses its input when you omit input. A skill that lists revisions runs that many follow-ups of a completed task for free.";
76
+ export declare const prepareHint = "Before long work, pass the agents you'll delegate to whose skills list connections to prepare_delegates, so your human connects their accounts at the start rather than partway through.";
77
+ export declare const summarize: (received: Artifact) => {
78
+ id: string;
79
+ type: string;
80
+ name: string | undefined;
81
+ mimeType: string | undefined;
82
+ text: string;
83
+ size?: never;
84
+ } | {
85
+ text?: never;
86
+ id: string;
87
+ type: string;
88
+ name: string;
89
+ mimeType: string | undefined;
90
+ size: number | undefined;
91
+ };
92
+ export declare const summarizeActions: (actions: ProposalAction[]) => {
93
+ provider: string;
94
+ url: string;
95
+ reason?: string;
96
+ agent?: string;
97
+ }[];
98
+ export declare const networkTool: ({ run, ...definition }: ToolDefinition) => NetworkTool;
99
+ export declare const attachmentsField: Field;
100
+ export declare const constructSource: (received: Artifact) => import("../content.js").LabeledContent | RemoteFile;
101
+ /**
102
+ * Keeps the artifacts the tasks delegated as part of each task returned, and the files on replies about tasks, for as
103
+ * long as that task lives, so it can forward or attach them.
104
+ */
105
+ export declare class ArtifactShelf {
106
+ private readonly received;
107
+ /** Summarizes the files a task returned or a reply about it carried for the model, keeping them for the current task. */
108
+ summarize(taskId: string | undefined, artifacts: Artifact[]): ({
109
+ id: string;
110
+ type: string;
111
+ name: string | undefined;
112
+ mimeType: string | undefined;
113
+ text: string;
114
+ size?: never;
115
+ } | {
116
+ text?: never;
117
+ id: string;
118
+ type: string;
119
+ name: string;
120
+ mimeType: string | undefined;
121
+ size: number | undefined;
122
+ })[];
123
+ find(task: IncomingTask, taskId: string, artifactId: string): Artifact | undefined;
124
+ /** Finds the files the model names among those received while working on the current task, ready to attach. */
125
+ findAttachments(references: FileReference[] | undefined): (import("../content.js").LabeledContent | RemoteFile)[] | undefined;
126
+ }
127
+ export declare const settleTask: (task: OutgoingTask, shelf: ArtifactShelf) => Promise<{
128
+ taskId: string;
129
+ status: string;
130
+ output?: import("../types.js").JsonObject;
131
+ artifacts: ({
132
+ id: string;
133
+ type: string;
134
+ name: string | undefined;
135
+ mimeType: string | undefined;
136
+ text: string;
137
+ size?: never;
138
+ } | {
139
+ text?: never;
140
+ id: string;
141
+ type: string;
142
+ name: string;
143
+ mimeType: string | undefined;
144
+ size: number | undefined;
145
+ })[];
146
+ } | {
147
+ taskId: string;
148
+ status: string;
149
+ code?: import("../protocol.js").TaskEndCode;
150
+ error: string;
151
+ }>;
152
+ //# sourceMappingURL=shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,QAAQ,EACT,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,OAAO,EACP,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,UAAU,EACV,MAAM,EACN,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAS,EACV,MAAM,aAAa,CAAC;AACrB,OAAO,KAA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