@parcha/agentrun-serve 0.1.0-beta.46 → 0.1.0-beta.47
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 +164 -1
- package/NOTICE +4 -0
- package/README.md +267 -40
- package/dist/acp-package.d.ts +35 -6
- package/dist/acp-package.js +3 -3
- package/dist/adapter-facts.d.ts +5 -2
- package/dist/adapter-facts.js +6 -3
- package/dist/adapters.d.ts +7 -0
- package/dist/adapters.js +39 -0
- package/dist/agents-store.d.ts +5 -3
- package/dist/agents-store.js +13 -8
- package/dist/api-only.d.ts +7 -10
- package/dist/api-only.js +7 -10
- package/dist/archil-routes.js +2 -1
- package/dist/cap.js +12 -2
- package/dist/chatgpt-plan.js +2 -1
- package/dist/cli.js +109 -41
- package/dist/composio-made.d.ts +19 -2
- package/dist/composio-made.js +17 -5
- package/dist/composio-preset.d.ts +42 -7
- package/dist/composio-preset.js +106 -70
- package/dist/composio-triggers.d.ts +9 -4
- package/dist/composio-triggers.js +20 -13
- package/dist/computer-attach.d.ts +11 -10
- package/dist/computer-attach.js +13 -14
- package/dist/computer-commands.d.ts +3 -0
- package/dist/computer-commands.js +3 -2
- package/dist/computer-lost.d.ts +4 -0
- package/dist/computer-lost.js +8 -3
- package/dist/computer-setting.d.ts +2 -0
- package/dist/computer-setting.js +2 -0
- package/dist/computers.d.ts +9 -75
- package/dist/computers.js +20 -66
- package/dist/console/assets/index-BBFzAxLB.js +715 -0
- package/dist/console/assets/index-BRi-Rgq6.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/cost-heal.d.ts +13 -0
- package/dist/cost-heal.js +27 -0
- package/dist/dial-relay.d.ts +6 -2
- package/dist/dial-relay.js +9 -12
- package/dist/email/routes.js +2 -1
- package/dist/errors.d.ts +2 -0
- package/dist/errors.js +5 -0
- package/dist/exa-keyless.d.ts +1 -1
- package/dist/exa-keyless.js +1 -1
- package/dist/faux-computers.d.ts +2 -3
- package/dist/faux-computers.js +9 -31
- package/dist/github-connection.js +2 -1
- package/dist/harness-archive.d.ts +19 -2
- package/dist/harness-archive.js +49 -15
- package/dist/harness-check.d.ts +73 -0
- package/dist/harness-check.js +489 -0
- package/dist/harness-cursor.d.ts +45 -0
- package/dist/harness-cursor.js +121 -0
- package/dist/harness-recipe.d.ts +127 -0
- package/dist/harness-recipe.js +357 -0
- package/dist/harness-table.d.ts +12 -0
- package/dist/harness-table.js +62 -2
- package/dist/harness.d.ts +2 -0
- package/dist/harness.js +3 -2
- package/dist/host-check.d.ts +6 -0
- package/dist/host-check.js +14 -0
- package/dist/host.d.ts +10 -3
- package/dist/host.js +17 -3
- package/dist/import-sources.d.ts +2 -0
- package/dist/import-sources.js +2 -0
- package/dist/import-summary.d.ts +15 -5
- package/dist/import-summary.js +24 -8
- package/dist/import.d.ts +24 -4
- package/dist/import.js +108 -26
- package/dist/key-refusal.d.ts +1 -0
- package/dist/key-refusal.js +8 -3
- package/dist/key-words.d.ts +1 -1
- package/dist/key-words.js +4 -4
- package/dist/learn/check.d.ts +3 -0
- package/dist/learn/check.js +31 -20
- package/dist/learn/compile.js +12 -5
- package/dist/learn/promote.d.ts +69 -2
- package/dist/learn/promote.js +95 -3
- package/dist/learned-nodes.d.ts +4 -3
- package/dist/learned-workflow.js +4 -1
- package/dist/learning-cost.d.ts +6 -16
- package/dist/learning-cost.js +6 -12
- package/dist/learning-words.d.ts +2 -0
- package/dist/learning-words.js +1 -1
- package/dist/listen-first.d.ts +10 -0
- package/dist/listen-first.js +25 -1
- package/dist/llms.txt +1 -1
- package/dist/mcp-gateway.d.ts +2 -1
- package/dist/mcp-gateway.js +31 -15
- package/dist/mcp-probe.d.ts +18 -6
- package/dist/mcp-probe.js +41 -8
- package/dist/mcp-secret-writes.d.ts +8 -0
- package/dist/mcp-secret-writes.js +104 -4
- package/dist/mcp-servers-store.d.ts +11 -5
- package/dist/mcp-servers-store.js +46 -20
- package/dist/model-form.d.ts +2 -1
- package/dist/model-form.js +22 -8
- package/dist/model-gateway.d.ts +113 -0
- package/dist/model-gateway.js +433 -0
- package/dist/model.d.ts +2 -1
- package/dist/model.js +9 -7
- package/dist/monid.js +1 -1
- package/dist/native/binding.d.ts +4 -0
- package/dist/native/binding.js +9 -0
- package/dist/native/cli.d.ts +3 -2
- package/dist/native/cli.js +6 -5
- package/dist/openapi.d.ts +2 -0
- package/dist/openapi.js +322 -39
- package/dist/owner.d.ts +4 -2
- package/dist/owner.js +10 -4
- package/dist/page.d.ts +8 -0
- package/dist/page.js +9 -1
- package/dist/port-models.js +17 -10
- package/dist/provider.d.ts +3 -3
- package/dist/provider.js +12 -3
- package/dist/public-address.d.ts +28 -0
- package/dist/public-address.js +62 -0
- package/dist/run-launch.d.ts +1 -1
- package/dist/run-launch.js +1 -1
- package/dist/run-secrets.d.ts +3 -2
- package/dist/run-secrets.js +6 -4
- package/dist/runner/adapter-loop.d.ts +10 -7
- package/dist/runner/adapter-loop.js +57 -22
- package/dist/runner/adapter-run-spec.d.ts +12 -0
- package/dist/runner/adapter-run-spec.js +40 -6
- package/dist/runner/adapters/index.js +16 -0
- package/dist/runner/adapters/pi.d.ts +5 -2
- package/dist/runner/adapters/pi.js +7 -4
- package/dist/runner/audit.d.ts +7 -0
- package/dist/runner/audit.js +15 -6
- package/dist/runner/claim-secrets.js +5 -1
- package/dist/runner/cli-run-spec.js +15 -7
- package/dist/runner/compare-end.d.ts +43 -0
- package/dist/runner/compare-end.js +95 -0
- package/dist/runner/computer-journal.d.ts +3 -0
- package/dist/runner/computer-journal.js +22 -2
- package/dist/runner/harness-loops.d.ts +6 -1
- package/dist/runner/harness-loops.js +94 -54
- package/dist/runner/held.d.ts +5 -4
- package/dist/runner/journal-kinds.d.ts +4 -1
- package/dist/runner/journal-kinds.js +3 -0
- package/dist/runner/loop-contract.d.ts +10 -0
- package/dist/runner/main.d.ts +5 -5
- package/dist/runner/main.js +62 -11
- package/dist/runner/mcp-claim.js +40 -12
- package/dist/runner/metrics.d.ts +26 -0
- package/dist/runner/metrics.js +44 -1
- package/dist/runner/presence.d.ts +41 -0
- package/dist/runner/presence.js +89 -0
- package/dist/runner/promotion.d.ts +9 -4
- package/dist/runner/promotion.js +33 -14
- package/dist/runner/run-child-host.js +40 -10
- package/dist/runner/runner.d.ts +5 -0
- package/dist/runner/runner.js +8 -0
- package/dist/runner/store-port.d.ts +3 -0
- package/dist/runner/store-secrets.js +19 -7
- package/dist/runner/workflow-first.d.ts +5 -2
- package/dist/runner/workflow-first.js +6 -3
- package/dist/runs-over-store.d.ts +6 -2
- package/dist/runs-over-store.js +14 -4
- package/dist/sdk/runs.d.ts +1 -1
- package/dist/sdk/runs.js +6 -1
- package/dist/sdk/schema.js +1 -1
- package/dist/secret-writes.d.ts +16 -3
- package/dist/secret-writes.js +28 -3
- package/dist/server-secrets-store.js +5 -0
- package/dist/server.d.ts +31 -2
- package/dist/server.js +322 -51
- package/dist/sign-ins-secrets.js +4 -1
- package/dist/skills/agentrun-serve/SKILL.md +11 -0
- package/dist/slack-url.d.ts +5 -0
- package/dist/slack-url.js +11 -0
- package/dist/slack.d.ts +107 -0
- package/dist/slack.js +292 -0
- package/dist/start-switches.d.ts +28 -0
- package/dist/start-switches.js +37 -0
- package/dist/stats.d.ts +1 -1
- package/dist/stats.js +2 -1
- package/dist/stop-signals.d.ts +11 -0
- package/dist/stop-signals.js +22 -0
- package/dist/store/agent-body.d.ts +1 -1
- package/dist/store/agent-body.js +2 -2
- package/dist/store/index.d.ts +3 -3
- package/dist/store/index.js +1 -1
- package/dist/store/postgres/migrations/0020_runners.sql +18 -0
- package/dist/store/postgres/store.d.ts +1 -1
- package/dist/store/postgres/store.js +4 -2
- package/dist/store/schema.d.ts +13 -5
- package/dist/store/schema.js +20 -11
- package/dist/store/seal.d.ts +16 -4
- package/dist/store/sqlite/store.d.ts +1 -1
- package/dist/store/sqlite/store.js +106 -27
- package/dist/store/store.d.ts +75 -23
- package/dist/store/store.js +11 -0
- package/dist/store-reads/analytics.js +3 -2
- package/dist/store-reads/cap.d.ts +7 -0
- package/dist/store-reads/cap.js +11 -1
- package/dist/store-reads/journal.js +27 -1
- package/dist/store-reads/learning.d.ts +23 -2
- package/dist/store-reads/learning.js +29 -8
- package/dist/store-reads/runs.d.ts +9 -0
- package/dist/store-reads/runs.js +19 -6
- package/dist/store-reads/stats.d.ts +4 -1
- package/dist/store-reads/stats.js +15 -6
- package/dist/store-view.d.ts +123 -14
- package/dist/store-view.js +154 -21
- package/dist/telemetry.d.ts +7 -7
- package/dist/telemetry.js +38 -15
- package/dist/timeline/timeline.js +18 -0
- package/dist/tool-keys-store.js +2 -2
- package/dist/tool-keys.js +2 -1
- package/dist/tool-plane.js +2 -2
- package/dist/trigger-adapter.d.ts +3 -4
- package/dist/trigger-adapter.js +2 -2
- package/dist/trigger-composio.js +3 -3
- package/dist/trigger-email.js +0 -2
- package/dist/trigger-feed.js +0 -2
- package/dist/trigger-schedule.js +3 -0
- package/dist/trigger-secrets-shown.d.ts +6 -3
- package/dist/trigger-secrets-shown.js +22 -13
- package/dist/trigger-targets.d.ts +1 -1
- package/dist/trigger-targets.js +19 -8
- package/dist/triggers.d.ts +2 -2
- package/dist/webhooks.d.ts +82 -8
- package/dist/webhooks.js +128 -45
- package/dist/wires.d.ts +6 -1
- package/dist/wires.js +5 -0
- package/dist/workspace/attach.d.ts +3 -2
- package/dist/workspace/attach.js +2 -1
- package/dist/workspace/attached-computers.d.ts +6 -8
- package/dist/workspace/attached-computers.js +27 -24
- package/dist/workspace/computer-deps.d.ts +2 -3
- package/dist/workspace/computer-deps.js +3 -6
- package/dist/workspace/computer-for-claim.js +72 -96
- package/dist/workspace/computer-kept.d.ts +0 -7
- package/dist/workspace/computer-kept.js +0 -17
- package/dist/workspace/resolve-computer.d.ts +18 -14
- package/dist/workspace/resolve-computer.js +47 -60
- package/dist/workspace/synced-folder.d.ts +20 -15
- package/dist/workspace/synced-folder.js +33 -43
- package/launcher/agentrun-serve +4 -1
- package/package.json +10 -10
- package/skills/agentrun-serve/SKILL.md +11 -0
- package/templates/README.md +1 -1
- package/dist/console/assets/index-C2MYaUBa.css +0 -1
- package/dist/console/assets/index-CZZeCReB.js +0 -701
|
@@ -241,6 +241,8 @@ function createMeter() {
|
|
|
241
241
|
// cost, or with an end when aborted.
|
|
242
242
|
let compactions = 0;
|
|
243
243
|
let compacting = 0;
|
|
244
|
+
// Compaction summaries a host marked as side requests since pi's last pi.compaction entry: that entry is theirs.
|
|
245
|
+
let sideSummaries = 0;
|
|
244
246
|
// How many are in flight: two side requests (a turn's parallel searches) may be.
|
|
245
247
|
let sidesOpen = 0;
|
|
246
248
|
const tokens = { input: 0, cacheRead: 0, cacheWrite: 0, output: 0 };
|
|
@@ -276,9 +278,25 @@ function createMeter() {
|
|
|
276
278
|
continued -= 1;
|
|
277
279
|
return "continued";
|
|
278
280
|
}
|
|
281
|
+
else if (entry.kind === "pi.compaction") {
|
|
282
|
+
// pi's summary of the older context. A summary request that left through the run's own model port was marked as a
|
|
283
|
+
// generation is (no `request` label) and booked at its price, and pi stores no answer for it: its cost rides on the
|
|
284
|
+
// answer pi stores beside it (what the session booked since the last one), so this entry is that request's answer,
|
|
285
|
+
// at no cost of its own here, its tokens unknown to pi's entries. One a host marked as a side request is closed by
|
|
286
|
+
// its own cost entry, never here. Shown as its phase row all the same.
|
|
287
|
+
if (sideSummaries > 0)
|
|
288
|
+
sideSummaries = 0;
|
|
289
|
+
else if (marked - answered - freeUnanswered - atMostUnanswered - (freeEnded ? 1 : 0) - (atMostEnded !== undefined ? 1 : 0) > 0) {
|
|
290
|
+
(requests += 1), (answered += 1);
|
|
291
|
+
addTokens(undefined);
|
|
292
|
+
}
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
279
295
|
else if (entry.kind === REQUEST_STARTED && isSide(entry)) {
|
|
280
296
|
compacting += 1;
|
|
281
297
|
sidesOpen += 1;
|
|
298
|
+
if (obj(entry.data)?.request === COMPACTION)
|
|
299
|
+
sideSummaries += 1;
|
|
282
300
|
}
|
|
283
301
|
else if (entry.kind === REQUEST_ENDED && isSide(entry)) {
|
|
284
302
|
if (unsent(entry))
|
package/dist/tool-keys-store.js
CHANGED
|
@@ -35,8 +35,8 @@ const fingerprint = (key) => createHmac("sha256", key).update("agentrun-serve se
|
|
|
35
35
|
/** What the start's log line says to a person when saved keys do not open, by why: where they are kept is the server's
|
|
36
36
|
* store (`kept=store`), and what to do is to save them again in the console's Settings. */
|
|
37
37
|
export const REENTER_SAID = {
|
|
38
|
-
seal_key_changed: "these saved keys were sealed under another seal key, so they do not open: save them again in Settings →
|
|
39
|
-
file_unreadable: "these saved keys do not read: save them again in Settings →
|
|
38
|
+
seal_key_changed: "these saved keys were sealed under another seal key, so they do not open: save them again in Settings → API Keys",
|
|
39
|
+
file_unreadable: "these saved keys do not read: save them again in Settings → API Keys",
|
|
40
40
|
};
|
|
41
41
|
/** The saved tool keys over the store. `toolKeysOverStore` builds it; the server awaits load() once before the first read. */
|
|
42
42
|
class ToolKeysOverStore {
|
package/dist/tool-keys.js
CHANGED
|
@@ -6,11 +6,12 @@
|
|
|
6
6
|
import { HARNESSES } from "./harness.js";
|
|
7
7
|
import { MODEL_KEYS } from "./model.js";
|
|
8
8
|
import { TOOL_KEY_ROWS } from "./key-words.js";
|
|
9
|
-
import { registerSecretWrite, secretMeta, secretName } from "./secret-writes.js";
|
|
9
|
+
import { registerSecretPage, registerSecretWrite, secretMeta, secretName } from "./secret-writes.js";
|
|
10
10
|
// Every value a person saves here is a secret (a tool's key, a model provider's key; BROWSERBASE_PROJECT_ID is kept the
|
|
11
11
|
// same way): saving one, replacing it or removing it takes the owner's session (secret-writes.ts), never the token.
|
|
12
12
|
registerSecretWrite("saveToolKey", () => true);
|
|
13
13
|
registerSecretWrite("deleteToolKey", () => true);
|
|
14
|
+
registerSecretPage(["saveToolKey", "deleteToolKey"], "/#/settings/keys");
|
|
14
15
|
export const SEAL_KEY_ENV = "AGENTRUN_SEAL_KEY";
|
|
15
16
|
/** Each key a person may save, fixed here: its kind, the fields it is entered as (BROWSERBASE_PROJECT_ID is no secret,
|
|
16
17
|
* and is kept the same way), and what it may unlock: tools by name, and `decisions.<id>`, a workflow's decision
|
package/dist/tool-plane.js
CHANGED
|
@@ -26,7 +26,7 @@ import { decisionKeysOf, PARALLEL_KEY_ENV } from "./decisions.js";
|
|
|
26
26
|
import { keyNeeded } from "./key-words.js";
|
|
27
27
|
import { DEFAULT_HARNESS, HARNESSES } from "./harness.js";
|
|
28
28
|
import { builtinHarness, harnessOf } from "./harness-table.js";
|
|
29
|
-
import { viaOpenRouter,
|
|
29
|
+
import { viaOpenRouter, wireOf } from "./provider.js";
|
|
30
30
|
import { savedIn } from "./secrets.js";
|
|
31
31
|
import { hostModel } from "./model.js";
|
|
32
32
|
import { NEEDS_A_COMPUTER, NO_SHELL } from "@parcha/agentrun-kernel/kernel";
|
|
@@ -170,7 +170,7 @@ function noNative(input) {
|
|
|
170
170
|
return { id: `${input.harness}, whose model requests carry no provider-hosted tool`, why: `${facts.label}'s model requests carry no provider-hosted tool` };
|
|
171
171
|
if (input.openRouter)
|
|
172
172
|
return { id: `${input.harness} on OpenRouter`, why: `through OpenRouter ${facts.label}'s own search is not run, and its searches are not counted to price` };
|
|
173
|
-
if (input.gateway &&
|
|
173
|
+
if (input.gateway && wireOf(facts.wire)?.gateway)
|
|
174
174
|
return { id: `${input.harness} behind a gateway`, why: `behind a gateway ${facts.label} has no own search` };
|
|
175
175
|
return input.capped ? cappedOwn(input.harness, facts.label, facts.webSearch) : undefined;
|
|
176
176
|
}
|
|
@@ -2,7 +2,7 @@ import type { InputIssue } from "./errors.js";
|
|
|
2
2
|
import type { SettingsSpec } from "./sealed-settings-store.js";
|
|
3
3
|
type Json = Record<string, unknown>;
|
|
4
4
|
/** Whether a run `adapter`'s firing starts is handed its trigger's last completed result: the one place it is decided
|
|
5
|
-
* (its previousResult, by default
|
|
5
|
+
* (its previousResult, by default false: a source opts in). */
|
|
6
6
|
export declare const carriesPrevious: (adapter: Pick<TriggerAdapter, "previousResult">) => boolean;
|
|
7
7
|
/** The most of a firing's payload passed on, in bytes of UTF-8 (triggers.ts cuts past it, at a character's start). A
|
|
8
8
|
* source that answers JSON fits its payload within it first (trigger-email.ts), so its JSON is never cut. */
|
|
@@ -28,9 +28,8 @@ export type TriggerAdapter = {
|
|
|
28
28
|
/** `clock`: it fires on its own times, read by the engine's timer (a source that polls, on each). `push`: a request delivered to the server fires it,
|
|
29
29
|
* keyed by the sender's own id, which a retry repeats. */
|
|
30
30
|
delivery: "clock" | "push";
|
|
31
|
-
/** Whether a run it starts is handed its trigger's last completed result (
|
|
32
|
-
*
|
|
33
|
-
* different person's (an email's sender), so one run's answer is never handed to the next. */
|
|
31
|
+
/** Whether a run it starts is handed its trigger's last completed result (previousResultOf). Default false. true only
|
|
32
|
+
* for a source whose runs repeat one job, never for one whose firings are different events. */
|
|
34
33
|
previousResult?: boolean;
|
|
35
34
|
/** Whether its words are its owner's (a run's message origin `owner`): true only when the owner wrote them as they set
|
|
36
35
|
* it up; never for words that come from outside. */
|
package/dist/trigger-adapter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { unknownFields } from "./validate.js";
|
|
2
2
|
/** Whether a run `adapter`'s firing starts is handed its trigger's last completed result: the one place it is decided
|
|
3
|
-
* (its previousResult, by default
|
|
4
|
-
export const carriesPrevious = (adapter) => adapter.previousResult ??
|
|
3
|
+
* (its previousResult, by default false: a source opts in). */
|
|
4
|
+
export const carriesPrevious = (adapter) => adapter.previousResult ?? false;
|
|
5
5
|
/** The most of a firing's payload passed on, in bytes of UTF-8 (triggers.ts cuts past it, at a character's start). A
|
|
6
6
|
* source that answers JSON fits its payload within it first (trigger-email.ts), so its JSON is never cut. */
|
|
7
7
|
export const PAYLOAD_KEPT_BYTES = 16 * 1024;
|
package/dist/trigger-composio.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
// that scope. Every event of the project comes to that one route, checked once with the secret (trigger-signatures.ts's
|
|
7
7
|
// composio scheme); each trigger whose instance is the delivery's metadata.trigger_id and whose `accept` takes it fires,
|
|
8
8
|
// each its own run. This is the one way Composio's events start runs: a webhook trigger takes no composio signature.
|
|
9
|
-
// A config can hold a credential
|
|
10
|
-
//
|
|
11
|
-
//
|
|
9
|
+
// A config can hold a credential. Composio's trigger schemas mark no field secret (their `config` is a plain JSON
|
|
10
|
+
// schema: type, title, description, required), so a field is sealed by its name (sealedConfigFields), or as an address
|
|
11
|
+
// carrying a credential (credentialUrl): kept in this source's sealed settings, the trigger keeping SEALED_MASK in its
|
|
12
12
|
// place and the field named in `sealed_config`, so no answer, row or log holds it (composio-triggers.ts).
|
|
13
13
|
import { ACCEPT_SCHEMA, acceptOf, acceptRefusal } from "./trigger-accept.js";
|
|
14
14
|
import { closedSchema, unknownSourceFields } from "./trigger-adapter.js";
|
package/dist/trigger-email.js
CHANGED
|
@@ -138,8 +138,6 @@ export const email = {
|
|
|
138
138
|
label: "email trigger",
|
|
139
139
|
delivery: "clock",
|
|
140
140
|
owner: false,
|
|
141
|
-
// Each message is its sender's: one run's answer (to alice) is never handed to the next (bob's).
|
|
142
|
-
previousResult: false,
|
|
143
141
|
settings: { scope: "trigger", fields: { [CURSOR]: { public: true }, [LAST_CHECK]: { public: true } } },
|
|
144
142
|
describe: `{kind: "email", account?: "${DEFAULT_ACCOUNT}", mailbox?: "INBOX", every_s?: ${MIN_EVERY_S}, accept?: [{event: "${EVENT}", where?}]}`,
|
|
145
143
|
fires: "each new message in the server's email account's mailbox (`email`), read every every_s seconds, that its `accept` takes",
|
package/dist/trigger-feed.js
CHANGED
|
@@ -375,8 +375,6 @@ export const feed = {
|
|
|
375
375
|
label: "feed trigger",
|
|
376
376
|
delivery: "clock",
|
|
377
377
|
owner: false,
|
|
378
|
-
// Each item is its own: one run's answer is never handed to the next.
|
|
379
|
-
previousResult: false,
|
|
380
378
|
settings: { scope: "trigger", fields: { [CURSOR]: { public: true }, [LAST_CHECK]: { public: true } } },
|
|
381
379
|
describe: `{kind: "feed", urls: ["https://..."], every_s?: ${DEFAULT_EVERY_S}, items?: "/data/items", id?: "/id", updated?: "/updated_at", fields?: ["/number", "/title"], accept?: [{event: "${EVENT}", where?}]}`,
|
|
382
380
|
fires: "each new or updated item in its feeds (`feed`: RSS, Atom, JSON Feed or a JSON list), read every every_s seconds, that its `accept` takes",
|
package/dist/trigger-schedule.js
CHANGED
|
@@ -40,6 +40,9 @@ export const schedule = {
|
|
|
40
40
|
label: "schedule",
|
|
41
41
|
delivery: "clock",
|
|
42
42
|
owner: true,
|
|
43
|
+
// Its runs repeat one job (a weekly digest): each is handed its trigger's last completed result, to leave out what
|
|
44
|
+
// that one reported.
|
|
45
|
+
previousResult: true,
|
|
43
46
|
describe: '{kind: "schedule", cron, timezone}, {kind: "schedule", at}, {kind: "schedule", every_s, start_at?}',
|
|
44
47
|
fires: `a cron line in a zone, one time, every N seconds (${MIN_EVERY_S} or more)`,
|
|
45
48
|
schemas: SCHEMAS,
|
|
@@ -2,9 +2,9 @@ import { type SecretMeta } from "./secret-writes.js";
|
|
|
2
2
|
import type { TriggerAdapter } from "./trigger-adapter.js";
|
|
3
3
|
/** What the token's answer says of a webhook trigger's secret, made and kept but not shown to it. */
|
|
4
4
|
export declare const TRIGGER_SECRET_WORDS = "Open the console to see this trigger's signing secret once: rotate it there.";
|
|
5
|
-
/** What the token's answer says of the outbound webhook's secret: the console
|
|
6
|
-
*
|
|
7
|
-
export declare const WEBHOOK_SECRET_WORDS = "Open the console to
|
|
5
|
+
/** What the token's answer says of the outbound webhook's secret: the console's Rotate secret makes a new one and shows it
|
|
6
|
+
* once. */
|
|
7
|
+
export declare const WEBHOOK_SECRET_WORDS = "Open Settings \u2192 Webhook in the console to rotate this webhook's signing secret and see the new one once.";
|
|
8
8
|
/** A webhook trigger's minted secret's metadata, named trigger:<id>: made by this server at a console's or a script's
|
|
9
9
|
* request (source console). `changedAt`: when it was made, where known (its create's or rotation's answer); its row
|
|
10
10
|
* keeps no time yet, so a read says null. */
|
|
@@ -31,6 +31,9 @@ export declare const webhookSecretMeta: (set: boolean, changedAt: string | null)
|
|
|
31
31
|
/** PUT /settings/webhook's answer: the minted value (the first save's) as `signing_secret` to a caller that may hold it,
|
|
32
32
|
* else the words. `view` carries the `secret` metadata already. */
|
|
33
33
|
export declare function webhookSaved(view: Record<string, unknown>, minted: string | undefined, mayHold: boolean): Record<string, unknown>;
|
|
34
|
+
/** POST /settings/webhook/secret's answer (the owner's session alone reaches it): the webhook as a read answers it, its
|
|
35
|
+
* `secret` metadata the new secret's, and the new value as `signing_secret`, this once. */
|
|
36
|
+
export declare const webhookRotated: (view: Record<string, unknown>, minted: string) => Record<string, unknown>;
|
|
34
37
|
/** What a trigger's view says of a secret its sealed settings keep but that does not open here (sealed under another seal
|
|
35
38
|
* key): unset, and why. */
|
|
36
39
|
export declare const TRIGGER_SECRET_UNOPENED = "Its signing secret does not open under this server's seal key: rotate it in the console.";
|
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
// Who sees a signing secret this server mints: a webhook trigger's (POST /triggers, POST /triggers/{id}/secret) and the
|
|
2
|
-
// outbound webhook's (the first PUT /settings/webhook). Each is shown once, as
|
|
3
|
-
// may write secrets (secret-writes.ts, the owner's signed-in session): the
|
|
4
|
-
// screens. The API token, which a run's process, an agent's MCP client or a
|
|
5
|
-
// secret's metadata (`secret`, the one SecretMeta shape) and the words that
|
|
6
|
-
//
|
|
7
|
-
// the
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
//
|
|
2
|
+
// outbound webhook's (the first PUT /settings/webhook, POST /settings/webhook/secret). Each is shown once, as
|
|
3
|
+
// `signing_secret`, and only to a caller that may write secrets (secret-writes.ts, the owner's signed-in session): the
|
|
4
|
+
// console's Triggers and Settings → Webhook screens. The API token, which a run's process, an agent's MCP client or a
|
|
5
|
+
// script may hold, gets what it made with the secret's metadata (`secret`, the one SecretMeta shape) and the words that
|
|
6
|
+
// send the person to the console for it.
|
|
7
|
+
// Rotating a trigger's secret, or the outbound webhook's, is a secret write: the token is refused it in the secret-write
|
|
8
|
+
// words, at the one check in the server's dispatch.
|
|
9
|
+
import { registerSecretPage, registerSecretWrite, secretMeta, secretName } from "./secret-writes.js";
|
|
10
|
+
// Replacing a trigger's secret or the outbound webhook's, and removing the outbound webhook (its secret goes with it), are
|
|
11
|
+
// secret writes. A trigger's create and the outbound webhook's first save mint one and write none the caller gave: the
|
|
12
|
+
// token may make them, and is shown no value.
|
|
12
13
|
registerSecretWrite("rotateTriggerSecret", () => true);
|
|
14
|
+
registerSecretWrite("rotateWebhookSecret", () => true);
|
|
13
15
|
registerSecretWrite("deleteWebhook", () => true);
|
|
16
|
+
// Where the owner finishes each in the console: the trigger's own page (Rotate), and Settings → Webhook (Rotate secret,
|
|
17
|
+
// Remove). The webhook's URL is never in a link: it can be a credential itself (webhooks.ts shownUrl).
|
|
18
|
+
registerSecretPage("rotateTriggerSecret", (_body, { params: [id] }) => (id && /^[A-Za-z0-9_-]{1,128}$/.test(id) ? `/#/triggers/${id}` : "/#/triggers"));
|
|
19
|
+
registerSecretPage(["rotateWebhookSecret", "deleteWebhook"], "/#/settings/webhook");
|
|
14
20
|
/** What the token's answer says of a webhook trigger's secret, made and kept but not shown to it. */
|
|
15
21
|
export const TRIGGER_SECRET_WORDS = "Open the console to see this trigger's signing secret once: rotate it there.";
|
|
16
|
-
/** What the token's answer says of the outbound webhook's secret: the console
|
|
17
|
-
*
|
|
18
|
-
export const WEBHOOK_SECRET_WORDS = "Open the console to
|
|
22
|
+
/** What the token's answer says of the outbound webhook's secret: the console's Rotate secret makes a new one and shows it
|
|
23
|
+
* once. */
|
|
24
|
+
export const WEBHOOK_SECRET_WORDS = "Open Settings → Webhook in the console to rotate this webhook's signing secret and see the new one once.";
|
|
19
25
|
/** A webhook trigger's minted secret's metadata, named trigger:<id>: made by this server at a console's or a script's
|
|
20
26
|
* request (source console). `changedAt`: when it was made, where known (its create's or rotation's answer); its row
|
|
21
27
|
* keeps no time yet, so a read says null. */
|
|
@@ -44,6 +50,9 @@ export function webhookSaved(view, minted, mayHold) {
|
|
|
44
50
|
return view;
|
|
45
51
|
return mayHold ? { ...view, signing_secret: minted } : { ...view, note: WEBHOOK_SECRET_WORDS };
|
|
46
52
|
}
|
|
53
|
+
/** POST /settings/webhook/secret's answer (the owner's session alone reaches it): the webhook as a read answers it, its
|
|
54
|
+
* `secret` metadata the new secret's, and the new value as `signing_secret`, this once. */
|
|
55
|
+
export const webhookRotated = (view, minted) => ({ ...view, signing_secret: minted });
|
|
47
56
|
/** The field an adapter mints for each of its triggers (a webhook's `secret`), if it mints one. */
|
|
48
57
|
const mintedField = (adapter) => adapter?.settings?.scope === "trigger" ? Object.entries(adapter.settings.fields).find(([, field]) => field.mint)?.[0] : undefined;
|
|
49
58
|
/** What a trigger's view says of a secret its sealed settings keep but that does not open here (sealed under another seal
|
|
@@ -40,7 +40,7 @@ export type TriggerTargets = {
|
|
|
40
40
|
targetIssues(target: Target): Promise<InputIssue[]>;
|
|
41
41
|
start(target: Extract<Target, {
|
|
42
42
|
kind: "start_run";
|
|
43
|
-
}>, input: Json, origin: RunTrigger, from: MessageOrigin, title
|
|
43
|
+
}>, input: Json, origin: RunTrigger, from: MessageOrigin, title: string | undefined, previous: boolean): Promise<{
|
|
44
44
|
run_id: string;
|
|
45
45
|
}>;
|
|
46
46
|
message(target: Extract<Target, {
|
package/dist/trigger-targets.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { ApiError, unsupported } from "./errors.js";
|
|
8
8
|
import { message, startRun, WAITS_ON_A_PERSON } from "./runs-over-store.js";
|
|
9
9
|
import { runOfOrigin } from "./store-reads/runs.js";
|
|
10
|
+
import { NATIVE_CAP_UNSUPPORTED, NATIVE_RUN_OVERRIDES_UNSUPPORTED, nativeOf, nativeRunOverrides } from "./native/binding.js";
|
|
10
11
|
/** Why a trigger may not message a run with no cap (server.ts NO_CAP). */
|
|
11
12
|
const NO_CAP = "The run has no spend cap: a trigger only messages a run with one, as every turn it drives is capped.";
|
|
12
13
|
/** The most of a trigger's firings, newest first, read for its last completed run. */
|
|
@@ -55,24 +56,34 @@ export function triggerTargets(store, deps) {
|
|
|
55
56
|
const pinned = await deps.start.pinnedOf(entry, { input: target.input });
|
|
56
57
|
const revision = pinned?.revision;
|
|
57
58
|
const defaultCap = revision?.body?.maxCostUsd;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
// A native run takes no cap and none of nativeRunOverrides, which its start refuses: so does a trigger on one.
|
|
60
|
+
const native = revision !== undefined && nativeOf(revision.body) !== undefined;
|
|
61
|
+
const start = native
|
|
62
|
+
? [
|
|
63
|
+
...(target.max_cost_usd !== undefined ? [{ field: "target.max_cost_usd", reason: "not_allowed", message: NATIVE_CAP_UNSUPPORTED }] : []),
|
|
64
|
+
...(defaultCap !== undefined ? [{ field: "target.agent_id", reason: "not_allowed", message: NATIVE_CAP_UNSUPPORTED }] : []),
|
|
65
|
+
...nativeRunOverrides(target).map((field) => ({ field: `target.${field}`, reason: "not_allowed", message: NATIVE_RUN_OVERRIDES_UNSUPPORTED })),
|
|
66
|
+
]
|
|
67
|
+
: target.max_cost_usd === undefined && defaultCap === undefined
|
|
68
|
+
? [{ field: "target.max_cost_usd", reason: "missing", message: `Every run a trigger starts is capped: give the target a max_cost_usd or set the agent's (the agent ${target.agent_id} has none).` }]
|
|
69
|
+
: [];
|
|
61
70
|
const wrong = revision ? await deps.start.explainRun(await deps.start.inputIssuesOf(revision, target.input), { input: target.input }, revision) : [];
|
|
62
|
-
return [...
|
|
71
|
+
return [...start, ...wrong.map((issue) => ({ ...issue, field: `target.${issue.field}` }))];
|
|
63
72
|
},
|
|
64
|
-
async start(target, given, trigger, from, title, previous
|
|
73
|
+
async start(target, given, trigger, from, title, previous) {
|
|
65
74
|
const entry = await deps.needAgent(target.agent_id);
|
|
66
75
|
// An agentic run is handed its trigger's previous result after its message (previousResultOf), so a repeat run
|
|
67
76
|
// (a weekly digest) leaves out what the last one reported. A workflow's input is its own schema's: nothing is added.
|
|
68
|
-
//
|
|
77
|
+
// `previous` is its adapter's previousResult (carriesPrevious).
|
|
69
78
|
const content = given.content;
|
|
70
79
|
const handed = previous && entry.revision?.kind === "agentic" && typeof content === "string" ? await previousResultOf(store, deps, trigger) : "";
|
|
71
80
|
const input = handed ? { ...given, content: `${content}${handed}` } : given;
|
|
72
|
-
// The target's cap, else the agent's default as it stands now: a run a trigger starts is never uncapped (capped)
|
|
81
|
+
// The target's cap, else the agent's default as it stands now: a run a trigger starts is never uncapped (capped),
|
|
82
|
+
// but a connected agent's, which its own CLI's limits keep and AgentRun can't cap (NATIVE_CAP_UNSUPPORTED).
|
|
83
|
+
const native = Boolean(nativeOf(entry.revision?.body));
|
|
73
84
|
const run = await startRun(store, deps.start, entry, { input, ...(target.max_cost_usd !== undefined ? { max_cost_usd: target.max_cost_usd } : {}), ...(target.effort ? { effort: target.effort } : {}) },
|
|
74
85
|
// Titled from the trigger (the engine's titleOf: "<Source> <name>"), never from its input, a sender's markup.
|
|
75
|
-
{ trigger, origin: { key: trigger.firing_key }, capped:
|
|
86
|
+
{ trigger, origin: { key: trigger.firing_key }, capped: !native, from, ...(title ? { title } : {}) });
|
|
76
87
|
return { run_id: run.id };
|
|
77
88
|
},
|
|
78
89
|
async message(target, input, key, from, bound) {
|
package/dist/triggers.d.ts
CHANGED
|
@@ -122,10 +122,10 @@ export type TriggerDeps = {
|
|
|
122
122
|
/** Starts the target's run with `input`, as POST /agents/{id}/runs would, under `origin`, titled `title` (its
|
|
123
123
|
* trigger's, never its input's); its first message is the trigger's (`from`, never the person's); ApiError when
|
|
124
124
|
* refused. */
|
|
125
|
-
/** `previous`
|
|
125
|
+
/** `previous` true: the run is handed its trigger's previous result (its adapter's previousResult, carriesPrevious). */
|
|
126
126
|
start(target: Extract<Target, {
|
|
127
127
|
kind: "start_run";
|
|
128
|
-
}>, input: Json, origin: RunTrigger, from: MessageOrigin, title: string, previous
|
|
128
|
+
}>, input: Json, origin: RunTrigger, from: MessageOrigin, title: string, previous: boolean): Promise<{
|
|
129
129
|
run_id: string;
|
|
130
130
|
}>;
|
|
131
131
|
/** Queues `input` for the target's run as a command row (answers false) under `key`, as the trigger's (`from`), within
|
package/dist/webhooks.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { fetch as undiciFetch } from "undici";
|
|
2
|
+
import { type ErrorCode } from "./errors.js";
|
|
3
|
+
import { type SealedSettingsOverStore, type SettingsSpec } from "./sealed-settings-store.js";
|
|
1
4
|
import type { Store } from "./store/index.js";
|
|
2
5
|
import type { TriggerFailed } from "./triggers.js";
|
|
3
6
|
/** A run's two notices, which the server's run-change follower tells. */
|
|
@@ -27,6 +30,31 @@ export declare const WEBHOOK_SECRET_SPEC: {
|
|
|
27
30
|
};
|
|
28
31
|
};
|
|
29
32
|
};
|
|
33
|
+
/** Where an outbox keeps what it sends and what it says, beside the webhook's own: its channel in the store, its setting,
|
|
34
|
+
* the sealed field that holds its credential (the webhook's minted secret; Slack's URL, slack.ts), its test message's
|
|
35
|
+
* type, and its words. */
|
|
36
|
+
export type Outbound = {
|
|
37
|
+
channel: string;
|
|
38
|
+
setting: string;
|
|
39
|
+
spec: SettingsSpec;
|
|
40
|
+
field: string;
|
|
41
|
+
testType: string;
|
|
42
|
+
words: {
|
|
43
|
+
removed: string;
|
|
44
|
+
off: string;
|
|
45
|
+
unset: string;
|
|
46
|
+
offWith: (reason: string) => string;
|
|
47
|
+
unreadable: string;
|
|
48
|
+
};
|
|
49
|
+
offCode: ErrorCode;
|
|
50
|
+
};
|
|
51
|
+
/** The webhook's own: every message type and word as they always were. */
|
|
52
|
+
export declare const WEBHOOK_OUTBOUND: Outbound;
|
|
53
|
+
/** What a receiver's answer turns off: the reason the outbox keeps, and the words its queued messages are dropped with. */
|
|
54
|
+
export type Gone = {
|
|
55
|
+
reason: string;
|
|
56
|
+
drop: string;
|
|
57
|
+
};
|
|
30
58
|
/** The webhook's URL as the server shows it (GET, its log): its origin and the last four characters of its path, never
|
|
31
59
|
* the whole URL, which can be a credential itself (a chat service's incoming-hook URL). */
|
|
32
60
|
export declare function shownUrl(url: string): string;
|
|
@@ -58,6 +86,20 @@ export type RunNotice = {
|
|
|
58
86
|
kind: "question" | "approval" | "stopped" | "budget" | "browser" | "computer";
|
|
59
87
|
};
|
|
60
88
|
};
|
|
89
|
+
/** The webhook as the store keeps it, but its secret: `secret_at`, when the secret was made (the same URL keeps it);
|
|
90
|
+
* `secret_scope`, the scope its secret is sealed under in trigger_settings, one of its own for each secret made, so the
|
|
91
|
+
* setting names the one secret that signs for its URL, and the two go live in the setting's one write. */
|
|
92
|
+
export type OutboundConfig = Config;
|
|
93
|
+
type Config = {
|
|
94
|
+
url: string;
|
|
95
|
+
secret_at: string;
|
|
96
|
+
secret_scope: string;
|
|
97
|
+
updated_at: string;
|
|
98
|
+
disabled?: {
|
|
99
|
+
at: string;
|
|
100
|
+
reason: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
61
103
|
export type Attempt = {
|
|
62
104
|
webhook_id: string;
|
|
63
105
|
type: MessageType;
|
|
@@ -92,16 +134,18 @@ export declare function waitMarkerOf(rows: readonly {
|
|
|
92
134
|
export type WebhooksStore = Pick<Store, "settings" | "triggerSettings" | "channels" | "flush">;
|
|
93
135
|
export declare class Webhooks {
|
|
94
136
|
private readonly store;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
137
|
+
protected readonly say: (fields: Record<string, string | number>) => void;
|
|
138
|
+
/** Which outbox this is: the webhook's (WEBHOOK_OUTBOUND), or another destination's over the same machinery. */
|
|
139
|
+
protected readonly outbound: Outbound;
|
|
140
|
+
protected readonly secrets: SealedSettingsOverStore;
|
|
141
|
+
protected config?: Config;
|
|
98
142
|
/** The ledger, by run, as channel_told holds it (this server is its one writer), and the waits seen while nothing is
|
|
99
143
|
* sent, held here only. */
|
|
100
144
|
private readonly notices;
|
|
101
145
|
/** The runs told of since this server started: their ledger entries are this server's news, which a start's catch-up
|
|
102
146
|
* never drops. */
|
|
103
147
|
private readonly told;
|
|
104
|
-
|
|
148
|
+
protected base: string;
|
|
105
149
|
private readonly timers;
|
|
106
150
|
/** The tries in flight, which close() stops and waits for: nothing is written once it is closed. */
|
|
107
151
|
private readonly trying;
|
|
@@ -129,7 +173,9 @@ export declare class Webhooks {
|
|
|
129
173
|
private readonly storeRetryMs;
|
|
130
174
|
private readonly timeoutMs;
|
|
131
175
|
/** `key` is the server's seal key; `say` takes a log line's fields. */
|
|
132
|
-
constructor(store: WebhooksStore, key: Buffer, say: (fields: Record<string, string | number>) => void, options?: WebhooksOptions
|
|
176
|
+
constructor(store: WebhooksStore, key: Buffer, say: (fields: Record<string, string | number>) => void, options?: WebhooksOptions,
|
|
177
|
+
/** Which outbox this is: the webhook's (WEBHOOK_OUTBOUND), or another destination's over the same machinery. */
|
|
178
|
+
outbound?: Outbound);
|
|
133
179
|
/** Reads the webhook, its secret and its ledger once, and goes on with the messages an earlier server left queued, each
|
|
134
180
|
* at its next try's time; a test send is tried once, so one left queued failed. Awaited once at start. */
|
|
135
181
|
load(): Promise<void>;
|
|
@@ -169,13 +215,23 @@ export declare class Webhooks {
|
|
|
169
215
|
}>;
|
|
170
216
|
/** The PUT's change, once every change before it has landed: the webhook as the last one left it, then the new one. */
|
|
171
217
|
private saveNow;
|
|
218
|
+
/** POST .../secret: a new secret for the URL set now, answered once; the webhook is otherwise as it was (its URL, when
|
|
219
|
+
* it was set, and off if a 410 turned it off). The secret it replaces goes at once, retired (still cut from what a run
|
|
220
|
+
* says): every try from then on, of a message queued before it too, is signed with the new one, since a try signs with
|
|
221
|
+
* the secret the setting names when it sends (tryOnce). A try already sending was signed with the old one. As a PUT
|
|
222
|
+
* does, the new secret is sealed under a scope of its own before the setting that names it is written, and a write
|
|
223
|
+
* that fails leaves the old secret signing, after a restart too. */
|
|
224
|
+
rotate(): Promise<{
|
|
225
|
+
view: ReturnType<Webhooks["view"]>;
|
|
226
|
+
secret: string;
|
|
227
|
+
}>;
|
|
172
228
|
/** DELETE: the webhook gone, its queued messages with it, and its secret (retired: still cut from what a run says); the
|
|
173
229
|
* log of attempts stays. In that order: shut to new notices, its queued messages dropped, the setting removed, then
|
|
174
230
|
* every secret of the webhook, on every DELETE (none once gone), so a removal of a secret that failed is finished by
|
|
175
231
|
* the next DELETE, and whatever fails, nothing of the removed webhook is left to send, to it or to a later one. */
|
|
176
232
|
remove(): Promise<void>;
|
|
177
233
|
/** `work`, once every change of the webhook asked for before it has settled, failed or not. */
|
|
178
|
-
|
|
234
|
+
protected change<T>(work: () => Promise<T>): Promise<T>;
|
|
179
235
|
/** GET .../deliveries: the last attempts, newest first. */
|
|
180
236
|
attemptsView(): Promise<{
|
|
181
237
|
attempts: Attempt[];
|
|
@@ -205,6 +261,10 @@ export declare class Webhooks {
|
|
|
205
261
|
endedAt?: string;
|
|
206
262
|
notice: RunNotice;
|
|
207
263
|
} | null>): Promise<string[]>;
|
|
264
|
+
/** A moment's message id, made from `key` (the same moment, told again by a later server too, has the same id). The
|
|
265
|
+
* store keeps one message per id across every channel, so another outbox's ids are made under its channel too: Slack's
|
|
266
|
+
* message for a run's end is never the webhook's, whichever is written first. The webhook's ids are as they always were. */
|
|
267
|
+
private messageId;
|
|
208
268
|
/** POST .../test: a `webhook.test` message tried once now, never again; its attempt. */
|
|
209
269
|
test(): Promise<Attempt>;
|
|
210
270
|
/** A message (and its ledger row, `told`) queued in one transaction, then made durable (the store's flush, as every write
|
|
@@ -228,9 +288,11 @@ export declare class Webhooks {
|
|
|
228
288
|
private signing;
|
|
229
289
|
/** The secret the webhook's setting names, opened here; undefined when none is set, or it does not open here. */
|
|
230
290
|
private signingSecret;
|
|
231
|
-
|
|
291
|
+
protected body(type: string, data: unknown): string;
|
|
232
292
|
/** The setting written, then held here: a write the store refuses throws, and what was held stays held. */
|
|
233
|
-
|
|
293
|
+
protected write(config: Config): Promise<void>;
|
|
294
|
+
/** The setting removed, durably, and none held here: a removal the store refuses throws, and what was held stays held. */
|
|
295
|
+
protected unwrite(): Promise<void>;
|
|
234
296
|
/** Whether an end's run.ended is still to be queued: at or after the webhook was set and the day began (a marker that
|
|
235
297
|
* names no time is not judged by one). The catch-up and the ledger's pruning read the same line, so the ledger never
|
|
236
298
|
* forgets an end a start would look for. */
|
|
@@ -244,6 +306,18 @@ export declare class Webhooks {
|
|
|
244
306
|
* next wait (`retry`), else dropped, and the log says so. A 410 turns the webhook off. A redelivery is a try of its
|
|
245
307
|
* own: it marks a message sent when it lands, and never drops one. */
|
|
246
308
|
private tryOnce;
|
|
309
|
+
/** What a try sends to (`url`) and with which headers, for the outbox's credential: the webhook's URL, signed with its
|
|
310
|
+
* secret. Slack's outbox sends to its sealed URL (slack.ts). */
|
|
311
|
+
protected request(config: Config, credential: string, id: string, timestamp: string, body: string): {
|
|
312
|
+
url: URL;
|
|
313
|
+
headers: Record<string, string>;
|
|
314
|
+
};
|
|
315
|
+
/** What a receiver's answer says: why the try failed (none when it landed), and whether the receiver is gone, which
|
|
316
|
+
* turns the outbox off. The webhook's: 2xx lands; a redirect is not followed; a 410 is gone. */
|
|
317
|
+
protected judged(res: Awaited<ReturnType<typeof undiciFetch>>): Promise<{
|
|
318
|
+
failure?: string;
|
|
319
|
+
gone?: Gone;
|
|
320
|
+
}>;
|
|
247
321
|
/** A try's outcome written: the message's new state and the try, in one transaction; its next try armed; a 410 that
|
|
248
322
|
* still names the webhook as it stands turns it off.
|
|
249
323
|
*
|