@owlmeans/llm-common 0.1.18-rc.35 → 0.1.18-rc.37

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 CHANGED
@@ -20,7 +20,7 @@ extends these; `@owlmeans/llm` implements against them.
20
20
  ## Installation
21
21
 
22
22
  ```bash
23
- bun add @owlmeans/llm-common@^0.1.18-rc.35
23
+ bun add @owlmeans/llm-common@^0.1.18-rc.37
24
24
  ```
25
25
 
26
26
  ## Usage
@@ -96,7 +96,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
96
96
  your project's skill store (`.agents/skills/`):
97
97
 
98
98
  ```sh
99
- npx @owlmeans/agent-skills@^0.1.18-rc.36
99
+ npx @owlmeans/agent-skills@^0.1.18-rc.41
100
100
  ```
101
101
 
102
102
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/llm-common",
4
- "version": "0.1.18-rc.35",
5
- "generatedAt": "2026-09-22T22:24:39.580Z",
4
+ "version": "0.1.18-rc.37",
5
+ "generatedAt": "2026-09-28T02:06:37.884Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: llm-common
3
- description: How to use @owlmeans/llm-common — runtime-free serializable contracts for LLM inference and execution (ModelProvider, ExecutionEffort/Level, ModelPolicy, PromptPolicy, SkillDefinition, ExecutionState, spectator records, NullCapture, LlmFileProvider). Auto-invoked when importing those contracts or extending them for a domain.
3
+ description: How to use @owlmeans/llm-common — runtime-free serializable contracts for LLM inference and execution (ModelProvider, ExecutionEffort/Level, ModelPolicy, PromptPolicy, SkillDefinition, ExecutionState and its cumulative-results view, PromptBlock, spectator records, NullCapture, LlmFileProvider). Auto-invoked when importing those contracts or extending them for a domain.
4
4
  user-invocable: false
5
5
  ---
6
6
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/llm-common
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/llm-common": "^0.1.18-rc.35"` in `dependencies`
11
+ **Install:** `"@owlmeans/llm-common": "^0.1.18-rc.37"` in `dependencies`
12
12
 
13
13
  The contracts half of the LLM stack. **No `@langchain/*` runtime dependency** — importable
14
14
  from a browser bundle, a queue worker, or any package that must not pull an inference SDK.
@@ -22,15 +22,18 @@ The dependency direction is one-way: a domain contracts package extends these;
22
22
  | `ModelProvider` | `OpenAI` · `Anthropic` · `Compatible`. Each value is an `LlmPlugin.type` in `@owlmeans/llm`. |
23
23
  | `ExecutionLevel` | `Project` → `Task` → `Helper`. Refinement is downward only. |
24
24
  | `ExecutionEffort` | `Economy` · `Standard` · `High` · `Max` — the single "how hard should this run" axis. |
25
+ | `ModelEffort` · `MODEL_EFFORT_ORDER` | The PROVIDER's effort value (`none` … `max`) sent as OpenAI `reasoning.effort` / Anthropic `output_config.effort`; `ModelConfigPatch.effort`. Not `ExecutionEffort`, which only sizes budgets. Which levels a model accepts is the `llm` plugins' table. |
25
26
  | `StructuredMode` | `Native` (provider JSON-schema mode) vs `Tool` (forced tool call). |
26
27
  | `SpectatorContentType`, `SPECTATOR_GENERAL` | Observability record enums/defaults. |
27
28
  | `ModelRole` | Open `string` — declare your own enum, its values stay assignable. |
28
29
  | `ModelConfigPatch` / `ModelConfigOverride` | The JSON-safe config subset; never credentials. Carries the model-capability fields (`contextWindow`, `maxOutput`, `combinedWindow`) alongside the budget ones — see the `llm` skill for what each means. |
29
30
  | `ModelPolicy` | `{ effort, roleOverrides?, modelOverrides?, utilityRole? }` — inherited by every refinement. |
30
31
  | `UTILITY_ROLE` | `'utility'` — the conventional cheap tier for side calls (a relevance pick, a classification). `ModelPolicy.utilityRole` points it at another alias; `ExecutionService.utility` resolves it. |
31
- | `ExecutionState` / `TaskExecutionState` | The persistable core (`level`/`purpose`/`policy`, plus `phase`/`completed`/`cursor`/`data`). |
32
+ | `ExecutionState` / `TaskExecutionState` | The persistable core (`level`/`purpose`/`policy`, optional `prompt`/`inquiry`/`results`, plus `phase`/`completed`/`cursor`/`data`). |
32
33
  | `LlmPurpose` | `{ type?, dedication? }` — metadata carried on every model call. |
33
- | `PromptBlock`, `PROMPT_BLOCK_ORDER`, `DEFAULT_SKILL_ORDER` | The ordered sections of a composed system prompt — the order IS the cache key. |
34
+ | `PromptBlock`, `PROMPT_BLOCK_ORDER`, `DEFAULT_SKILL_ORDER` | The ordered sections of a composed system prompt — `Role`, `Skills`, `Packages`, `Results`, `Context`; the order IS the cache key. |
35
+ | `CumulativeResults`, `CumulativeResultsSection` | A pipeline step's view of what earlier steps produced: `step`, rendered `sections` (oldest first), `omitted` step names, `chars`, and a `digest` that is never rendered. |
36
+ | `renderCumulativeResults(view)` · `CUMULATIVE_RESULTS_PREAMBLE` · `CUMULATIVE_RESULTS_OMITTED_LEAD`/`_TAIL` | The view as prompt text: the fixed rules, the sections, the "not listed for space" line — or `''` for no view. |
34
37
  | `SkillDefinition` | One named block of reusable prompt knowledge. `body` must be a pure constant. |
35
38
  | `PromptPolicy` | `{ role?, skills?, cacheSystem?, cacheTtl? }` — carried on `ExecutionState`, merged downward. |
36
39
  | `CacheTtl`, `CacheUsage` | `'5m' \| '1h'`; normalized prompt-cache accounting. |
@@ -54,6 +57,22 @@ LlmFileProvider`); implementing it from scratch means all four:
54
57
  Resolving the project root is deliberately NOT part of the contract, and an implementation must not
55
58
  narrow an inherited signature — that is what stops a rich helper from satisfying this one.
56
59
 
60
+ ## `ExecutionState.results` — the cumulative-results view
61
+
62
+ What the earlier steps of the pipeline an execution works inside produced, cut by `@owlmeans/agent`'s
63
+ `cumulativeResultsPlugin` for ONE step. It is state, not a collaborator — plain rendered text, so a
64
+ snapshot and a restore compose the same prompt — and it is inherited down the execution chain like
65
+ any state field, but REPLACED (`ExecutionService.withResults`), never merged, when another step is
66
+ handed its own view.
67
+
68
+ `renderCumulativeResults` is pure: the same view renders the same bytes, an absent or empty view
69
+ renders NOTHING (never a heading over an empty list, which a model reads as "nothing was produced"),
70
+ and the digest never reaches a prompt. `CUMULATIVE_RESULTS_PREAMBLE` is written for the weakest model
71
+ a pipeline may run on — use the names verbatim, import only from the listed specifier, never declare
72
+ a listed thing again, a missing thing does not exist yet unless the list says it left something out,
73
+ and a source file shown in the conversation is NEWER than the list and wins. Change its wording only
74
+ deliberately: it opens a block that recurs on every call of a step.
75
+
57
76
  ## Extension rules
58
77
 
59
78
  Open types are open **on purpose** — extend, do not fork:
@@ -97,6 +116,13 @@ instances, credentials, file handles, callbacks, `ModelConfig` (it carries `secr
97
116
  Nothing at runtime. `@langchain/core` is a **dev** dependency, for the `UsageMetadata` type
98
117
  on a spectator message only.
99
118
 
119
+ ## Testing
120
+
121
+ Category A. `bun test ./tests` (the package's `test` script, so the root run includes it):
122
+ `inquiry.spec.ts` for the answer helpers, `results.spec.ts` for the block order and the rendered view.
123
+
100
124
  ## Related
101
125
 
102
126
  - [[llm]] — the runtime that implements these contracts
127
+ - [[llm-prompt-caching]] — why `Results` sits where it does in the block order
128
+ - [[agent]] — `cumulativeResultsPlugin`, which cuts the view
package/build/consts.d.ts CHANGED
@@ -45,6 +45,23 @@ export declare enum ExecutionEffort {
45
45
  High = "high",
46
46
  Max = "max"
47
47
  }
48
+ /**
49
+ * The PROVIDER's own effort knob — OpenAI `reasoning.effort`, Anthropic
50
+ * `output_config.effort`. Not {@link ExecutionEffort}: that is this package's tier, which
51
+ * sizes token budgets; this is a value sent on the wire. Which levels a model accepts is a
52
+ * provider-plugin fact in `@owlmeans/llm`.
53
+ */
54
+ export declare enum ModelEffort {
55
+ None = "none",
56
+ Minimal = "minimal",
57
+ Low = "low",
58
+ Medium = "medium",
59
+ High = "high",
60
+ XHigh = "xhigh",
61
+ Max = "max"
62
+ }
63
+ /** {@link ModelEffort} from least to most work — the order an escalation climbs. */
64
+ export declare const MODEL_EFFORT_ORDER: readonly ModelEffort[];
48
65
  /**
49
66
  * How a model is asked to produce a schema-conforming object.
50
67
  *
@@ -80,12 +97,18 @@ export declare const SPECTATOR_GENERAL = "general";
80
97
  * - `Packages` — capabilities resolved from whatever the request happens to mention.
81
98
  * Varies per request, so it gets its OWN breakpoint and can never
82
99
  * invalidate the two blocks above it.
100
+ * - `Results` — what the earlier steps of the pipeline this call runs in produced
101
+ * (`ExecutionState.results`). Stable within one step, different on the
102
+ * next, so it sits BELOW every boundary that is cached across steps and
103
+ * is emitted only when a view is present — a call without one composes
104
+ * exactly the bytes it composed before this block existed.
83
105
  * - `Context` — volatile, caller-supplied system text. Never cached.
84
106
  */
85
107
  export declare enum PromptBlock {
86
108
  Role = "role",
87
109
  Skills = "skills",
88
110
  Packages = "packages",
111
+ Results = "results",
89
112
  Context = "context"
90
113
  }
91
114
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,yFAAyF;IACzF,MAAM,WAAW;IACjB,8BAA8B;IAC9B,SAAS,cAAc;IACvB,yFAAyF;IACzF,UAAU,eAAe;IACzB;;;;;;;;;;;;OAYG;IACH,SAAS,cAAc;CACxB;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED;;;;GAIG;AACH,oBAAY,eAAe;IACzB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED;;;;;;;;;GASG;AACH,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,0DAA0D;AAC1D,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,cAAc;CACvB;AAED,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,YAAY,CAAA;AAE1C;;;;;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GAmBG;AACH,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,WAAW,EAM3C,CAAA;AAEV,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,YAAY,CAAA"}
package/build/consts.js CHANGED
@@ -48,6 +48,27 @@ export var ExecutionEffort;
48
48
  ExecutionEffort["High"] = "high";
49
49
  ExecutionEffort["Max"] = "max";
50
50
  })(ExecutionEffort || (ExecutionEffort = {}));
51
+ /**
52
+ * The PROVIDER's own effort knob — OpenAI `reasoning.effort`, Anthropic
53
+ * `output_config.effort`. Not {@link ExecutionEffort}: that is this package's tier, which
54
+ * sizes token budgets; this is a value sent on the wire. Which levels a model accepts is a
55
+ * provider-plugin fact in `@owlmeans/llm`.
56
+ */
57
+ export var ModelEffort;
58
+ (function (ModelEffort) {
59
+ ModelEffort["None"] = "none";
60
+ ModelEffort["Minimal"] = "minimal";
61
+ ModelEffort["Low"] = "low";
62
+ ModelEffort["Medium"] = "medium";
63
+ ModelEffort["High"] = "high";
64
+ ModelEffort["XHigh"] = "xhigh";
65
+ ModelEffort["Max"] = "max";
66
+ })(ModelEffort || (ModelEffort = {}));
67
+ /** {@link ModelEffort} from least to most work — the order an escalation climbs. */
68
+ export const MODEL_EFFORT_ORDER = [
69
+ ModelEffort.None, ModelEffort.Minimal, ModelEffort.Low, ModelEffort.Medium,
70
+ ModelEffort.High, ModelEffort.XHigh, ModelEffort.Max,
71
+ ];
51
72
  /**
52
73
  * How a model is asked to produce a schema-conforming object.
53
74
  *
@@ -85,6 +106,11 @@ export const SPECTATOR_GENERAL = 'general';
85
106
  * - `Packages` — capabilities resolved from whatever the request happens to mention.
86
107
  * Varies per request, so it gets its OWN breakpoint and can never
87
108
  * invalidate the two blocks above it.
109
+ * - `Results` — what the earlier steps of the pipeline this call runs in produced
110
+ * (`ExecutionState.results`). Stable within one step, different on the
111
+ * next, so it sits BELOW every boundary that is cached across steps and
112
+ * is emitted only when a view is present — a call without one composes
113
+ * exactly the bytes it composed before this block existed.
88
114
  * - `Context` — volatile, caller-supplied system text. Never cached.
89
115
  */
90
116
  export var PromptBlock;
@@ -92,6 +118,7 @@ export var PromptBlock;
92
118
  PromptBlock["Role"] = "role";
93
119
  PromptBlock["Skills"] = "skills";
94
120
  PromptBlock["Packages"] = "packages";
121
+ PromptBlock["Results"] = "results";
95
122
  PromptBlock["Context"] = "context";
96
123
  })(PromptBlock || (PromptBlock = {}));
97
124
  /**
@@ -103,6 +130,7 @@ export const PROMPT_BLOCK_ORDER = [
103
130
  PromptBlock.Role,
104
131
  PromptBlock.Skills,
105
132
  PromptBlock.Packages,
133
+ PromptBlock.Results,
106
134
  PromptBlock.Context,
107
135
  ];
108
136
  /** Sort weight of a skill that declares none — see `SkillDefinition.order`. */
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,CAAN,IAAY,aAqBX;AArBD,WAAY,aAAa;IACvB,yFAAyF;IACzF,kCAAiB,CAAA;IACjB,8BAA8B;IAC9B,wCAAuB,CAAA;IACvB,yFAAyF;IACzF,0CAAyB,CAAA;IACzB;;;;;;;;;;;;OAYG;IACH,wCAAuB,CAAA;AACzB,CAAC,EArBW,aAAa,KAAb,aAAa,QAqBxB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,mCAAiB,CAAA;AACnB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,wCAAqB,CAAA;IAC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A;AAE1C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAN,IAAY,WAMX;AAND,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,kCAAmB,CAAA;AACrB,CAAC,EANW,WAAW,KAAX,WAAW,QAMtB;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,WAAW,CAAC,IAAI;IAChB,WAAW,CAAC,MAAM;IAClB,WAAW,CAAC,QAAQ;IACpB,WAAW,CAAC,OAAO;IACnB,WAAW,CAAC,OAAO;CACX,CAAA;AAEV,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAA"}
package/build/index.d.ts CHANGED
@@ -5,4 +5,5 @@ export type * from './files/types.js';
5
5
  export * from './files/utils.js';
6
6
  export * from './delegate/index.js';
7
7
  export * from './inquiry/index.js';
8
+ export * from './results/index.js';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,kBAAkB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,kBAAkB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA"}
package/build/index.js CHANGED
@@ -2,4 +2,5 @@ export * from './consts.js';
2
2
  export * from './files/utils.js';
3
3
  export * from './delegate/index.js';
4
4
  export * from './inquiry/index.js';
5
+ export * from './results/index.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAI3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAI3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The fixed wording that introduces a {@link CumulativeResults} view in a prompt.
3
+ *
4
+ * Written for the WEAKEST model a pipeline may run on, so every rule is literal and says what to do
5
+ * rather than what to consider. It is a pure constant — no interpolation, no clock — because it
6
+ * opens a block that recurs verbatim on every call of a step, and the rules are the reason the
7
+ * block exists at all: a list of names with no instruction attached is read as a suggestion, and a
8
+ * suggestion is exactly what a model re-derives, renames or re-cases.
9
+ *
10
+ * The last rules carry the list's own limits. It is written between steps and can go stale in ways
11
+ * a live file read cannot, so a file actually shown in the conversation must win; and it may leave
12
+ * things out for space, so "not listed" means "does not exist yet" only when nothing was left out.
13
+ */
14
+ export declare const CUMULATIVE_RESULTS_PREAMBLE = "## Results of earlier steps\n\nEverything below was read from the project's files by code, after each earlier step of this work finished. No model wrote it.\n\nRules for using it:\n- These are the AUTHORITATIVE names produced by earlier steps. Use every name, path and import specifier exactly as written here. Never re-derive, rename, re-case or guess a different path.\n- Import a listed symbol only from the specifier listed for it.\n- Never declare anything listed here a second time. Import it, call it or extend it instead.\n- Anything the current task needs that this list does not contain does not exist yet, unless the list says it left something out for space; then look in the project's files first. Create a missing thing only if the task says to, and never under a name that merely resembles a listed one.\n- A source file actually shown elsewhere in this conversation is NEWER than this list and wins wherever the two disagree: this list can go stale between steps, a file you are shown cannot.\n- An entry marked \"(names only)\" lists names without their detail. Read that file before relying on its shape.\n- A summary marked \"(not verified)\" was written by a model and never checked against the files. Treat it as a hint, never as a fact.";
15
+ /** Opens the line naming the steps a view left out for space. The names follow it. */
16
+ export declare const CUMULATIVE_RESULTS_OMITTED_LEAD = "Not listed here for space:";
17
+ /** Closes that line — what the model is to do about a step it cannot see. */
18
+ export declare const CUMULATIVE_RESULTS_OMITTED_TAIL = "Those steps finished and what they made exists in the project's files. Look there before creating anything they may already have made.";
19
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../src/results/consts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,2BAA2B,+uCAW6F,CAAA;AAErI,sFAAsF;AACtF,eAAO,MAAM,+BAA+B,+BAA+B,CAAA;AAE3E,6EAA6E;AAC7E,eAAO,MAAM,+BAA+B,2IAC+F,CAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The fixed wording that introduces a {@link CumulativeResults} view in a prompt.
3
+ *
4
+ * Written for the WEAKEST model a pipeline may run on, so every rule is literal and says what to do
5
+ * rather than what to consider. It is a pure constant — no interpolation, no clock — because it
6
+ * opens a block that recurs verbatim on every call of a step, and the rules are the reason the
7
+ * block exists at all: a list of names with no instruction attached is read as a suggestion, and a
8
+ * suggestion is exactly what a model re-derives, renames or re-cases.
9
+ *
10
+ * The last rules carry the list's own limits. It is written between steps and can go stale in ways
11
+ * a live file read cannot, so a file actually shown in the conversation must win; and it may leave
12
+ * things out for space, so "not listed" means "does not exist yet" only when nothing was left out.
13
+ */
14
+ export const CUMULATIVE_RESULTS_PREAMBLE = `## Results of earlier steps
15
+
16
+ Everything below was read from the project's files by code, after each earlier step of this work finished. No model wrote it.
17
+
18
+ Rules for using it:
19
+ - These are the AUTHORITATIVE names produced by earlier steps. Use every name, path and import specifier exactly as written here. Never re-derive, rename, re-case or guess a different path.
20
+ - Import a listed symbol only from the specifier listed for it.
21
+ - Never declare anything listed here a second time. Import it, call it or extend it instead.
22
+ - Anything the current task needs that this list does not contain does not exist yet, unless the list says it left something out for space; then look in the project's files first. Create a missing thing only if the task says to, and never under a name that merely resembles a listed one.
23
+ - A source file actually shown elsewhere in this conversation is NEWER than this list and wins wherever the two disagree: this list can go stale between steps, a file you are shown cannot.
24
+ - An entry marked "(names only)" lists names without their detail. Read that file before relying on its shape.
25
+ - A summary marked "(not verified)" was written by a model and never checked against the files. Treat it as a hint, never as a fact.`;
26
+ /** Opens the line naming the steps a view left out for space. The names follow it. */
27
+ export const CUMULATIVE_RESULTS_OMITTED_LEAD = 'Not listed here for space:';
28
+ /** Closes that line — what the model is to do about a step it cannot see. */
29
+ export const CUMULATIVE_RESULTS_OMITTED_TAIL = 'Those steps finished and what they made exists in the project\'s files. Look there before creating anything they may already have made.';
30
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/results/consts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG;;;;;;;;;;;qIAW0F,CAAA;AAErI,sFAAsF;AACtF,MAAM,CAAC,MAAM,+BAA+B,GAAG,4BAA4B,CAAA;AAE3E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,+BAA+B,GAC1C,yIAAyI,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './consts.js';
2
+ export type * from './types.js';
3
+ export * from './utils.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/results/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './consts.js';
2
+ export * from './utils.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/results/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * One producing step's contribution to a {@link CumulativeResults} view, already rendered.
3
+ *
4
+ * `step` names the step that produced it — for a step of a pipeline composed under another, the
5
+ * composing path as well (`design/screens`) — so two pipelines' steps of the same name never read
6
+ * as one.
7
+ */
8
+ export interface CumulativeResultsSection {
9
+ step: string;
10
+ text: string;
11
+ }
12
+ /**
13
+ * What the earlier steps of a pipeline produced, cut for ONE later step.
14
+ *
15
+ * Serializable and immutable: it travels on `ExecutionState.results`, so it survives a snapshot and
16
+ * a restore, and a resumed run composes the same prompt the interrupted one did. Everything in it is
17
+ * already rendered — the view is cut by the pipeline runtime, where the budgets are known, and the
18
+ * prompt layer only places it.
19
+ */
20
+ export interface CumulativeResults {
21
+ /** The step this view was cut for. */
22
+ step: string;
23
+ /** Oldest first. Each is one producing step, rendered in full or as names only. */
24
+ sections: CumulativeResultsSection[];
25
+ /** Steps whose results exist but were left out of this view to stay inside its budget. */
26
+ omitted: string[];
27
+ /** Characters of the sections as rendered, separators included. */
28
+ chars: number;
29
+ /**
30
+ * A digest of the sections — for a trace line or a debugger, to tell two views apart.
31
+ *
32
+ * NEVER rendered into a prompt: it is exactly the kind of varying, meaningless byte a model would
33
+ * copy into its answer or treat as an instruction.
34
+ */
35
+ digest: string;
36
+ }
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/results/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAA;IACZ,mFAAmF;IACnF,QAAQ,EAAE,wBAAwB,EAAE,CAAA;IACpC,0FAA0F;IAC1F,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAA;IACb;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAA;CACf"}
@@ -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,11 @@
1
+ import type { CumulativeResults } from './types.js';
2
+ /**
3
+ * A {@link CumulativeResults} view as prompt text, or `''` when there is nothing to say.
4
+ *
5
+ * Pure and total: the same view renders to the same bytes on every runtime, and an absent or empty
6
+ * view renders to NOTHING — not a heading over an empty list, which a model would read as "no
7
+ * earlier step produced anything" and act on. The view's digest is never rendered; its sections are
8
+ * placed in the order the view holds them, which is oldest first.
9
+ */
10
+ export declare const renderCumulativeResults: (view: CumulativeResults | null | undefined) => string;
11
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/results/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAKnD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,SAAU,iBAAiB,GAAG,IAAI,GAAG,SAAS,KAAG,MAmBpF,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { CUMULATIVE_RESULTS_OMITTED_LEAD, CUMULATIVE_RESULTS_OMITTED_TAIL, CUMULATIVE_RESULTS_PREAMBLE, } from './consts.js';
2
+ /** Separator between sections — the same two newlines every other prompt join uses. */
3
+ const SEPARATOR = '\n\n';
4
+ /**
5
+ * A {@link CumulativeResults} view as prompt text, or `''` when there is nothing to say.
6
+ *
7
+ * Pure and total: the same view renders to the same bytes on every runtime, and an absent or empty
8
+ * view renders to NOTHING — not a heading over an empty list, which a model would read as "no
9
+ * earlier step produced anything" and act on. The view's digest is never rendered; its sections are
10
+ * placed in the order the view holds them, which is oldest first.
11
+ */
12
+ export const renderCumulativeResults = (view) => {
13
+ if (view == null) {
14
+ return '';
15
+ }
16
+ const sections = view.sections.map(section => section.text.trim()).filter(text => text !== '');
17
+ const omitted = view.omitted.filter(step => step.trim() !== '');
18
+ if (sections.length === 0 && omitted.length === 0) {
19
+ return '';
20
+ }
21
+ const parts = [CUMULATIVE_RESULTS_PREAMBLE, ...sections];
22
+ if (omitted.length > 0) {
23
+ parts.push(`${CUMULATIVE_RESULTS_OMITTED_LEAD} ${omitted.map(step => `\`${step}\``).join(', ')}. `
24
+ + CUMULATIVE_RESULTS_OMITTED_TAIL);
25
+ }
26
+ return parts.join(SEPARATOR);
27
+ };
28
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/results/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,+BAA+B,EAAE,+BAA+B,EAAE,2BAA2B,GAC9F,MAAM,aAAa,CAAA;AAGpB,uFAAuF;AACvF,MAAM,SAAS,GAAG,MAAM,CAAA;AAExB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,IAA0C,EAAU,EAAE;IAC5F,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAA;IAC9F,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAC/D,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClD,OAAO,EAAE,CAAA;IACX,CAAC;IAED,MAAM,KAAK,GAAG,CAAC,2BAA2B,EAAE,GAAG,QAAQ,CAAC,CAAA;IACxD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CACR,GAAG,+BAA+B,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;cACrF,+BAA+B,CAClC,CAAA;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAC9B,CAAC,CAAA"}
package/build/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { ExecutionEffort, ExecutionLevel, PromptBlock } from './consts.js';
1
+ import type { ExecutionEffort, ExecutionLevel, ModelEffort, PromptBlock } from './consts.js';
2
2
  import type { InquiryConfig } from './inquiry/types.js';
3
+ import type { CumulativeResults } from './results/types.js';
3
4
  /**
4
5
  * Free-form observability metadata attached to every model call — forwarded to the
5
6
  * inference provider as run metadata and recorded on every spectator entry. Kept
@@ -30,6 +31,8 @@ export interface ModelConfigPatch {
30
31
  maxTokensCap?: number;
31
32
  topP?: number;
32
33
  disableThinking?: boolean;
34
+ /** Provider-native effort; clamped to what the model accepts, dropped where it accepts none. */
35
+ effort?: ModelEffort;
33
36
  /** Total window the model accepts (input + output). Informational / validation only. */
34
37
  contextWindow?: number;
35
38
  /** What the PROVIDER can emit in one request. Hard ceiling for `maxTokens`/`maxTokensCap`. */
@@ -138,6 +141,15 @@ export interface ExecutionState {
138
141
  * same policy, as the one that parked it.
139
142
  */
140
143
  inquiry?: InquiryConfig;
144
+ /**
145
+ * What the earlier steps of the pipeline this execution works inside produced, cut for the step
146
+ * at hand. Rendered into `PromptBlock.Results` by the prompt service.
147
+ *
148
+ * State, not a collaborator: it is plain rendered text, and a resumed run must compose the
149
+ * prompt the interrupted one did. Inherited by every refinement like any other state field, and
150
+ * replaced — never merged — when a later step is handed its own view.
151
+ */
152
+ results?: CumulativeResults;
141
153
  }
142
154
  /**
143
155
  * The task level's own fields.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAC/E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAEvD;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,yEAAyE;IACzE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;GAIG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,wFAAwF;IACxF,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,8FAA8F;IAC9F,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4EAA4E;IAC5E,cAAc,CAAC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AE,OAAO,CAAA;QACrB;;;;WAIG;QACH,YAAY,CAAC,EAAE,OAAO,CAAA;QACtB,WAAW,EAAE,OAAO,CAAA;KACrB,CAAA;CACF"}
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@owlmeans/llm-common",
3
- "version": "0.1.18-rc.35",
3
+ "version": "0.1.18-rc.37",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "build": "tsc -b",
8
8
  "dev": "sleep 171 && nodemon -e ts,tsx,json --watch src --exec \"tsc -p ./tsconfig.json\"",
9
- "watch": "tsc -b -w --preserveWatchOutput --pretty"
9
+ "watch": "tsc -b -w --preserveWatchOutput --pretty",
10
+ "test": "bun test ./tests"
10
11
  },
11
12
  "main": "build/index.js",
12
13
  "module": "build/index.js",
package/src/consts.ts CHANGED
@@ -49,6 +49,28 @@ export enum ExecutionEffort {
49
49
  Max = 'max',
50
50
  }
51
51
 
52
+ /**
53
+ * The PROVIDER's own effort knob — OpenAI `reasoning.effort`, Anthropic
54
+ * `output_config.effort`. Not {@link ExecutionEffort}: that is this package's tier, which
55
+ * sizes token budgets; this is a value sent on the wire. Which levels a model accepts is a
56
+ * provider-plugin fact in `@owlmeans/llm`.
57
+ */
58
+ export enum ModelEffort {
59
+ None = 'none',
60
+ Minimal = 'minimal',
61
+ Low = 'low',
62
+ Medium = 'medium',
63
+ High = 'high',
64
+ XHigh = 'xhigh',
65
+ Max = 'max',
66
+ }
67
+
68
+ /** {@link ModelEffort} from least to most work — the order an escalation climbs. */
69
+ export const MODEL_EFFORT_ORDER: readonly ModelEffort[] = [
70
+ ModelEffort.None, ModelEffort.Minimal, ModelEffort.Low, ModelEffort.Medium,
71
+ ModelEffort.High, ModelEffort.XHigh, ModelEffort.Max,
72
+ ]
73
+
52
74
  /**
53
75
  * How a model is asked to produce a schema-conforming object.
54
76
  *
@@ -87,12 +109,18 @@ export const SPECTATOR_GENERAL = 'general'
87
109
  * - `Packages` — capabilities resolved from whatever the request happens to mention.
88
110
  * Varies per request, so it gets its OWN breakpoint and can never
89
111
  * invalidate the two blocks above it.
112
+ * - `Results` — what the earlier steps of the pipeline this call runs in produced
113
+ * (`ExecutionState.results`). Stable within one step, different on the
114
+ * next, so it sits BELOW every boundary that is cached across steps and
115
+ * is emitted only when a view is present — a call without one composes
116
+ * exactly the bytes it composed before this block existed.
90
117
  * - `Context` — volatile, caller-supplied system text. Never cached.
91
118
  */
92
119
  export enum PromptBlock {
93
120
  Role = 'role',
94
121
  Skills = 'skills',
95
122
  Packages = 'packages',
123
+ Results = 'results',
96
124
  Context = 'context',
97
125
  }
98
126
 
@@ -105,6 +133,7 @@ export const PROMPT_BLOCK_ORDER: readonly PromptBlock[] = [
105
133
  PromptBlock.Role,
106
134
  PromptBlock.Skills,
107
135
  PromptBlock.Packages,
136
+ PromptBlock.Results,
108
137
  PromptBlock.Context,
109
138
  ] as const
110
139
 
package/src/index.ts CHANGED
@@ -6,3 +6,4 @@ export type * from './files/types.js'
6
6
  export * from './files/utils.js'
7
7
  export * from './delegate/index.js'
8
8
  export * from './inquiry/index.js'
9
+ export * from './results/index.js'
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The fixed wording that introduces a {@link CumulativeResults} view in a prompt.
3
+ *
4
+ * Written for the WEAKEST model a pipeline may run on, so every rule is literal and says what to do
5
+ * rather than what to consider. It is a pure constant — no interpolation, no clock — because it
6
+ * opens a block that recurs verbatim on every call of a step, and the rules are the reason the
7
+ * block exists at all: a list of names with no instruction attached is read as a suggestion, and a
8
+ * suggestion is exactly what a model re-derives, renames or re-cases.
9
+ *
10
+ * The last rules carry the list's own limits. It is written between steps and can go stale in ways
11
+ * a live file read cannot, so a file actually shown in the conversation must win; and it may leave
12
+ * things out for space, so "not listed" means "does not exist yet" only when nothing was left out.
13
+ */
14
+ export const CUMULATIVE_RESULTS_PREAMBLE = `## Results of earlier steps
15
+
16
+ Everything below was read from the project's files by code, after each earlier step of this work finished. No model wrote it.
17
+
18
+ Rules for using it:
19
+ - These are the AUTHORITATIVE names produced by earlier steps. Use every name, path and import specifier exactly as written here. Never re-derive, rename, re-case or guess a different path.
20
+ - Import a listed symbol only from the specifier listed for it.
21
+ - Never declare anything listed here a second time. Import it, call it or extend it instead.
22
+ - Anything the current task needs that this list does not contain does not exist yet, unless the list says it left something out for space; then look in the project's files first. Create a missing thing only if the task says to, and never under a name that merely resembles a listed one.
23
+ - A source file actually shown elsewhere in this conversation is NEWER than this list and wins wherever the two disagree: this list can go stale between steps, a file you are shown cannot.
24
+ - An entry marked "(names only)" lists names without their detail. Read that file before relying on its shape.
25
+ - A summary marked "(not verified)" was written by a model and never checked against the files. Treat it as a hint, never as a fact.`
26
+
27
+ /** Opens the line naming the steps a view left out for space. The names follow it. */
28
+ export const CUMULATIVE_RESULTS_OMITTED_LEAD = 'Not listed here for space:'
29
+
30
+ /** Closes that line — what the model is to do about a step it cannot see. */
31
+ export const CUMULATIVE_RESULTS_OMITTED_TAIL =
32
+ 'Those steps finished and what they made exists in the project\'s files. Look there before creating anything they may already have made.'
@@ -0,0 +1,3 @@
1
+ export * from './consts.js'
2
+ export type * from './types.js'
3
+ export * from './utils.js'
@@ -0,0 +1,37 @@
1
+ /**
2
+ * One producing step's contribution to a {@link CumulativeResults} view, already rendered.
3
+ *
4
+ * `step` names the step that produced it — for a step of a pipeline composed under another, the
5
+ * composing path as well (`design/screens`) — so two pipelines' steps of the same name never read
6
+ * as one.
7
+ */
8
+ export interface CumulativeResultsSection {
9
+ step: string
10
+ text: string
11
+ }
12
+
13
+ /**
14
+ * What the earlier steps of a pipeline produced, cut for ONE later step.
15
+ *
16
+ * Serializable and immutable: it travels on `ExecutionState.results`, so it survives a snapshot and
17
+ * a restore, and a resumed run composes the same prompt the interrupted one did. Everything in it is
18
+ * already rendered — the view is cut by the pipeline runtime, where the budgets are known, and the
19
+ * prompt layer only places it.
20
+ */
21
+ export interface CumulativeResults {
22
+ /** The step this view was cut for. */
23
+ step: string
24
+ /** Oldest first. Each is one producing step, rendered in full or as names only. */
25
+ sections: CumulativeResultsSection[]
26
+ /** Steps whose results exist but were left out of this view to stay inside its budget. */
27
+ omitted: string[]
28
+ /** Characters of the sections as rendered, separators included. */
29
+ chars: number
30
+ /**
31
+ * A digest of the sections — for a trace line or a debugger, to tell two views apart.
32
+ *
33
+ * NEVER rendered into a prompt: it is exactly the kind of varying, meaningless byte a model would
34
+ * copy into its answer or treat as an instruction.
35
+ */
36
+ digest: string
37
+ }
@@ -0,0 +1,36 @@
1
+ import {
2
+ CUMULATIVE_RESULTS_OMITTED_LEAD, CUMULATIVE_RESULTS_OMITTED_TAIL, CUMULATIVE_RESULTS_PREAMBLE,
3
+ } from './consts.js'
4
+ import type { CumulativeResults } from './types.js'
5
+
6
+ /** Separator between sections — the same two newlines every other prompt join uses. */
7
+ const SEPARATOR = '\n\n'
8
+
9
+ /**
10
+ * A {@link CumulativeResults} view as prompt text, or `''` when there is nothing to say.
11
+ *
12
+ * Pure and total: the same view renders to the same bytes on every runtime, and an absent or empty
13
+ * view renders to NOTHING — not a heading over an empty list, which a model would read as "no
14
+ * earlier step produced anything" and act on. The view's digest is never rendered; its sections are
15
+ * placed in the order the view holds them, which is oldest first.
16
+ */
17
+ export const renderCumulativeResults = (view: CumulativeResults | null | undefined): string => {
18
+ if (view == null) {
19
+ return ''
20
+ }
21
+ const sections = view.sections.map(section => section.text.trim()).filter(text => text !== '')
22
+ const omitted = view.omitted.filter(step => step.trim() !== '')
23
+ if (sections.length === 0 && omitted.length === 0) {
24
+ return ''
25
+ }
26
+
27
+ const parts = [CUMULATIVE_RESULTS_PREAMBLE, ...sections]
28
+ if (omitted.length > 0) {
29
+ parts.push(
30
+ `${CUMULATIVE_RESULTS_OMITTED_LEAD} ${omitted.map(step => `\`${step}\``).join(', ')}. `
31
+ + CUMULATIVE_RESULTS_OMITTED_TAIL,
32
+ )
33
+ }
34
+
35
+ return parts.join(SEPARATOR)
36
+ }
package/src/types.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { ExecutionEffort, ExecutionLevel, PromptBlock } from './consts.js'
1
+ import type { ExecutionEffort, ExecutionLevel, ModelEffort, PromptBlock } from './consts.js'
2
2
  import type { InquiryConfig } from './inquiry/types.js'
3
+ import type { CumulativeResults } from './results/types.js'
3
4
 
4
5
  /**
5
6
  * Free-form observability metadata attached to every model call — forwarded to the
@@ -33,6 +34,8 @@ export interface ModelConfigPatch {
33
34
  maxTokensCap?: number
34
35
  topP?: number
35
36
  disableThinking?: boolean
37
+ /** Provider-native effort; clamped to what the model accepts, dropped where it accepts none. */
38
+ effort?: ModelEffort
36
39
  /** Total window the model accepts (input + output). Informational / validation only. */
37
40
  contextWindow?: number
38
41
  /** What the PROVIDER can emit in one request. Hard ceiling for `maxTokens`/`maxTokensCap`. */
@@ -148,6 +151,15 @@ export interface ExecutionState {
148
151
  * same policy, as the one that parked it.
149
152
  */
150
153
  inquiry?: InquiryConfig
154
+ /**
155
+ * What the earlier steps of the pipeline this execution works inside produced, cut for the step
156
+ * at hand. Rendered into `PromptBlock.Results` by the prompt service.
157
+ *
158
+ * State, not a collaborator: it is plain rendered text, and a resumed run must compose the
159
+ * prompt the interrupted one did. Inherited by every refinement like any other state field, and
160
+ * replaced — never merged — when a later step is handed its own view.
161
+ */
162
+ results?: CumulativeResults
151
163
  }
152
164
 
153
165
  /**
@@ -0,0 +1,65 @@
1
+ import { describe, expect, test } from 'bun:test'
2
+ import {
3
+ CUMULATIVE_RESULTS_OMITTED_LEAD, CUMULATIVE_RESULTS_PREAMBLE, PROMPT_BLOCK_ORDER, PromptBlock,
4
+ renderCumulativeResults,
5
+ } from '../src/index.js'
6
+ import type { CumulativeResults } from '../src/index.js'
7
+
8
+ /**
9
+ * The prompt-facing half of cumulative pipeline results: where the block sits and what it says.
10
+ * Both are cache facts as much as wording — a view must render to the same bytes every time, and
11
+ * an absent view must render to nothing at all.
12
+ */
13
+
14
+ const view = (patch: Partial<CumulativeResults> = {}): CumulativeResults => ({
15
+ step: 'resources',
16
+ sections: [
17
+ { step: 'types', text: '### types\n- type `User`: { id: string } — import from `@app/common`' },
18
+ { step: 'files', text: '### files (names only)\n- file: `a.ts`' },
19
+ ],
20
+ omitted: [],
21
+ chars: 100,
22
+ digest: 'digest-that-must-never-be-rendered',
23
+ ...patch,
24
+ })
25
+
26
+ describe('@owlmeans/llm-common — results block placement', () => {
27
+ test('sits after the packages block and before the per-call context', () => {
28
+ expect(PROMPT_BLOCK_ORDER).toEqual([
29
+ PromptBlock.Role, PromptBlock.Skills, PromptBlock.Packages, PromptBlock.Results,
30
+ PromptBlock.Context,
31
+ ])
32
+ })
33
+ })
34
+
35
+ describe('@owlmeans/llm-common — rendering a results view', () => {
36
+ test('no view, or a view with nothing in it, renders nothing at all', () => {
37
+ expect(renderCumulativeResults(undefined)).toBe('')
38
+ expect(renderCumulativeResults(null)).toBe('')
39
+ expect(renderCumulativeResults(view({ sections: [] }))).toBe('')
40
+ })
41
+
42
+ test('opens with the fixed rules, then the sections oldest first', () => {
43
+ const text = renderCumulativeResults(view())
44
+
45
+ expect(text.startsWith(CUMULATIVE_RESULTS_PREAMBLE)).toBe(true)
46
+ expect(text).toContain('No model wrote it.')
47
+ expect(text).toContain('Import a listed symbol only from the specifier listed for it.')
48
+ expect(text).toContain('is NEWER than this list')
49
+ expect(text.indexOf('### types')).toBeLessThan(text.indexOf('### files'))
50
+ })
51
+
52
+ test('never renders the digest, and renders the same bytes every time', () => {
53
+ const text = renderCumulativeResults(view())
54
+
55
+ expect(text).not.toContain('digest-that-must-never-be-rendered')
56
+ expect(renderCumulativeResults(view())).toBe(text)
57
+ })
58
+
59
+ test('names the steps left out for space, and says their results exist', () => {
60
+ const text = renderCumulativeResults(view({ omitted: ['scaffold', 'design/screens'] }))
61
+
62
+ expect(text).toContain(`${CUMULATIVE_RESULTS_OMITTED_LEAD} \`scaffold\`, \`design/screens\`.`)
63
+ expect(text.endsWith('Look there before creating anything they may already have made.')).toBe(true)
64
+ })
65
+ })