@owlmeans/agent-common 0.1.18-rc.47 → 0.1.18-rc.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +174 -13
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/agent-common/SKILL.md +1 -1
- package/build/consts.d.ts +20 -0
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +103 -0
- package/build/consts.js.map +1 -1
- package/build/errors.d.ts +1 -1
- package/build/errors.js +1 -1
- package/build/helpers/conversation.d.ts +0 -9
- package/build/helpers/conversation.d.ts.map +1 -1
- package/build/helpers/conversation.js +0 -28
- package/build/helpers/conversation.js.map +1 -1
- package/build/helpers/truncate.d.ts +10 -0
- package/build/helpers/truncate.d.ts.map +1 -0
- package/build/helpers/truncate.js +29 -0
- package/build/helpers/truncate.js.map +1 -0
- package/build/index.d.ts +4 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/models/pipeline-spec/types.d.ts +57 -0
- package/build/models/pipeline-spec/types.d.ts.map +1 -0
- package/build/models/pipeline-spec/types.js +2 -0
- package/build/models/pipeline-spec/types.js.map +1 -0
- package/build/models/pipeline-spec.d.ts +4 -0
- package/build/models/pipeline-spec.d.ts.map +1 -0
- package/build/models/pipeline-spec.js +171 -0
- package/build/models/pipeline-spec.js.map +1 -0
- package/build/pipeline.d.ts +4 -43
- package/build/pipeline.d.ts.map +1 -1
- package/build/pipeline.js +9 -205
- package/build/pipeline.js.map +1 -1
- package/build/results/types.d.ts +211 -0
- package/build/results/types.d.ts.map +1 -0
- package/build/results/types.js +2 -0
- package/build/results/types.js.map +1 -0
- package/build/results.d.ts +3 -55
- package/build/results.d.ts.map +1 -1
- package/build/results.js +202 -250
- package/build/results.js.map +1 -1
- package/build/types.d.ts +1 -137
- package/build/types.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/consts.ts +113 -0
- package/src/errors.ts +1 -1
- package/src/helpers/conversation.ts +0 -32
- package/src/helpers/truncate.ts +31 -0
- package/src/index.ts +4 -1
- package/src/models/pipeline-spec/types.ts +58 -0
- package/src/models/pipeline-spec.ts +202 -0
- package/src/pipeline.ts +10 -231
- package/src/results/types.ts +221 -0
- package/src/results.ts +229 -274
- package/src/types.ts +2 -147
- package/tests/pipeline.spec.ts +26 -29
- package/tests/results.spec.ts +24 -26
- package/build/flows.d.ts +0 -21
- package/build/flows.d.ts.map +0 -1
- package/build/flows.js +0 -105
- package/build/flows.js.map +0 -1
- package/src/flows.ts +0 -113
package/README.md
CHANGED
|
@@ -1,23 +1,160 @@
|
|
|
1
1
|
# @owlmeans/agent-common
|
|
2
2
|
|
|
3
3
|
Serializable contracts for OwlMeans agents and LLM pipelines: conversation identity, the run
|
|
4
|
-
lifecycle flow, and the
|
|
4
|
+
lifecycle flow, the pipeline declaration and run row, the cumulative-results records with their
|
|
5
|
+
deterministic renderers, and the record shapes an application persists. Runtime-free by design — no
|
|
6
|
+
LangChain, no LangGraph, no storage driver — so a backend, a reconciler, an operator console or a
|
|
7
|
+
browser bundle imports it to read what an agent wrote and to say where a pipeline run stands. It does
|
|
8
|
+
not run anything: executing agents and pipelines, binding stores and cutting result views is the
|
|
9
|
+
runtime, [`@owlmeans/agent`](../agent). The package's skill is `agent-common`.
|
|
5
10
|
|
|
6
|
-
|
|
7
|
-
bundle can import these shapes to read what an agent wrote without pulling the runtime. The
|
|
8
|
-
runtime is [`@owlmeans/agent`](../agent).
|
|
11
|
+
## Installation
|
|
9
12
|
|
|
10
|
-
|
|
13
|
+
```bash
|
|
14
|
+
bun add @owlmeans/agent-common@^0.1.18-rc.49
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Concepts
|
|
18
|
+
|
|
19
|
+
- **Conversation** — `ConversationRef` (`{ conversationId, scope }`): the thread a run belongs to and
|
|
20
|
+
the wider subject its memory is filed under. `conversationFor` derives both from an `LlmPurpose`
|
|
21
|
+
dedication (`<kind>:<id>`).
|
|
22
|
+
- **Run lifecycle** — `agentRunFlow`, an `@owlmeans/flow` declaration with steps `Received` →
|
|
23
|
+
`Prepared` → `Working` → `Finalizing` → `Finished`, plus a terminal `Failed`. The steps say how far
|
|
24
|
+
a run got; nothing resumes one.
|
|
25
|
+
- **Pipeline** — `PipelineSpec`, a declaration of named steps joined by `after` edges. It is the
|
|
26
|
+
resumable unit; `makePipelineSpecModel(spec)` validates and orders it.
|
|
27
|
+
- **Pipeline run** — `PipelineRun`, the one authority on where a run stands: status, `completed` /
|
|
28
|
+
`pending` steps, `state` as JSON **text** with `stateChars`, and `heartbeatAt`.
|
|
29
|
+
- **Cumulative results** — `CumulativeResultFact`s a step produced, collected into a
|
|
30
|
+
`CumulativeResultEntry` per step, rendered full or names-only so later steps reuse the
|
|
31
|
+
authoritative names.
|
|
32
|
+
- **Port** — a store name (`AGENT_CONVERSATION_STORE`, …) a consumer binds its own storage under. An
|
|
33
|
+
unbound port is not an error; the plugin that needs it degrades to a no-op.
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Derive a conversation and cap text
|
|
38
|
+
|
|
39
|
+
```typescript
|
|
40
|
+
import { DEFAULT_SUMMARY_CHARS, conversationFor, truncateAt } from '@owlmeans/agent-common'
|
|
41
|
+
|
|
42
|
+
const ref = conversationFor({ type: 'coder', dedication: `project:${projectId}` })
|
|
43
|
+
// { conversationId: 'project:<id>', scope: '<id>' } — an empty dedication becomes 'anonymous'
|
|
44
|
+
|
|
45
|
+
const summary = truncateAt(modelAnswer, DEFAULT_SUMMARY_CHARS) // cuts on a paragraph/line/sentence/word, marks with '…'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Drive the run lifecycle
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import { makeFlowModel } from '@owlmeans/flow'
|
|
52
|
+
import { AgentRunStep, AgentRunTransition, agentRunFlow } from '@owlmeans/agent-common'
|
|
53
|
+
|
|
54
|
+
const model = await makeFlowModel(agentRunFlow)
|
|
55
|
+
model.transit(model.next().transition, true) // Received → Prepared: one automatic edge per step
|
|
56
|
+
model.transit(AgentRunTransition.Work, true)
|
|
57
|
+
|
|
58
|
+
model.step().step === AgentRunStep.Working
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Declare and validate a pipeline
|
|
62
|
+
|
|
63
|
+
```typescript
|
|
64
|
+
import { makePipelineSpecModel, PipelineSpecError } from '@owlmeans/agent-common'
|
|
65
|
+
import type { PipelineSpec } from '@owlmeans/agent-common'
|
|
66
|
+
|
|
67
|
+
export const scaffoldPipeline: PipelineSpec = {
|
|
68
|
+
alias: 'scaffold',
|
|
69
|
+
version: 2, // bump on every added, removed or renamed step
|
|
70
|
+
steps: [
|
|
71
|
+
{ step: 'plan', title: 'Plan the change' },
|
|
72
|
+
{ step: 'types', after: ['plan'] },
|
|
73
|
+
{ step: 'api', after: ['types'] },
|
|
74
|
+
{ step: 'web', after: ['types'] },
|
|
75
|
+
{ step: 'wipe-preview', after: ['api', 'web'], nonIdempotent: true },
|
|
76
|
+
],
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const spec = makePipelineSpecModel(scaffoldPipeline)
|
|
80
|
+
spec.validate() // throws PipelineSpecError naming every fault at once
|
|
81
|
+
spec.orderSteps() // ['plan', 'types', 'api', 'web', 'wipe-preview']
|
|
82
|
+
spec.descendants('types') // what a resume from 'types' re-runs, 'types' included
|
|
83
|
+
spec.ancestry('wipe-preview') // [{ step: 'plan', depth: 3 }, { step: 'types', depth: 2 }, …]
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Render a step's results
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { CumulativeFactKind, CumulativeResultSource, cumulativeResultsHelper } from '@owlmeans/agent-common'
|
|
90
|
+
|
|
91
|
+
const { full, compact } = cumulativeResultsHelper.renderResultEntry({
|
|
92
|
+
label: 'types',
|
|
93
|
+
source: CumulativeResultSource.Extracted,
|
|
94
|
+
facts: [
|
|
95
|
+
{ kind: CumulativeFactKind.Type, name: 'User', signature: '{ id: string; email: string }', specifier: '@app/common' },
|
|
96
|
+
{ kind: CumulativeFactKind.Endpoint, name: 'user.create', ref: 'User', attrs: { method: 'POST', path: '/api/users' } },
|
|
97
|
+
],
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
const spec = cumulativeResultsHelper.mergeResultsSpecs(pipelineResults, deploymentOverlay)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## API
|
|
104
|
+
|
|
105
|
+
### Functions and helpers
|
|
11
106
|
|
|
12
107
|
| Export | Purpose |
|
|
13
108
|
|---|---|
|
|
14
109
|
| `conversationFor(purpose, override?)` | Derives a `ConversationRef` from an `LlmPurpose` dedication — the thread identity an agent run belongs to |
|
|
15
110
|
| `truncateAt(text, max)` | Boundary-aware truncation; every character cap in the family lands here |
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
|
|
111
|
+
| `makePipelineSpecModel(spec)` | `PipelineSpecModel`: `validate`, `orderSteps`, `descendants`, `ancestry`, `ancestors`, `stepOf`, `record` |
|
|
112
|
+
| `validatePipelineSpec`, `orderPipelineSteps`, `pipelineDescendants`, `pipelineStep` | Deprecated wrappers over `makePipelineSpecModel` |
|
|
113
|
+
| `cumulativeResultsHelper` (`createCumulativeResultsHelper()`) | `factKey`, `sortFacts`, `renderResultFact`, `renderResultEntry`, `renderResultSummary`, `compareResultOrder`, `rootRunOf`, `resultLabel`, `mergeResultsSpecs` |
|
|
114
|
+
|
|
115
|
+
### Records and types
|
|
116
|
+
|
|
117
|
+
| Export | Purpose |
|
|
118
|
+
|---|---|
|
|
119
|
+
| `agentRunFlow` / `agentFlows` / `AgentRunStep` / `AgentRunTransition` | The `@owlmeans/flow` lifecycle a run is driven through |
|
|
120
|
+
| `ConversationEvent` (+ `ConversationEventInput`) | One finished run, compacted: `summary` (what happened) + `advice` (what to do next) |
|
|
121
|
+
| `MemoryNode` / `MemoryEvent` (+ `MemoryEventInput`) | Agent-authored memory: a subsystem graph node, and an entry in a bounded sequence |
|
|
20
122
|
| `AgentRunMessage` | What a transport carries; execution state travels by reference |
|
|
123
|
+
| `PipelineSpec`, `PipelineStepSpec`, `PipelineState` | The declaration and the scalar state passed between steps |
|
|
124
|
+
| `PipelineRun`, `PipelineRunInquiry`, `PipelineProgress` | The persisted run row, the question a `Waiting` run stopped on, runner progress |
|
|
125
|
+
| `PipelineSpecModel`, `PipelineStepDepth` | The spec model and an ancestor with its edge distance |
|
|
126
|
+
| `CumulativeResultFact`, `CumulativeResultEntry`, `RenderableResultEntry`, `RenderedResultEntry`, `ResultRenderCaps` | Cumulative-results records and rendering |
|
|
127
|
+
| `CumulativeResultsSpec`, `StepResultsSpec`, `ResultSummarySpec`, `ResultFactQuery`, `CumulativeResultsHelper` | The JSON-safe declaration, a facts query, the helper interface |
|
|
128
|
+
|
|
129
|
+
### Constants and enums
|
|
130
|
+
|
|
131
|
+
| Export | Value / members |
|
|
132
|
+
|---|---|
|
|
133
|
+
| `AGENTS_SERVICE` | `'agents'` — plural, so it never collides with an app's own `agent` service |
|
|
134
|
+
| `AGENT_CONVERSATION_STORE`, `AGENT_MEMORY_GRAPH_STORE`, `AGENT_MEMORY_EVENTS_STORE`, `AGENT_PIPELINE_RUN_STORE`, `AGENT_CHECKPOINT_STORE`, `AGENT_CUMULATIVE_RESULT_STORE` | Port names |
|
|
135
|
+
| `AGENT_RUN_FLOW`, `SCOPE_SEP`, `INQUIRY_ANSWERS_KEY`, `RESULTS_EVERY_STEP` | `'agent-run'`, `':'`, `'answers'`, `'*'` |
|
|
136
|
+
| `DEFAULT_SUMMARY_CHARS` 1200 · `DEFAULT_ADVICE_CHARS` 400 · `DEFAULT_EVENT_WINDOW` 3 · `DEFAULT_MEMORY_NODE_CHARS` 2000 · `DEFAULT_MEMORY_EVENTS_LIMIT` 50 | Run and memory caps |
|
|
137
|
+
| `DEFAULT_MAX_STATE_CHARS` 256 000 · `DEFAULT_STEP_ATTEMPTS` 1 · `DEFAULT_STEP_TIMEOUT` 1 800 000 ms | Pipeline defaults |
|
|
138
|
+
| `DEFAULT_RESULTS_MAX_CHARS` 12 000 · `DEFAULT_RESULT_ENTRY_CHARS` 4 000 · `DEFAULT_RESULT_COMPACT_CHARS` 400 · `DEFAULT_RESULTS_WINDOW` 2 · `DEFAULT_RESULT_SUMMARY_CHARS` 600 | Cumulative-results caps |
|
|
139
|
+
| `AgentRunStatus` | `Ok`, `Failed` |
|
|
140
|
+
| `PipelineRunStatus` | `Running`, `Done`, `Failed`, `Aborted`, `Waiting` |
|
|
141
|
+
| `CumulativeResultSource` | `Extracted`, `Rebuilt`, `Seeded`, `Summarized` |
|
|
142
|
+
| `CumulativeFactKind` | `Type`, `Symbol`, `Endpoint`, `Resource`, `File` |
|
|
143
|
+
| `ResultViewMode` | `Full`, `Compact`, `Omitted` |
|
|
144
|
+
|
|
145
|
+
### Errors
|
|
146
|
+
|
|
147
|
+
All extend `AgentCommonError` (a `ResilientError`) and are registered for marshalling.
|
|
148
|
+
|
|
149
|
+
| Error | Thrown when |
|
|
150
|
+
|---|---|
|
|
151
|
+
| `AgentRunStateError` | a run is asked to advance along a transition its step does not offer |
|
|
152
|
+
| `PipelineSpecError` | a declaration is not runnable — every fault in one message |
|
|
153
|
+
| `PipelineVersionError` | a resume targets a run started under another spec `version` |
|
|
154
|
+
| `PipelineUnknownStepError` | a step name the spec does not declare |
|
|
155
|
+
| `PipelineNotIdempotentError` | a resume would re-enter a completed `nonIdempotent` step without `force` |
|
|
156
|
+
| `PipelineStateTooLargeError` | a step's state exceeds the run row's cap |
|
|
157
|
+
| `PipelineNotResumableError` | a step asks a question with no one to answer and no run store to park in |
|
|
21
158
|
|
|
22
159
|
## Conventions worth knowing
|
|
23
160
|
|
|
@@ -27,8 +164,8 @@ at its own adapter boundary.
|
|
|
27
164
|
|
|
28
165
|
**Flow steps are lifecycle stages, not conversational turns.** `FlowPayload` holds flat scalars
|
|
29
166
|
only and a ReAct loop's turn count is unbounded, so the loop lives inside the `Working` step and
|
|
30
|
-
only its counter travels in the payload. What the steps buy is the ability to say
|
|
31
|
-
|
|
167
|
+
only its counter travels in the payload. What the steps buy is the ability to say how far a run got
|
|
168
|
+
when it ended. Resumable work is a pipeline.
|
|
32
169
|
|
|
33
170
|
**Each working step has exactly one non-explicit outgoing transition**, so `FlowModel.next()` always
|
|
34
171
|
has an unambiguous answer and a driver can advance a run without knowing the vocabulary. `Fail` is
|
|
@@ -36,7 +173,31 @@ marked explicit precisely so it never becomes that automatic answer.
|
|
|
36
173
|
|
|
37
174
|
**Port names are exported, ports are not bound here.** `AGENT_CONVERSATION_STORE` and friends are
|
|
38
175
|
the keys a consumer registers its own storage under. An unbound port is not an error — the plugin
|
|
39
|
-
that needs it degrades to a no-op.
|
|
176
|
+
that needs it degrades to a no-op. A pipeline without `AGENT_PIPELINE_RUN_STORE` still runs but
|
|
177
|
+
cannot be resumed.
|
|
178
|
+
|
|
179
|
+
**A rendered result entry is deterministic.** Facts sort by kind (file facts last), name and
|
|
180
|
+
location; nothing that varies (timestamp, run id, revision) is rendered, and over its cap an entry
|
|
181
|
+
drops whole facts and says how many.
|
|
182
|
+
|
|
183
|
+
## Common pitfalls
|
|
184
|
+
|
|
185
|
+
- A pipeline state is scalars and keys; a document in it fails the step with
|
|
186
|
+
`PipelineStateTooLargeError` rather than being truncated — store artifacts elsewhere and pass keys.
|
|
187
|
+
- Forgetting to bump `version` after renaming a step lets a resume skip work silently; a bumped
|
|
188
|
+
version makes the resume refuse instead.
|
|
189
|
+
- `nonIdempotent: true` with `attempts > 1` is a validation fault.
|
|
190
|
+
- `ancestry`/`ancestors` exclude the named step, `descendants` include it.
|
|
191
|
+
- Caps are applied by truncation after the model answers; restating them in a prompt is not a cap.
|
|
192
|
+
- A `Waiting` run's `heartbeatAt` does not move — do not treat it as stale.
|
|
193
|
+
|
|
194
|
+
## Related packages
|
|
195
|
+
|
|
196
|
+
- [`@owlmeans/agent`](../agent) — the runtime that executes runs and pipelines and writes these records
|
|
197
|
+
- [`@owlmeans/llm-common`](../llm-common) — `LlmPurpose` and `Inquiry`
|
|
198
|
+
- [`@owlmeans/flow`](../flow) — the flow model the run lifecycle is declared against
|
|
199
|
+
- [`@owlmeans/resource`](../resource) — `ResourceRecord`, the base of every persisted record
|
|
200
|
+
- [`@owlmeans/error`](../error) — `ResilientError`, the base of the error family
|
|
40
201
|
|
|
41
202
|
<!-- owlmeans:agent-guidance:start -->
|
|
42
203
|
## Agent guidance
|
|
@@ -46,7 +207,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
46
207
|
your project's skill store (`.agents/skills/`):
|
|
47
208
|
|
|
48
209
|
```sh
|
|
49
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
210
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.52
|
|
50
211
|
```
|
|
51
212
|
|
|
52
213
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/agent-common",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"version": "0.1.18-rc.49",
|
|
5
|
+
"generatedAt": "2026-10-08T21:27:54.286Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/agent-common
|
|
9
9
|
|
|
10
10
|
**Layer:** Cross-cutting domain
|
|
11
|
-
**Install:** `"@owlmeans/agent-common": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/agent-common": "^0.1.18-rc.49"` in `dependencies`
|
|
12
12
|
|
|
13
13
|
Serializable contracts for the agent family. No LangChain, no LangGraph, no storage driver — a
|
|
14
14
|
backend or a browser bundle imports these to read what an agent wrote without pulling the runtime.
|
package/build/consts.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ShallowFlow } from '@owlmeans/flow';
|
|
1
2
|
/**
|
|
2
3
|
* The agent service alias.
|
|
3
4
|
*
|
|
@@ -157,4 +158,23 @@ export declare enum CumulativeFactKind {
|
|
|
157
158
|
Resource = "resource",
|
|
158
159
|
File = "file"
|
|
159
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* The lifecycle of one agent run.
|
|
163
|
+
*
|
|
164
|
+
* Read it as "how far did this run get", not "what did it say". Everything conversational happens
|
|
165
|
+
* inside `Working`; the steps exist so a plugin reading `onFinish` can say where a run ended.
|
|
166
|
+
* `Fail` is reachable from every working step and is TERMINAL — see the note on that step.
|
|
167
|
+
*
|
|
168
|
+
* `service` is left as the flow name on every step. A flow step normally binds to a service or an
|
|
169
|
+
* entrypoint, but an agent run is driven by whoever holds the model — there is no second party to
|
|
170
|
+
* hand control to, and inventing one would put a name in the serialized state that nothing
|
|
171
|
+
* resolves.
|
|
172
|
+
*
|
|
173
|
+
* Each working step keeps exactly ONE non-explicit outgoing transition, so `FlowModel.next()`
|
|
174
|
+
* always has an unambiguous answer: that is what lets a driver advance the run without knowing the
|
|
175
|
+
* vocabulary. `Fail` is marked explicit precisely so it never becomes that automatic answer.
|
|
176
|
+
*/
|
|
177
|
+
export declare const agentRunFlow: ShallowFlow;
|
|
178
|
+
/** Every flow this package declares, for a provider to serve. */
|
|
179
|
+
export declare const agentFlows: ShallowFlow[];
|
|
160
180
|
//# sourceMappingURL=consts.d.ts.map
|
package/build/consts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,WAAW,CAAA;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,6BAA6B,CAAA;AAClE,eAAO,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O,YAAY;CACpB;AAED,6CAA6C;AAC7C,oBAAY,sBAAsB;IAChC,2EAA2E;IAC3E,SAAS,cAAc;IACvB;;;OAGG;IACH,OAAO,YAAY;IACnB,8EAA8E;IAC9E,MAAM,WAAW;IACjB,0EAA0E;IAC1E,UAAU,eAAe;CAC1B;AAED,4DAA4D;AAC5D,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,mCAAmC;IACnC,OAAO,YAAY;IACnB,uEAAuE;IACvE,OAAO,YAAY;CACpB;AAED;;;GAGG;AACH,oBAAY,kBAAkB;IAC5B,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,IAAI,SAAS;CACd;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY,EAAE,WA0F1B,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,UAAU,EAAE,WAAW,EAAmB,CAAA"}
|
package/build/consts.js
CHANGED
|
@@ -164,4 +164,107 @@ export var CumulativeFactKind;
|
|
|
164
164
|
CumulativeFactKind["Resource"] = "resource";
|
|
165
165
|
CumulativeFactKind["File"] = "file";
|
|
166
166
|
})(CumulativeFactKind || (CumulativeFactKind = {}));
|
|
167
|
+
/**
|
|
168
|
+
* The lifecycle of one agent run.
|
|
169
|
+
*
|
|
170
|
+
* Read it as "how far did this run get", not "what did it say". Everything conversational happens
|
|
171
|
+
* inside `Working`; the steps exist so a plugin reading `onFinish` can say where a run ended.
|
|
172
|
+
* `Fail` is reachable from every working step and is TERMINAL — see the note on that step.
|
|
173
|
+
*
|
|
174
|
+
* `service` is left as the flow name on every step. A flow step normally binds to a service or an
|
|
175
|
+
* entrypoint, but an agent run is driven by whoever holds the model — there is no second party to
|
|
176
|
+
* hand control to, and inventing one would put a name in the serialized state that nothing
|
|
177
|
+
* resolves.
|
|
178
|
+
*
|
|
179
|
+
* Each working step keeps exactly ONE non-explicit outgoing transition, so `FlowModel.next()`
|
|
180
|
+
* always has an unambiguous answer: that is what lets a driver advance the run without knowing the
|
|
181
|
+
* vocabulary. `Fail` is marked explicit precisely so it never becomes that automatic answer.
|
|
182
|
+
*/
|
|
183
|
+
export const agentRunFlow = {
|
|
184
|
+
flow: AGENT_RUN_FLOW,
|
|
185
|
+
initialStep: AgentRunStep.Received,
|
|
186
|
+
steps: {
|
|
187
|
+
[AgentRunStep.Received]: {
|
|
188
|
+
index: 0,
|
|
189
|
+
step: AgentRunStep.Received,
|
|
190
|
+
service: AGENT_RUN_FLOW,
|
|
191
|
+
initial: true,
|
|
192
|
+
transitions: {
|
|
193
|
+
[AgentRunTransition.Prepare]: {
|
|
194
|
+
transition: AgentRunTransition.Prepare,
|
|
195
|
+
step: AgentRunStep.Prepared,
|
|
196
|
+
},
|
|
197
|
+
[AgentRunTransition.Fail]: {
|
|
198
|
+
transition: AgentRunTransition.Fail,
|
|
199
|
+
step: AgentRunStep.Failed,
|
|
200
|
+
explicit: true,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
[AgentRunStep.Prepared]: {
|
|
205
|
+
index: 1,
|
|
206
|
+
step: AgentRunStep.Prepared,
|
|
207
|
+
service: AGENT_RUN_FLOW,
|
|
208
|
+
transitions: {
|
|
209
|
+
[AgentRunTransition.Work]: {
|
|
210
|
+
transition: AgentRunTransition.Work,
|
|
211
|
+
step: AgentRunStep.Working,
|
|
212
|
+
},
|
|
213
|
+
[AgentRunTransition.Fail]: {
|
|
214
|
+
transition: AgentRunTransition.Fail,
|
|
215
|
+
step: AgentRunStep.Failed,
|
|
216
|
+
explicit: true,
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
[AgentRunStep.Working]: {
|
|
221
|
+
index: 2,
|
|
222
|
+
step: AgentRunStep.Working,
|
|
223
|
+
service: AGENT_RUN_FLOW,
|
|
224
|
+
transitions: {
|
|
225
|
+
[AgentRunTransition.Finalize]: {
|
|
226
|
+
transition: AgentRunTransition.Finalize,
|
|
227
|
+
step: AgentRunStep.Finalizing,
|
|
228
|
+
},
|
|
229
|
+
[AgentRunTransition.Fail]: {
|
|
230
|
+
transition: AgentRunTransition.Fail,
|
|
231
|
+
step: AgentRunStep.Failed,
|
|
232
|
+
explicit: true,
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
[AgentRunStep.Finalizing]: {
|
|
237
|
+
index: 3,
|
|
238
|
+
step: AgentRunStep.Finalizing,
|
|
239
|
+
service: AGENT_RUN_FLOW,
|
|
240
|
+
transitions: {
|
|
241
|
+
[AgentRunTransition.Finish]: {
|
|
242
|
+
transition: AgentRunTransition.Finish,
|
|
243
|
+
step: AgentRunStep.Finished,
|
|
244
|
+
},
|
|
245
|
+
[AgentRunTransition.Fail]: {
|
|
246
|
+
transition: AgentRunTransition.Fail,
|
|
247
|
+
step: AgentRunStep.Failed,
|
|
248
|
+
explicit: true,
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
[AgentRunStep.Finished]: {
|
|
253
|
+
index: 4,
|
|
254
|
+
step: AgentRunStep.Finished,
|
|
255
|
+
service: AGENT_RUN_FLOW,
|
|
256
|
+
transitions: {},
|
|
257
|
+
},
|
|
258
|
+
[AgentRunStep.Failed]: {
|
|
259
|
+
index: 5,
|
|
260
|
+
step: AgentRunStep.Failed,
|
|
261
|
+
service: AGENT_RUN_FLOW,
|
|
262
|
+
// Terminal. Nothing resumes a ReAct run — its tool results are side effects already applied
|
|
263
|
+
// to the world, so re-entering it re-applies them. Resumable work is a pipeline.
|
|
264
|
+
transitions: {},
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
};
|
|
268
|
+
/** Every flow this package declares, for a provider to serve. */
|
|
269
|
+
export const agentFlows = [agentRunFlow];
|
|
167
270
|
//# sourceMappingURL=consts.js.map
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"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,QAAQ,CAAC,EAAE;YACvB,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,YAAY,CAAC,QAAQ;YAC3B,OAAO,EAAE,cAAc;YACvB,WAAW,EAAE,EAAE;SAChB;QAED,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;YACrB,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,YAAY,CAAC,MAAM;YACzB,OAAO,EAAE,cAAc;YACvB,4FAA4F;YAC5F,iFAAiF;YACjF,WAAW,EAAE,EAAE;SAChB;KACF;CACF,CAAA;AAED,iEAAiE;AACjE,MAAM,CAAC,MAAM,UAAU,GAAkB,CAAC,YAAY,CAAC,CAAA"}
|
package/build/errors.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare class AgentRunStateError extends AgentCommonError {
|
|
|
11
11
|
/**
|
|
12
12
|
* A pipeline declaration is not runnable.
|
|
13
13
|
*
|
|
14
|
-
* Thrown by {@link import('./pipeline.js').
|
|
14
|
+
* Thrown by {@link import('./models/pipeline-spec/types.js').PipelineSpecModel.validate} and by the runner's own build
|
|
15
15
|
* step, and it always names EVERY fault it found rather than the first: a spec is authored once and
|
|
16
16
|
* fixed once, and reporting faults one per build turns a five-minute edit into five builds.
|
|
17
17
|
*/
|
package/build/errors.js
CHANGED
|
@@ -16,7 +16,7 @@ export class AgentRunStateError extends AgentCommonError {
|
|
|
16
16
|
/**
|
|
17
17
|
* A pipeline declaration is not runnable.
|
|
18
18
|
*
|
|
19
|
-
* Thrown by {@link import('./pipeline.js').
|
|
19
|
+
* Thrown by {@link import('./models/pipeline-spec/types.js').PipelineSpecModel.validate} and by the runner's own build
|
|
20
20
|
* step, and it always names EVERY fault it found rather than the first: a spec is authored once and
|
|
21
21
|
* fixed once, and reporting faults one per build turns a five-minute edit into five builds.
|
|
22
22
|
*/
|
|
@@ -14,13 +14,4 @@ import type { ConversationRef } from '../types.js';
|
|
|
14
14
|
* dedication.
|
|
15
15
|
*/
|
|
16
16
|
export declare const conversationFor: (purpose: LlmPurpose | undefined, override?: Partial<ConversationRef>) => ConversationRef;
|
|
17
|
-
/**
|
|
18
|
-
* Cut `text` to `max` characters on a boundary a reader will not trip over.
|
|
19
|
-
*
|
|
20
|
-
* Every cap in this package lands here, because a model asked for "at most N characters" answers
|
|
21
|
-
* with N plus whatever it felt was needed. Truncating mid-word reads as corruption and truncating
|
|
22
|
-
* mid-sentence reads as a bug report, so the cut prefers the last paragraph, then line, then
|
|
23
|
-
* sentence, then word break inside the last quarter of the budget, and always marks itself.
|
|
24
|
-
*/
|
|
25
|
-
export declare const truncateAt: (text: string, max: number) => string;
|
|
26
17
|
//# sourceMappingURL=conversation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/helpers/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,YACjB,UAAU,GAAG,SAAS,aACpB,OAAO,CAAC,eAAe,CAAC,KAClC,eASF,CAAA
|
|
1
|
+
{"version":3,"file":"conversation.d.ts","sourceRoot":"","sources":["../../src/helpers/conversation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe,YACjB,UAAU,GAAG,SAAS,aACpB,OAAO,CAAC,eAAe,CAAC,KAClC,eASF,CAAA"}
|
|
@@ -21,32 +21,4 @@ export const conversationFor = (purpose, override) => {
|
|
|
21
21
|
scope: override?.scope ?? (target !== '' ? target : 'anonymous'),
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Cut `text` to `max` characters on a boundary a reader will not trip over.
|
|
26
|
-
*
|
|
27
|
-
* Every cap in this package lands here, because a model asked for "at most N characters" answers
|
|
28
|
-
* with N plus whatever it felt was needed. Truncating mid-word reads as corruption and truncating
|
|
29
|
-
* mid-sentence reads as a bug report, so the cut prefers the last paragraph, then line, then
|
|
30
|
-
* sentence, then word break inside the last quarter of the budget, and always marks itself.
|
|
31
|
-
*/
|
|
32
|
-
export const truncateAt = (text, max) => {
|
|
33
|
-
const trimmed = text.trim();
|
|
34
|
-
if (trimmed.length <= max) {
|
|
35
|
-
return trimmed;
|
|
36
|
-
}
|
|
37
|
-
if (max <= 1) {
|
|
38
|
-
return trimmed.slice(0, Math.max(0, max));
|
|
39
|
-
}
|
|
40
|
-
const ellipsis = '…';
|
|
41
|
-
const budget = max - ellipsis.length;
|
|
42
|
-
const head = trimmed.slice(0, budget);
|
|
43
|
-
const floor = Math.floor(budget * 0.75);
|
|
44
|
-
for (const boundary of ['\n\n', '\n', '. ', ' ']) {
|
|
45
|
-
const at = head.lastIndexOf(boundary);
|
|
46
|
-
if (at >= floor) {
|
|
47
|
-
return head.slice(0, boundary === '. ' ? at + 1 : at).trimEnd() + ellipsis;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return head.trimEnd() + ellipsis;
|
|
51
|
-
};
|
|
52
24
|
//# sourceMappingURL=conversation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversation.js","sourceRoot":"","sources":["../../src/helpers/conversation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGxC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,OAA+B,EAC/B,QAAmC,EAClB,EAAE;IACnB,MAAM,UAAU,GAAG,OAAO,EAAE,UAAU,IAAI,EAAE,CAAA;IAC5C,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAC/C,MAAM,MAA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
|
|
2
|
+
* Cut `text` to `max` characters on a boundary a reader will not trip over.
|
|
3
|
+
*
|
|
4
|
+
* Every cap in this package lands here, because a model asked for "at most N characters" answers
|
|
5
|
+
* with N plus whatever it felt was needed. Truncating mid-word reads as corruption and truncating
|
|
6
|
+
* mid-sentence reads as a bug report, so the cut prefers the last paragraph, then line, then
|
|
7
|
+
* sentence, then word break inside the last quarter of the budget, and always marks itself.
|
|
8
|
+
*/
|
|
9
|
+
export declare const truncateAt: (text: string, max: number) => string;
|
|
10
|
+
//# sourceMappingURL=truncate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncate.d.ts","sourceRoot":"","sources":["../../src/helpers/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,SAAU,MAAM,OAAO,MAAM,KAAG,MAsBtD,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cut `text` to `max` characters on a boundary a reader will not trip over.
|
|
3
|
+
*
|
|
4
|
+
* Every cap in this package lands here, because a model asked for "at most N characters" answers
|
|
5
|
+
* with N plus whatever it felt was needed. Truncating mid-word reads as corruption and truncating
|
|
6
|
+
* mid-sentence reads as a bug report, so the cut prefers the last paragraph, then line, then
|
|
7
|
+
* sentence, then word break inside the last quarter of the budget, and always marks itself.
|
|
8
|
+
*/
|
|
9
|
+
export const truncateAt = (text, max) => {
|
|
10
|
+
const trimmed = text.trim();
|
|
11
|
+
if (trimmed.length <= max) {
|
|
12
|
+
return trimmed;
|
|
13
|
+
}
|
|
14
|
+
if (max <= 1) {
|
|
15
|
+
return trimmed.slice(0, Math.max(0, max));
|
|
16
|
+
}
|
|
17
|
+
const ellipsis = '…';
|
|
18
|
+
const budget = max - ellipsis.length;
|
|
19
|
+
const head = trimmed.slice(0, budget);
|
|
20
|
+
const floor = Math.floor(budget * 0.75);
|
|
21
|
+
for (const boundary of ['\n\n', '\n', '. ', ' ']) {
|
|
22
|
+
const at = head.lastIndexOf(boundary);
|
|
23
|
+
if (at >= floor) {
|
|
24
|
+
return head.slice(0, boundary === '. ' ? at + 1 : at).trimEnd() + ellipsis;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return head.trimEnd() + ellipsis;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=truncate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncate.js","sourceRoot":"","sources":["../../src/helpers/truncate.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,GAAW,EAAU,EAAE;IAC9D,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAA;IAC3B,IAAI,OAAO,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;QAC1B,OAAO,OAAO,CAAA;IAChB,CAAC;IACD,IAAI,GAAG,IAAI,CAAC,EAAE,CAAC;QACb,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;IAC3C,CAAC;IAED,MAAM,QAAQ,GAAG,GAAG,CAAA;IACpB,MAAM,MAAM,GAAG,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAA;IACpC,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IAEvC,KAAK,MAAM,QAAQ,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;QACjD,MAAM,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACrC,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC;YAChB,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAA;QAC5E,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAA;AAClC,CAAC,CAAA"}
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export * from './consts.js';
|
|
2
2
|
export * from './errors.js';
|
|
3
3
|
export type * from './types.js';
|
|
4
|
+
export type * from './results/types.js';
|
|
5
|
+
export type * from './models/pipeline-spec/types.js';
|
|
6
|
+
export * from './models/pipeline-spec.js';
|
|
4
7
|
export * from './pipeline.js';
|
|
5
8
|
export * from './results.js';
|
|
6
|
-
export * from './flows.js';
|
|
7
9
|
export * from './helpers/conversation.js';
|
|
10
|
+
export * from './helpers/truncate.js';
|
|
8
11
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,oBAAoB,CAAA;AACvC,mBAAmB,iCAAiC,CAAA;AACpD,cAAc,2BAA2B,CAAA;AACzC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * from './consts.js';
|
|
2
2
|
export * from './errors.js';
|
|
3
|
+
export * from './models/pipeline-spec.js';
|
|
3
4
|
export * from './pipeline.js';
|
|
4
5
|
export * from './results.js';
|
|
5
|
-
export * from './flows.js';
|
|
6
6
|
export * from './helpers/conversation.js';
|
|
7
|
+
export * from './helpers/truncate.js';
|
|
7
8
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAI3B,cAAc,2BAA2B,CAAA;AACzC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { PipelineSpec, PipelineStepSpec } from '../../types.js';
|
|
2
|
+
/** One step a step transitively waits on, with the fewest `after` edges between the two. */
|
|
3
|
+
export interface PipelineStepDepth {
|
|
4
|
+
step: string;
|
|
5
|
+
depth: number;
|
|
6
|
+
}
|
|
7
|
+
/** The rules of one pipeline declaration: its validity, its order and the graph of its steps. */
|
|
8
|
+
export interface PipelineSpecModel {
|
|
9
|
+
readonly record: PipelineSpec;
|
|
10
|
+
/**
|
|
11
|
+
* Every fault in one message, or nothing.
|
|
12
|
+
*
|
|
13
|
+
* Total and IO-free, so a spec can be checked by a test in microseconds and by the runner at build
|
|
14
|
+
* time. It reports EVERY fault it finds rather than the first, because a spec is authored once and
|
|
15
|
+
* a build that names one fault per run turns a five-minute edit into five builds.
|
|
16
|
+
*
|
|
17
|
+
* @throws {PipelineSpecError}
|
|
18
|
+
*/
|
|
19
|
+
validate: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* The steps in an order that respects every `after`, with declaration order as the tie-break.
|
|
22
|
+
*
|
|
23
|
+
* Deterministic on purpose: the order decides what a progress report calls "step 3 of 16" and what
|
|
24
|
+
* a resume considers already behind it, and an order that depends on a `Set`'s iteration would make
|
|
25
|
+
* both drift between processes.
|
|
26
|
+
*
|
|
27
|
+
* @throws {PipelineSpecError} on a cycle or an unknown `after`.
|
|
28
|
+
*/
|
|
29
|
+
orderSteps: () => string[];
|
|
30
|
+
/**
|
|
31
|
+
* `step` and everything that transitively waits on it.
|
|
32
|
+
*
|
|
33
|
+
* What a resume has to re-run when an operator names a step: re-entering a step without re-entering
|
|
34
|
+
* what read its output leaves the run describing a state that no longer follows from itself.
|
|
35
|
+
*
|
|
36
|
+
* @throws {PipelineUnknownStepError} when the spec does not declare `step`.
|
|
37
|
+
*/
|
|
38
|
+
descendants: (step: string) => string[];
|
|
39
|
+
/**
|
|
40
|
+
* Every step `step` transitively waits on, with its DEPTH — the fewest `after` edges between the
|
|
41
|
+
* two — in topological order.
|
|
42
|
+
*
|
|
43
|
+
* The mirror of {@link PipelineSpecModel.descendants}, with one deliberate asymmetry: the named step
|
|
44
|
+
* itself is NOT included. A re-run re-enters the step it names, so the descendants include it;
|
|
45
|
+
* nothing is its own predecessor, so the ancestors do not. The depth is what a consumer uses to
|
|
46
|
+
* decide how much of a predecessor's output it needs to be told — a direct predecessor is depth 1
|
|
47
|
+
* however far apart the two sit in the topological order.
|
|
48
|
+
*
|
|
49
|
+
* @throws {PipelineUnknownStepError} when the spec does not declare `step`.
|
|
50
|
+
*/
|
|
51
|
+
ancestry: (step: string) => PipelineStepDepth[];
|
|
52
|
+
/** The names from {@link PipelineSpecModel.ancestry}: what must finish before `step` may start, in order. */
|
|
53
|
+
ancestors: (step: string) => string[];
|
|
54
|
+
/** The declaration of one step, by name. `null` when the spec does not declare it. */
|
|
55
|
+
stepOf: (step: string) => PipelineStepSpec | null;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|