@leuduan/lagent 0.0.0-stage → 0.1.2
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/LICENSE +16 -0
- package/README.md +144 -2
- package/dist/chunks/2O7ZGEIT.js +1 -0
- package/dist/chunks/2OSESBIL.js +1 -0
- package/dist/chunks/34KW6VNQ.js +1 -0
- package/dist/chunks/37YOGDGY.js +1 -0
- package/dist/chunks/3LQHQRIU.js +6 -0
- package/dist/chunks/3QCW4WDJ.js +1 -0
- package/dist/chunks/4XVRUSCQ.js +1 -0
- package/dist/chunks/6ECI2GGV.js +1 -0
- package/dist/chunks/74HKUGRR.js +1 -0
- package/dist/chunks/ADHERZLW.js +2 -0
- package/dist/chunks/AP6Q4EPT.js +36 -0
- package/dist/chunks/BM3S37EZ.js +1 -0
- package/dist/chunks/C5LYCXJG.js +1 -0
- package/dist/chunks/CDQG7RKA.js +1 -0
- package/dist/chunks/D7E6EWIE.js +3 -0
- package/dist/chunks/DDANMY45.js +3 -0
- package/dist/chunks/DRYAN665.js +1 -0
- package/dist/chunks/DXFXAYDN.js +17 -0
- package/dist/chunks/EGZI4XQX.js +24 -0
- package/dist/chunks/ENWFSU27.js +41 -0
- package/dist/chunks/G6RXC3AL.js +1 -0
- package/dist/chunks/G74AGRAJ.js +15 -0
- package/dist/chunks/GQGNVSKB.js +1 -0
- package/dist/chunks/IJ2WNMD5.js +7 -0
- package/dist/chunks/J5S4URAW.js +1 -0
- package/dist/chunks/JPZFKSWT.js +1 -0
- package/dist/chunks/KESCTXGO.js +5 -0
- package/dist/chunks/L3N4FIEN.js +1 -0
- package/dist/chunks/NAOUTU7A.js +4 -0
- package/dist/chunks/NDIM7MEW.js +1 -0
- package/dist/chunks/O4PPOM5Z.js +2 -0
- package/dist/chunks/OVZFGILJ.js +1 -0
- package/dist/chunks/P5ZHHOOM.js +6 -0
- package/dist/chunks/PUSUPTAT.js +1 -0
- package/dist/chunks/QMMLQJBS.js +1 -0
- package/dist/chunks/RK3VP2Q4.js +3 -0
- package/dist/chunks/SGGMBSBA.js +1 -0
- package/dist/chunks/SL2YLB2F.js +1 -0
- package/dist/chunks/TOOIB6J2.js +1 -0
- package/dist/chunks/TYTQRLTX.js +1 -0
- package/dist/chunks/UC3FVVJ2.js +5 -0
- package/dist/chunks/UCTEU62F.js +1 -0
- package/dist/chunks/UD3VJER6.js +1 -0
- package/dist/chunks/UKXMCHHT.js +1 -0
- package/dist/chunks/WUUKTSRT.js +7 -0
- package/dist/chunks/X65X4KP5.js +7 -0
- package/dist/chunks/YIR5MYGU.js +1 -0
- package/dist/chunks/YLNJXQ3Z.js +1 -0
- package/dist/context.d.ts +101 -0
- package/dist/index.d.ts +47 -0
- package/dist/index.js +77 -0
- package/dist/journal/catalog.d.ts +112 -0
- package/dist/journal/forkChain.d.ts +16 -0
- package/dist/journal/index.d.ts +15 -0
- package/dist/journal/journal.d.ts +475 -0
- package/dist/journal/projection.d.ts +87 -0
- package/dist/journal/store.d.ts +181 -0
- package/dist/kit/claim.d.ts +13 -0
- package/dist/kit/drain.d.ts +10 -0
- package/dist/kit/extension.d.ts +180 -0
- package/dist/kit/grants.d.ts +9 -0
- package/dist/kit/modes.d.ts +65 -0
- package/dist/kit/retries.d.ts +25 -0
- package/dist/kit/scope.d.ts +32 -0
- package/dist/kit/service.d.ts +7 -0
- package/dist/kit/strategy.d.ts +10 -0
- package/dist/kit/timers.d.ts +43 -0
- package/dist/kit/tool.d.ts +72 -0
- package/dist/llm/client.d.ts +135 -0
- package/dist/llm/content.d.ts +52 -0
- package/dist/llm/door.d.ts +21 -0
- package/dist/llm/door.js +1 -0
- package/dist/llm/failure.d.ts +82 -0
- package/dist/llm/index.d.ts +16 -0
- package/dist/llm/primitives.d.ts +286 -0
- package/dist/llm/prompt.d.ts +21 -0
- package/dist/llm/provider.d.ts +63 -0
- package/dist/llm/readLedger.d.ts +24 -0
- package/dist/llm/request.d.ts +58 -0
- package/dist/loop/agent.d.ts +134 -0
- package/dist/loop/auxiliary.d.ts +54 -0
- package/dist/loop/chain.d.ts +46 -0
- package/dist/loop/chunks.d.ts +27 -0
- package/dist/loop/continuation.d.ts +166 -0
- package/dist/loop/decide.d.ts +64 -0
- package/dist/loop/errors.d.ts +162 -0
- package/dist/loop/forks.d.ts +61 -0
- package/dist/loop/holds.d.ts +104 -0
- package/dist/loop/hooks.d.ts +241 -0
- package/dist/loop/inbox.d.ts +188 -0
- package/dist/loop/index.d.ts +37 -0
- package/dist/loop/limits.d.ts +14 -0
- package/dist/loop/opening.d.ts +42 -0
- package/dist/loop/prepare.d.ts +30 -0
- package/dist/loop/projections.d.ts +307 -0
- package/dist/loop/replace.d.ts +33 -0
- package/dist/loop/requests.d.ts +129 -0
- package/dist/loop/route.d.ts +53 -0
- package/dist/loop/runtime.d.ts +85 -0
- package/dist/loop/state.d.ts +70 -0
- package/dist/loop/strategy.d.ts +71 -0
- package/dist/loop/summary.d.ts +3 -0
- package/dist/loop/surface.d.ts +153 -0
- package/dist/loop/threadState.d.ts +72 -0
- package/dist/loop/tool.d.ts +101 -0
- package/dist/loop/toolCalls.d.ts +42 -0
- package/dist/loop/wake.d.ts +32 -0
- package/dist/models/config/agent.d.ts +18 -0
- package/dist/models/config/prompt.d.ts +18 -0
- package/dist/models/door.d.ts +12 -0
- package/dist/models/door.js +1 -0
- package/dist/models/index.d.ts +7 -0
- package/dist/models/jsonSchema.d.ts +7 -0
- package/dist/models/wire/journal.d.ts +2772 -0
- package/dist/models/wire/primitives.d.ts +65 -0
- package/dist/plugin.d.ts +53 -0
- package/dist/plugin.js +1 -0
- package/dist/plugins/agentsMd.d.ts +76 -0
- package/dist/plugins/agentsMd.js +1 -0
- package/dist/plugins/ask/askQuestion.d.ts +9 -0
- package/dist/plugins/ask/index.d.ts +26 -0
- package/dist/plugins/ask/index.js +1 -0
- package/dist/plugins/ask/service.d.ts +125 -0
- package/dist/plugins/commands/background.d.ts +8 -0
- package/dist/plugins/commands/foreground.d.ts +4 -0
- package/dist/plugins/commands/index.d.ts +40 -0
- package/dist/plugins/commands/index.js +1 -0
- package/dist/plugins/commands/output.d.ts +115 -0
- package/dist/plugins/commands/record.d.ts +549 -0
- package/dist/plugins/commands/service.d.ts +314 -0
- package/dist/plugins/commands/shell.d.ts +25 -0
- package/dist/plugins/compaction/checkpoint.d.ts +91 -0
- package/dist/plugins/compaction/config.d.ts +133 -0
- package/dist/plugins/compaction/estimate.d.ts +29 -0
- package/dist/plugins/compaction/index.d.ts +2 -0
- package/dist/plugins/compaction/index.js +7 -0
- package/dist/plugins/compaction/log.d.ts +61 -0
- package/dist/plugins/compaction/planner.d.ts +207 -0
- package/dist/plugins/compaction/preset.d.ts +86 -0
- package/dist/plugins/compaction/prune.d.ts +9 -0
- package/dist/plugins/compaction/records.d.ts +227 -0
- package/dist/plugins/compaction/segments.d.ts +23 -0
- package/dist/plugins/compaction/shared.d.ts +14 -0
- package/dist/plugins/compaction/summarize.d.ts +13 -0
- package/dist/plugins/dateAndBranch.d.ts +47 -0
- package/dist/plugins/dateAndBranch.js +1 -0
- package/dist/plugins/delegations/answers.d.ts +39 -0
- package/dist/plugins/delegations/assignmentKey.d.ts +22 -0
- package/dist/plugins/delegations/cleanup.d.ts +161 -0
- package/dist/plugins/delegations/constraint.d.ts +76 -0
- package/dist/plugins/delegations/index.d.ts +39 -0
- package/dist/plugins/delegations/index.js +1 -0
- package/dist/plugins/delegations/notices.d.ts +261 -0
- package/dist/plugins/delegations/obligations.d.ts +210 -0
- package/dist/plugins/delegations/record.d.ts +632 -0
- package/dist/plugins/delegations/request.d.ts +381 -0
- package/dist/plugins/delegations/role.d.ts +30 -0
- package/dist/plugins/delegations/service.d.ts +562 -0
- package/dist/plugins/delegations/standing.d.ts +19 -0
- package/dist/plugins/delegations/stopCheck.d.ts +21 -0
- package/dist/plugins/delegations/testing.d.ts +16 -0
- package/dist/plugins/delegations/tools.d.ts +71 -0
- package/dist/plugins/delegations/waitBook.d.ts +116 -0
- package/dist/plugins/delegations/waits.d.ts +118 -0
- package/dist/plugins/diagnostics/digest.d.ts +14 -0
- package/dist/plugins/diagnostics/index.d.ts +68 -0
- package/dist/plugins/diagnostics/index.js +1 -0
- package/dist/plugins/historyRecall/history.d.ts +9 -0
- package/dist/plugins/historyRecall/index.d.ts +31 -0
- package/dist/plugins/historyRecall/index.js +1 -0
- package/dist/plugins/historyRecall/render.d.ts +34 -0
- package/dist/plugins/historyRecall/tools.d.ts +4 -0
- package/dist/plugins/mcp/catalog.d.ts +36 -0
- package/dist/plugins/mcp/config.d.ts +63 -0
- package/dist/plugins/mcp/connection.d.ts +53 -0
- package/dist/plugins/mcp/errors.d.ts +32 -0
- package/dist/plugins/mcp/index.d.ts +33 -0
- package/dist/plugins/mcp/index.js +5 -0
- package/dist/plugins/mcp/mount.d.ts +98 -0
- package/dist/plugins/mcp/names.d.ts +25 -0
- package/dist/plugins/mcp/render.d.ts +29 -0
- package/dist/plugins/mcp/slots.d.ts +15 -0
- package/dist/plugins/mcp/stdio.d.ts +49 -0
- package/dist/plugins/mcp/tool.d.ts +41 -0
- package/dist/plugins/providers/anthropic.d.ts +175 -0
- package/dist/plugins/providers/anthropicMessages.d.ts +65 -0
- package/dist/plugins/providers/codex.d.ts +60 -0
- package/dist/plugins/providers/codexAuth.d.ts +116 -0
- package/dist/plugins/providers/deepseek.d.ts +55 -0
- package/dist/plugins/providers/door.d.ts +61 -0
- package/dist/plugins/providers/door.js +1 -0
- package/dist/plugins/providers/failure.d.ts +23 -0
- package/dist/plugins/providers/gateway.d.ts +23 -0
- package/dist/plugins/providers/index.d.ts +6 -0
- package/dist/plugins/providers/openaiChat.d.ts +62 -0
- package/dist/plugins/providers/openaiResponses.d.ts +100 -0
- package/dist/plugins/providers/opencodeCopilot.d.ts +23 -0
- package/dist/plugins/providers/opencodeGo.d.ts +98 -0
- package/dist/plugins/providers/shared.d.ts +104 -0
- package/dist/plugins/providers/stream.d.ts +154 -0
- package/dist/plugins/routeContext.d.ts +22 -0
- package/dist/plugins/routeContext.js +1 -0
- package/dist/plugins/schedules/index.d.ts +21 -0
- package/dist/plugins/schedules/index.js +5 -0
- package/dist/plugins/schedules/record.d.ts +396 -0
- package/dist/plugins/schedules/service.d.ts +120 -0
- package/dist/plugins/schedules/time.d.ts +26 -0
- package/dist/plugins/schedules/tools.d.ts +6 -0
- package/dist/plugins/skills/discovery.d.ts +54 -0
- package/dist/plugins/skills/index.d.ts +31 -0
- package/dist/plugins/skills/index.js +1 -0
- package/dist/plugins/skills/tool.d.ts +11 -0
- package/dist/plugins/store/durableObject.d.ts +23 -0
- package/dist/plugins/store/durableObject.js +1 -0
- package/dist/plugins/store/durableObjectConnection.d.ts +27 -0
- package/dist/plugins/store/memory.d.ts +29 -0
- package/dist/plugins/store/sql.d.ts +59 -0
- package/dist/plugins/store/sqlite.d.ts +31 -0
- package/dist/plugins/store/sqlite.js +1 -0
- package/dist/plugins/subAgents/availableRoutes.d.ts +53 -0
- package/dist/plugins/subAgents/fork.d.ts +32 -0
- package/dist/plugins/subAgents/index.d.ts +67 -0
- package/dist/plugins/subAgents/index.js +1 -0
- package/dist/plugins/subAgents/tool.d.ts +38 -0
- package/dist/plugins/toolPolicy/index.d.ts +61 -0
- package/dist/plugins/toolPolicy/index.js +1 -0
- package/dist/plugins/tools/editFiles.d.ts +128 -0
- package/dist/plugins/tools/fsRead.d.ts +17 -0
- package/dist/plugins/tools/html.d.ts +23 -0
- package/dist/plugins/tools/index.d.ts +59 -0
- package/dist/plugins/tools/index.js +1 -0
- package/dist/plugins/tools/network.d.ts +23 -0
- package/dist/plugins/tools/ripgrep.d.ts +20 -0
- package/dist/plugins/tools/textEdit.d.ts +67 -0
- package/dist/plugins/tools/web.d.ts +32 -0
- package/dist/plugins/truncateToolOutput.d.ts +26 -0
- package/dist/plugins/truncateToolOutput.js +1 -0
- package/dist/plugins/usage/index.d.ts +24 -0
- package/dist/plugins/usage/index.js +1 -0
- package/dist/plugins/usage/tracker.d.ts +34 -0
- package/dist/plugins/verify/facts.d.ts +356 -0
- package/dist/plugins/verify/index.d.ts +75 -0
- package/dist/plugins/verify/index.js +1 -0
- package/dist/plugins/verify/service.d.ts +90 -0
- package/dist/plugins/workflows/assignment.d.ts +16 -0
- package/dist/plugins/workflows/bindings.d.ts +95 -0
- package/dist/plugins/workflows/cleanup.d.ts +38 -0
- package/dist/plugins/workflows/definition.d.ts +184 -0
- package/dist/plugins/workflows/fold.d.ts +373 -0
- package/dist/plugins/workflows/index.d.ts +28 -0
- package/dist/plugins/workflows/index.js +6 -0
- package/dist/plugins/workflows/observations.d.ts +81 -0
- package/dist/plugins/workflows/participants.d.ts +143 -0
- package/dist/plugins/workflows/policy.d.ts +112 -0
- package/dist/plugins/workflows/providers.d.ts +146 -0
- package/dist/plugins/workflows/record.d.ts +2863 -0
- package/dist/plugins/workflows/routing.d.ts +116 -0
- package/dist/plugins/workflows/schema.d.ts +26 -0
- package/dist/plugins/workflows/service.d.ts +477 -0
- package/dist/plugins/workflows/submit.d.ts +8 -0
- package/dist/plugins/workflows/view.d.ts +103 -0
- package/dist/plugins/workflows/work.d.ts +21 -0
- package/dist/plugins/workspaceContext.d.ts +38 -0
- package/dist/plugins/workspaceContext.js +1 -0
- package/dist/presets/agents.d.ts +7 -0
- package/dist/presets/base.d.ts +10 -0
- package/dist/presets/codex.d.ts +60 -0
- package/dist/presets/index.d.ts +4 -0
- package/dist/presets/prompts.d.ts +56 -0
- package/dist/sandbox/absent.d.ts +32 -0
- package/dist/sandbox/client.d.ts +39 -0
- package/dist/sandbox/files.d.ts +28 -0
- package/dist/sandbox/index.d.ts +49 -0
- package/dist/sandbox/index.js +4 -0
- package/dist/sandbox/mode.d.ts +57 -0
- package/dist/sandbox/policy.d.ts +86 -0
- package/dist/sandbox/protocol.d.ts +107 -0
- package/dist/sandbox/service.d.ts +143 -0
- package/dist/sandbox/worker.d.ts +12 -0
- package/dist/sandbox/worker.js +1 -0
- package/dist/services/admission.d.ts +174 -0
- package/dist/services/agents.d.ts +37 -0
- package/dist/services/birth.d.ts +220 -0
- package/dist/services/contributions.d.ts +73 -0
- package/dist/services/core.d.ts +34 -0
- package/dist/services/journal.d.ts +26 -0
- package/dist/services/launches.d.ts +104 -0
- package/dist/services/llm.d.ts +80 -0
- package/dist/services/owner.d.ts +367 -0
- package/dist/services/preset.d.ts +154 -0
- package/dist/services/presets.d.ts +139 -0
- package/dist/services/prompts.d.ts +67 -0
- package/dist/services/runEvents.d.ts +79 -0
- package/dist/services/thread.d.ts +267 -0
- package/dist/services/threadActivation.d.ts +100 -0
- package/dist/services/threadDirs.d.ts +38 -0
- package/dist/services/threadView.d.ts +92 -0
- package/dist/services/threads.d.ts +449 -0
- package/dist/services/tools.d.ts +41 -0
- package/dist/sys/environment.d.ts +47 -0
- package/dist/sys/git.d.ts +60 -0
- package/dist/sys/paths.d.ts +56 -0
- package/dist/sys/spawn.d.ts +176 -0
- package/dist/testing/clock.d.ts +17 -0
- package/dist/testing/fakeLlm.d.ts +74 -0
- package/dist/testing/fedLlm.d.ts +32 -0
- package/dist/testing/helpers.d.ts +344 -0
- package/dist/testing/index.d.ts +13 -0
- package/dist/testing/index.js +1 -0
- package/dist/testing/processes.d.ts +13 -0
- package/dist/testing/sandbox.d.ts +71 -0
- package/dist/testing/settlement.d.ts +6 -0
- package/dist/testing/tmpDirs.d.ts +17 -0
- package/dist/util/async.d.ts +8 -0
- package/dist/util/diff.d.ts +25 -0
- package/dist/util/dispatch.d.ts +8 -0
- package/dist/util/errors.d.ts +28 -0
- package/dist/util/foldState.d.ts +17 -0
- package/dist/util/freeze.d.ts +2 -0
- package/dist/util/ids.d.ts +2 -0
- package/dist/util/json.d.ts +37 -0
- package/dist/util/log.d.ts +6 -0
- package/dist/util/text.d.ts +21 -0
- package/dist/util/version.d.ts +2 -0
- package/package.json +175 -3
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { WriteRows } from '../../loop/index.js';
|
|
3
|
+
import type { InitialInstallation, ThreadEnvironment } from '../../models/index.js';
|
|
4
|
+
import type { DeepReadonly, JsonValue } from '../../util/json.js';
|
|
5
|
+
/**
|
|
6
|
+
* A conversation's configuration as a provider pins from it: the root's, as the host proposes to
|
|
7
|
+
* create it, or an isolated participant's, as its opening resolved it. Installation ids are left
|
|
8
|
+
* out: they name installations, they do not configure them.
|
|
9
|
+
*/
|
|
10
|
+
export type Configured = DeepReadonly<{
|
|
11
|
+
environment: ThreadEnvironment;
|
|
12
|
+
installations: Omit<InitialInstallation, 'installation_id'>[];
|
|
13
|
+
}>;
|
|
14
|
+
/** What a binding tells the workflows that subscribe to it: its availability may have changed, or it is gone for good. */
|
|
15
|
+
export type ProviderNotice = 'availability' | 'disposed';
|
|
16
|
+
/** The pin a provider gives an opening, from which everything the instance asks of it is served; or why it cannot. */
|
|
17
|
+
export type PinOutcome = {
|
|
18
|
+
readonly config: JsonValue;
|
|
19
|
+
} | {
|
|
20
|
+
readonly refused: string;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* What every provider binding is: a direct host binding, named by the definitions that use it. Its
|
|
24
|
+
* name is its whole identity, as a definition's id is: a change that would break the instances
|
|
25
|
+
* running on it binds under a new name. An instance records the serializable pin it was opened
|
|
26
|
+
* with, and runs only on a binding that still accepts that pin.
|
|
27
|
+
*/
|
|
28
|
+
export type ProviderBinding = {
|
|
29
|
+
/** Why it cannot serve now, or `null` when it can; synchronous. */
|
|
30
|
+
unavailable(): string | null;
|
|
31
|
+
/** Why it cannot serve a pin recorded earlier, or `null` when it can. */
|
|
32
|
+
validate(config: DeepReadonly<JsonValue>): string | null;
|
|
33
|
+
/** The pin an opening records from `configured`; asked outside any write, cancellable. */
|
|
34
|
+
pin(configured: Configured, signal: AbortSignal): Promise<PinOutcome>;
|
|
35
|
+
/**
|
|
36
|
+
* Calls `listener` when what `unavailable` answers may have changed, and once with `disposed`
|
|
37
|
+
* when the binding is gone for good. Returns the unsubscribe.
|
|
38
|
+
*/
|
|
39
|
+
subscribe(listener: (notice: ProviderNotice) => void): () => void;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* One requirement a check records for an assignment, in the write that opens the assignment's task:
|
|
43
|
+
* the pin the instance recorded, the owner and assignment it is for, the participant generation
|
|
44
|
+
* serving it, and the input whose claim activates it, the task's.
|
|
45
|
+
*/
|
|
46
|
+
export type CheckRequest = {
|
|
47
|
+
readonly config: DeepReadonly<JsonValue>;
|
|
48
|
+
readonly owner: string;
|
|
49
|
+
readonly assignment: string;
|
|
50
|
+
readonly generation: number;
|
|
51
|
+
readonly inputId: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* A check provider: judges an isolated participant's answer through a requirement it owns. Its pin
|
|
55
|
+
* is taken from the configuration of each participant whose assignments list it. Every thread such
|
|
56
|
+
* an assignment runs on is created requiring `requires`, the constraint owners its judgement needs,
|
|
57
|
+
* so the thread is held rather than its answer accepted unchecked while the check's owner is
|
|
58
|
+
* missing; `owed` gives the rows recording the requirement, decided inside the write that opens the
|
|
59
|
+
* assignment's task, which they may refuse.
|
|
60
|
+
*/
|
|
61
|
+
export type CheckProvider = ProviderBinding & {
|
|
62
|
+
readonly requires: readonly string[];
|
|
63
|
+
owed(request: CheckRequest): WriteRows;
|
|
64
|
+
};
|
|
65
|
+
/** What one acquisition found: a value with its citation detail, a genuine absence, or no answer now. */
|
|
66
|
+
export type Acquired = {
|
|
67
|
+
readonly kind: 'value';
|
|
68
|
+
readonly value: JsonValue;
|
|
69
|
+
/** Whether the value is a snapshot (`true`) or describes something live that can change. */
|
|
70
|
+
readonly immutable: boolean;
|
|
71
|
+
/** What the citation records of how it was acquired, such as a baseline. */
|
|
72
|
+
readonly detail: JsonValue;
|
|
73
|
+
}
|
|
74
|
+
/** There is nothing to bind: an optional binding binds `null`. */
|
|
75
|
+
| {
|
|
76
|
+
readonly kind: 'absent';
|
|
77
|
+
}
|
|
78
|
+
/** It could not be acquired now: never absence, so the entry is refused. */
|
|
79
|
+
| {
|
|
80
|
+
readonly kind: 'unavailable';
|
|
81
|
+
readonly reason: string;
|
|
82
|
+
};
|
|
83
|
+
/** One acquisition for an attempt's entry. */
|
|
84
|
+
export type EvidenceRequest = {
|
|
85
|
+
/** The pin the instance recorded at its opening. */
|
|
86
|
+
readonly config: DeepReadonly<JsonValue>;
|
|
87
|
+
readonly instance: string;
|
|
88
|
+
readonly attempt: string;
|
|
89
|
+
readonly step: string;
|
|
90
|
+
readonly input: string;
|
|
91
|
+
readonly signal: AbortSignal;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* An evidence provider: supplies an input no participant produced, acquired at attempt entry
|
|
95
|
+
* outside the journal write. Its pin is taken from the root's configuration. A throw is an
|
|
96
|
+
* `unavailable` answer; an abort of the request's signal cancels the entry.
|
|
97
|
+
*/
|
|
98
|
+
export type EvidenceProvider = ProviderBinding & {
|
|
99
|
+
acquire(request: EvidenceRequest): Promise<Acquired>;
|
|
100
|
+
};
|
|
101
|
+
export declare const CheckProviderSchema: z.ZodCustom<CheckProvider, CheckProvider>;
|
|
102
|
+
export declare const EvidenceProviderSchema: z.ZodCustom<EvidenceProvider, EvidenceProvider>;
|
|
103
|
+
/** What an instance records of one provider at its opening. */
|
|
104
|
+
export type ProviderPin = {
|
|
105
|
+
readonly config: JsonValue;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* The providers one mount binds, as workflows holds them: it owns the subscription to each, the
|
|
109
|
+
* bindings that told it they are gone, and every acquisition in flight, which a provider's disposal
|
|
110
|
+
* or the mount's drain aborts and awaits. A binding is usable for a recorded pin only while it is
|
|
111
|
+
* not disposed, says it is available and accepts the pinned configuration.
|
|
112
|
+
*/
|
|
113
|
+
export declare class Providers {
|
|
114
|
+
private readonly disposed;
|
|
115
|
+
private readonly inFlight;
|
|
116
|
+
private readonly drained;
|
|
117
|
+
private readonly bindings;
|
|
118
|
+
constructor(bindings: Providers['bindings']);
|
|
119
|
+
/** Subscribes to every binding: `changed` hears each notice, after a disposal is taken in. Returns the unsubscribe. */
|
|
120
|
+
watch(changed: (kind: 'check' | 'evidence', name: string, notice: ProviderNotice) => void): () => void;
|
|
121
|
+
/** Why `name` cannot serve `pin` now, or `null`: absent, gone, unavailable, or refusing the pin. */
|
|
122
|
+
problem(kind: 'check' | 'evidence', name: string, pin: DeepReadonly<ProviderPin> | undefined): string | null;
|
|
123
|
+
/**
|
|
124
|
+
* The pin an opening records for `name`, refused when it is unavailable or refuses `configured`;
|
|
125
|
+
* rejects only with {@link CancelledError}.
|
|
126
|
+
*/
|
|
127
|
+
pin(kind: 'check' | 'evidence', name: string, configured: Configured, signal: AbortSignal): Promise<ProviderPin | {
|
|
128
|
+
readonly refused: string;
|
|
129
|
+
}>;
|
|
130
|
+
/**
|
|
131
|
+
* Acquires evidence from `name` under the instance's pin: `unavailable` when the binding cannot
|
|
132
|
+
* serve the pin or the provider fails; rejects only with {@link CancelledError}, cancelled by the
|
|
133
|
+
* request's signal, the provider's disposal or the drain.
|
|
134
|
+
*/
|
|
135
|
+
acquire(name: string, pin: DeepReadonly<ProviderPin> | undefined, request: Omit<EvidenceRequest, 'config'>): Promise<Acquired>;
|
|
136
|
+
/** Aborts every acquisition and pin in flight, and waits for each provider's own work to settle. */
|
|
137
|
+
drain(): Promise<void>;
|
|
138
|
+
private table;
|
|
139
|
+
private dispose;
|
|
140
|
+
/** Runs `work` under a signal the caller's, the drain or the provider's disposal aborts, kept until it settles. */
|
|
141
|
+
private tracked;
|
|
142
|
+
}
|
|
143
|
+
/** An acquisition or pin cancelled: by its caller's signal, the provider's disposal or the mount's drain. */
|
|
144
|
+
export declare class CancelledError extends Error {
|
|
145
|
+
constructor(cause: unknown);
|
|
146
|
+
}
|