@parcha/agentrun-serve 0.1.0-beta.39 → 0.1.0-beta.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/README.md +129 -16
- package/dist/api-only.d.ts +3 -1
- package/dist/api-only.js +4 -2
- package/dist/api-token.d.ts +30 -0
- package/dist/api-token.js +89 -0
- package/dist/cli.js +19 -5
- package/dist/composio-made.d.ts +54 -0
- package/dist/composio-made.js +83 -0
- package/dist/composio-preset.d.ts +16 -8
- package/dist/composio-preset.js +106 -43
- package/dist/composio-triggers.d.ts +7 -2
- package/dist/composio-triggers.js +13 -7
- package/dist/computer-attach.d.ts +29 -11
- package/dist/computer-attach.js +141 -47
- package/dist/computer-keys.d.ts +4 -0
- package/dist/computer-keys.js +5 -0
- package/dist/computers.d.ts +11 -1
- package/dist/computers.js +21 -12
- package/dist/console/assets/index-C3gNPz58.css +1 -0
- package/dist/console/assets/index-COGhx_2Z.js +711 -0
- package/dist/console/index.html +2 -2
- package/dist/decisions.js +9 -2
- package/dist/email/account.d.ts +0 -1
- package/dist/email/account.js +3 -3
- package/dist/email/answer.d.ts +5 -0
- package/dist/email/answer.js +35 -0
- package/dist/email/mail.js +19 -26
- package/dist/email/names.d.ts +30 -0
- package/dist/email/names.js +34 -0
- package/dist/email/routes.d.ts +1 -0
- package/dist/email/routes.js +1 -1
- package/dist/email/tools.d.ts +11 -4
- package/dist/email/tools.js +91 -46
- package/dist/eval-feed.d.ts +26 -0
- package/dist/eval-feed.js +68 -0
- package/dist/eval-mailbox.d.ts +5 -2
- package/dist/eval-mailbox.js +14 -6
- package/dist/exa-keyless.d.ts +1 -1
- package/dist/exa-keyless.js +1 -1
- package/dist/feed/feed-faux.d.ts +62 -0
- package/dist/feed/feed-faux.js +123 -0
- package/dist/feed/fetch.d.ts +41 -0
- package/dist/feed/fetch.js +128 -0
- package/dist/feed/parse.d.ts +41 -0
- package/dist/feed/parse.js +300 -0
- package/dist/learn/check.d.ts +3 -1
- package/dist/learn/check.js +57 -2
- package/dist/learn/compile.d.ts +3 -2
- package/dist/learn/compile.js +7 -6
- package/dist/learn/promote.d.ts +25 -14
- package/dist/learn/promote.js +32 -14
- package/dist/learned-nodes.d.ts +21 -4
- package/dist/learned-nodes.js +21 -8
- package/dist/learned-workflow.d.ts +3 -3
- package/dist/learned-workflow.js +14 -5
- package/dist/learning-cost.d.ts +17 -8
- package/dist/learning-cost.js +12 -4
- package/dist/local-models.d.ts +7 -1
- package/dist/local-models.js +11 -5
- package/dist/mcp-oauth.d.ts +15 -1
- package/dist/mcp-oauth.js +39 -5
- package/dist/mcp-pin-first.d.ts +4 -2
- package/dist/mcp-pin-first.js +4 -3
- package/dist/mcp-servers-store.d.ts +58 -5
- package/dist/mcp-servers-store.js +136 -17
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/observation/http.d.ts +4 -1
- package/dist/observation/http.js +5 -4
- package/dist/openapi.d.ts +1 -1
- package/dist/openapi.js +63 -27
- package/dist/port-models.d.ts +4 -1
- package/dist/port-models.js +1 -0
- package/dist/print.d.ts +6 -3
- package/dist/print.js +4 -2
- package/dist/refusal-words.d.ts +3 -0
- package/dist/refusal-words.js +3 -0
- package/dist/run-labels.d.ts +23 -0
- package/dist/run-labels.js +79 -0
- package/dist/run-launch.d.ts +2 -0
- package/dist/run-launch.js +2 -0
- package/dist/run-secrets.js +12 -4
- package/dist/run-view.d.ts +3 -4
- package/dist/run-view.js +26 -24
- package/dist/runner/adapter-loop.d.ts +6 -2
- package/dist/runner/adapter-loop.js +136 -22
- package/dist/runner/adapter-run-spec.d.ts +5 -0
- package/dist/runner/adapter-run-spec.js +75 -32
- package/dist/runner/beside.d.ts +6 -3
- package/dist/runner/beside.js +9 -7
- package/dist/runner/cli-run-spec.js +33 -26
- package/dist/runner/conformance/harness.js +69 -14
- package/dist/runner/conformance/subject.d.ts +4 -1
- package/dist/runner/journal-kinds.d.ts +22 -0
- package/dist/runner/journal-kinds.js +39 -0
- package/dist/runner/main.d.ts +1 -1
- package/dist/runner/main.js +2 -2
- package/dist/runner/mcp-claim.d.ts +3 -0
- package/dist/runner/mcp-claim.js +1 -1
- package/dist/runner/mcp-run.d.ts +4 -0
- package/dist/runner/mcp-run.js +5 -3
- package/dist/runner/model-route.d.ts +7 -3
- package/dist/runner/model-route.js +24 -9
- package/dist/runner/promotion.d.ts +16 -8
- package/dist/runner/promotion.js +178 -55
- package/dist/runner/workflow-first.d.ts +6 -5
- package/dist/runner/workflow-first.js +9 -7
- package/dist/runs-over-store.js +5 -2
- package/dist/sdk/runs.d.ts +7 -1
- package/dist/sdk/runs.js +19 -6
- package/dist/secret-cut.js +3 -1
- package/dist/secrets.js +3 -1
- package/dist/server.d.ts +27 -2
- package/dist/server.js +181 -56
- package/dist/store/dialect.d.ts +6 -0
- package/dist/store/dialect.js +2 -0
- package/dist/store/index.d.ts +1 -1
- package/dist/store/postgres/connection.d.ts +11 -5
- package/dist/store/postgres/connection.js +44 -17
- package/dist/store/postgres/dialect.js +6 -0
- package/dist/store/postgres/migrations/0015_run_labels.sql +5 -0
- package/dist/store/postgres/migrations/0016_minted_tokens.sql +21 -0
- package/dist/store/postgres/store.d.ts +7 -3
- package/dist/store/postgres/store.js +1 -0
- package/dist/store/schema.d.ts +9 -0
- package/dist/store/schema.js +26 -2
- package/dist/store/sqlite/connection.js +80 -8
- package/dist/store/sqlite/run-launch.d.ts +11 -0
- package/dist/store/sqlite/run-launch.js +8 -0
- package/dist/store/sqlite/run-patch.d.ts +2 -1
- package/dist/store/sqlite/run-patch.js +3 -2
- package/dist/store/sqlite/store.js +101 -26
- package/dist/store/sqlite/worker.d.ts +2 -0
- package/dist/store/sqlite/worker.js +13 -10
- package/dist/store/store.d.ts +53 -1
- package/dist/store-reads/journal.js +2 -1
- package/dist/store-reads/learning.d.ts +30 -13
- package/dist/store-reads/learning.js +130 -51
- package/dist/store-reads/runs.d.ts +4 -3
- package/dist/store-reads/runs.js +3 -2
- package/dist/store-view.js +4 -2
- package/dist/template-eval.d.ts +4 -0
- package/dist/template-eval.js +127 -50
- package/dist/templates.d.ts +24 -1
- package/dist/templates.js +129 -21
- package/dist/timeline/origin.d.ts +1 -1
- package/dist/timeline/origin.js +2 -2
- package/dist/tool-gate.d.ts +5 -3
- package/dist/tool-gate.js +5 -2
- package/dist/tools.d.ts +13 -0
- package/dist/tools.js +15 -10
- package/dist/trigger-adapter.d.ts +12 -36
- package/dist/trigger-adapters.js +2 -1
- package/dist/trigger-email.js +30 -77
- package/dist/trigger-feed.d.ts +12 -0
- package/dist/trigger-feed.js +371 -0
- package/dist/triggers.d.ts +27 -14
- package/dist/triggers.js +121 -80
- package/dist/webhooks.js +9 -5
- package/dist/workflow/decision-recovery.js +5 -2
- package/dist/workflow/decisions.d.ts +7 -0
- package/dist/workspace/computer-deps.d.ts +5 -1
- package/dist/workspace/computer-deps.js +2 -2
- package/dist/workspace/index.d.ts +1 -0
- package/dist/workspace/index.js +2 -0
- package/dist/workspace/resolve-computer.d.ts +32 -3
- package/dist/workspace/resolve-computer.js +47 -9
- package/launcher/agentrun-serve +6 -1
- package/package.json +10 -9
- package/templates/README.md +27 -2
- package/dist/console/assets/index-BNhZs-jp.css +0 -1
- package/dist/console/assets/index-BQv5aOGB.js +0 -700
package/dist/templates.js
CHANGED
|
@@ -151,10 +151,11 @@ export class PackageError extends Error {
|
|
|
151
151
|
this.problems = problems;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
/** The source kinds whose accept rules a parameter may fill: a github trigger's,
|
|
155
|
-
* sends every trigger of a project to one URL
|
|
156
|
-
|
|
157
|
-
|
|
154
|
+
/** The source kinds whose accept rules a parameter may fill: a github trigger's, a webhook trigger's (a provider that
|
|
155
|
+
* sends every trigger of a project to one URL is filtered to the owner's own repository by them), a composio
|
|
156
|
+
* trigger's, and a feed trigger's (the pull requests of one author, say). */
|
|
157
|
+
const FILTERED_KINDS = ["github", "webhook", "composio", "feed"];
|
|
158
|
+
/** A github, webhook, composio or feed source split at its where conditions' `in` values, the one place a parameter may fill it: `ins`, each
|
|
158
159
|
* condition's list, and `rest`, the source without them. */
|
|
159
160
|
function whereIns(source) {
|
|
160
161
|
const ins = [];
|
|
@@ -178,6 +179,34 @@ export function githubTriggerWords(packageName, source) {
|
|
|
178
179
|
return `${subject} runs on each ${or(events)} ${repos.length ? `to ${or(repos)}` : "to a repository the GitHub App is installed on"}.`;
|
|
179
180
|
}
|
|
180
181
|
const GITHUB_EVENT_WORDS = { pull_request: "pull request", pull_request_review: "pull request review", pull_request_review_comment: "review comment", issue_comment: "comment", issues: "issue", release: "release" };
|
|
182
|
+
/** The refusals of a trigger's create that mean this server can't set it up yet, by the trigger's source kind: an apply
|
|
183
|
+
* skips that trigger, never the apply, and says so under triggers.<i> (not_set_up_here). Any other refusal (a bad event
|
|
184
|
+
* or config, a 422, Composio's own error on the create) undoes the apply. GitHub's: no GitHub App here. Composio's: no
|
|
185
|
+
* public URL to send to, no connected account (or several) for the saved server's user, or the project's subscription
|
|
186
|
+
* at another address, which only the owner moves, from the console. */
|
|
187
|
+
export const TRIGGER_NOT_SET_UP_YET = {
|
|
188
|
+
github: ["github_not_connected"],
|
|
189
|
+
composio: ["composio_no_public_url", "composio_not_connected", "composio_account_ambiguous", "composio_subscription_elsewhere"],
|
|
190
|
+
};
|
|
191
|
+
/** Whether refusal `code` of a trigger of source kind `kind` is one TRIGGER_NOT_SET_UP_YET skips. */
|
|
192
|
+
export const notSetUpYet = (kind, code) => typeof kind === "string" && Object.hasOwn(TRIGGER_NOT_SET_UP_YET, kind) && TRIGGER_NOT_SET_UP_YET[kind].includes(code);
|
|
193
|
+
/** What an apply says of a composio trigger it skipped (notSetUpYet): which trigger, and the refusal's own words. */
|
|
194
|
+
export function composioTriggerSkipped(packageName, trigger, why) {
|
|
195
|
+
const source = isObject(trigger.source) ? trigger.source : {};
|
|
196
|
+
return `The ${packageName} template's trigger ${String(trigger.name)} (Composio ${String(source.event)} on ${String(source.server)}) was not made: ${why}`;
|
|
197
|
+
}
|
|
198
|
+
/** Whether a feed trigger, its parameters filled, reads no feed: its urls one whole array parameter the apply was given
|
|
199
|
+
* empty. An apply skips it, never itself, as it skips a github trigger with GitHub not connected (a warning under
|
|
200
|
+
* triggers.<i>): the agent stands. */
|
|
201
|
+
export const feedLeftEmpty = (trigger) => isObject(trigger.source) && trigger.source.kind === "feed" && Array.isArray(trigger.source.urls) && !trigger.source.urls.length;
|
|
202
|
+
/** What an apply says of a feed trigger it skipped (feedLeftEmpty): which, and the parameter to set. `declared` is the
|
|
203
|
+
* package's own urls ("${parameters.status_feeds}"). */
|
|
204
|
+
export function feedTriggerEmpty(packageName, trigger, declared) {
|
|
205
|
+
const named = (typeof declared === "string" ? [...declared.matchAll(PLACEHOLDER)][0]?.[1] : undefined) ?? "its feeds parameter";
|
|
206
|
+
return `The ${packageName} template's feed trigger ${String(trigger.name)} was not made: no feeds given in ${named}. Apply again with ${named} set to the feeds it should read.`;
|
|
207
|
+
}
|
|
208
|
+
/** Where the owner makes a composio trigger an apply skipped, once what refused it is fixed. */
|
|
209
|
+
export const COMPOSIO_TRIGGER_FIX = "Once that's fixed, make it from Triggers → New app trigger for this agent, with the same event and config.";
|
|
181
210
|
/** What an apply says of a github trigger it skipped because GitHub is not connected here: what to do, and what the
|
|
182
211
|
* trigger would then run on, in the package's own words ("Code review runs on each pull request to acme/widgets."). */
|
|
183
212
|
export const githubTriggerUnconnected = (packageName, source) => `Connect GitHub in Settings, then apply again so it runs by itself: ${githubTriggerWords(packageName, source)}`;
|
|
@@ -212,16 +241,32 @@ const inputFilled = (value, given) => {
|
|
|
212
241
|
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, inputFilled(item, given)]).filter(([, item]) => item !== undefined));
|
|
213
242
|
return value;
|
|
214
243
|
};
|
|
215
|
-
/** A trigger filled from the apply's parameters: its target.input typed (inputFilled),
|
|
216
|
-
* placeholder names, the rest as text. */
|
|
244
|
+
/** A trigger filled from the apply's parameters: its target.input and a composio source's config typed (inputFilled),
|
|
245
|
+
* its enabled the boolean its one placeholder names, the rest as text. */
|
|
217
246
|
const triggerFilled = (trigger, given) => {
|
|
218
247
|
const out = filled(trigger, given);
|
|
219
248
|
if (isObject(trigger.target) && trigger.target.input !== undefined)
|
|
220
249
|
out.target = { ...out.target, input: inputFilled(trigger.target.input, given) };
|
|
221
250
|
if (typeof trigger.enabled === "string" && WHOLE.test(trigger.enabled))
|
|
222
251
|
out.enabled = typedFilled(trigger.enabled, given);
|
|
252
|
+
// A composio trigger's config is typed as a pin's values are: a value that is one placeholder alone takes the
|
|
253
|
+
// parameter's type (an integer config field gets an integer).
|
|
254
|
+
if (isObject(trigger.source) && trigger.source.kind === "composio" && isObject(trigger.source.config))
|
|
255
|
+
out.source = { ...out.source, config: inputFilled(trigger.source.config, given) };
|
|
256
|
+
// A feed trigger's urls as one placeholder alone take the array its parameter names, whole; a list's URLs are text.
|
|
257
|
+
if (isObject(trigger.source) && trigger.source.kind === "feed" && typeof trigger.source.urls === "string")
|
|
258
|
+
out.source = { ...out.source, urls: typedFilled(trigger.source.urls, given) };
|
|
223
259
|
return out;
|
|
224
260
|
};
|
|
261
|
+
/** The source of the package's trigger `name`, filled from the apply's `parameters` as an apply fills it (each parameter
|
|
262
|
+
* left out given its default): a template eval reads the feed URLs its case's trigger will read before it applies. */
|
|
263
|
+
export function filledSource(p, name, parameters) {
|
|
264
|
+
const trigger = p.triggers.find((one) => one.name === name);
|
|
265
|
+
if (!trigger)
|
|
266
|
+
return undefined;
|
|
267
|
+
const filledOne = triggerFilled(trigger, applyBodyOf(p, { parameters }).parameters);
|
|
268
|
+
return isObject(filledOne.source) ? filledOne.source : undefined;
|
|
269
|
+
}
|
|
225
270
|
/** An mcp entry's `pin` read: by tool, each one of the entry's `tools`, its arguments checked by the one rule every pin
|
|
226
271
|
* is (tool-plane.ts pinIssues, on the tool's gate name), text in it may hold `${parameters.<name>}` (checked with the
|
|
227
272
|
* other placeholders). Each problem is told through `bad`; a tool whose pin reads is kept. */
|
|
@@ -652,6 +697,16 @@ export function readPackage(from) {
|
|
|
652
697
|
const set = isObject(source) && source.kind === "composio" ? COMPOSIO_SET.filter((field) => source[field] !== undefined) : [];
|
|
653
698
|
if (set.length)
|
|
654
699
|
bad(MANIFEST, `triggers[${i}].source holds ${set.join(" and ")}, which this server sets when it makes a composio trigger on Composio: a template can't carry ${set.length > 1 ? "them" : "it"}. Leave ${set.length > 1 ? "them" : "it"} out, or make the trigger from the console on this server (Triggers → New app trigger) once the agent is made.`);
|
|
700
|
+
// Its server is one of the package's own needs, by its toolkit, as mcp:<toolkit>/<tool> names its tools: no saved
|
|
701
|
+
// server's name, which is only the author's. The apply makes it on the saved server that need resolves to
|
|
702
|
+
// (onServers). A required need: one with no saved server refuses the apply, so the trigger is never made without one.
|
|
703
|
+
if (isObject(source) && source.kind === "composio") {
|
|
704
|
+
const need = mcp.find((one) => one.toolkit === source.server);
|
|
705
|
+
if (!need || need.source !== "composio")
|
|
706
|
+
bad(MANIFEST, `triggers[${i}].source.server ${JSON.stringify(source.server)} names no MCP need of the package with source: composio: a template's composio trigger names that need's toolkit (server: github for the need {source: composio, toolkit: github}), and the apply makes it on the saved Composio server the need resolves to`);
|
|
707
|
+
else if (!need.required)
|
|
708
|
+
bad(MANIFEST, `triggers[${i}].source.server ${need.toolkit}: the trigger's server is the mcp need of the toolkit ${need.toolkit}, so that need is required: true. An optional one may have no saved server here, and the trigger would have none`);
|
|
709
|
+
}
|
|
655
710
|
});
|
|
656
711
|
if (triggers.length && !(isObject(f.budget) && f.budget.per_run_usd !== undefined))
|
|
657
712
|
bad(MANIFEST, "budget is required when the package has triggers: {per_run_usd}, each run's cap");
|
|
@@ -683,11 +738,13 @@ export function readPackage(from) {
|
|
|
683
738
|
if (!Object.hasOwn(fields, used))
|
|
684
739
|
bad(MANIFEST, `\${parameters.${used}} names no parameter`);
|
|
685
740
|
}
|
|
686
|
-
// A placeholder fills text a run reads, a schedule's time (its cron and timezone, read as the schedule at apply),
|
|
687
|
-
// github or
|
|
688
|
-
//
|
|
689
|
-
//
|
|
690
|
-
//
|
|
741
|
+
// A placeholder fills text a run reads, a schedule's time (its cron and timezone, read as the schedule at apply), a
|
|
742
|
+
// github, webhook, composio or feed trigger's where `in` values (the repository it takes, say), a composio trigger's
|
|
743
|
+
// config values (what Composio watches for it: the owner's repository, team or label), and a feed trigger's urls (a
|
|
744
|
+
// placeholder inside a URL, or the whole list as one naming an array parameter); a trigger's other settings, a
|
|
745
|
+
// composio trigger's server and event and a feed trigger's every_s, items and id among them, are the package's own,
|
|
746
|
+
// checked here. A parameter that sets a time has a default, so the schedule the package ships is checked here too; one
|
|
747
|
+
// a where, a composio config or a feed's urls take is required or has a default, so the trigger never fills empty.
|
|
691
748
|
triggers.forEach((trigger, i) => {
|
|
692
749
|
if (!isObject(trigger))
|
|
693
750
|
return;
|
|
@@ -695,12 +752,14 @@ export function readPackage(from) {
|
|
|
695
752
|
const filtered = isObject(trigger.source) && FILTERED_KINDS.includes(trigger.source.kind);
|
|
696
753
|
const fixed = Object.entries(trigger).flatMap(([key, value]) => key === "target" && isObject(value) ? Object.entries(value).filter(([k]) => k !== "input").map(([k, v]) => [`target.${k}`, v])
|
|
697
754
|
: key === "source" && timed && isObject(value) ? Object.entries(value).filter(([k]) => !SCHEDULE_FIELDS.includes(k)).map(([k, v]) => [`source.${k}`, v])
|
|
698
|
-
: key === "source" && filtered && isObject(value) ?
|
|
699
|
-
: key === "
|
|
700
|
-
: [[key, value]]
|
|
755
|
+
: key === "source" && filtered && isObject(value) && value.kind === "composio" ? Object.entries(whereIns(value).rest).filter(([k]) => k !== "config").map(([k, v]) => [`source.${k}`, v])
|
|
756
|
+
: key === "source" && filtered && isObject(value) && value.kind === "feed" ? Object.entries(whereIns(value).rest).filter(([k]) => k !== "urls").map(([k, v]) => [`source.${k}`, v])
|
|
757
|
+
: key === "source" && filtered && isObject(value) ? [[key, whereIns(value).rest]]
|
|
758
|
+
: key === "enabled" && typeof value === "string" ? []
|
|
759
|
+
: [[key, value]]);
|
|
701
760
|
for (const [at, value] of fixed)
|
|
702
761
|
for (const [used] of strings(value).flatMap((text) => [...text.matchAll(PLACEHOLDER)]))
|
|
703
|
-
bad(MANIFEST, `triggers[${i}].${at} holds ${used}: a placeholder goes in display_name, the instructions, a trigger's target.input, a schedule's cron and timezone, a github or
|
|
762
|
+
bad(MANIFEST, `triggers[${i}].${at} holds ${used}: a placeholder goes in display_name, the instructions, a trigger's target.input, a schedule's cron and timezone, a github, webhook, composio or feed trigger's where in values, a composio trigger's config values, a feed trigger's urls, or an mcp pin's values`);
|
|
704
763
|
// enabled is true, false, or one boolean parameter with a default, filled at apply (triggerFilled): the trigger is on
|
|
705
764
|
// or off by the owner's answer, and by the package's default when the apply leaves it out.
|
|
706
765
|
if (typeof trigger.enabled === "string") {
|
|
@@ -720,6 +779,30 @@ export function readPackage(from) {
|
|
|
720
779
|
bad(MANIFEST, `parameters.${used} is used in triggers[${i}].source.accept, so it is required or has a default: a ${trigger.source.kind} trigger filled empty takes no event`);
|
|
721
780
|
}
|
|
722
781
|
}
|
|
782
|
+
// A feed's urls: a list whose URLs may hold placeholders, or one placeholder alone naming an array-of-strings
|
|
783
|
+
// parameter, filled whole; each parameter they name required or with a default, so the trigger never reads none.
|
|
784
|
+
if (isObject(trigger.source) && trigger.source.kind === "feed") {
|
|
785
|
+
const urls = trigger.source.urls;
|
|
786
|
+
if (typeof urls === "string") {
|
|
787
|
+
const rule = `triggers[${i}].source.urls is a list of URLs, or one placeholder alone, "\${parameters.<name>}", naming an array parameter of strings`;
|
|
788
|
+
const whole = WHOLE.exec(urls);
|
|
789
|
+
const spec = whole && Object.hasOwn(fields, whole[1]) ? fields[whole[1]] : undefined;
|
|
790
|
+
if (!whole)
|
|
791
|
+
bad(MANIFEST, rule);
|
|
792
|
+
else if (spec && (spec.type !== "array" || !isObject(spec.items) || spec.items.type !== "string"))
|
|
793
|
+
bad(MANIFEST, `${rule}: parameters.${whole[1]} is ${spec.type === "array" ? "an array of other than strings" : `a ${String(spec.type)}`}`);
|
|
794
|
+
}
|
|
795
|
+
for (const used of new Set(strings(urls).flatMap((text) => [...text.matchAll(PLACEHOLDER)].map((m) => m[1])))) {
|
|
796
|
+
if (Object.hasOwn(fields, used) && !parameters.required?.includes(used) && fields[used].default === undefined)
|
|
797
|
+
bad(MANIFEST, `parameters.${used} is used in triggers[${i}].source.urls, so it is required or has a default: a feed trigger filled empty reads no feed`);
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
if (isObject(trigger.source) && trigger.source.kind === "composio") {
|
|
801
|
+
for (const used of new Set(strings(trigger.source.config).flatMap((text) => [...text.matchAll(PLACEHOLDER)].map((m) => m[1])))) {
|
|
802
|
+
if (Object.hasOwn(fields, used) && !parameters.required?.includes(used) && fields[used].default === undefined)
|
|
803
|
+
bad(MANIFEST, `parameters.${used} is used in triggers[${i}].source.config, so it is required or has a default: a composio trigger filled empty watches nothing of the owner's (Composio refuses a required config value left empty)`);
|
|
804
|
+
}
|
|
805
|
+
}
|
|
723
806
|
if (!timed)
|
|
724
807
|
return;
|
|
725
808
|
for (const field of SCHEDULE_FIELDS) {
|
|
@@ -783,11 +866,12 @@ export function readPackage(from) {
|
|
|
783
866
|
const caseDoc = own.includes("case.yaml") ? parseDocument(text(`${at}/case.yaml`), { uniqueKeys: true }) : undefined;
|
|
784
867
|
if (caseDoc?.errors.length)
|
|
785
868
|
bad(`${at}/case.yaml`, "is not YAML");
|
|
786
|
-
// An email case's run is its trigger's, on the trigger's input (template-eval.ts): its prompt.md has no body.
|
|
787
|
-
const
|
|
869
|
+
// An email or feed case's run is its trigger's, on the trigger's input (template-eval.ts): its prompt.md has no body.
|
|
870
|
+
const caseJs = !!caseDoc && !caseDoc.errors.length && isObject(caseDoc.toJS()) ? caseDoc.toJS() : undefined;
|
|
871
|
+
const triggeredCase = caseJs !== undefined && (caseJs.email !== undefined || caseJs.feed !== undefined);
|
|
788
872
|
if (!own.includes("prompt.md"))
|
|
789
873
|
bad(at, "has no prompt.md");
|
|
790
|
-
else if (!
|
|
874
|
+
else if (!triggeredCase && !front(`${at}/prompt.md`, false)?.body.trim())
|
|
791
875
|
bad(`${at}/prompt.md`, "its body is empty: the body is the run's input");
|
|
792
876
|
const graders = own.filter((p) => p.startsWith("graders/"));
|
|
793
877
|
if (!graders.length)
|
|
@@ -826,6 +910,14 @@ export function readPackage(from) {
|
|
|
826
910
|
// hangs on the value (a pattern, a bound, a choice) is the apply's, on the value given. Its type, and whether the
|
|
827
911
|
// inputs name the field at all, are checked here.
|
|
828
912
|
const sampled = (field) => {
|
|
913
|
+
// A feed's URL filled from a parameter with no default holds a sample, no URL: the apply checks the value given.
|
|
914
|
+
const url = /^triggers\.(\d+)\.source\.urls(?:\[(\d+)\])?$/.exec(field);
|
|
915
|
+
if (url) {
|
|
916
|
+
const urls = p.triggers[Number(url[1])]?.source?.urls;
|
|
917
|
+
const named = (text) => strings(text).flatMap((one) => [...one.matchAll(PLACEHOLDER)].map((m) => m[1]));
|
|
918
|
+
const used = typeof urls === "string" ? named(urls) : Array.isArray(urls) && url[2] !== undefined ? named(urls[Number(url[2])]) : [];
|
|
919
|
+
return used.some((name) => Object.hasOwn(fields, name) && fields[name].default === undefined);
|
|
920
|
+
}
|
|
829
921
|
const at = /^triggers\.(\d+)\.target\.input\.([^.]+)/.exec(field);
|
|
830
922
|
const target = at ? p.triggers[Number(at[1])]?.target : undefined;
|
|
831
923
|
const value = at && isObject(target) && isObject(target.input) ? target.input[at[2]] : undefined;
|
|
@@ -837,8 +929,15 @@ export function readPackage(from) {
|
|
|
837
929
|
const at = /^triggers\.(\d+)\.enabled$/.exec(field);
|
|
838
930
|
return !!at && typeof p.triggers[Number(at[1])]?.enabled === "string";
|
|
839
931
|
};
|
|
932
|
+
// A feed trigger a parameter's default leaves with no feeds is skipped at apply (feedLeftEmpty), never refused: so its
|
|
933
|
+
// urls are not refused here. Every other field of it is checked, as the apply makes it once the owner sets urls.
|
|
934
|
+
const skippedAtApply = (field) => {
|
|
935
|
+
const at = /^triggers\.(\d+)\.source\.urls(?:\[\d+\])?$/.exec(field);
|
|
936
|
+
const trigger = at ? made.triggers[Number(at[1])] : undefined;
|
|
937
|
+
return !!trigger && feedLeftEmpty(trigger);
|
|
938
|
+
};
|
|
840
939
|
for (const issue of madeTriggerIssues(made.triggers, 0, p.inputSchema))
|
|
841
|
-
if (!saidEnabled(issue.field) && (["wrong_type", "not_allowed", "missing"].includes(issue.reason) || !sampled(issue.field)))
|
|
940
|
+
if (!saidEnabled(issue.field) && !skippedAtApply(issue.field) && (["wrong_type", "not_allowed", "missing"].includes(issue.reason) || !sampled(issue.field)))
|
|
842
941
|
bad(MANIFEST, `${issue.field.replace(/^triggers\.(\d+)\./, "triggers[$1].")}: ${issue.message}`);
|
|
843
942
|
if (problems.length)
|
|
844
943
|
throw new PackageError(dir, [...new Set(problems)]);
|
|
@@ -1221,7 +1320,16 @@ export function onServerNames(text, servers) {
|
|
|
1221
1320
|
return text.replace(MCP_NAME_IN_TEXT, (name) => onServerName(name, servers));
|
|
1222
1321
|
}
|
|
1223
1322
|
/** `p` as the agent an apply makes on `servers` sees it: its instructions and each skill file with the package's tool
|
|
1224
|
-
* names on the saved servers' (onServerNames)
|
|
1323
|
+
* names on the saved servers' (onServerNames), and each composio trigger's server, its need's toolkit, the saved server
|
|
1324
|
+
* that need resolved to (onServerTrigger). Nothing else of it names a server: its pins and allow are by tool. */
|
|
1225
1325
|
export function onServers(p, servers) {
|
|
1226
|
-
return { ...p, instructions: onServerNames(p.instructions, servers), skills: Object.fromEntries(Object.entries(p.skills).map(([path, text]) => [path, onServerNames(text, servers)])) };
|
|
1326
|
+
return { ...p, instructions: onServerNames(p.instructions, servers), skills: Object.fromEntries(Object.entries(p.skills).map(([path, text]) => [path, onServerNames(text, servers)])), triggers: p.triggers.map((trigger) => onServerTrigger(trigger, servers)) };
|
|
1327
|
+
}
|
|
1328
|
+
/** Trigger `trigger` on the saved servers of `servers` ({toolkit: saved name}): a composio one's `source.server`, the
|
|
1329
|
+
* toolkit of the package's need (readPackage), the saved server the apply resolved that need to. Any other as it is. */
|
|
1330
|
+
function onServerTrigger(trigger, servers) {
|
|
1331
|
+
const source = trigger.source;
|
|
1332
|
+
if (!isObject(source) || source.kind !== "composio" || typeof source.server !== "string" || !Object.hasOwn(servers, source.server))
|
|
1333
|
+
return trigger;
|
|
1334
|
+
return { ...trigger, source: { ...source, server: servers[source.server] } };
|
|
1227
1335
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EntryLike } from "./timeline.js";
|
|
2
2
|
/** What fired a trigger: its definition's kind, never what its payload says. */
|
|
3
|
-
export declare const TRIGGER_SOURCES: readonly ["schedule", "webhook", "slack", "github", "composio", "email"];
|
|
3
|
+
export declare const TRIGGER_SOURCES: readonly ["schedule", "webhook", "slack", "github", "composio", "email", "feed"];
|
|
4
4
|
export type TriggerSource = (typeof TRIGGER_SOURCES)[number];
|
|
5
5
|
/** How a trigger's Timeline row names its source: "<label> <trigger>: <its first line>". */
|
|
6
6
|
export declare const TRIGGER_LABELS: Readonly<Record<TriggerSource, string>>;
|
package/dist/timeline/origin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { obj, str } from "./util.js";
|
|
2
2
|
/** What fired a trigger: its definition's kind, never what its payload says. */
|
|
3
|
-
export const TRIGGER_SOURCES = ["schedule", "webhook", "slack", "github", "composio", "email"];
|
|
3
|
+
export const TRIGGER_SOURCES = ["schedule", "webhook", "slack", "github", "composio", "email", "feed"];
|
|
4
4
|
/** How a trigger's Timeline row names its source: "<label> <trigger>: <its first line>". */
|
|
5
|
-
export const TRIGGER_LABELS = { schedule: "Schedule", webhook: "Webhook", slack: "Slack", github: "GitHub", composio: "Composio", email: "Email" };
|
|
5
|
+
export const TRIGGER_LABELS = { schedule: "Schedule", webhook: "Webhook", slack: "Slack", github: "GitHub", composio: "Composio", email: "Email", feed: "Feed" };
|
|
6
6
|
const REASONS = new Set(["cap_raised", "approval", "handed_back", "output_retry"]);
|
|
7
7
|
const SOURCES = new Set(TRIGGER_SOURCES);
|
|
8
8
|
/** An entry kind that names the origin of the next user entry in its conversation whose text is exactly `text`: written
|
package/dist/tool-gate.d.ts
CHANGED
|
@@ -141,7 +141,8 @@ export type PendingApproval = {
|
|
|
141
141
|
/** The call's arguments as text, at most ARGS_PREVIEW_BYTES. */
|
|
142
142
|
args_preview: string;
|
|
143
143
|
/** What the call does in words, where its tool says (email_send: "Send email to <to>, cc <cc>: <subject>" and the
|
|
144
|
-
* text's first 300 characters),
|
|
144
|
+
* text's first 300 characters), then why it asks when its setting allows it (ToolEntry.asks), redacted as its
|
|
145
|
+
* arguments are. */
|
|
145
146
|
summary?: string;
|
|
146
147
|
requested_at: string;
|
|
147
148
|
price?: ApprovalPrice;
|
|
@@ -149,8 +150,9 @@ export type PendingApproval = {
|
|
|
149
150
|
destructive?: true;
|
|
150
151
|
};
|
|
151
152
|
export { type DenyFrom, deniedText, denyPlace, NOT_RUN, RAN_UNKNOWN, refusedText, type SettingFrom } from "./refusal-words.js";
|
|
152
|
-
/** The refusal of an ask where no one can approve it: a server with accounts off, whose answer route takes no token.
|
|
153
|
-
|
|
153
|
+
/** The refusal of an ask where no one can approve it: a server with accounts off, whose answer route takes no token.
|
|
154
|
+
* `because`: the tool's own reason (ToolEntry.asks) for a call its setting allows, which no setting lifts. */
|
|
155
|
+
export declare const noApproverText: (tool: string, ran?: "no" | "unknown", because?: string) => string;
|
|
154
156
|
/** The Timeline row of a call that waits for an approval. */
|
|
155
157
|
export declare const APPROVAL_ROW: "tool_approval_requested";
|
|
156
158
|
/** A call's arguments shown on its approval, at most this many bytes. */
|
package/dist/tool-gate.js
CHANGED
|
@@ -329,8 +329,11 @@ export const permissionOf = (name, server, agent = {}, approvals = "ask", effect
|
|
|
329
329
|
// The refusal words (SettingFrom, DenyFrom, NOT_RUN, RAN_UNKNOWN, denyPlace, deniedText, refusedText) live in
|
|
330
330
|
// refusal-words.ts, shared with the runner's loops.
|
|
331
331
|
export { deniedText, denyPlace, NOT_RUN, RAN_UNKNOWN, refusedText } from "./refusal-words.js";
|
|
332
|
-
/** The refusal of an ask where no one can approve it: a server with accounts off, whose answer route takes no token.
|
|
333
|
-
|
|
332
|
+
/** The refusal of an ask where no one can approve it: a server with accounts off, whose answer route takes no token.
|
|
333
|
+
* `because`: the tool's own reason (ToolEntry.asks) for a call its setting allows, which no setting lifts. */
|
|
334
|
+
export const noApproverText = (tool, ran = "no", because) => because === undefined
|
|
335
|
+
? `${DENIED_OPENING}${tool} needs the owner's approval, and this server has accounts off (AGENTRUN_ACCOUNTS=0), so no one can give it: set the tool to allow or deny in the agent's Tools. ${ran === "no" ? NOT_RUN : RAN_UNKNOWN}`
|
|
336
|
+
: `${DENIED_OPENING}${tool} needs the owner's approval for this call (${because}), and this server has accounts off (AGENTRUN_ACCOUNTS=0), so no one can give it. ${ran === "no" ? NOT_RUN : RAN_UNKNOWN}`;
|
|
334
337
|
/** The Timeline row of a call that waits for an approval. */
|
|
335
338
|
export const APPROVAL_ROW = "tool_approval_requested";
|
|
336
339
|
/** A call's arguments shown on its approval, at most this many bytes. */
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./email/labels.js";
|
|
1
2
|
import type { TSchema } from "typebox";
|
|
2
3
|
import { type Extension, type Harness, type ToolRegistration, type Tx } from "@earendil-works/pi-durable";
|
|
3
4
|
import type { Revision } from "./agent-rows.js";
|
|
@@ -158,6 +159,12 @@ export type EffectRun = {
|
|
|
158
159
|
ledger?: Ledger;
|
|
159
160
|
search?: SearchOn;
|
|
160
161
|
};
|
|
162
|
+
/** What a tool's own ask (ToolEntry.asks) reads: the run's host, and how many calls of a tool the run has run to a good
|
|
163
|
+
* end, from the run's record (its journal), so a pause and a new host count them all. */
|
|
164
|
+
export type AskContext = {
|
|
165
|
+
readonly host: ToolHost;
|
|
166
|
+
ran(tool: string): Promise<number>;
|
|
167
|
+
};
|
|
161
168
|
export type ToolEntry = {
|
|
162
169
|
/** One line, for capabilities. */
|
|
163
170
|
summary: string;
|
|
@@ -177,6 +184,12 @@ export type ToolEntry = {
|
|
|
177
184
|
/** No agent whose place is a sandbox may name it: it writes the run's work/ from this machine by paths a box's command
|
|
178
185
|
* could turn through a link (runnable.ts). */
|
|
179
186
|
runnerOnly?: true;
|
|
187
|
+
/** On the runner, before the intent of a call its setting allows: why this call asks a person anyway, in words (shown
|
|
188
|
+
* on its approval), or nothing. No setting lifts it; where no one can approve, the call is refused in those words. */
|
|
189
|
+
asks?(args: Record<string, unknown>, ctx: AskContext): Promise<string | undefined>;
|
|
190
|
+
/** What a call waiting on approval does, in a person's words (run-view.ts, the pending approval's `summary`): email_send's
|
|
191
|
+
* to whom and what. Undefined where its arguments do not say. */
|
|
192
|
+
approvalSummary?(args: unknown): string | undefined;
|
|
180
193
|
};
|
|
181
194
|
/** Where the browser files what it reads: the run's `evidence/`, through its Workspace, so the run's files show it and
|
|
182
195
|
* the agent can read it back. A text body follows one line of the read's facts; a capture's bytes go beside its facts.
|
package/dist/tools.js
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
// run's folder or its computer. `bash` and the background tools may be named only by an agent whose place is a box
|
|
6
6
|
// (runnable.ts).
|
|
7
7
|
import { blurbOf, isHostTool } from "./tool-list.js";
|
|
8
|
-
import { EMAIL_DRAFT, EMAIL_FILE, EMAIL_READ, EMAIL_SEARCH, EMAIL_SEND } from "./email/names.js";
|
|
8
|
+
import { EMAIL_DESCRIPTIONS, EMAIL_DRAFT, EMAIL_FILE, EMAIL_READ, EMAIL_SEARCH, EMAIL_SEND, fileSummary, sendSummary } from "./email/names.js";
|
|
9
|
+
// The email tools' timeline lines (registerLabel), registered as this module loads.
|
|
10
|
+
import "./email/labels.js";
|
|
9
11
|
import { mcpNameOf } from "./tool-names.js";
|
|
10
12
|
import { appendFileSync } from "node:fs";
|
|
11
13
|
import { pathToFileURL } from "node:url";
|
|
@@ -82,12 +84,15 @@ const callOnly = (summary, effect) => ({
|
|
|
82
84
|
summary, needs: [], nodes: false, callOnly: true, effect,
|
|
83
85
|
bind: async () => { throw new Error("a call-only tool binds no agent tool"); },
|
|
84
86
|
});
|
|
85
|
-
/** An email tool (email/
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
/** An email tool, its summary its description (email/names.ts), its binding (email/tools.ts bindEmail) and email_send's
|
|
88
|
+
* own ask (sendAsks) loaded at first use, the mail libraries with them. */
|
|
89
|
+
const emailTool = (name) => ({
|
|
90
|
+
summary: EMAIL_DESCRIPTIONS[name],
|
|
88
91
|
needs: [],
|
|
89
92
|
nodes: false,
|
|
90
|
-
bind: async (host) => (await import("./email/tools.js")).
|
|
93
|
+
bind: async (host) => (await import("./email/tools.js")).bindEmail(name, host),
|
|
94
|
+
...(name === EMAIL_SEND ? { approvalSummary: sendSummary, asks: async (args, ctx) => (await import("./email/tools.js")).sendAsks(args, ctx) } : {}),
|
|
95
|
+
...(name === EMAIL_FILE ? { approvalSummary: fileSummary } : {}),
|
|
91
96
|
});
|
|
92
97
|
/** web_fetch, bound under `name`. */
|
|
93
98
|
const webFetchEntry = (name) => ({
|
|
@@ -594,11 +599,11 @@ export const TOOLS = Object.freeze({
|
|
|
594
599
|
},
|
|
595
600
|
// The email tools (email/tools.ts) on the server's one email account (Settings → Email), every harness's as web_fetch is;
|
|
596
601
|
// the mail libraries load at the first bind.
|
|
597
|
-
[EMAIL_SEARCH]: emailTool(EMAIL_SEARCH
|
|
598
|
-
[EMAIL_READ]: emailTool(EMAIL_READ
|
|
599
|
-
[EMAIL_DRAFT]: emailTool(EMAIL_DRAFT
|
|
600
|
-
[EMAIL_SEND]: emailTool(EMAIL_SEND
|
|
601
|
-
[EMAIL_FILE]: emailTool(EMAIL_FILE
|
|
602
|
+
[EMAIL_SEARCH]: emailTool(EMAIL_SEARCH),
|
|
603
|
+
[EMAIL_READ]: emailTool(EMAIL_READ),
|
|
604
|
+
[EMAIL_DRAFT]: emailTool(EMAIL_DRAFT),
|
|
605
|
+
[EMAIL_SEND]: emailTool(EMAIL_SEND),
|
|
606
|
+
[EMAIL_FILE]: emailTool(EMAIL_FILE),
|
|
602
607
|
browser: browserTool,
|
|
603
608
|
// A pi run's subagent (runner/subagent.ts): a native tool of the run's root agent, bound by the runner's pi spec
|
|
604
609
|
// (adapter-run-spec.ts), never by this table; not a host tool (tool-list.ts `replay`), so another harness refuses it.
|
|
@@ -76,46 +76,17 @@ export type TriggerAdapter = {
|
|
|
76
76
|
/** Whether each firing of a trigger of `source` starts its own run, its last run active or not (a webhook that takes
|
|
77
77
|
* only the events it names). Default false: a firing while the last run is active is skipped. */
|
|
78
78
|
concurrent?(source: Source): boolean;
|
|
79
|
-
/** For a clock source that polls (the email
|
|
79
|
+
/** For a clock source that polls (the email and feed triggers): what it finds when its time comes, read from outside the server.
|
|
80
80
|
* The engine fires each event it returns through the path a pushed event takes (`takes`, `concurrent`,
|
|
81
81
|
* max_active_runs, the day-kept keys, a run per event), records no `missed` row for a time it was not there for, and
|
|
82
|
-
* keeps the poll's cursor once its firings are recorded.
|
|
82
|
+
* keeps the poll's cursor once its firings are recorded. A poll with no cursor is where its trigger starts watching:
|
|
83
|
+
* the engine polls at once when the trigger is made, turned on again (its cursor and last check forgotten first) or its
|
|
84
|
+
* source edited (its cursor kept: a poll whose cursor was read elsewhere starts over itself). */
|
|
83
85
|
poll?(source: Source, ctx: PollContext): Promise<PollResult>;
|
|
84
|
-
/** For a source that polls: where its trigger starts watching, taken when the trigger is made, when an edit changes one
|
|
85
|
-
* of its source's `on` fields and when it is turned on again; never at its first poll. An edit of any other field keeps
|
|
86
|
-
* the cursor. A start not taken (the source unreachable, or slower than the engine waits) leaves no cursor: the first
|
|
87
|
-
* poll that reads the source takes it, and says so. */
|
|
88
|
-
start?: Start;
|
|
89
86
|
/** A run's title after its trigger's name, from what its source says of the firing (its attrs): an email's sender and
|
|
90
87
|
* subject. Default: the event and action the attrs name. */
|
|
91
88
|
title?(attrs: Record<string, string>): string | undefined;
|
|
92
89
|
};
|
|
93
|
-
/** Why a start is taken: the trigger was made, an edit changed where it reads, or it was turned on again. */
|
|
94
|
-
export type StartWhy = "created" | "edited" | "enabled";
|
|
95
|
-
/** What a start is given: its trigger, why, and the source's credentials, read now (as a poll's). */
|
|
96
|
-
export type StartContext = {
|
|
97
|
-
trigger: string;
|
|
98
|
-
why: StartWhy;
|
|
99
|
-
credentials(): Promise<unknown>;
|
|
100
|
-
};
|
|
101
|
-
/** What a start found: `check`, said on the trigger as its last check (a refusal here never counts toward turning it
|
|
102
|
-
* off); `note`, the history line it writes; `cursor`, the settings it starts from, none when it could not read the
|
|
103
|
-
* source. */
|
|
104
|
-
export type StartResult = {
|
|
105
|
-
check: {
|
|
106
|
-
ok: boolean;
|
|
107
|
-
message: string;
|
|
108
|
-
};
|
|
109
|
-
note: string;
|
|
110
|
-
cursor?: Record<string, string>;
|
|
111
|
-
};
|
|
112
|
-
export type Start = {
|
|
113
|
-
/** The source's fields an edit of which takes a new start. */
|
|
114
|
-
on: readonly string[];
|
|
115
|
-
take(source: Source, ctx: StartContext): Promise<StartResult>;
|
|
116
|
-
/** The words of a start the engine stopped waiting for. */
|
|
117
|
-
unchecked(source: Source, why: StartWhy): string;
|
|
118
|
-
};
|
|
119
90
|
/** What a poll is given: its trigger's own settings (its cursor, public, as the adapter's `settings` names them) and the
|
|
120
91
|
* source's credentials, read now (TriggerDeps.credentials: the email account, opened). */
|
|
121
92
|
export type PollContext = {
|
|
@@ -124,14 +95,16 @@ export type PollContext = {
|
|
|
124
95
|
credentials(): Promise<unknown>;
|
|
125
96
|
};
|
|
126
97
|
/** One event a poll found: a pushed event's fields; `cursor`, the settings to keep once it and every event before it are
|
|
127
|
-
* recorded; `left`, when it is recorded as skipped and starts nothing, why (in words). */
|
|
98
|
+
* recorded (read by the engine of the last event it records alone, so a source may make it when asked); `left`, when it is recorded as skipped and starts nothing, why (in words). */
|
|
128
99
|
export type PolledEvent = PushEvent & {
|
|
129
100
|
cursor: Record<string, string>;
|
|
130
101
|
left?: string;
|
|
131
102
|
};
|
|
132
103
|
/** What a poll found: `check`, said on the trigger as its last check; `refused`, the source's credentials refused (the
|
|
133
|
-
* engine turns the trigger off at the third in a row, `detail` its words); `
|
|
134
|
-
* (a
|
|
104
|
+
* engine turns the trigger off at the third in a row, `detail` its words); `stop`, the source can't be read again as it
|
|
105
|
+
* is (every feed a feed trigger reads gone): the engine turns the trigger off now, its source unreadable, `detail` its
|
|
106
|
+
* words; `note`, one history line that starts no run (a first poll's, a reset's); `events`, oldest first; `cursor`, the
|
|
107
|
+
* settings to keep once every event is recorded. */
|
|
135
108
|
export type PollResult = {
|
|
136
109
|
check: {
|
|
137
110
|
ok: boolean;
|
|
@@ -140,6 +113,9 @@ export type PollResult = {
|
|
|
140
113
|
refused?: {
|
|
141
114
|
detail: string;
|
|
142
115
|
};
|
|
116
|
+
stop?: {
|
|
117
|
+
detail: string;
|
|
118
|
+
};
|
|
143
119
|
note?: string;
|
|
144
120
|
events?: PolledEvent[];
|
|
145
121
|
cursor?: Record<string, string>;
|
package/dist/trigger-adapters.js
CHANGED
|
@@ -3,4 +3,5 @@ import { schedule } from "./trigger-schedule.js";
|
|
|
3
3
|
import { github } from "./trigger-github.js";
|
|
4
4
|
import { webhook } from "./trigger-webhook.js";
|
|
5
5
|
import { email } from "./trigger-email.js";
|
|
6
|
-
|
|
6
|
+
import { feed } from "./trigger-feed.js";
|
|
7
|
+
export const TRIGGER_ADAPTERS = [schedule, webhook, github, composio, email, feed];
|