@owlmeans/agent-common 0.1.18-rc.7 → 0.1.18

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.
Files changed (65) hide show
  1. package/README.md +174 -13
  2. package/agent-meta/manifest.json +3 -3
  3. package/agent-meta/skills/agent-common/SKILL.md +69 -14
  4. package/build/consts.d.ts +118 -5
  5. package/build/consts.d.ts.map +1 -1
  6. package/build/consts.js +204 -4
  7. package/build/consts.js.map +1 -1
  8. package/build/consts.local.d.ts +9 -0
  9. package/build/consts.local.d.ts.map +1 -0
  10. package/build/consts.local.js +9 -0
  11. package/build/consts.local.js.map +1 -0
  12. package/build/errors.d.ts +60 -0
  13. package/build/errors.d.ts.map +1 -1
  14. package/build/errors.js +84 -0
  15. package/build/errors.js.map +1 -1
  16. package/build/helpers/conversation.d.ts +0 -9
  17. package/build/helpers/conversation.d.ts.map +1 -1
  18. package/build/helpers/conversation.js +0 -28
  19. package/build/helpers/conversation.js.map +1 -1
  20. package/build/helpers/truncate.d.ts +10 -0
  21. package/build/helpers/truncate.d.ts.map +1 -0
  22. package/build/helpers/truncate.js +29 -0
  23. package/build/helpers/truncate.js.map +1 -0
  24. package/build/index.d.ts +6 -1
  25. package/build/index.d.ts.map +1 -1
  26. package/build/index.js +4 -1
  27. package/build/index.js.map +1 -1
  28. package/build/models/pipeline-spec/types.d.ts +57 -0
  29. package/build/models/pipeline-spec/types.d.ts.map +1 -0
  30. package/build/models/pipeline-spec/types.js +2 -0
  31. package/build/models/pipeline-spec/types.js.map +1 -0
  32. package/build/models/pipeline-spec.d.ts +4 -0
  33. package/build/models/pipeline-spec.d.ts.map +1 -0
  34. package/build/models/pipeline-spec.js +171 -0
  35. package/build/models/pipeline-spec.js.map +1 -0
  36. package/build/pipeline.d.ts +10 -0
  37. package/build/pipeline.d.ts.map +1 -0
  38. package/build/pipeline.js +10 -0
  39. package/build/pipeline.js.map +1 -0
  40. package/build/results/types.d.ts +211 -0
  41. package/build/results/types.d.ts.map +1 -0
  42. package/build/results/types.js +2 -0
  43. package/build/results/types.js.map +1 -0
  44. package/build/results.d.ts +4 -0
  45. package/build/results.d.ts.map +1 -0
  46. package/build/results.js +218 -0
  47. package/build/results.js.map +1 -0
  48. package/build/types.d.ts +146 -24
  49. package/build/types.d.ts.map +1 -1
  50. package/package.json +8 -8
  51. package/src/consts.local.ts +15 -0
  52. package/src/consts.ts +218 -4
  53. package/src/errors.ts +96 -0
  54. package/src/helpers/conversation.ts +0 -32
  55. package/src/helpers/truncate.ts +31 -0
  56. package/src/index.ts +6 -1
  57. package/src/models/pipeline-spec/types.ts +58 -0
  58. package/src/models/pipeline-spec.ts +202 -0
  59. package/src/pipeline.ts +16 -0
  60. package/src/results/types.ts +221 -0
  61. package/src/results.ts +270 -0
  62. package/src/types.ts +153 -25
  63. package/tests/pipeline.spec.ts +164 -0
  64. package/tests/results.spec.ts +148 -0
  65. package/src/flows.ts +0 -118
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/models/pipeline-spec/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEpE,4FAA4F;AAC5F,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd;AAED,iGAAiG;AACjG,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAA;IAC7B;;;;;;;;OAQG;IACH,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB;;;;;;;;OAQG;IACH,UAAU,EAAE,MAAM,MAAM,EAAE,CAAA;IAC1B;;;;;;;OAOG;IACH,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAA;IACvC;;;;;;;;;;;OAWG;IACH,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,iBAAiB,EAAE,CAAA;IAC/C,6GAA6G;IAC7G,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EAAE,CAAA;IACrC,sFAAsF;IACtF,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,gBAAgB,GAAG,IAAI,CAAA;CAClD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/models/pipeline-spec/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { PipelineSpec } from '../types.js';
2
+ import type { PipelineSpecModel } from './pipeline-spec/types.js';
3
+ export declare const makePipelineSpecModel: (spec: PipelineSpec) => PipelineSpecModel;
4
+ //# sourceMappingURL=pipeline-spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-spec.d.ts","sourceRoot":"","sources":["../../src/models/pipeline-spec.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,aAAa,CAAA;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAqB,MAAM,0BAA0B,CAAA;AAEpF,eAAO,MAAM,qBAAqB,SAAU,YAAY,KAAG,iBAoM1D,CAAA"}
@@ -0,0 +1,171 @@
1
+ import { DEFAULT_STEP_ATTEMPTS } from '../consts.js';
2
+ import { PipelineSpecError, PipelineUnknownStepError } from '../errors.js';
3
+ export const makePipelineSpecModel = (spec) => {
4
+ const fault = (faults, message) => {
5
+ faults.push(message);
6
+ };
7
+ const validate = () => {
8
+ const faults = [];
9
+ if (spec.alias == null || spec.alias.trim() === '') {
10
+ fault(faults, 'alias is empty');
11
+ }
12
+ if (!Number.isInteger(spec.version) || spec.version < 1) {
13
+ fault(faults, `version must be a positive integer, got ${String(spec.version)}`);
14
+ }
15
+ if (!Array.isArray(spec.steps) || spec.steps.length === 0) {
16
+ fault(faults, 'no steps declared');
17
+ throw new PipelineSpecError(`${spec.alias ?? '?'}: ${faults.join('; ')}`);
18
+ }
19
+ const seen = new Set();
20
+ for (const step of spec.steps) {
21
+ if (step.step == null || step.step.trim() === '') {
22
+ fault(faults, 'a step has an empty name');
23
+ continue;
24
+ }
25
+ if (seen.has(step.step)) {
26
+ fault(faults, `duplicate step "${step.step}"`);
27
+ }
28
+ seen.add(step.step);
29
+ }
30
+ for (const step of spec.steps) {
31
+ for (const dependency of step.after ?? []) {
32
+ if (dependency === step.step) {
33
+ fault(faults, `step "${step.step}" declares itself in \`after\``);
34
+ }
35
+ else if (!seen.has(dependency)) {
36
+ fault(faults, `step "${step.step}" waits on unknown step "${dependency}"`);
37
+ }
38
+ }
39
+ const attempts = step.attempts ?? DEFAULT_STEP_ATTEMPTS;
40
+ if (!Number.isInteger(attempts) || attempts < 1) {
41
+ fault(faults, `step "${step.step}" declares attempts ${String(step.attempts)}`);
42
+ }
43
+ if (step.nonIdempotent === true && attempts > 1) {
44
+ fault(faults, `step "${step.step}" is nonIdempotent and declares attempts ${attempts} — an automatic `
45
+ + 'retry is exactly what that flag says must not happen');
46
+ }
47
+ if (step.timeout != null && (!Number.isFinite(step.timeout) || step.timeout <= 0)) {
48
+ fault(faults, `step "${step.step}" declares timeout ${String(step.timeout)}`);
49
+ }
50
+ }
51
+ // A cycle is reported here rather than left to the sort, so one message carries every fault.
52
+ if (faults.every(entry => !entry.includes('unknown step'))) {
53
+ const cycle = detectCycle();
54
+ if (cycle != null) {
55
+ fault(faults, `cycle: ${cycle.join(' → ')}`);
56
+ }
57
+ }
58
+ if (faults.length > 0) {
59
+ throw new PipelineSpecError(`${spec.alias}: ${faults.join('; ')}`);
60
+ }
61
+ };
62
+ const detectCycle = () => {
63
+ const after = new Map(spec.steps.map(step => [step.step, step.after ?? []]));
64
+ const state = new Map();
65
+ const path = [];
66
+ const walk = (name) => {
67
+ const mark = state.get(name);
68
+ if (mark === 2)
69
+ return null;
70
+ if (mark === 1)
71
+ return [...path.slice(path.indexOf(name)), name];
72
+ state.set(name, 1);
73
+ path.push(name);
74
+ for (const dependency of after.get(name) ?? []) {
75
+ const found = walk(dependency);
76
+ if (found != null)
77
+ return found;
78
+ }
79
+ path.pop();
80
+ state.set(name, 2);
81
+ return null;
82
+ };
83
+ for (const step of spec.steps) {
84
+ const found = walk(step.step);
85
+ if (found != null)
86
+ return found.reverse();
87
+ }
88
+ return null;
89
+ };
90
+ const orderSteps = () => {
91
+ const names = spec.steps.map(step => step.step);
92
+ const known = new Set(names);
93
+ const pending = new Map();
94
+ const dependents = new Map();
95
+ for (const step of spec.steps) {
96
+ const dependencies = new Set();
97
+ for (const dependency of step.after ?? []) {
98
+ if (!known.has(dependency)) {
99
+ throw new PipelineSpecError(`${spec.alias}: step "${step.step}" waits on unknown step "${dependency}"`);
100
+ }
101
+ dependencies.add(dependency);
102
+ dependents.set(dependency, [...(dependents.get(dependency) ?? []), step.step]);
103
+ }
104
+ pending.set(step.step, dependencies);
105
+ }
106
+ const ordered = [];
107
+ const emitted = new Set();
108
+ while (ordered.length < names.length) {
109
+ // Declaration order among everything currently ready — never a set's own order.
110
+ const ready = names.filter(name => !emitted.has(name) && (pending.get(name)?.size ?? 0) === 0);
111
+ if (ready.length === 0) {
112
+ const cycle = detectCycle();
113
+ throw new PipelineSpecError(`${spec.alias}: cycle: ${(cycle ?? names.filter(name => !emitted.has(name))).join(' → ')}`);
114
+ }
115
+ for (const name of ready) {
116
+ ordered.push(name);
117
+ emitted.add(name);
118
+ for (const dependent of dependents.get(name) ?? []) {
119
+ pending.get(dependent)?.delete(name);
120
+ }
121
+ }
122
+ }
123
+ return ordered;
124
+ };
125
+ const descendants = (step) => {
126
+ if (!spec.steps.some(entry => entry.step === step)) {
127
+ throw new PipelineUnknownStepError(`${spec.alias}:${step}`);
128
+ }
129
+ const reached = new Set([step]);
130
+ let grew = true;
131
+ while (grew) {
132
+ grew = false;
133
+ for (const entry of spec.steps) {
134
+ if (reached.has(entry.step))
135
+ continue;
136
+ if ((entry.after ?? []).some(dependency => reached.has(dependency))) {
137
+ reached.add(entry.step);
138
+ grew = true;
139
+ }
140
+ }
141
+ }
142
+ return orderSteps().filter(name => reached.has(name));
143
+ };
144
+ const ancestry = (step) => {
145
+ if (!spec.steps.some(entry => entry.step === step)) {
146
+ throw new PipelineUnknownStepError(`${spec.alias}:${step}`);
147
+ }
148
+ const after = new Map(spec.steps.map(entry => [entry.step, entry.after ?? []]));
149
+ const depths = new Map();
150
+ let frontier = [step];
151
+ for (let depth = 1; frontier.length > 0; ++depth) {
152
+ const next = [];
153
+ for (const name of frontier) {
154
+ for (const dependency of after.get(name) ?? []) {
155
+ if (dependency !== step && !depths.has(dependency)) {
156
+ depths.set(dependency, depth);
157
+ next.push(dependency);
158
+ }
159
+ }
160
+ }
161
+ frontier = next;
162
+ }
163
+ return orderSteps()
164
+ .filter(name => depths.has(name))
165
+ .map(name => ({ step: name, depth: depths.get(name) }));
166
+ };
167
+ const ancestors = (step) => ancestry(step).map(entry => entry.step);
168
+ const stepOf = (step) => spec.steps.find(entry => entry.step === step) ?? null;
169
+ return { record: spec, validate, orderSteps, descendants, ancestry, ancestors, stepOf };
170
+ };
171
+ //# sourceMappingURL=pipeline-spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-spec.js","sourceRoot":"","sources":["../../src/models/pipeline-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAA;AAI1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,IAAkB,EAAqB,EAAE;IAC7E,MAAM,K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E,KAAK,CAAC,CAAA;wBAC7B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;oBACvB,CAAC;gBACH,CAAC;YACH,CAAC;YACD,QAAQ,GAAG,IAAI,CAAA;QACjB,CAAC;QAED,OAAO,UAAU,EAAE;aAChB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aAChC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,IAAI,CAAE,EAAE,CAAC,CAAC,CAAA;IAC5D,CAAC,CAAA;IAED,MAAM,SAAS,GAAG,CAAC,IAAY,EAAY,EAAE,CAC3C,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAEzC,MAAM,MAAM,GAAG,CAAC,IAAY,EAA2B,EAAE,CACvD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,IAAI,CAAA;IAEvD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,CAAA;AACzF,CAAC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { PipelineSpec, PipelineStepSpec } from './types.js';
2
+ /** @deprecated compat:factory-refactor — use `makePipelineSpecModel(spec).validate()` */
3
+ export declare const validatePipelineSpec: (spec: PipelineSpec) => void;
4
+ /** @deprecated compat:factory-refactor — use `makePipelineSpecModel(spec).orderSteps()` */
5
+ export declare const orderPipelineSteps: (spec: PipelineSpec) => string[];
6
+ /** @deprecated compat:factory-refactor — use `makePipelineSpecModel(spec).descendants(…)` */
7
+ export declare const pipelineDescendants: (spec: PipelineSpec, step: string) => string[];
8
+ /** @deprecated compat:factory-refactor — use `makePipelineSpecModel(spec).stepOf(…)` */
9
+ export declare const pipelineStep: (spec: PipelineSpec, step: string) => PipelineStepSpec | null;
10
+ //# sourceMappingURL=pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAEhE,yFAAyF;AACzF,eAAO,MAAM,oBAAoB,SAAU,YAAY,KAAG,IAA8C,CAAA;AAExG,2FAA2F;AAC3F,eAAO,MAAM,kBAAkB,SAAU,YAAY,KAAG,MAAM,EAA8C,CAAA;AAE5G,6FAA6F;AAC7F,eAAO,MAAM,mBAAmB,SAAU,YAAY,QAAQ,MAAM,KAAG,MAAM,EAC9B,CAAA;AAE/C,wFAAwF;AACxF,eAAO,MAAM,YAAY,SAAU,YAAY,QAAQ,MAAM,KAAG,gBAAgB,GAAG,IACzC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { makePipelineSpecModel } from './models/pipeline-spec.js';
2
+ /** @deprecated compat:factory-refactor — use `makePipelineSpecModel(spec).validate()` */
3
+ export const validatePipelineSpec = (spec) => makePipelineSpecModel(spec).validate();
4
+ /** @deprecated compat:factory-refactor — use `makePipelineSpecModel(spec).orderSteps()` */
5
+ export const orderPipelineSteps = (spec) => makePipelineSpecModel(spec).orderSteps();
6
+ /** @deprecated compat:factory-refactor — use `makePipelineSpecModel(spec).descendants(…)` */
7
+ export const pipelineDescendants = (spec, step) => makePipelineSpecModel(spec).descendants(step);
8
+ /** @deprecated compat:factory-refactor — use `makePipelineSpecModel(spec).stepOf(…)` */
9
+ export const pipelineStep = (spec, step) => makePipelineSpecModel(spec).stepOf(step);
10
+ //# sourceMappingURL=pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAA;AAGjE,yFAAyF;AACzF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,IAAkB,EAAQ,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAA;AAExG,2FAA2F;AAC3F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAkB,EAAY,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,CAAA;AAE5G,6FAA6F;AAC7F,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAkB,EAAE,IAAY,EAAY,EAAE,CAChF,qBAAqB,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAA;AAE/C,wFAAwF;AACxF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAkB,EAAE,IAAY,EAA2B,EAAE,CACxF,qBAAqB,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA"}
@@ -0,0 +1,211 @@
1
+ import type { ResourceRecord } from '@owlmeans/resource';
2
+ import { RESULTS_EVERY_STEP, CumulativeResultSource } from '../consts.js';
3
+ /**
4
+ * ONE authoritative fact about what a step produced, small enough to be one line of a prompt.
5
+ *
6
+ * Every field is optional past `kind` and `name`, because facts differ in what matters about them:
7
+ * a type has a shape and an import specifier, an endpoint an alias, a method, a path and a guard, a
8
+ * resource a table and an accessor, a file only its path. Put scalars that have no field of their
9
+ * own into `attrs`.
10
+ */
11
+ export interface CumulativeResultFact {
12
+ /** What the fact is about — see {@link CumulativeFactKind}. */
13
+ kind: string;
14
+ /** The name to use VERBATIM. */
15
+ name: string;
16
+ /** The file it lives in, relative to the project root. */
17
+ path?: string;
18
+ /** The module specifier it is imported from. */
19
+ specifier?: string;
20
+ /** Its shape or signature, on one line. */
21
+ signature?: string;
22
+ /** Fields, parameters or columns, when there is no signature to say it. */
23
+ members?: string[];
24
+ /** Another fact's name this one points at — a returned type, a mapped table. */
25
+ ref?: string;
26
+ /** Scalars without a field of their own — `method`, `path`, `guard`, `table`. */
27
+ attrs?: Record<string, string>;
28
+ }
29
+ /**
30
+ * One step's contribution to a ledger.
31
+ *
32
+ * Keyed by `(ledger, runId, step)`. `order` places it in the ledger: the topological index of the
33
+ * step in its own pipeline, preceded by the index path of every step it was composed under, so a
34
+ * run composed as a step of another sorts inside that step, ahead of the composing step's own
35
+ * entry. A single number cannot say that: two pipelines' indexes are not comparable.
36
+ *
37
+ * `full` and `compact` are rendered once, when the entry is written, and never contain a timestamp,
38
+ * a run id or anything else a model would copy without meaning to.
39
+ */
40
+ export interface CumulativeResultEntry extends ResourceRecord {
41
+ /** What entries can see each other — by default the root run of the composition. */
42
+ ledger: string;
43
+ pipeline: string;
44
+ runId: string;
45
+ step: string;
46
+ /** How the entry is headed in a prompt: the step, behind the path of the steps it runs under. */
47
+ label: string;
48
+ order: number[];
49
+ /** Bumped every time the entry is re-extracted after a later step rewrote one of its files. */
50
+ revision: number;
51
+ source: CumulativeResultSource;
52
+ /** An `optional` step that failed: whatever it left behind, and a heading that says so. */
53
+ partial?: boolean;
54
+ facts: CumulativeResultFact[];
55
+ /** The files the facts were read from — what a later rewrite is matched against. */
56
+ files: string[];
57
+ /** A model's summary, rendered and capped. NOT verified, and always labelled so. */
58
+ summary?: string;
59
+ full: string;
60
+ compact: string;
61
+ /** Consumers that always get the full entry, by step name, or every later step. */
62
+ fullFor?: string[] | typeof RESULTS_EVERY_STEP;
63
+ /** Consumers that never see the entry in their prompt. */
64
+ omitFor?: string[];
65
+ /** How many edges back the entry is still rendered in full by default. */
66
+ window?: number;
67
+ updatedAt: string;
68
+ }
69
+ /**
70
+ * The optional model-written summary of a step. OFF unless a step declares one.
71
+ *
72
+ * Facts are the product; a summary is for what code cannot extract — an intent, a decision taken.
73
+ * It is bounded by `maxChars` in code after the model answers, rendered deterministically from the
74
+ * schema-shaped answer, and always labelled as unverified wherever it is shown.
75
+ */
76
+ export interface ResultSummarySpec {
77
+ /** Which model — interpreted by the caller's summarize callback (a model role, typically). */
78
+ role?: string;
79
+ instructions: string;
80
+ /** JSON schema of the answer. Absent means `{ summary: string }`. */
81
+ schema?: Record<string, unknown>;
82
+ /** Defaults to `DEFAULT_RESULT_SUMMARY_CHARS`. */
83
+ maxChars?: number;
84
+ }
85
+ /**
86
+ * What one step contributes, and to whom. JSON-safe, so a declaration can live in data.
87
+ *
88
+ * Extractors are named, never inlined: a declaration names what runs, and the runtime holds the
89
+ * code. A consumer not named in `full` or `omit` gets the full entry within `window` edges and the
90
+ * names only beyond it.
91
+ */
92
+ export interface StepResultsSpec {
93
+ /** Named deterministic extractors, run in this order. */
94
+ extractors?: string[];
95
+ /** Later steps that get the FULL entry wherever they sit, or `'*'` for all of them. */
96
+ full?: string[] | typeof RESULTS_EVERY_STEP;
97
+ /** Later steps that are never shown the entry. */
98
+ omit?: string[];
99
+ /** Overrides {@link CumulativeResultsSpec.window} for this entry. */
100
+ window?: number;
101
+ /** Cap on the full rendering; facts are dropped whole, never cut. */
102
+ maxChars?: number;
103
+ /** Cap on the names-only rendering. */
104
+ maxCompactChars?: number;
105
+ /** Re-extract this entry when a later step rewrites one of its files. Defaults to the spec's. */
106
+ refresh?: boolean;
107
+ summary?: ResultSummarySpec;
108
+ }
109
+ /** The pipeline-level declaration — merged from a pipeline's own and any overlay with {@link CumulativeResultsHelper.mergeResultsSpecs}. */
110
+ export interface CumulativeResultsSpec {
111
+ /** Per step, by step name. A step with no entry contributes only what it records itself. */
112
+ steps?: Record<string, StepResultsSpec>;
113
+ /** Default {@link DEFAULT_RESULTS_WINDOW}. */
114
+ window?: number;
115
+ /** Total characters of one view. Default `DEFAULT_RESULTS_MAX_CHARS`. */
116
+ maxChars?: number;
117
+ /** Default cap of one full entry. Default {@link DEFAULT_RESULT_ENTRY_CHARS}. */
118
+ maxEntryChars?: number;
119
+ /** Default cap of one names-only entry. Default {@link DEFAULT_RESULT_COMPACT_CHARS}. */
120
+ maxCompactChars?: number;
121
+ /** Default for {@link StepResultsSpec.refresh}. Defaults to `true`. */
122
+ refresh?: boolean;
123
+ }
124
+ /** What a facts query may narrow by. Every field is an exact match. */
125
+ export interface ResultFactQuery {
126
+ kind?: string;
127
+ name?: string;
128
+ /** A producing step, by its name or by its label. */
129
+ step?: string;
130
+ }
131
+ /** What {@link CumulativeResultsHelper.renderResultEntry} needs of an entry. */
132
+ export interface RenderableResultEntry extends Pick<CumulativeResultEntry, 'label' | 'source' | 'partial' | 'facts' | 'summary'> {
133
+ }
134
+ export interface ResultRenderCaps {
135
+ /** Cap on the full rendering. Default {@link DEFAULT_RESULT_ENTRY_CHARS}. */
136
+ maxChars?: number;
137
+ /** Cap on the names-only rendering. Default {@link DEFAULT_RESULT_COMPACT_CHARS}. */
138
+ maxCompactChars?: number;
139
+ }
140
+ /** An entry's two renderings. */
141
+ export interface RenderedResultEntry {
142
+ full: string;
143
+ compact: string;
144
+ }
145
+ /**
146
+ * CUMULATIVE PIPELINE RESULTS — the contracts.
147
+ *
148
+ * After a step of a pipeline finishes, code reads what it produced — a type's shape, a file, an
149
+ * endpoint's method, path and parameters, a resource's table — into a small list of FACTS, and the
150
+ * later steps are told those facts instead of re-deriving them from the files. A later step that is
151
+ * handed the authoritative names does not invent a second spelling of them, and that is the whole
152
+ * point: it removes the class of errors that live BETWEEN steps.
153
+ *
154
+ * Everything here is data and pure functions. The runtime that extracts, stores and cuts the views
155
+ * is `@owlmeans/agent`'s `cumulativeResultsPlugin`; the prompt block it lands in is
156
+ * `@owlmeans/llm`'s. A backend or a browser bundle reads an entry without either.
157
+ */
158
+ export interface CumulativeResultsHelper {
159
+ /**
160
+ * The identity of a fact inside a ledger: what it is, what it is called and where it comes from.
161
+ * Two facts with one key are one fact, owned by whichever entry produced it first.
162
+ */
163
+ factKey: (fact: CumulativeResultFact) => string;
164
+ /**
165
+ * Facts in the one order they are ever rendered in: by kind (file facts last), name and location,
166
+ * with a code-unit comparison so every host sorts them alike.
167
+ */
168
+ sortFacts: (facts: readonly CumulativeResultFact[]) => CumulativeResultFact[];
169
+ /** One fact as one prompt line: kind and name, shape, scalars, pointer, and where it comes from. */
170
+ renderResultFact: (fact: CumulativeResultFact) => string;
171
+ /**
172
+ * An entry's two renderings — in full, and as names only — or two empty strings when it has
173
+ * nothing to say.
174
+ *
175
+ * Deterministic and free of anything that varies between two renderings of the same facts: no
176
+ * timestamp, no run id, no revision. Over its cap an entry DROPS whole facts, in render order, and
177
+ * says how many it dropped; it never cuts one fact's line, because half a signature is a wrong
178
+ * signature. An empty entry that is not partial renders to nothing, so it costs a view nothing.
179
+ */
180
+ renderResultEntry: (entry: RenderableResultEntry, caps?: ResultRenderCaps) => RenderedResultEntry;
181
+ /**
182
+ * Ledger order: element by element, and where one key is a prefix of the other, the LONGER one
183
+ * first — an entry of a run composed under a step sorts ahead of that step's own entry, which is
184
+ * written only once the composed run has finished.
185
+ */
186
+ compareResultOrder: (a: readonly number[], b: readonly number[]) => number;
187
+ /** The root run of a composition — what a composed run's id (`<parent>/<step>`) starts with. */
188
+ rootRunOf: (runId: string) => string;
189
+ /**
190
+ * How an entry is headed: the step, behind the path of composing steps between the ledger's root
191
+ * run and the run that produced it. A root-run step is headed by its bare name.
192
+ */
193
+ resultLabel: (ledger: string, runId: string, step: string) => string;
194
+ /**
195
+ * A model's schema-shaped summary as one capped line, the same bytes for the same answer.
196
+ *
197
+ * An object renders as `key: value` pairs in key order; one with a single key renders as that
198
+ * value alone, so the default `{ summary }` answer reads as prose. The cap is applied here, after
199
+ * the model answered — a cap in a prompt is a request.
200
+ */
201
+ renderResultSummary: (answer: unknown, maxChars?: number) => string;
202
+ /**
203
+ * Several declarations as one — a pipeline's own, then any overlay (a variant, a deployment).
204
+ *
205
+ * Later declarations win field by field, except the lists: extractors, `full` consumers and `omit`
206
+ * consumers ACCUMULATE, the way skills do down an execution chain, because an overlay that adds an
207
+ * extractor is not asking to lose the ones the pipeline declared. `'*'` in `full` absorbs names.
208
+ */
209
+ mergeResultsSpecs: (...specs: Array<CumulativeResultsSpec | null | undefined>) => CumulativeResultsSpec;
210
+ }
211
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/results/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAEzE;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAA;IACZ,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,gFAAgF;IAChF,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,iFAAiF;IACjF,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,oFAAoF;IACpF,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,iGAAiG;IACjG,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,+FAA+F;IAC/F,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,sBAAsB,CAAA;IAC9B,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAA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,CAAC,EAAE,gBAAgB,KAAK,mBAAmB,CAAA;IACjG;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,MAAM,CAAA;IAC1E,gGAAgG;IAChG,SAAS,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACpC;;;OAGG;IACH,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;IACpE;;;;;;OAMG;IACH,mBAAmB,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;IACnE;;;;;;OAMG;IACH,iBAAiB,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,qBAAqB,GAAG,IAAI,GAAG,SAAS,CAAC,KAAK,qBAAqB,CAAA;CACxG"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/results/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import type { CumulativeResultsHelper } from './results/types.js';
2
+ export declare const createCumulativeResultsHelper: () => CumulativeResultsHelper;
3
+ export declare const cumulativeResultsHelper: CumulativeResultsHelper;
4
+ //# sourceMappingURL=results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"results.d.ts","sourceRoot":"","sources":["../src/results.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACY,uBAAuB,EAE9C,MAAM,oBAAoB,CAAA;AAE3B,eAAO,MAAM,6BAA6B,QAAO,uBAmQhD,CAAA;AAED,eAAO,MAAM,uBAAuB,yBAAkC,CAAA"}