@agentjam/sdk 0.0.0-stage → 0.1.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 +181 -2
- package/dist/adapters/ai.d.ts +47 -0
- package/dist/adapters/ai.d.ts.map +1 -0
- package/dist/adapters/ai.js +168 -0
- package/dist/adapters/ai.js.map +1 -0
- package/dist/adapters/anthropic.d.ts +68 -0
- package/dist/adapters/anthropic.d.ts.map +1 -0
- package/dist/adapters/anthropic.js +193 -0
- package/dist/adapters/anthropic.js.map +1 -0
- package/dist/adapters/openai.d.ts +35 -0
- package/dist/adapters/openai.d.ts.map +1 -0
- package/dist/adapters/openai.js +80 -0
- package/dist/adapters/openai.js.map +1 -0
- package/dist/adapters/openaiAgents.d.ts +39 -0
- package/dist/adapters/openaiAgents.d.ts.map +1 -0
- package/dist/adapters/openaiAgents.js +152 -0
- package/dist/adapters/openaiAgents.js.map +1 -0
- package/dist/adapters/shared.d.ts +72 -0
- package/dist/adapters/shared.d.ts.map +1 -0
- package/dist/adapters/shared.js +174 -0
- package/dist/adapters/shared.js.map +1 -0
- package/dist/agent.d.ts +462 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +1820 -0
- package/dist/agent.js.map +1 -0
- package/dist/artifacts.d.ts +79 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +367 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/attachments.d.ts +43 -0
- package/dist/attachments.d.ts.map +1 -0
- package/dist/attachments.js +69 -0
- package/dist/attachments.js.map +1 -0
- package/dist/connections.d.ts +109 -0
- package/dist/connections.d.ts.map +1 -0
- package/dist/connections.js +274 -0
- package/dist/connections.js.map +1 -0
- package/dist/content.d.ts +36 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +21 -0
- package/dist/content.js.map +1 -0
- package/dist/cron.d.ts +31 -0
- package/dist/cron.d.ts.map +1 -0
- package/dist/cron.js +93 -0
- package/dist/cron.js.map +1 -0
- package/dist/errors.d.ts +227 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +253 -0
- package/dist/errors.js.map +1 -0
- package/dist/events.d.ts +57 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +24 -0
- package/dist/events.js.map +1 -0
- package/dist/idempotency.d.ts +21 -0
- package/dist/idempotency.d.ts.map +1 -0
- package/dist/idempotency.js +46 -0
- package/dist/idempotency.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs.d.ts +22 -0
- package/dist/inputs.d.ts.map +1 -0
- package/dist/inputs.js +72 -0
- package/dist/inputs.js.map +1 -0
- package/dist/mpp.d.ts +76 -0
- package/dist/mpp.d.ts.map +1 -0
- package/dist/mpp.js +113 -0
- package/dist/mpp.js.map +1 -0
- package/dist/oauth.d.ts +3 -0
- package/dist/oauth.d.ts.map +1 -0
- package/dist/oauth.js +2 -0
- package/dist/oauth.js.map +1 -0
- package/dist/oauthCallbacks.d.ts +2 -0
- package/dist/oauthCallbacks.d.ts.map +1 -0
- package/dist/oauthCallbacks.js +58 -0
- package/dist/oauthCallbacks.js.map +1 -0
- package/dist/platforms/datadog.d.ts +10 -0
- package/dist/platforms/datadog.d.ts.map +1 -0
- package/dist/platforms/datadog.js +15 -0
- package/dist/platforms/datadog.js.map +1 -0
- package/dist/platforms/github.d.ts +181 -0
- package/dist/platforms/github.d.ts.map +1 -0
- package/dist/platforms/github.js +468 -0
- package/dist/platforms/github.js.map +1 -0
- package/dist/platforms/google.d.ts +19 -0
- package/dist/platforms/google.d.ts.map +1 -0
- package/dist/platforms/google.js +70 -0
- package/dist/platforms/google.js.map +1 -0
- package/dist/platforms/grafana.d.ts +10 -0
- package/dist/platforms/grafana.d.ts.map +1 -0
- package/dist/platforms/grafana.js +14 -0
- package/dist/platforms/grafana.js.map +1 -0
- package/dist/platforms/posthog.d.ts +10 -0
- package/dist/platforms/posthog.d.ts.map +1 -0
- package/dist/platforms/posthog.js +14 -0
- package/dist/platforms/posthog.js.map +1 -0
- package/dist/platforms/presets.d.ts +34 -0
- package/dist/platforms/presets.d.ts.map +1 -0
- package/dist/platforms/presets.js +36 -0
- package/dist/platforms/presets.js.map +1 -0
- package/dist/platforms/sentry.d.ts +79 -0
- package/dist/platforms/sentry.d.ts.map +1 -0
- package/dist/platforms/sentry.js +124 -0
- package/dist/platforms/sentry.js.map +1 -0
- package/dist/platforms/slack.d.ts +101 -0
- package/dist/platforms/slack.d.ts.map +1 -0
- package/dist/platforms/slack.js +309 -0
- package/dist/platforms/slack.js.map +1 -0
- package/dist/platforms/splunk.d.ts +10 -0
- package/dist/platforms/splunk.d.ts.map +1 -0
- package/dist/platforms/splunk.js +14 -0
- package/dist/platforms/splunk.js.map +1 -0
- package/dist/polling.d.ts +2 -0
- package/dist/polling.d.ts.map +1 -0
- package/dist/polling.js +66 -0
- package/dist/polling.js.map +1 -0
- package/dist/profile.d.ts +60 -0
- package/dist/profile.d.ts.map +1 -0
- package/dist/profile.js +119 -0
- package/dist/profile.js.map +1 -0
- package/dist/protocol.d.ts +474 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +2 -0
- package/dist/protocol.js.map +1 -0
- package/dist/providers.d.ts +113 -0
- package/dist/providers.d.ts.map +1 -0
- package/dist/providers.js +98 -0
- package/dist/providers.js.map +1 -0
- package/dist/recaps.d.ts +10 -0
- package/dist/recaps.d.ts.map +1 -0
- package/dist/recaps.js +49 -0
- package/dist/recaps.js.map +1 -0
- package/dist/relay/chains.d.ts +62 -0
- package/dist/relay/chains.d.ts.map +1 -0
- package/dist/relay/chains.js +150 -0
- package/dist/relay/chains.js.map +1 -0
- package/dist/relay/credentials.d.ts +25 -0
- package/dist/relay/credentials.d.ts.map +1 -0
- package/dist/relay/credentials.js +234 -0
- package/dist/relay/credentials.js.map +1 -0
- package/dist/relay/endpoints.d.ts +13 -0
- package/dist/relay/endpoints.d.ts.map +1 -0
- package/dist/relay/endpoints.js +13 -0
- package/dist/relay/endpoints.js.map +1 -0
- package/dist/relay/frames.d.ts +193 -0
- package/dist/relay/frames.d.ts.map +1 -0
- package/dist/relay/frames.js +161 -0
- package/dist/relay/frames.js.map +1 -0
- package/dist/relay/grants.d.ts +158 -0
- package/dist/relay/grants.d.ts.map +1 -0
- package/dist/relay/grants.js +2 -0
- package/dist/relay/grants.js.map +1 -0
- package/dist/relay/guestStore.d.ts +37 -0
- package/dist/relay/guestStore.d.ts.map +1 -0
- package/dist/relay/guestStore.js +61 -0
- package/dist/relay/guestStore.js.map +1 -0
- package/dist/relay/guests.d.ts +7 -0
- package/dist/relay/guests.d.ts.map +1 -0
- package/dist/relay/guests.js +30 -0
- package/dist/relay/guests.js.map +1 -0
- package/dist/relay/memory.d.ts +60 -0
- package/dist/relay/memory.d.ts.map +1 -0
- package/dist/relay/memory.js +334 -0
- package/dist/relay/memory.js.map +1 -0
- package/dist/relay/payments.d.ts +43 -0
- package/dist/relay/payments.d.ts.map +1 -0
- package/dist/relay/payments.js +115 -0
- package/dist/relay/payments.js.map +1 -0
- package/dist/relay/profiles.d.ts +10 -0
- package/dist/relay/profiles.d.ts.map +1 -0
- package/dist/relay/profiles.js +43 -0
- package/dist/relay/profiles.js.map +1 -0
- package/dist/relay/relay.d.ts +133 -0
- package/dist/relay/relay.d.ts.map +1 -0
- package/dist/relay/relay.js +2 -0
- package/dist/relay/relay.js.map +1 -0
- package/dist/relay/remote.d.ts +39 -0
- package/dist/relay/remote.d.ts.map +1 -0
- package/dist/relay/remote.js +492 -0
- package/dist/relay/remote.js.map +1 -0
- package/dist/relay/revisions.d.ts +13 -0
- package/dist/relay/revisions.d.ts.map +1 -0
- package/dist/relay/revisions.js +34 -0
- package/dist/relay/revisions.js.map +1 -0
- package/dist/relay/schedules.d.ts +41 -0
- package/dist/relay/schedules.d.ts.map +1 -0
- package/dist/relay/schedules.js +217 -0
- package/dist/relay/schedules.js.map +1 -0
- package/dist/relay/secrets.d.ts +14 -0
- package/dist/relay/secrets.d.ts.map +1 -0
- package/dist/relay/secrets.js +30 -0
- package/dist/relay/secrets.js.map +1 -0
- package/dist/relay/sessions.d.ts +59 -0
- package/dist/relay/sessions.d.ts.map +1 -0
- package/dist/relay/sessions.js +282 -0
- package/dist/relay/sessions.js.map +1 -0
- package/dist/relay/uploads.d.ts +15 -0
- package/dist/relay/uploads.d.ts.map +1 -0
- package/dist/relay/uploads.js +55 -0
- package/dist/relay/uploads.js.map +1 -0
- package/dist/requests.d.ts +22 -0
- package/dist/requests.d.ts.map +1 -0
- package/dist/requests.js +64 -0
- package/dist/requests.js.map +1 -0
- package/dist/screening.d.ts +93 -0
- package/dist/screening.d.ts.map +1 -0
- package/dist/screening.js +176 -0
- package/dist/screening.js.map +1 -0
- package/dist/secrets.d.ts +38 -0
- package/dist/secrets.d.ts.map +1 -0
- package/dist/secrets.js +162 -0
- package/dist/secrets.js.map +1 -0
- package/dist/skills.d.ts +11 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +55 -0
- package/dist/skills.js.map +1 -0
- package/dist/stripe.d.ts +10 -0
- package/dist/stripe.d.ts.map +1 -0
- package/dist/stripe.js +51 -0
- package/dist/stripe.js.map +1 -0
- package/dist/tasks/access.d.ts +35 -0
- package/dist/tasks/access.d.ts.map +1 -0
- package/dist/tasks/access.js +101 -0
- package/dist/tasks/access.js.map +1 -0
- package/dist/tasks/incoming.d.ts +333 -0
- package/dist/tasks/incoming.d.ts.map +1 -0
- package/dist/tasks/incoming.js +354 -0
- package/dist/tasks/incoming.js.map +1 -0
- package/dist/tasks/outgoing.d.ts +137 -0
- package/dist/tasks/outgoing.d.ts.map +1 -0
- package/dist/tasks/outgoing.js +233 -0
- package/dist/tasks/outgoing.js.map +1 -0
- package/dist/tasks/scheduled.d.ts +76 -0
- package/dist/tasks/scheduled.d.ts.map +1 -0
- package/dist/tasks/scheduled.js +110 -0
- package/dist/tasks/scheduled.js.map +1 -0
- package/dist/tasks/triggers.d.ts +47 -0
- package/dist/tasks/triggers.d.ts.map +1 -0
- package/dist/tasks/triggers.js +149 -0
- package/dist/tasks/triggers.js.map +1 -0
- package/dist/tasks/watches.d.ts +13 -0
- package/dist/tasks/watches.d.ts.map +1 -0
- package/dist/tasks/watches.js +54 -0
- package/dist/tasks/watches.js.map +1 -0
- package/dist/tools.d.ts +85 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +627 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +926 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/vaults/local.d.ts +54 -0
- package/dist/vaults/local.d.ts.map +1 -0
- package/dist/vaults/local.js +362 -0
- package/dist/vaults/local.js.map +1 -0
- package/dist/vaults/remote.d.ts +78 -0
- package/dist/vaults/remote.d.ts.map +1 -0
- package/dist/vaults/remote.js +295 -0
- package/dist/vaults/remote.js.map +1 -0
- package/dist/vaults/vault.d.ts +69 -0
- package/dist/vaults/vault.d.ts.map +1 -0
- package/dist/vaults/vault.js +19 -0
- package/dist/vaults/vault.js.map +1 -0
- package/dist/verdicts.d.ts +15 -0
- package/dist/verdicts.d.ts.map +1 -0
- package/dist/verdicts.js +17 -0
- package/dist/verdicts.js.map +1 -0
- package/dist/watermarks.d.ts +29 -0
- package/dist/watermarks.d.ts.map +1 -0
- package/dist/watermarks.js +11 -0
- package/dist/watermarks.js.map +1 -0
- package/package.json +152 -3
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const firstAccessCheckMs = 5_000;
|
|
2
|
+
const maxAccessCheckMs = 60_000;
|
|
3
|
+
const computeNextCheck = (delayMs) => Math.min(delayMs * 2, maxAccessCheckMs);
|
|
4
|
+
const waitKey = (provider, { requester, id }) => JSON.stringify([provider, requester, id]);
|
|
5
|
+
/** One task's wait on access, woken early once its holder's connection is ready, even between its checks. */
|
|
6
|
+
class AccessWaiter {
|
|
7
|
+
proposalId;
|
|
8
|
+
close;
|
|
9
|
+
woken = false;
|
|
10
|
+
resume;
|
|
11
|
+
constructor(proposalId, close) {
|
|
12
|
+
this.proposalId = proposalId;
|
|
13
|
+
this.close = close;
|
|
14
|
+
}
|
|
15
|
+
wake() {
|
|
16
|
+
if (this.resume)
|
|
17
|
+
return this.resume();
|
|
18
|
+
this.woken = true;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Waits `delayMs`, or less once `wake()` is called, returning at once when it was called since the last wait.
|
|
22
|
+
*
|
|
23
|
+
* @returns Whether a ready connection woke the wait.
|
|
24
|
+
* @throws The reason `signal` aborted with, as soon as it does.
|
|
25
|
+
*/
|
|
26
|
+
async sleep(delayMs, signal) {
|
|
27
|
+
signal.throwIfAborted();
|
|
28
|
+
if (this.woken) {
|
|
29
|
+
this.woken = false;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return new Promise((resolve, reject) => {
|
|
33
|
+
const stop = () => {
|
|
34
|
+
clearTimeout(timer);
|
|
35
|
+
signal.removeEventListener("abort", abort);
|
|
36
|
+
this.resume = undefined;
|
|
37
|
+
};
|
|
38
|
+
const abort = () => {
|
|
39
|
+
stop();
|
|
40
|
+
reject(signal.reason);
|
|
41
|
+
};
|
|
42
|
+
const timer = setTimeout(() => {
|
|
43
|
+
stop();
|
|
44
|
+
resolve(false);
|
|
45
|
+
}, delayMs);
|
|
46
|
+
this.resume = () => {
|
|
47
|
+
stop();
|
|
48
|
+
resolve(true);
|
|
49
|
+
};
|
|
50
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** Tracks the tasks waiting on access, so a provider's connection becoming ready or relinked reaches each of them. */
|
|
55
|
+
export class AccessWaits {
|
|
56
|
+
waiters = new Map();
|
|
57
|
+
/**
|
|
58
|
+
* Calls `check` after each wait, backing off from 5 seconds to a minute apart, or sooner once the wait's
|
|
59
|
+
* connection is ready, until it returns true.
|
|
60
|
+
*
|
|
61
|
+
* @param check Reports whether the task has its access, told whether a ready connection woke it.
|
|
62
|
+
* @throws The reason `signal` aborted with, as soon as it does.
|
|
63
|
+
*/
|
|
64
|
+
async poll(wait, signal, check) {
|
|
65
|
+
const waiter = this.open(wait);
|
|
66
|
+
try {
|
|
67
|
+
for (let delay = firstAccessCheckMs;; delay = computeNextCheck(delay)) {
|
|
68
|
+
if (await check(await waiter.sleep(delay, signal)))
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
waiter.close();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
open({ provider, holder, proposalId }) {
|
|
77
|
+
const key = waitKey(provider, holder);
|
|
78
|
+
const waiters = this.waiters.get(key) ?? new Set();
|
|
79
|
+
const waiter = new AccessWaiter(proposalId, () => {
|
|
80
|
+
waiters.delete(waiter);
|
|
81
|
+
if (waiters.size === 0)
|
|
82
|
+
this.waiters.delete(key);
|
|
83
|
+
});
|
|
84
|
+
waiters.add(waiter);
|
|
85
|
+
this.waiters.set(key, waiters);
|
|
86
|
+
return waiter;
|
|
87
|
+
}
|
|
88
|
+
wake(provider, holder) {
|
|
89
|
+
for (const waiter of this.findWaiters(provider, holder))
|
|
90
|
+
waiter.wake();
|
|
91
|
+
}
|
|
92
|
+
/** The ids of the tasks waiting on access to `provider` through `holder`'s connection. */
|
|
93
|
+
listWaiting(provider, holder) {
|
|
94
|
+
const ids = this.findWaiters(provider, holder).map(({ proposalId }) => proposalId);
|
|
95
|
+
return [...new Set(ids)];
|
|
96
|
+
}
|
|
97
|
+
findWaiters(provider, holder) {
|
|
98
|
+
return [...(this.waiters.get(waitKey(provider, holder)) ?? [])];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=access.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access.js","sourceRoot":"","sources":["../../src/tasks/access.ts"],"names":[],"mappings":"AAoBA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GAAG,EAAgB,CAAC;QAEjE,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE;YAC/C,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACvB,IAAI,OAAO,CAAC,IAAI,KAAK,CAAC;gBAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAE/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,IAAI,CAAC,QAAgB,EAAE,MAAwB;QACpD,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC;YAAE,MAAM,CAAC,IAAI,EAAE,CAAC;IACzE,CAAC;IAED,0FAA0F;IACnF,WAAW,CAAC,QAAgB,EAAE,MAAwB;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,GAAG,CAChD,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,UAAU,CAC/B,CAAC;QAEF,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,CAAC;IAEO,WAAW,CAAC,QAAgB,EAAE,MAAwB;QAC5D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAClE,CAAC;CACF"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import type { ArtifactSource } from "../artifacts.js";
|
|
2
|
+
import type { CredentialSource } from "../connections.js";
|
|
3
|
+
import { AgentJamError } from "../errors.js";
|
|
4
|
+
import type { Body, CostReport, TaskEndCode, TaskEnvelope } from "../protocol.js";
|
|
5
|
+
import type { Account } from "../providers.js";
|
|
6
|
+
import type { Attachment, Awaitable, ConnectionFetch, DeclaredConnection, Delegate, HistoryPage, HistoryQuery, IncomingMessage, InferInput, InferOutput, InputSchema, JsonObject, MessageReply, Price, SecretConnection, SendOptions, SkillCard, TaskInbox, TaskRecap, TriggerEvent } from "../types.js";
|
|
7
|
+
import type { AccessOptions } from "./access.js";
|
|
8
|
+
/** What `onTask` may return: nothing, one artifact source, or several to send in order. */
|
|
9
|
+
export type TaskOutput = ArtifactSource | ArtifactSource[] | void;
|
|
10
|
+
/** A task this agent accepted. It's passed to `onTask` and available through `currentTask()`. */
|
|
11
|
+
export interface IncomingTask {
|
|
12
|
+
/** The task's unique id. */
|
|
13
|
+
readonly id: string;
|
|
14
|
+
/** The agent that proposed the task. */
|
|
15
|
+
readonly from: string;
|
|
16
|
+
/** The human whose request started the task's chain, as their email or `guest:<agent>`, or `undefined` on relays that don't track one. */
|
|
17
|
+
readonly principal: string | undefined;
|
|
18
|
+
/** The requester's description of the task. */
|
|
19
|
+
readonly text: string;
|
|
20
|
+
/** The name of the skill the task calls for, if the requester named one. */
|
|
21
|
+
readonly skill: string | undefined;
|
|
22
|
+
/** The requester's structured input, which the relay validated against the skill's input schema. */
|
|
23
|
+
readonly input: JsonObject | undefined;
|
|
24
|
+
/** The files the requester attached, already downloaded. */
|
|
25
|
+
readonly attachments: Attachment[];
|
|
26
|
+
/** What the earlier task this one follows up on asked for and produced, when the requester proposed it as a follow-up. */
|
|
27
|
+
readonly previous: TaskRecap | undefined;
|
|
28
|
+
/** The schedule this task is a run of, if any. */
|
|
29
|
+
readonly scheduleId: string | undefined;
|
|
30
|
+
/** The run's number, starting from 1, if the task is a run of a schedule. */
|
|
31
|
+
readonly run: number | undefined;
|
|
32
|
+
/** The trigger event that started this run, if it's a run of a trigger schedule. */
|
|
33
|
+
readonly event: TriggerEvent | undefined;
|
|
34
|
+
/** Whether another session of this agent started the task before it left, so the work may be partly done. */
|
|
35
|
+
readonly resumed: boolean;
|
|
36
|
+
/** Which attempt at the task this is: 1 for the first, plus one for each time it resumed. */
|
|
37
|
+
readonly attempt: number;
|
|
38
|
+
/**
|
|
39
|
+
* Aborts when the requester cancels, the task fails, or this agent disconnects. It aborts with a `ReassignedError` once
|
|
40
|
+
* the task moved to another session of this agent, after which nothing this session sends for it reaches the requester.
|
|
41
|
+
*/
|
|
42
|
+
readonly signal: AbortSignal;
|
|
43
|
+
/**
|
|
44
|
+
* What the relay holds from the requester for this task, in cents, which caps what it can charge until
|
|
45
|
+
* the hold grows. It's `undefined` for free tasks and on relays that don't hold funds.
|
|
46
|
+
*/
|
|
47
|
+
readonly heldCents: number | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Sends a progress update to the requester. Does nothing once the task has ended.
|
|
50
|
+
*
|
|
51
|
+
* @param text The update to show the requester.
|
|
52
|
+
* @returns Resolves once the update has been sent.
|
|
53
|
+
*/
|
|
54
|
+
update(text: string): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Sends the requester a message about this task and resolves with its reply, waiting until the task
|
|
57
|
+
* ends since a human may need to answer. It reaches the session that proposed the task, in a
|
|
58
|
+
* conversation named after the task unless `options` names another.
|
|
59
|
+
*
|
|
60
|
+
* @param text The message to send.
|
|
61
|
+
* @param options The conversation to continue and the files to attach, plus per-call request overrides.
|
|
62
|
+
* @returns The requester's reply, with its files downloaded.
|
|
63
|
+
* @throws {AgentNotFoundError} If the session that proposed the task is gone.
|
|
64
|
+
* @throws {TimeoutError} If `options` sets a timeout and no reply arrives within it.
|
|
65
|
+
*/
|
|
66
|
+
send(text: string, options?: RequesterMessageOptions): Promise<MessageReply>;
|
|
67
|
+
/**
|
|
68
|
+
* Opens the task's inbox, so the requester's messages about the task queue up for the work in progress
|
|
69
|
+
* instead of reaching `onMessage`, each answered right away with an acknowledgement. It closes once the task ends.
|
|
70
|
+
*
|
|
71
|
+
* @returns The inbox, which every call shares.
|
|
72
|
+
*/
|
|
73
|
+
openInbox(): TaskInbox;
|
|
74
|
+
/**
|
|
75
|
+
* Sends an artifact right away, streaming async iterables. Does nothing once the task has ended.
|
|
76
|
+
* Requesters keep only the latest delivery of each key that `artifact()` names, so repeated deliveries replace it.
|
|
77
|
+
*
|
|
78
|
+
* @param source The artifact content, optionally labeled with `artifact()`.
|
|
79
|
+
* @returns Resolves once the whole artifact has been sent.
|
|
80
|
+
* @throws {AgentJamError} If the artifact's key isn't a string of 1 to 256 characters, which also fails the task.
|
|
81
|
+
*/
|
|
82
|
+
deliver(source: ArtifactSource): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Adds to the task's running cost, which a `cost_plus` skill charges plus its markup once the
|
|
85
|
+
* task completes or its requester cancels it. A `cost_plus` task that never calls this fails instead of completing.
|
|
86
|
+
*
|
|
87
|
+
* @param costCents The cost to add in cents, at least 0 and as precise as a millionth of a cent, such as 0.0137.
|
|
88
|
+
* @throws {AgentJamError} If `costCents` isn't a finite number of at least 0.
|
|
89
|
+
*/
|
|
90
|
+
incrementCost(costCents: number): void;
|
|
91
|
+
/**
|
|
92
|
+
* Commits to an action that can't be undone, such as a purchase, after which the requester can't cancel
|
|
93
|
+
* the task. Only an irreversible skill's tasks can commit, and a `cost_plus` one first grows `heldCents`
|
|
94
|
+
* to cover its running cost with the action's cost added, plus the skill's markup.
|
|
95
|
+
*
|
|
96
|
+
* @param options The action's cost in cents, added to the running cost once the commit is recorded.
|
|
97
|
+
* @returns Resolves once the relay recorded the commit, so the action can go ahead.
|
|
98
|
+
* @throws {UncoveredCostError} If the requester can't fund the cost plus the skill's markup, which commits nothing.
|
|
99
|
+
* @throws {AgentJamError} If the skill isn't irreversible, the task has ended, or a `cost_plus` task has no cost.
|
|
100
|
+
*/
|
|
101
|
+
commit(options?: CommitOptions): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Gets an access token for the requester's account through `connection`, refreshing it when it expired.
|
|
104
|
+
*
|
|
105
|
+
* @param connection A connection in the `connections` of the task's skill.
|
|
106
|
+
* @param name The token to get, such as Slack's `user` token, for a provider that issues several. Defaults to the provider's default token.
|
|
107
|
+
* @returns A current access token.
|
|
108
|
+
* @throws {ConnectionRevokedError} If the account is no longer connected.
|
|
109
|
+
* @throws {AgentJamError} If the task's skill doesn't declare `connection`, or the grant has no token named `name`.
|
|
110
|
+
*/
|
|
111
|
+
credentials<Token extends string>(connection: CredentialSource<Token>, name?: NoInfer<Token>): Promise<string>;
|
|
112
|
+
/**
|
|
113
|
+
* Gets the requester's account through `connection`, such as their Slack workspace and user.
|
|
114
|
+
*
|
|
115
|
+
* @param connection A connection in the `connections` of the task's skill.
|
|
116
|
+
* @returns The account, or undefined if the connection doesn't know it.
|
|
117
|
+
* @throws {ConnectionRevokedError} If the account is no longer connected.
|
|
118
|
+
* @throws {AgentJamError} If the task's skill doesn't declare `connection`.
|
|
119
|
+
*/
|
|
120
|
+
account(connection: CredentialSource): Promise<Account | undefined>;
|
|
121
|
+
/**
|
|
122
|
+
* Asks the requester's human for access the task turned out to lack, such as a repository they didn't grant a
|
|
123
|
+
* GitHub App or a Drive file they didn't pick, then waits until `verify` passes, spending no model turns. The task
|
|
124
|
+
* waits on the human until then, and the relay passes the link up the chain to them, so nothing needs relaying.
|
|
125
|
+
* Gather and verify all access before `commit()`, since a committed task can't wait on the human.
|
|
126
|
+
*
|
|
127
|
+
* @param connection A connection in the `connections` of the task's skill.
|
|
128
|
+
* @param options What the human must do, how to check it's done, and optionally where.
|
|
129
|
+
* @returns Resolves once `verify` passes, with the task running again.
|
|
130
|
+
* @throws {TaskCanceledError} If the human didn't act within an hour, or the requester canceled the task.
|
|
131
|
+
* @throws {TaskCommittedError} If the task was committed, which also fails the task and releases what the relay holds for it.
|
|
132
|
+
* @throws {AgentJamError} If the task has ended, its skill doesn't declare `connection`, or neither `url` nor the connection gives a link.
|
|
133
|
+
*/
|
|
134
|
+
requireAccess(connection: DeclaredConnection, options: AccessOptions): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Returns a `fetch` that sends requests to the provider of a secret connection through the platform's proxy,
|
|
137
|
+
* which adds the human's credential, so the agent never sees it. Pass a path under the credential's base URL,
|
|
138
|
+
* such as `/api/search`, or a full URL under it.
|
|
139
|
+
*
|
|
140
|
+
* @param connection A secret connection in the `connections` of the task's skill.
|
|
141
|
+
* @returns A `fetch` that throws `ConnectionRevokedError` once the credential is gone and `RequestRefusedError` for requests the platform refuses.
|
|
142
|
+
* @throws {AgentJamError} If the task's skill doesn't declare `connection` as a secret connection.
|
|
143
|
+
*/
|
|
144
|
+
connectionFetch(connection: SecretConnection): ConnectionFetch;
|
|
145
|
+
/**
|
|
146
|
+
* Gets the non-secret fields the human entered for a secret connection, such as their Grafana URL.
|
|
147
|
+
*
|
|
148
|
+
* @param connection A secret connection in the `connections` of the task's skill.
|
|
149
|
+
* @returns The non-secret fields by name.
|
|
150
|
+
* @throws {ConnectionRevokedError} If the credential is gone.
|
|
151
|
+
* @throws {AgentJamError} If the task's skill doesn't declare `connection` as a secret connection.
|
|
152
|
+
*/
|
|
153
|
+
connectionConfig(connection: SecretConnection): Promise<Record<string, string>>;
|
|
154
|
+
/**
|
|
155
|
+
* Asks agents this task is about to hand work off to for the accounts their skills need, so the
|
|
156
|
+
* requester's human connects them now rather than once each handoff starts. Prepare only the delegates
|
|
157
|
+
* the task will use, since each one may ask the human to connect. Does nothing once the task has ended.
|
|
158
|
+
*
|
|
159
|
+
* @param delegates The agents and the skills of theirs the task will call for.
|
|
160
|
+
* @returns Resolves once every delegate answered, reporting the ones that couldn't prepare to `onError`.
|
|
161
|
+
*/
|
|
162
|
+
prepare(delegates: Delegate[]): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Lists the ended tasks this agent ran before this one, newest first: earlier runs of its schedule for a run, or
|
|
165
|
+
* earlier tasks of its skill for the same human for a one-off. Recall what any of them produced with `recallTask()`.
|
|
166
|
+
*
|
|
167
|
+
* @param query The page size and the `next` of an earlier page.
|
|
168
|
+
* @returns A page of past tasks, with `next` set when older ones remain.
|
|
169
|
+
* @throws {AgentJamError} If the relay doesn't keep tasks, or `query` is invalid.
|
|
170
|
+
*/
|
|
171
|
+
listHistory(query?: HistoryQuery): Promise<HistoryPage>;
|
|
172
|
+
/**
|
|
173
|
+
* Gets the task's input as the skill's input schema parsed it before the task was accepted, so its
|
|
174
|
+
* refinements held and its transforms applied.
|
|
175
|
+
*
|
|
176
|
+
* @param skill The skill the task calls for, with its `input` schema.
|
|
177
|
+
* @returns The requester's input, parsed.
|
|
178
|
+
* @throws {AgentJamError} If the task calls for another skill, or this process wasn't connected with the skill's input schema.
|
|
179
|
+
*/
|
|
180
|
+
getInput<Schema extends InputSchema>(skill: {
|
|
181
|
+
name: string;
|
|
182
|
+
input: Schema;
|
|
183
|
+
}): InferOutput<Schema>;
|
|
184
|
+
/**
|
|
185
|
+
* Sets the task's structured output, which the requester reads with `getOutput()` once the task completes.
|
|
186
|
+
* A task whose skill has an output schema must set it before it completes, and setting it again replaces it.
|
|
187
|
+
*
|
|
188
|
+
* @param skill The skill the task calls for, with its `output` schema.
|
|
189
|
+
* @param output The output, matching the schema.
|
|
190
|
+
* @returns Resolves once the schema accepted the output.
|
|
191
|
+
* @throws {AgentJamError} If the task calls for another skill, or the schema refuses the output.
|
|
192
|
+
*/
|
|
193
|
+
setOutput<Schema extends InputSchema>(skill: {
|
|
194
|
+
name: string;
|
|
195
|
+
output: Schema;
|
|
196
|
+
}, output: InferInput<Schema>): Promise<void>;
|
|
197
|
+
}
|
|
198
|
+
/** Options for a task's `send()`, which is always about that task. */
|
|
199
|
+
export type TaskMessageOptions = Omit<SendOptions, "taskId">;
|
|
200
|
+
/** Options for a running task's `send()` to its requester, which only the requester can steer. */
|
|
201
|
+
export type RequesterMessageOptions = Omit<TaskMessageOptions, "steer">;
|
|
202
|
+
/** Options for a task's `commit()`. */
|
|
203
|
+
export type CommitOptions = {
|
|
204
|
+
/** The cost in cents of the action being committed to, which a `cost_plus` skill charges plus its markup. */
|
|
205
|
+
costCents?: number;
|
|
206
|
+
};
|
|
207
|
+
type TaskDetails = Pick<IncomingTask, "id" | "from" | "text" | "skill" | "attachments"> & {
|
|
208
|
+
principal?: string | undefined;
|
|
209
|
+
input?: JsonObject | undefined;
|
|
210
|
+
parsedInput?: {
|
|
211
|
+
value: unknown;
|
|
212
|
+
} | undefined;
|
|
213
|
+
previous?: TaskRecap | undefined;
|
|
214
|
+
scheduleId?: string | undefined;
|
|
215
|
+
run?: number | undefined;
|
|
216
|
+
event?: TriggerEvent | undefined;
|
|
217
|
+
attempt?: number | undefined;
|
|
218
|
+
resumable?: boolean;
|
|
219
|
+
price?: Price | undefined;
|
|
220
|
+
card?: SkillCard | undefined;
|
|
221
|
+
isSelf?: boolean;
|
|
222
|
+
heldCents?: number | undefined;
|
|
223
|
+
} & ConnectionAccess;
|
|
224
|
+
/** How a task or schedule reaches the accounts its skill's connections hold. */
|
|
225
|
+
export type ConnectionAccess = Pick<IncomingTask, "credentials" | "account" | "connectionFetch" | "connectionConfig">;
|
|
226
|
+
type ExecutionLink = {
|
|
227
|
+
post: (body: Body<TaskEnvelope> | CostReport) => Promise<void>;
|
|
228
|
+
send: (text: string, options: TaskMessageOptions) => Promise<MessageReply>;
|
|
229
|
+
/** Uploads a file artifact, resolving with `undefined` when the relay can't store files. */
|
|
230
|
+
upload: (file: File, signal: AbortSignal) => Promise<string | undefined>;
|
|
231
|
+
prepare: (delegates: Delegate[]) => Promise<void>;
|
|
232
|
+
listHistory: (query: HistoryQuery) => Promise<HistoryPage>;
|
|
233
|
+
requireAccess: (connection: DeclaredConnection, options: AccessOptions, signal: AbortSignal) => Promise<void>;
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* Looks up the task being executed in the current async context.
|
|
237
|
+
*
|
|
238
|
+
* @returns The current task, or `undefined` outside a task.
|
|
239
|
+
*/
|
|
240
|
+
export declare const currentTask: () => IncomingTask | undefined;
|
|
241
|
+
/**
|
|
242
|
+
* Invariant: a task sends exactly one terminal envelope, and `task.complete` follows the last
|
|
243
|
+
* chunk of every delivered artifact. A `task.update` follows every streamed piece read before it was
|
|
244
|
+
* sent. Nothing is sent once the task has ended.
|
|
245
|
+
*/
|
|
246
|
+
export declare class TaskExecution implements IncomingTask {
|
|
247
|
+
private readonly link;
|
|
248
|
+
readonly id: string;
|
|
249
|
+
readonly from: string;
|
|
250
|
+
readonly principal: string | undefined;
|
|
251
|
+
readonly text: string;
|
|
252
|
+
readonly skill: string | undefined;
|
|
253
|
+
readonly input: JsonObject | undefined;
|
|
254
|
+
readonly attachments: Attachment[];
|
|
255
|
+
readonly previous: TaskRecap | undefined;
|
|
256
|
+
readonly scheduleId: string | undefined;
|
|
257
|
+
readonly run: number | undefined;
|
|
258
|
+
readonly event: TriggerEvent | undefined;
|
|
259
|
+
readonly attempt: number;
|
|
260
|
+
/** Whether another session of this agent picks the task up once this one leaves, rather than it failing. */
|
|
261
|
+
readonly resumable: boolean;
|
|
262
|
+
readonly credentials: IncomingTask["credentials"];
|
|
263
|
+
readonly account: IncomingTask["account"];
|
|
264
|
+
readonly connectionFetch: IncomingTask["connectionFetch"];
|
|
265
|
+
readonly connectionConfig: IncomingTask["connectionConfig"];
|
|
266
|
+
private readonly controller;
|
|
267
|
+
private readonly deliveries;
|
|
268
|
+
private readonly backlogs;
|
|
269
|
+
private readonly outcome;
|
|
270
|
+
private ended;
|
|
271
|
+
private costCents;
|
|
272
|
+
private reportedCents;
|
|
273
|
+
private reportedAt;
|
|
274
|
+
private costReport;
|
|
275
|
+
private held;
|
|
276
|
+
private readonly price;
|
|
277
|
+
private readonly card;
|
|
278
|
+
private readonly isSelf;
|
|
279
|
+
private readonly parsedInput;
|
|
280
|
+
private inbox;
|
|
281
|
+
private output;
|
|
282
|
+
constructor({ id, from, principal, text, skill, input, parsedInput, attachments, previous, scheduleId, run, event, attempt, resumable, price, card, isSelf, heldCents, credentials, account, connectionFetch, connectionConfig, }: TaskDetails, link: ExecutionLink);
|
|
283
|
+
get resumed(): boolean;
|
|
284
|
+
get signal(): AbortSignal;
|
|
285
|
+
get heldCents(): number | undefined;
|
|
286
|
+
/** Records what the relay holds for the task once its hold changed. */
|
|
287
|
+
setHeldCents(heldCents: number): void;
|
|
288
|
+
/** Resolves once the task has ended and its terminal envelope, if any, has been sent. */
|
|
289
|
+
get settled(): Promise<void>;
|
|
290
|
+
update(text: string): Promise<void>;
|
|
291
|
+
send(text: string, options?: RequesterMessageOptions): Promise<MessageReply>;
|
|
292
|
+
openInbox(): TaskInbox;
|
|
293
|
+
/** Queues a requester's message about the task for the work in progress, returning whether its open inbox took it. */
|
|
294
|
+
queueMessage(message: IncomingMessage): boolean;
|
|
295
|
+
prepare(delegates: Delegate[]): Promise<void>;
|
|
296
|
+
listHistory(query?: HistoryQuery): Promise<HistoryPage>;
|
|
297
|
+
requireAccess(connection: DeclaredConnection, options: AccessOptions): Promise<void>;
|
|
298
|
+
incrementCost(costCents: number): void;
|
|
299
|
+
commit({ costCents }?: CommitOptions): Promise<void>;
|
|
300
|
+
getInput<Schema extends InputSchema>({ name, }: {
|
|
301
|
+
name: string;
|
|
302
|
+
input: Schema;
|
|
303
|
+
}): InferOutput<Schema>;
|
|
304
|
+
setOutput<Schema extends InputSchema>({ name, output }: {
|
|
305
|
+
name: string;
|
|
306
|
+
output: Schema;
|
|
307
|
+
}, value: InferInput<Schema>): Promise<void>;
|
|
308
|
+
deliver(source: ArtifactSource): Promise<void>;
|
|
309
|
+
/** Runs `work` inside this task's async context, then completes or fails the task. */
|
|
310
|
+
perform(work: (task: IncomingTask) => Awaitable<TaskOutput>): Promise<void>;
|
|
311
|
+
fail(error: unknown): Promise<void>;
|
|
312
|
+
cancel(reason: string | undefined, code?: TaskEndCode): void;
|
|
313
|
+
/** Ends the task in this session without telling the requester, aborting its signal with `error`. */
|
|
314
|
+
abandon(error: AgentJamError): void;
|
|
315
|
+
private settle;
|
|
316
|
+
private post;
|
|
317
|
+
/** Abandons the task once the relay refuses `request` because the task moved to another session. */
|
|
318
|
+
private fenceRequest;
|
|
319
|
+
private computeCost;
|
|
320
|
+
/** Whether the running cost is reported: for a `cost_plus` skill, or a task the agent proposed to itself. */
|
|
321
|
+
private get isCostReported();
|
|
322
|
+
private scheduleCostReport;
|
|
323
|
+
private sendCostReport;
|
|
324
|
+
private reportCost;
|
|
325
|
+
/** Counts the hold marks that the charge for `costCents` reached. */
|
|
326
|
+
private countMarks;
|
|
327
|
+
private assertSkill;
|
|
328
|
+
private finish;
|
|
329
|
+
private stream;
|
|
330
|
+
private sendUpload;
|
|
331
|
+
}
|
|
332
|
+
export {};
|
|
333
|
+
//# sourceMappingURL=incoming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"incoming.d.ts","sourceRoot":"","sources":["../../src/tasks/incoming.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAOtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EACL,aAAa,EAKd,MAAM,cAAc,CAAC;AAGtB,OAAO,KAAK,EACV,IAAI,EACJ,UAAU,EACV,WAAW,EACX,YAAY,EACb,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,KAAK,EACL,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,SAAS,EACT,SAAS,EACT,YAAY,EACb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,2FAA2F;AAC3F,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,cAAc,EAAE,GAAG,I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