@owlmeans/llm 0.1.18-rc.14 → 0.1.18-rc.16
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 +1 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/llm/SKILL.md +2 -20
- package/agent-meta/skills/llm-prompt-caching/SKILL.md +3 -47
- package/build/consts.d.ts +0 -4
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +0 -4
- package/build/consts.js.map +1 -1
- package/build/execution/service.d.ts.map +1 -1
- package/build/execution/service.js +1 -15
- package/build/execution/service.js.map +1 -1
- package/build/execution/types.d.ts +1 -19
- package/build/execution/types.d.ts.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/package.json +6 -6
- package/src/consts.ts +0 -4
- package/src/execution/service.ts +1 -17
- package/src/execution/types.ts +2 -22
- package/src/index.ts +0 -1
- package/build/inquiry/bridge.d.ts +0 -22
- package/build/inquiry/bridge.d.ts.map +0 -1
- package/build/inquiry/bridge.js +0 -29
- package/build/inquiry/bridge.js.map +0 -1
- package/build/inquiry/errors.d.ts +0 -29
- package/build/inquiry/errors.d.ts.map +0 -1
- package/build/inquiry/errors.js +0 -40
- package/build/inquiry/errors.js.map +0 -1
- package/build/inquiry/index.d.ts +0 -4
- package/build/inquiry/index.d.ts.map +0 -1
- package/build/inquiry/index.js +0 -4
- package/build/inquiry/index.js.map +0 -1
- package/build/inquiry/transport.d.ts +0 -12
- package/build/inquiry/transport.d.ts.map +0 -1
- package/build/inquiry/transport.js +0 -35
- package/build/inquiry/transport.js.map +0 -1
- package/src/inquiry/bridge.ts +0 -33
- package/src/inquiry/errors.ts +0 -46
- package/src/inquiry/index.ts +0 -3
- package/src/inquiry/transport.ts +0 -42
- package/tests/inquiry.spec.ts +0 -200
package/README.md
CHANGED
|
@@ -184,7 +184,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
184
184
|
your project's skill store (`.agents/skills/`):
|
|
185
185
|
|
|
186
186
|
```sh
|
|
187
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
187
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.15
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
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/llm",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-
|
|
4
|
+
"version": "0.1.18-rc.16",
|
|
5
|
+
"generatedAt": "2026-09-12T08:39:52.723Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/llm
|
|
9
9
|
|
|
10
10
|
**Layer:** Core
|
|
11
|
-
**Install:** `"@owlmeans/llm": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/llm": "^0.1.18-rc.16"` in `dependencies` (plus the `@langchain/*` peers)
|
|
12
12
|
|
|
13
13
|
The inference runtime. Everything provider-specific is a **plugin**; the model itself only owns the
|
|
14
14
|
provider-independent parts (streaming discipline, retries, validation, observability). Serializable
|
|
@@ -33,8 +33,6 @@ symbol "because a test needs it".
|
|
|
33
33
|
| `NO_SAMPLING_PREFIXES` / `rejectsSampling(model)` · `RESPONSES_API_PREFIXES` / `usesResponsesApi(model)` | Which families reject which sampling parameters — see the table below. Consumers pin presets against them. |
|
|
34
34
|
| `withRetry`, `registerFatalError`, `isFatalError`, `spectate`, `normalizeInput`, `parseJsonContent`, `coerceToSchema` | Helpers usable alongside a model. Also at `@owlmeans/llm/helpers`. |
|
|
35
35
|
| `LlmError`, `LlmModelError`, `LlmMissconfiguredError`, `LlmPluginError`, `LlmRetryExceededError` | `ResilientError` family. `LlmModelError` is the RETRYABLE one. |
|
|
36
|
-
| `registerInquiryTransport`, `releaseInquiryTransport`, `hasInquiryTransport`, `inquiryTransportFor` | The inquiry-channel registry — how a question reaches a person. `inquiryTransportFor` throws rather than waits. |
|
|
37
|
-
| `executionInquiry(service, exec)` · `InquiryError`, `InquiryUnavailable`, `InquiryDeclined` | The ONE adapter mapping an absent channel to `null`, and the error family behind it. `InquiryUnavailable` is registered fatal. |
|
|
38
36
|
| `mergePrompt`, `mergePolicy`, `resolveRole`, `effortPatch` | Execution merge helpers; `mergePrompt` unions skills and takes the deepest role. |
|
|
39
37
|
| `DEFAULT_MODEL_RETRIES`, `MODEL_STREAM_TIMEOUT_MS` (3 min idle), `FALLBACK_AFTER_ATTEMPTS`, `DEFAULT_EFFORT`, `EFFORT_TABLE`, `MAX_CACHE_BREAKPOINTS`, `MAX_SYSTEM_BREAKPOINTS`, `MIN_CACHEABLE_TOKENS`, `LLM_SERVICE`, `EXECUTION_SERVICE`, `PROMPT_SERVICE` | Tuning + aliases. |
|
|
40
38
|
|
|
@@ -127,20 +125,6 @@ handle comes from the other end — `PromptComposeParams.utility` (and `AgentOpt
|
|
|
127
125
|
OPTIONAL resolver, unset wherever no cheap tier is wired, so a plugin that cannot get one degrades
|
|
128
126
|
rather than fails.
|
|
129
127
|
|
|
130
|
-
### Asking a person: `ask(exec, inquiry, signal?)`
|
|
131
|
-
|
|
132
|
-
A run that needs a decision which is genuinely not its own puts ONE question to whoever is behind
|
|
133
|
-
it, under `ExecutionState.inquiry` — `ask` hands it to the transport seated under
|
|
134
|
-
`inquiry.transport`, `default` returns the question's own default (or a decline) and asks nobody,
|
|
135
|
-
`refuse` throws `InquiryDeclined`. **No configuration means `default`**: a run that was never given
|
|
136
|
-
a channel must never block on one. The answer comes back capped by `capAnswer`, and
|
|
137
|
-
`inquiry` is NOT in `COLLABORATOR_KEYS` — it is state, so a resumed run asks the same way.
|
|
138
|
-
|
|
139
|
-
`inquiryTransportFor` throws `InquiryUnavailable`, registered fatal beside the throw so no retry
|
|
140
|
-
ladder spends itself on a channel nobody is behind. Wire a pipeline or an agent through
|
|
141
|
-
`executionInquiry(service, exec)`, the one place that reads that as "nobody is there" (`null`) while
|
|
142
|
-
letting a decline escape. Everything else about the primitive: [[inquiry]].
|
|
143
|
-
|
|
144
128
|
### The plugin seam is `advise`-only, and `use()` seats by alias
|
|
145
129
|
|
|
146
130
|
`ExecutionPlugin` carries one hook: `advise` — answer a performer's question about the project it
|
|
@@ -312,8 +296,7 @@ blank tool results are stubbed to keep their `tool_use` pairing). Details: packa
|
|
|
312
296
|
suite is gated on `ANTHROPIC_SECRET` and self-skips with a printed reason without it, and the OpenRouter
|
|
313
297
|
suite is disabled unconditionally: an aggregator on a separate account serving models no deployment runs,
|
|
314
298
|
whose `402 requires more credits` reads as a failure of the code under test. `plugins.spec.ts` covers the
|
|
315
|
-
`Compatible` provider offline
|
|
316
|
-
matrix and the `executionInquiry` bridge — no provider, no network.
|
|
299
|
+
`Compatible` provider offline.
|
|
317
300
|
|
|
318
301
|
## Depends On
|
|
319
302
|
|
|
@@ -325,5 +308,4 @@ matrix and the `executionInquiry` bridge — no provider, no network.
|
|
|
325
308
|
|
|
326
309
|
- [[llm-common]] — the serializable contracts · [[llm-prompt-caching]] — prompt composition, block
|
|
327
310
|
order and the cache invariants
|
|
328
|
-
- [[inquiry]] — the human-in-the-loop primitive: contracts, the registry, `ask`, and the pipeline park
|
|
329
311
|
- [[context]] — service registration · [[error]] — the `ResilientError` family
|
|
@@ -22,8 +22,8 @@ into a single system message:
|
|
|
22
22
|
| # | Block | Contributed by | Changes | Breakpoint |
|
|
23
23
|
|---|-------|----------------|---------|-----------|
|
|
24
24
|
| 0 | `Role` | `rolePlugin` ← `PromptPolicy.role` | per role | — |
|
|
25
|
-
| 1 | `Skills` | `skillsPlugin` ← registry + `inline
|
|
26
|
-
| 2 | `Packages` |
|
|
25
|
+
| 1 | `Skills` | `skillsPlugin` ← registry + `inline` | per helper | ✅ closes role+skills |
|
|
26
|
+
| 2 | `Packages` | application plugins (`owlmeansPackagesPlugin`) | per request | ✅ its own |
|
|
27
27
|
| 3 | `Context` | `contextPlugin` ← `context`, `callSkills` | per call | **never** (unless sole block) |
|
|
28
28
|
|
|
29
29
|
A caller's own leading `SystemMessage` is detached by `makeLlmModel` and re-emitted as
|
|
@@ -144,50 +144,6 @@ The manifest deliberately carries no git ref — version-matching comes from shi
|
|
|
144
144
|
copy inside the tarball, so for a package that is NOT installed the ref is a plugin option
|
|
145
145
|
(`ref`, default `main`).
|
|
146
146
|
|
|
147
|
-
## Project skills in a prompt (`@owlmeans/agent-skills/llm`)
|
|
148
|
-
|
|
149
|
-
`projectSkillsPlugin(options)` (order 55) loads the skills the PROJECT itself has installed —
|
|
150
|
-
the Agent Skills standard's `.agents/skills/<name>/SKILL.md` directories, read through the
|
|
151
|
-
`LlmFileProvider` and never through `node:fs`.
|
|
152
|
-
|
|
153
|
-
It splits a skill across two blocks because the halves have different cache lifetimes:
|
|
154
|
-
|
|
155
|
-
- the **index** (`- <name> — <description>`, sorted by `compareAlias`, capped, descriptions
|
|
156
|
-
clipped) goes into `Skills`. It is a property of the project, identical on every call about
|
|
157
|
-
it, so it must be byte-stable — it sits behind the breakpoint every such call shares.
|
|
158
|
-
- an activated **body** goes into `Packages`, which carries its own breakpoint and may change
|
|
159
|
-
per request.
|
|
160
|
-
|
|
161
|
-
That is progressive disclosure expressed as a cache layout: the model always knows what exists
|
|
162
|
-
and pays for a skill's text only when something says the call is about it.
|
|
163
|
-
|
|
164
|
-
Activation, in precedence order and capped at `maxActivated` (3): names the call itself asked
|
|
165
|
-
for → deterministic `rules` (`{ skills, when: { purposeType?, action?, mention?, paths? } }`)
|
|
166
|
-
→ the host's `activate(signals)` → optionally ONE `ctx.utility()` pick (`relevanceModel: true`,
|
|
167
|
-
off by default, memoised per project + signals hash so a retry re-sends identical bytes). Only
|
|
168
|
-
the deterministic mechanisms may influence anything cached.
|
|
169
|
-
|
|
170
|
-
Both body emitters claim `skill:<name>` first, and `owlmeansPackagesPlugin` (order 50) claims
|
|
171
|
-
before this one **by design**: a request that names `@owlmeans/auth` is a more specific signal
|
|
172
|
-
than a rule, so the package's copy wins the tie. A name the host registry already resolves is
|
|
173
|
-
dropped from the index entirely — `skillsPlugin` renders it, and indexing it too would
|
|
174
|
-
advertise one thing under two descriptions.
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
ctx.prompts().use(projectSkillsPlugin({
|
|
178
|
-
files: () => fileProvider,
|
|
179
|
-
rules: [{ skills: ['deploy'], when: { paths: ['charts/**', '*.yaml'] } }],
|
|
180
|
-
}))
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
Reads are cached per project (keyed by `LlmFileProvider.key`, `WeakMap` by instance without
|
|
184
|
-
one); listings expire after `listTtlMs` (30s) because skills are edited by hand mid-run. After
|
|
185
|
-
writing a skill into a project the agent is still working in, call
|
|
186
|
-
`invalidateProjectSkills(key)`.
|
|
187
|
-
|
|
188
|
-
`projectSkillsAgentPlugin` completes the picture inside a run: a `read_skill(name)` tool, for
|
|
189
|
-
the turn that turns out to need a body composition could not have predicted.
|
|
190
|
-
|
|
191
147
|
## Provider facts these rules encode
|
|
192
148
|
|
|
193
149
|
**Anthropic** ([prompt-caching](https://platform.claude.com/docs/en/build-with-claude/prompt-caching.md)) —
|
|
@@ -210,4 +166,4 @@ role); the `compatible` plugin deliberately does not, because aggregators runnin
|
|
|
210
166
|
|
|
211
167
|
- [[llm]] — the runtime and the provider-plugin seam
|
|
212
168
|
- [[llm-common]] — `SkillDefinition`, `PromptPolicy`, `PromptBlock`, `LlmFileProvider`
|
|
213
|
-
- [[agent-skills]] — `@owlmeans/agent-skills/llm
|
|
169
|
+
- [[agent-skills]] — `@owlmeans/agent-skills/llm` package-skill resolver and parser
|
package/build/consts.d.ts
CHANGED
|
@@ -102,10 +102,6 @@ export declare const EFFORT_TABLE: Record<ExecutionEffort, ModelConfigPatch>;
|
|
|
102
102
|
*
|
|
103
103
|
* `state` is in the list because a `TaskExecution` carries its own composed state —
|
|
104
104
|
* without excluding it every `derive`/`escalate`/`withPurpose` would nest another copy.
|
|
105
|
-
*
|
|
106
|
-
* `inquiry` is deliberately ABSENT: how a run may put a question to a person is state, and a run
|
|
107
|
-
* resumed from a snapshot must ask through the same channel under the same policy. Listing it
|
|
108
|
-
* here would leave a resumed run silently unable to ask anything.
|
|
109
105
|
*/
|
|
110
106
|
export declare const COLLABORATOR_KEYS: string[];
|
|
111
107
|
//# 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,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEtE,mFAAmF;AACnF,eAAO,MAAM,WAAW,yBAAyB,CAAA;AAEjD,8DAA8D;AAC9D,eAAO,MAAM,iBAAiB,mCAAmC,CAAA;AAEjE,0FAA0F;AAC1F,eAAO,MAAM,cAAc,gCAAgC,CAAA;AAE3D,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,QAAgB,CAAA;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,IAAI,CAAA;AAExC;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,QAAY,CAAA;AAE/C,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,IAAI,CAAA;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,IAAI,CAAA;AAEvC,kFAAkF;AAClF,eAAO,MAAM,iBAAiB,EAAE,QAAe,CAAA;AAE/C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAo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AAO,MAAM,oBAAoB,OAAO,CAAA;AAExC;;;;GAIG;AACH,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,QAGkD,CAAA;AAE/E;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,cAAc,CAAA;AAE7C,uFAAuF;AACvF,eAAO,MAAM,iBAAiB,YAAY,CAAA;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAA;AAE3C,8DAA8D;AAC9D,eAAO,MAAM,cAAc,2BAA2B,CAAA;AAEtD;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAKlE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAErC,CAAA"}
|
package/build/consts.js
CHANGED
|
@@ -109,10 +109,6 @@ export const EFFORT_TABLE = {
|
|
|
109
109
|
*
|
|
110
110
|
* `state` is in the list because a `TaskExecution` carries its own composed state —
|
|
111
111
|
* without excluding it every `derive`/`escalate`/`withPurpose` would nest another copy.
|
|
112
|
-
*
|
|
113
|
-
* `inquiry` is deliberately ABSENT: how a run may put a question to a person is state, and a run
|
|
114
|
-
* resumed from a snapshot must ask through the same channel under the same policy. Listing it
|
|
115
|
-
* here would leave a resumed run silently unable to ask anything.
|
|
116
112
|
*/
|
|
117
113
|
export const COLLABORATOR_KEYS = [
|
|
118
114
|
'state', 'models', 'model', 'temperatureFactory', 'outputErrors', 'files', 'prompts',
|
package/build/consts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,mFAAmF;AACnF,MAAM,CAAC,MAAM,WAAW,GAAG,sBAAsB,CAAA;AAEjD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,iBAAiB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,eAAe,GAAG,CAAC,CAAA;AAEhC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,6DAA6D;MACzF,gHAAgH;MAChH,iGAAiG;MACjG,2EAA2E,CAAA;AAE/E;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,WAAW,CAAA;AAE7C,uFAAuF;AACvF,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAA;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAA;AAE3C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC,QAAQ,CAAA;AAEtD;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAA8C;IACrE,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE;IAClD,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE,EAAE;IAC9B,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE;IACjE,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE;CACjE,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACzC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,OAAO,EAAE,SAAS;CACrF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/execution/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/execution/service.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKlE,OAAO,KAAK,EACkB,gBAAgB,EAAE,uBAAuB,EAAE,cAAc,EACrD,oBAAoB,EACrD,MAAM,YAAY,CAAA;AAMnB;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,cAAc,GAAG,cAAc,WAClE,uBAAuB,QAC1B,MAAM,gBAAgB,CAAC,CAAC,CAAC,KAC9B,gBAAgB,CAAC,CAAC,CAqKpB,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,cAAc,GAAG,cAAc,UACrE,MAAM,YACJ,uBAAuB,KAC/B,gBAAgB,CAAC,CAAC,CAMpB,CAAA;AAED,eAAO,MAAM,sBAAsB,GACjC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,cAAc,GAAG,cAAc,OAEtF,CAAC,UACC,MAAM,YACJ,uBAAuB,KAC/B,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAQ5B,CAAA"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { createService } from '@owlmeans/context';
|
|
2
|
-
import {
|
|
2
|
+
import { ExecutionEffort, ExecutionLevel, UTILITY_ROLE } from '@owlmeans/llm-common';
|
|
3
3
|
import { COLLABORATOR_KEYS, EXECUTION_SERVICE } from '../consts.js';
|
|
4
|
-
import { InquiryDeclined } from '../inquiry/errors.js';
|
|
5
|
-
import { inquiryTransportFor } from '../inquiry/transport.js';
|
|
6
4
|
import { composeExecState, composeTaskState, effortPatch, freeze, mergeOverride, mergePolicy, mergePrompt, resolveRole, } from './utils.js';
|
|
7
5
|
/**
|
|
8
6
|
* Build the execution service implementation WITHOUT registering it as a context
|
|
@@ -37,9 +35,6 @@ export const executionServiceApi = (options, self) => {
|
|
|
37
35
|
purpose: { ...input.purpose },
|
|
38
36
|
policy: { ...input.policy },
|
|
39
37
|
...(input.prompt != null ? { prompt: { ...input.prompt } } : {}),
|
|
40
|
-
// Copied like every other piece of state, and NOT listed in `COLLABORATOR_KEYS`: a resumed
|
|
41
|
-
// run has to ask through the channel and policy it was started with.
|
|
42
|
-
...(input.inquiry != null ? { inquiry: { ...input.inquiry } } : {}),
|
|
43
38
|
}),
|
|
44
39
|
forTask: (parent, input) => {
|
|
45
40
|
const { effort, phase, data, prompt, ...extras } = input;
|
|
@@ -147,15 +142,6 @@ export const executionServiceApi = (options, self) => {
|
|
|
147
142
|
}
|
|
148
143
|
return null;
|
|
149
144
|
},
|
|
150
|
-
ask: async (exec, inquiry, signal) => {
|
|
151
|
-
const policy = exec.inquiry?.policy ?? InquiryPolicy.Default;
|
|
152
|
-
// No channel was ever configured, so there is nobody to wait for: assume and carry on.
|
|
153
|
-
if (policy === InquiryPolicy.Default)
|
|
154
|
-
return defaultAnswerFor(inquiry);
|
|
155
|
-
if (policy === InquiryPolicy.Refuse)
|
|
156
|
-
throw new InquiryDeclined(inquiry.id);
|
|
157
|
-
return capAnswer(await inquiryTransportFor(exec.inquiry?.transport).ask(inquiry, signal));
|
|
158
|
-
},
|
|
159
145
|
snapshot: exec => {
|
|
160
146
|
if (exec.level === ExecutionLevel.Task) {
|
|
161
147
|
return freeze({ ...exec.state });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/execution/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/execution/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAEpF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAMnE,OAAO,EACL,gBAAgB,E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A4B,EAAE,EAChB,EAAE;IACvB,MAAM,OAAO,GAAwB,aAAa,CAChD,KAAK,EAAE,mBAAmB,CAAI,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAwB,CAC7E,CAAA;IAED,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAGpC,GAAM,EACN,KAAK,GAAW,iBAAiB,EACjC,OAAO,GAA4B,EAAE,EACR,EAAE;IAC/B,MAAM,OAAO,GAAG,GAAkC,CAAA;IAElD,OAAO,CAAC,eAAe,CAAC,oBAAoB,CAAI,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;IAEhE,OAAO,CAAC,UAAU,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAsB,KAAK,CAAC,CAAA;IAEtE,OAAO,OAAO,CAAA;AAChB,CAAC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
|
2
2
|
import type { InitializedService } from '@owlmeans/context';
|
|
3
|
-
import type { ExecutionEffort, ExecutionLevel, ExecutionState, FileProviderRef,
|
|
3
|
+
import type { ExecutionEffort, ExecutionLevel, ExecutionState, FileProviderRef, LlmPurpose, ModelConfigOverride, ModelPolicy, ModelRole, PromptPolicy, TaskExecutionState } from '@owlmeans/llm-common';
|
|
4
4
|
import type { LlmService, TemperatureFactory } from '../types.js';
|
|
5
5
|
import type { PromptService } from '../prompt/types.js';
|
|
6
6
|
/**
|
|
@@ -45,11 +45,6 @@ export interface ProjectExecutionInput {
|
|
|
45
45
|
purpose: LlmPurpose;
|
|
46
46
|
/** Baseline role and skills for the whole run. */
|
|
47
47
|
prompt?: PromptPolicy;
|
|
48
|
-
/**
|
|
49
|
-
* How this run may put a question to a person (see {@link ExecutionService.ask}). State, not a
|
|
50
|
-
* collaborator — it travels into every snapshot, so a resumed run asks the same way.
|
|
51
|
-
*/
|
|
52
|
-
inquiry?: InquiryConfig;
|
|
53
48
|
outputErrors?: boolean;
|
|
54
49
|
captureNull?: boolean;
|
|
55
50
|
}
|
|
@@ -182,19 +177,6 @@ export interface ExecutionService<S extends ExecutionShape = ExecutionShape> ext
|
|
|
182
177
|
*/
|
|
183
178
|
snapshot: (exec: S['exec']) => ExecutionState;
|
|
184
179
|
restore: (state: ExecutionState, collaborators?: S['collaborators']) => S['exec'];
|
|
185
|
-
/**
|
|
186
|
-
* Put a question to whoever is behind this execution, under its own policy.
|
|
187
|
-
*
|
|
188
|
-
* `ask` → the seated transport (and the answer comes back capped to
|
|
189
|
-
* `DEFAULT_INQUIRY_ANSWER_CHARS`); `default` → the question's own default, or a decline, which
|
|
190
|
-
* the caller is expected to RECORD as an assumption; `refuse` → `InquiryDeclined`. No config at
|
|
191
|
-
* all means `default`: a run that was never given a channel must never block on one.
|
|
192
|
-
*
|
|
193
|
-
* Throws `InquiryUnavailable` when the policy is `ask` and nothing is seated under the
|
|
194
|
-
* execution's transport key. Wire it through `executionInquiry` to read that as "nobody is
|
|
195
|
-
* there" instead.
|
|
196
|
-
*/
|
|
197
|
-
ask: (exec: S['exec'], inquiry: Inquiry, signal?: AbortSignal) => Promise<InquiryAnswer>;
|
|
198
180
|
/**
|
|
199
181
|
* Ask the registered plugins about the project this execution runs in. Plugins are
|
|
200
182
|
* consulted in registration order and the FIRST usable answer wins, so one advisor owns
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/execution/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAA;AAChF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,KAAK,EACV,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/execution/types.ts"],"names":[],"mappings":"AAAA,OAA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AC,CAAC,CAAC,CAAA;CACtC"}
|
package/build/index.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export * from './model.js';
|
|
|
5
5
|
export * from './service.js';
|
|
6
6
|
export * from './helpers/index.js';
|
|
7
7
|
export * from './execution/index.js';
|
|
8
|
-
export * from './inquiry/index.js';
|
|
9
8
|
export * from './prompt/index.js';
|
|
10
9
|
export type * from './plugins/types.js';
|
|
11
10
|
export { plugins, registerLlmPlugin, pluginOf, pluginFor, resolvePlugin } from './plugins/index.js';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,mBAAmB,oBAAoB,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnG,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,gBAAgB,GACpF,MAAM,qBAAqB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -4,7 +4,6 @@ export * from './model.js';
|
|
|
4
4
|
export * from './service.js';
|
|
5
5
|
export * from './helpers/index.js';
|
|
6
6
|
export * from './execution/index.js';
|
|
7
|
-
export * from './inquiry/index.js';
|
|
8
7
|
export * from './prompt/index.js';
|
|
9
8
|
export { plugins, registerLlmPlugin, pluginOf, pluginFor, resolvePlugin } from './plugins/index.js';
|
|
10
9
|
export { anthropicPlugin, ANTHROPIC_FAMILY, NO_SAMPLING_PREFIXES, rejectsSampling } from './plugins/anthropic.js';
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAE3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAE3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACnG,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACjH,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EACL,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,sBAAsB,EAAE,gBAAgB,GACpF,MAAM,qBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/llm",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.16",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@langchain/core": "^1.2.9",
|
|
48
48
|
"@langchain/openai": "^1.5.10",
|
|
49
49
|
"@owlmeans/dep-config": "workspace:*",
|
|
50
|
-
"@owlmeans/test": "^0.1.18-rc.
|
|
50
|
+
"@owlmeans/test": "^0.1.18-rc.11",
|
|
51
51
|
"@types/bun": "^1.4.0",
|
|
52
52
|
"@types/node": "^26.1.0",
|
|
53
53
|
"nodemon": "^3.1.14",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
58
|
-
"@owlmeans/basic-ids": "^0.1.18-rc.
|
|
59
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
60
|
-
"@owlmeans/error": "^0.1.18-rc.
|
|
61
|
-
"@owlmeans/llm-common": "^0.1.18-rc.
|
|
58
|
+
"@owlmeans/basic-ids": "^0.1.18-rc.12",
|
|
59
|
+
"@owlmeans/context": "^0.1.18-rc.11",
|
|
60
|
+
"@owlmeans/error": "^0.1.18-rc.11",
|
|
61
|
+
"@owlmeans/llm-common": "^0.1.18-rc.15",
|
|
62
62
|
"ajv": "^8.17.1"
|
|
63
63
|
},
|
|
64
64
|
"publishConfig": {
|
package/src/consts.ts
CHANGED
|
@@ -129,10 +129,6 @@ export const EFFORT_TABLE: Record<ExecutionEffort, ModelConfigPatch> = {
|
|
|
129
129
|
*
|
|
130
130
|
* `state` is in the list because a `TaskExecution` carries its own composed state —
|
|
131
131
|
* without excluding it every `derive`/`escalate`/`withPurpose` would nest another copy.
|
|
132
|
-
*
|
|
133
|
-
* `inquiry` is deliberately ABSENT: how a run may put a question to a person is state, and a run
|
|
134
|
-
* resumed from a snapshot must ask through the same channel under the same policy. Listing it
|
|
135
|
-
* here would leave a resumed run silently unable to ask anything.
|
|
136
132
|
*/
|
|
137
133
|
export const COLLABORATOR_KEYS: string[] = [
|
|
138
134
|
'state', 'models', 'model', 'temperatureFactory', 'outputErrors', 'files', 'prompts',
|
package/src/execution/service.ts
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import { createService } from '@owlmeans/context'
|
|
2
2
|
import type { BasicConfig, BasicContext } from '@owlmeans/context'
|
|
3
|
-
import {
|
|
4
|
-
capAnswer, defaultAnswerFor, ExecutionEffort, ExecutionLevel, InquiryPolicy, UTILITY_ROLE,
|
|
5
|
-
} from '@owlmeans/llm-common'
|
|
3
|
+
import { ExecutionEffort, ExecutionLevel, UTILITY_ROLE } from '@owlmeans/llm-common'
|
|
6
4
|
import type { ExecutionState, ModelPolicy, TaskExecutionState } from '@owlmeans/llm-common'
|
|
7
5
|
import { COLLABORATOR_KEYS, EXECUTION_SERVICE } from '../consts.js'
|
|
8
|
-
import { InquiryDeclined } from '../inquiry/errors.js'
|
|
9
|
-
import { inquiryTransportFor } from '../inquiry/transport.js'
|
|
10
6
|
import type { TemperatureFactory } from '../types.js'
|
|
11
7
|
import type {
|
|
12
8
|
Execution, ExecutionPlugin, ExecutionService, ExecutionServiceOptions, ExecutionShape,
|
|
@@ -56,9 +52,6 @@ export const executionServiceApi = <S extends ExecutionShape = ExecutionShape>(
|
|
|
56
52
|
purpose: { ...input.purpose },
|
|
57
53
|
policy: { ...input.policy },
|
|
58
54
|
...(input.prompt != null ? { prompt: { ...input.prompt } } : {}),
|
|
59
|
-
// Copied like every other piece of state, and NOT listed in `COLLABORATOR_KEYS`: a resumed
|
|
60
|
-
// run has to ask through the channel and policy it was started with.
|
|
61
|
-
...(input.inquiry != null ? { inquiry: { ...input.inquiry } } : {}),
|
|
62
55
|
}) as S['project'],
|
|
63
56
|
|
|
64
57
|
forTask: (parent, input) => {
|
|
@@ -187,15 +180,6 @@ export const executionServiceApi = <S extends ExecutionShape = ExecutionShape>(
|
|
|
187
180
|
return null
|
|
188
181
|
},
|
|
189
182
|
|
|
190
|
-
ask: async (exec, inquiry, signal) => {
|
|
191
|
-
const policy = exec.inquiry?.policy ?? InquiryPolicy.Default
|
|
192
|
-
// No channel was ever configured, so there is nobody to wait for: assume and carry on.
|
|
193
|
-
if (policy === InquiryPolicy.Default) return defaultAnswerFor(inquiry)
|
|
194
|
-
if (policy === InquiryPolicy.Refuse) throw new InquiryDeclined(inquiry.id)
|
|
195
|
-
|
|
196
|
-
return capAnswer(await inquiryTransportFor(exec.inquiry?.transport).ask(inquiry, signal))
|
|
197
|
-
},
|
|
198
|
-
|
|
199
183
|
snapshot: exec => {
|
|
200
184
|
if (exec.level === ExecutionLevel.Task) {
|
|
201
185
|
return freeze({ ...(exec as unknown as TaskExecution).state })
|
package/src/execution/types.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models'
|
|
2
2
|
import type { InitializedService } from '@owlmeans/context'
|
|
3
3
|
import type {
|
|
4
|
-
ExecutionEffort, ExecutionLevel, ExecutionState, FileProviderRef,
|
|
5
|
-
|
|
6
|
-
TaskExecutionState,
|
|
4
|
+
ExecutionEffort, ExecutionLevel, ExecutionState, FileProviderRef, LlmPurpose,
|
|
5
|
+
ModelConfigOverride, ModelPolicy, ModelRole, PromptPolicy, TaskExecutionState,
|
|
7
6
|
} from '@owlmeans/llm-common'
|
|
8
7
|
import type { LlmService, TemperatureFactory } from '../types.js'
|
|
9
8
|
import type { PromptService } from '../prompt/types.js'
|
|
@@ -54,11 +53,6 @@ export interface ProjectExecutionInput {
|
|
|
54
53
|
purpose: LlmPurpose
|
|
55
54
|
/** Baseline role and skills for the whole run. */
|
|
56
55
|
prompt?: PromptPolicy
|
|
57
|
-
/**
|
|
58
|
-
* How this run may put a question to a person (see {@link ExecutionService.ask}). State, not a
|
|
59
|
-
* collaborator — it travels into every snapshot, so a resumed run asks the same way.
|
|
60
|
-
*/
|
|
61
|
-
inquiry?: InquiryConfig
|
|
62
56
|
outputErrors?: boolean
|
|
63
57
|
captureNull?: boolean
|
|
64
58
|
}
|
|
@@ -206,20 +200,6 @@ export interface ExecutionService<S extends ExecutionShape = ExecutionShape> ext
|
|
|
206
200
|
snapshot: (exec: S['exec']) => ExecutionState
|
|
207
201
|
restore: (state: ExecutionState, collaborators?: S['collaborators']) => S['exec']
|
|
208
202
|
|
|
209
|
-
/**
|
|
210
|
-
* Put a question to whoever is behind this execution, under its own policy.
|
|
211
|
-
*
|
|
212
|
-
* `ask` → the seated transport (and the answer comes back capped to
|
|
213
|
-
* `DEFAULT_INQUIRY_ANSWER_CHARS`); `default` → the question's own default, or a decline, which
|
|
214
|
-
* the caller is expected to RECORD as an assumption; `refuse` → `InquiryDeclined`. No config at
|
|
215
|
-
* all means `default`: a run that was never given a channel must never block on one.
|
|
216
|
-
*
|
|
217
|
-
* Throws `InquiryUnavailable` when the policy is `ask` and nothing is seated under the
|
|
218
|
-
* execution's transport key. Wire it through `executionInquiry` to read that as "nobody is
|
|
219
|
-
* there" instead.
|
|
220
|
-
*/
|
|
221
|
-
ask: (exec: S['exec'], inquiry: Inquiry, signal?: AbortSignal) => Promise<InquiryAnswer>
|
|
222
|
-
|
|
223
203
|
/**
|
|
224
204
|
* Ask the registered plugins about the project this execution runs in. Plugins are
|
|
225
205
|
* consulted in registration order and the FIRST usable answer wins, so one advisor owns
|
package/src/index.ts
CHANGED
|
@@ -6,7 +6,6 @@ export * from './model.js'
|
|
|
6
6
|
export * from './service.js'
|
|
7
7
|
export * from './helpers/index.js'
|
|
8
8
|
export * from './execution/index.js'
|
|
9
|
-
export * from './inquiry/index.js'
|
|
10
9
|
export * from './prompt/index.js'
|
|
11
10
|
export type * from './plugins/types.js'
|
|
12
11
|
export { plugins, registerLlmPlugin, pluginOf, pluginFor, resolvePlugin } from './plugins/index.js'
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Inquiry, InquiryAnswer } from '@owlmeans/llm-common';
|
|
2
|
-
/**
|
|
3
|
-
* The ONE adapter between an execution and whatever asks questions through it — a pipeline
|
|
4
|
-
* runner's `inquiry.ask`, an agent plugin's channel.
|
|
5
|
-
*
|
|
6
|
-
* It exists so "nobody is there" is decided in a single place: {@link InquiryUnavailable} becomes
|
|
7
|
-
* `null`, which every consumer reads as "carry on without an answer", and everything else — a
|
|
8
|
-
* decline included — escapes untouched. A consumer that mapped the two together would turn a
|
|
9
|
-
* person saying "I will not decide" into a run that parks forever, or the reverse.
|
|
10
|
-
*
|
|
11
|
-
* It asks for the one METHOD it calls rather than for an `ExecutionService<S>`, and infers the
|
|
12
|
-
* execution type from the execution it is handed. A shape generic would be unusable here: every
|
|
13
|
-
* member of `ExecutionService<S>` mentions `S` only through an indexed access (`S['exec']`,
|
|
14
|
-
* `S['projectInput']`, …), which is not an inference site, so `S` fell back to the bare
|
|
15
|
-
* `ExecutionShape` and then refused every real service contravariantly on `root`. The narrow
|
|
16
|
-
* parameter also lets anything that can answer a question stand in — a service, a facade, a
|
|
17
|
-
* test double — which is the whole point of an adapter.
|
|
18
|
-
*/
|
|
19
|
-
export declare const executionInquiry: <E>(service: {
|
|
20
|
-
ask: (exec: E, inquiry: Inquiry, signal?: AbortSignal) => Promise<InquiryAnswer>;
|
|
21
|
-
}, exec: E) => ((inquiry: Inquiry, signal?: AbortSignal) => Promise<InquiryAnswer | null>);
|
|
22
|
-
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../src/inquiry/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAGlE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,WACvB;IAAE,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,CAAA;CAAE,QACvF,CAAC,KACN,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAS1E,CAAA"}
|
package/build/inquiry/bridge.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { InquiryUnavailable } from './errors.js';
|
|
2
|
-
/**
|
|
3
|
-
* The ONE adapter between an execution and whatever asks questions through it — a pipeline
|
|
4
|
-
* runner's `inquiry.ask`, an agent plugin's channel.
|
|
5
|
-
*
|
|
6
|
-
* It exists so "nobody is there" is decided in a single place: {@link InquiryUnavailable} becomes
|
|
7
|
-
* `null`, which every consumer reads as "carry on without an answer", and everything else — a
|
|
8
|
-
* decline included — escapes untouched. A consumer that mapped the two together would turn a
|
|
9
|
-
* person saying "I will not decide" into a run that parks forever, or the reverse.
|
|
10
|
-
*
|
|
11
|
-
* It asks for the one METHOD it calls rather than for an `ExecutionService<S>`, and infers the
|
|
12
|
-
* execution type from the execution it is handed. A shape generic would be unusable here: every
|
|
13
|
-
* member of `ExecutionService<S>` mentions `S` only through an indexed access (`S['exec']`,
|
|
14
|
-
* `S['projectInput']`, …), which is not an inference site, so `S` fell back to the bare
|
|
15
|
-
* `ExecutionShape` and then refused every real service contravariantly on `root`. The narrow
|
|
16
|
-
* parameter also lets anything that can answer a question stand in — a service, a facade, a
|
|
17
|
-
* test double — which is the whole point of an adapter.
|
|
18
|
-
*/
|
|
19
|
-
export const executionInquiry = (service, exec) => async (inquiry, signal) => {
|
|
20
|
-
try {
|
|
21
|
-
return await service.ask(exec, inquiry, signal);
|
|
22
|
-
}
|
|
23
|
-
catch (e) {
|
|
24
|
-
if (e instanceof InquiryUnavailable)
|
|
25
|
-
return null;
|
|
26
|
-
throw e;
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=bridge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.js","sourceRoot":"","sources":["../../src/inquiry/bridge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,OAA6F,EAC7F,IAAO,EACsE,EAAE,CAC/E,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE;IACxB,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;IACjD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,kBAAkB;YAAE,OAAO,IAAI,CAAA;QAEhD,MAAM,CAAC,CAAA;IACT,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ResilientError } from '@owlmeans/error';
|
|
2
|
-
export declare class InquiryError extends ResilientError {
|
|
3
|
-
static typeName: string;
|
|
4
|
-
constructor(message?: string);
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* No transport is seated under this key, or the one that was has gone.
|
|
8
|
-
*
|
|
9
|
-
* FATAL, and registered as such beside the throw. Nothing above it can improve by trying again:
|
|
10
|
-
* every retry ladder in the stack exists for a performer that answered badly, and there is nobody
|
|
11
|
-
* to ask. Left unrecognised, an absent channel costs an agent its whole turn budget on a tool it
|
|
12
|
-
* will never get an answer from.
|
|
13
|
-
*/
|
|
14
|
-
export declare class InquiryUnavailable extends InquiryError {
|
|
15
|
-
static typeName: string;
|
|
16
|
-
constructor(message?: string);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Nobody may be asked (policy `refuse`), or the answerer refused to decide.
|
|
20
|
-
*
|
|
21
|
-
* NOT retryable either, and deliberately a different class from {@link InquiryUnavailable}: a
|
|
22
|
-
* channel that answered "I will not decide this" is working. Whoever asked must decide itself and
|
|
23
|
-
* record the assumption, rather than treat the run as broken.
|
|
24
|
-
*/
|
|
25
|
-
export declare class InquiryDeclined extends InquiryError {
|
|
26
|
-
static typeName: string;
|
|
27
|
-
constructor(message?: string);
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/inquiry/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,qBAAa,YAAa,SAAQ,cAAc;IAC9C,OAAuB,QAAQ,SAAsC;IAErE,YAAY,OAAO,GAAE,MAAgB,EAEpC;CACF;AAED;;;;;;;GAOG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,OAAuB,QAAQ,SAAwC;IAEvE,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF;AAED;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAuB,QAAQ,SAAqC;IAEpE,YAAY,OAAO,GAAE,MAAgB,EAGpC;CACF"}
|
package/build/inquiry/errors.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { ResilientError } from '@owlmeans/error';
|
|
2
|
-
export class InquiryError extends ResilientError {
|
|
3
|
-
static typeName = `Inquiry${ResilientError.typeName}`;
|
|
4
|
-
constructor(message = 'error') {
|
|
5
|
-
super(InquiryError.typeName, `inquiry:${message}`);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* No transport is seated under this key, or the one that was has gone.
|
|
10
|
-
*
|
|
11
|
-
* FATAL, and registered as such beside the throw. Nothing above it can improve by trying again:
|
|
12
|
-
* every retry ladder in the stack exists for a performer that answered badly, and there is nobody
|
|
13
|
-
* to ask. Left unrecognised, an absent channel costs an agent its whole turn budget on a tool it
|
|
14
|
-
* will never get an answer from.
|
|
15
|
-
*/
|
|
16
|
-
export class InquiryUnavailable extends InquiryError {
|
|
17
|
-
static typeName = `Unavailable${InquiryError.typeName}`;
|
|
18
|
-
constructor(message = 'error') {
|
|
19
|
-
super(`unavailable:${message}`);
|
|
20
|
-
this.type = InquiryUnavailable.typeName;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Nobody may be asked (policy `refuse`), or the answerer refused to decide.
|
|
25
|
-
*
|
|
26
|
-
* NOT retryable either, and deliberately a different class from {@link InquiryUnavailable}: a
|
|
27
|
-
* channel that answered "I will not decide this" is working. Whoever asked must decide itself and
|
|
28
|
-
* record the assumption, rather than treat the run as broken.
|
|
29
|
-
*/
|
|
30
|
-
export class InquiryDeclined extends InquiryError {
|
|
31
|
-
static typeName = `Declined${InquiryError.typeName}`;
|
|
32
|
-
constructor(message = 'error') {
|
|
33
|
-
super(`declined:${message}`);
|
|
34
|
-
this.type = InquiryDeclined.typeName;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
ResilientError.registerErrorClass(InquiryError);
|
|
38
|
-
ResilientError.registerErrorClass(InquiryUnavailable);
|
|
39
|
-
ResilientError.registerErrorClass(InquiryDeclined);
|
|
40
|
-
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/inquiry/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAEhD,MAAM,OAAO,YAAa,SAAQ,cAAc;IACvC,MAAM,CAAU,QAAQ,GAAG,UAAU,cAAc,CAAC,QAAQ,EAAE,CAAA;IAErE,YAAY,OAAO,GAAW,OAAO;QACnC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,WAAW,OAAO,EAAE,CAAC,CAAA;IACpD,CAAC;CACF;AAED;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAC3C,MAAM,CAAU,QAAQ,GAAG,cAAc,YAAY,CAAC,QAAQ,EAAE,CAAA;IAEvE,YAAY,OAAO,GAAW,OAAO;QACnC,KAAK,CAAC,eAAe,OAAO,EAAE,CAAC,CAAA;QAC/B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC,QAAQ,CAAA;IACzC,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,OAAO,eAAgB,SAAQ,YAAY;IACxC,MAAM,CAAU,QAAQ,GAAG,WAAW,YAAY,CAAC,QAAQ,EAAE,CAAA;IAEpE,YAAY,OAAO,GAAW,OAAO;QACnC,KAAK,CAAC,YAAY,OAAO,EAAE,CAAC,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC,QAAQ,CAAA;IACtC,CAAC;CACF;AAED,cAAc,CAAC,kBAAkB,CAAC,YAAY,CAAC,CAAA;AAC/C,cAAc,CAAC,kBAAkB,CAAC,kBAAkB,CAAC,CAAA;AACrD,cAAc,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAA"}
|
package/build/inquiry/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inquiry/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA"}
|
package/build/inquiry/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/inquiry/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { InquiryTransport } from '@owlmeans/llm-common';
|
|
2
|
-
export declare const registerInquiryTransport: (key: string, transport: InquiryTransport) => void;
|
|
3
|
-
export declare const releaseInquiryTransport: (key: string) => void;
|
|
4
|
-
export declare const hasInquiryTransport: (key: string) => boolean;
|
|
5
|
-
/**
|
|
6
|
-
* The transport for a key, or a fatal refusal — never a wait.
|
|
7
|
-
*
|
|
8
|
-
* Named `inquiryTransportFor` rather than `transportFor`: `@owlmeans/llm` and
|
|
9
|
-
* `@owlmeans/llm-delegate` are re-exported into one namespace by `@owlmeans/viable`.
|
|
10
|
-
*/
|
|
11
|
-
export declare const inquiryTransportFor: (key: string | undefined) => InquiryTransport;
|
|
12
|
-
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/inquiry/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAe5D,eAAO,MAAM,wBAAwB,QAAS,MAAM,aAAa,gBAAgB,KAAG,IAEnF,CAAA;AAED,eAAO,MAAM,uBAAuB,QAAS,MAAM,KAAG,IAErD,CAAA;AAED,eAAO,MAAM,mBAAmB,QAAS,MAAM,KAAG,OAAkC,CAAA;AAEpF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,QAAS,MAAM,GAAG,SAAS,KAAG,gBAM7D,CAAA"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { registerFatalError } from '../helpers/retry.js';
|
|
2
|
-
import { InquiryUnavailable } from './errors.js';
|
|
3
|
-
/**
|
|
4
|
-
* Which channel reaches which person.
|
|
5
|
-
*
|
|
6
|
-
* Module-level and keyed by string, exactly like the delegate-transport registry beside it: a
|
|
7
|
-
* process holds many at once — one per connected agent, one per open browser session — and an
|
|
8
|
-
* execution names the one its run belongs to. Seating is what an application does when a channel
|
|
9
|
-
* attaches; releasing is what it does when one goes away, and a question that arrives afterwards
|
|
10
|
-
* fails immediately rather than hanging on nobody.
|
|
11
|
-
*/
|
|
12
|
-
const transports = {};
|
|
13
|
-
export const registerInquiryTransport = (key, transport) => {
|
|
14
|
-
transports[key] = transport;
|
|
15
|
-
};
|
|
16
|
-
export const releaseInquiryTransport = (key) => {
|
|
17
|
-
delete transports[key];
|
|
18
|
-
};
|
|
19
|
-
export const hasInquiryTransport = (key) => transports[key] != null;
|
|
20
|
-
/**
|
|
21
|
-
* The transport for a key, or a fatal refusal — never a wait.
|
|
22
|
-
*
|
|
23
|
-
* Named `inquiryTransportFor` rather than `transportFor`: `@owlmeans/llm` and
|
|
24
|
-
* `@owlmeans/llm-delegate` are re-exported into one namespace by `@owlmeans/viable`.
|
|
25
|
-
*/
|
|
26
|
-
export const inquiryTransportFor = (key) => {
|
|
27
|
-
if (key == null || transports[key] == null) {
|
|
28
|
-
throw new InquiryUnavailable(key ?? 'unkeyed');
|
|
29
|
-
}
|
|
30
|
-
return transports[key];
|
|
31
|
-
};
|
|
32
|
-
// Beside the throw, so no caller has to remember: an absent channel aborts every retry loop at
|
|
33
|
-
// once instead of being spent through as if the answer might come next time.
|
|
34
|
-
registerFatalError(e => e instanceof InquiryUnavailable ? e : null);
|
|
35
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/inquiry/transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,GAAqC,EAAE,CAAA;AAEvD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,GAAW,EAAE,SAA2B,EAAQ,EAAE;IACzF,UAAU,CAAC,GAAG,CAAC,GAAG,SAAS,CAAA;AAC7B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAQ,EAAE;IAC3D,OAAO,UAAU,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAW,EAAW,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAA;AAEpF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAuB,EAAoB,EAAE;IAC/E,IAAI,GAAG,IAAI,IAAI,IAAI,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC;QAC3C,MAAM,IAAI,kBAAkB,CAAC,GAAG,IAAI,SAAS,CAAC,CAAA;IAChD,CAAC;IAED,OAAO,UAAU,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC,CAAA;AAED,+FAA+F;AAC/F,6EAA6E;AAC7E,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,YAAY,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA"}
|
package/src/inquiry/bridge.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Inquiry, InquiryAnswer } from '@owlmeans/llm-common'
|
|
2
|
-
import { InquiryUnavailable } from './errors.js'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The ONE adapter between an execution and whatever asks questions through it — a pipeline
|
|
6
|
-
* runner's `inquiry.ask`, an agent plugin's channel.
|
|
7
|
-
*
|
|
8
|
-
* It exists so "nobody is there" is decided in a single place: {@link InquiryUnavailable} becomes
|
|
9
|
-
* `null`, which every consumer reads as "carry on without an answer", and everything else — a
|
|
10
|
-
* decline included — escapes untouched. A consumer that mapped the two together would turn a
|
|
11
|
-
* person saying "I will not decide" into a run that parks forever, or the reverse.
|
|
12
|
-
*
|
|
13
|
-
* It asks for the one METHOD it calls rather than for an `ExecutionService<S>`, and infers the
|
|
14
|
-
* execution type from the execution it is handed. A shape generic would be unusable here: every
|
|
15
|
-
* member of `ExecutionService<S>` mentions `S` only through an indexed access (`S['exec']`,
|
|
16
|
-
* `S['projectInput']`, …), which is not an inference site, so `S` fell back to the bare
|
|
17
|
-
* `ExecutionShape` and then refused every real service contravariantly on `root`. The narrow
|
|
18
|
-
* parameter also lets anything that can answer a question stand in — a service, a facade, a
|
|
19
|
-
* test double — which is the whole point of an adapter.
|
|
20
|
-
*/
|
|
21
|
-
export const executionInquiry = <E>(
|
|
22
|
-
service: { ask: (exec: E, inquiry: Inquiry, signal?: AbortSignal) => Promise<InquiryAnswer> },
|
|
23
|
-
exec: E
|
|
24
|
-
): ((inquiry: Inquiry, signal?: AbortSignal) => Promise<InquiryAnswer | null>) =>
|
|
25
|
-
async (inquiry, signal) => {
|
|
26
|
-
try {
|
|
27
|
-
return await service.ask(exec, inquiry, signal)
|
|
28
|
-
} catch (e) {
|
|
29
|
-
if (e instanceof InquiryUnavailable) return null
|
|
30
|
-
|
|
31
|
-
throw e
|
|
32
|
-
}
|
|
33
|
-
}
|
package/src/inquiry/errors.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ResilientError } from '@owlmeans/error'
|
|
2
|
-
|
|
3
|
-
export class InquiryError extends ResilientError {
|
|
4
|
-
public static override typeName = `Inquiry${ResilientError.typeName}`
|
|
5
|
-
|
|
6
|
-
constructor(message: string = 'error') {
|
|
7
|
-
super(InquiryError.typeName, `inquiry:${message}`)
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* No transport is seated under this key, or the one that was has gone.
|
|
13
|
-
*
|
|
14
|
-
* FATAL, and registered as such beside the throw. Nothing above it can improve by trying again:
|
|
15
|
-
* every retry ladder in the stack exists for a performer that answered badly, and there is nobody
|
|
16
|
-
* to ask. Left unrecognised, an absent channel costs an agent its whole turn budget on a tool it
|
|
17
|
-
* will never get an answer from.
|
|
18
|
-
*/
|
|
19
|
-
export class InquiryUnavailable extends InquiryError {
|
|
20
|
-
public static override typeName = `Unavailable${InquiryError.typeName}`
|
|
21
|
-
|
|
22
|
-
constructor(message: string = 'error') {
|
|
23
|
-
super(`unavailable:${message}`)
|
|
24
|
-
this.type = InquiryUnavailable.typeName
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Nobody may be asked (policy `refuse`), or the answerer refused to decide.
|
|
30
|
-
*
|
|
31
|
-
* NOT retryable either, and deliberately a different class from {@link InquiryUnavailable}: a
|
|
32
|
-
* channel that answered "I will not decide this" is working. Whoever asked must decide itself and
|
|
33
|
-
* record the assumption, rather than treat the run as broken.
|
|
34
|
-
*/
|
|
35
|
-
export class InquiryDeclined extends InquiryError {
|
|
36
|
-
public static override typeName = `Declined${InquiryError.typeName}`
|
|
37
|
-
|
|
38
|
-
constructor(message: string = 'error') {
|
|
39
|
-
super(`declined:${message}`)
|
|
40
|
-
this.type = InquiryDeclined.typeName
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
ResilientError.registerErrorClass(InquiryError)
|
|
45
|
-
ResilientError.registerErrorClass(InquiryUnavailable)
|
|
46
|
-
ResilientError.registerErrorClass(InquiryDeclined)
|
package/src/inquiry/index.ts
DELETED
package/src/inquiry/transport.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { InquiryTransport } from '@owlmeans/llm-common'
|
|
2
|
-
import { registerFatalError } from '../helpers/retry.js'
|
|
3
|
-
import { InquiryUnavailable } from './errors.js'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Which channel reaches which person.
|
|
7
|
-
*
|
|
8
|
-
* Module-level and keyed by string, exactly like the delegate-transport registry beside it: a
|
|
9
|
-
* process holds many at once — one per connected agent, one per open browser session — and an
|
|
10
|
-
* execution names the one its run belongs to. Seating is what an application does when a channel
|
|
11
|
-
* attaches; releasing is what it does when one goes away, and a question that arrives afterwards
|
|
12
|
-
* fails immediately rather than hanging on nobody.
|
|
13
|
-
*/
|
|
14
|
-
const transports: Record<string, InquiryTransport> = {}
|
|
15
|
-
|
|
16
|
-
export const registerInquiryTransport = (key: string, transport: InquiryTransport): void => {
|
|
17
|
-
transports[key] = transport
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const releaseInquiryTransport = (key: string): void => {
|
|
21
|
-
delete transports[key]
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const hasInquiryTransport = (key: string): boolean => transports[key] != null
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The transport for a key, or a fatal refusal — never a wait.
|
|
28
|
-
*
|
|
29
|
-
* Named `inquiryTransportFor` rather than `transportFor`: `@owlmeans/llm` and
|
|
30
|
-
* `@owlmeans/llm-delegate` are re-exported into one namespace by `@owlmeans/viable`.
|
|
31
|
-
*/
|
|
32
|
-
export const inquiryTransportFor = (key: string | undefined): InquiryTransport => {
|
|
33
|
-
if (key == null || transports[key] == null) {
|
|
34
|
-
throw new InquiryUnavailable(key ?? 'unkeyed')
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return transports[key]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Beside the throw, so no caller has to remember: an absent channel aborts every retry loop at
|
|
41
|
-
// once instead of being spent through as if the answer might come next time.
|
|
42
|
-
registerFatalError(e => e instanceof InquiryUnavailable ? e : null)
|
package/tests/inquiry.spec.ts
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, test } from 'bun:test'
|
|
2
|
-
import { DEFAULT_INQUIRY_ANSWER_CHARS, InquiryKind, InquiryPolicy } from '@owlmeans/llm-common'
|
|
3
|
-
import type { Inquiry, InquiryAnswer } from '@owlmeans/llm-common'
|
|
4
|
-
import {
|
|
5
|
-
DEFAULT_EFFORT, executionInquiry, hasInquiryTransport, inquiryTransportFor, InquiryDeclined,
|
|
6
|
-
InquiryUnavailable, isFatalError, makeExecutionService, makeLlmService,
|
|
7
|
-
registerInquiryTransport, releaseInquiryTransport,
|
|
8
|
-
} from '@owlmeans/llm'
|
|
9
|
-
import type {
|
|
10
|
-
Execution, ExecutionService, ExecutionShape, ProjectExecution, ProjectExecutionInput,
|
|
11
|
-
} from '@owlmeans/llm'
|
|
12
|
-
import { offlineConfigs } from './context.js'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The runtime half of the inquiry primitive: who answers, under which policy, and what a caller
|
|
16
|
-
* above it is allowed to conclude from a failure. The distinction the specs are here to hold is
|
|
17
|
-
* that "nobody is there" and "the person declined" are different outcomes — one is a channel
|
|
18
|
-
* fault no retry can fix, the other is a decision the run carries on from.
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
const KEY = 'spec-inquiry'
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* A consumer's OWN shape, every member narrowed — the way `@owlmeans/viable` declares
|
|
25
|
-
* `ViableExecutionShape` and instantiates the service with it.
|
|
26
|
-
*
|
|
27
|
-
* The bridge must take a service built from one without a type argument. Being generic over the
|
|
28
|
-
* SHAPE cannot do that: `S` appears in `ExecutionService<S>` only through indexed accesses
|
|
29
|
-
* (`S['exec']`, `S['projectInput']`, …), which is not an inference site, so it fell back to the
|
|
30
|
-
* bare `ExecutionShape` and then refused every real service contravariantly on `root`. Nothing
|
|
31
|
-
* written against the DEFAULT shape can see that, which is why this spec declares its own.
|
|
32
|
-
*/
|
|
33
|
-
interface SpecExecution extends Execution {
|
|
34
|
-
origin: string
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
interface SpecProjectExecution extends ProjectExecution {
|
|
38
|
-
origin: string
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
interface SpecProjectInput extends ProjectExecutionInput {
|
|
42
|
-
origin: string
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
interface SpecShape extends ExecutionShape {
|
|
46
|
-
exec: SpecExecution
|
|
47
|
-
project: SpecProjectExecution
|
|
48
|
-
projectInput: SpecProjectInput
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const inquiry = (patch: Partial<Inquiry> = {}): Inquiry => ({
|
|
52
|
-
id: 'q1',
|
|
53
|
-
kind: InquiryKind.Choice,
|
|
54
|
-
question: 'Which database does the origin use?',
|
|
55
|
-
options: [
|
|
56
|
-
{ value: 'postgres', label: 'PostgreSQL' },
|
|
57
|
-
{ value: 'mongo', label: 'MongoDB' },
|
|
58
|
-
],
|
|
59
|
-
...patch,
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
let service: ExecutionService
|
|
63
|
-
let asked: Inquiry[]
|
|
64
|
-
|
|
65
|
-
/** A channel that records what it was asked and answers what the spec told it to. */
|
|
66
|
-
const seat = (answer: (asked: Inquiry) => InquiryAnswer | Promise<InquiryAnswer>): void => {
|
|
67
|
-
registerInquiryTransport(KEY, {
|
|
68
|
-
ask: async question => {
|
|
69
|
-
asked.push(question)
|
|
70
|
-
|
|
71
|
-
return await answer(question)
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const root = (transport?: string, policy?: InquiryPolicy): ProjectExecution => service.root({
|
|
77
|
-
models: () => makeLlmService({ models: offlineConfigs }, `spec-inquiry-llm-${asked.length}`),
|
|
78
|
-
policy: { effort: DEFAULT_EFFORT },
|
|
79
|
-
purpose: { type: 'spec' },
|
|
80
|
-
...(policy != null ? { inquiry: { transport, policy } } : {}),
|
|
81
|
-
})
|
|
82
|
-
|
|
83
|
-
beforeEach(() => {
|
|
84
|
-
asked = []
|
|
85
|
-
service = makeExecutionService(`spec-inquiry-${Math.trunc(performance.now() * 1000)}`)
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
afterEach(() => releaseInquiryTransport(KEY))
|
|
89
|
-
|
|
90
|
-
describe('@owlmeans/llm — the inquiry transport registry', () => {
|
|
91
|
-
test('a channel is seated under a key and released again', () => {
|
|
92
|
-
expect(hasInquiryTransport(KEY)).toBe(false)
|
|
93
|
-
seat(() => ({ inquiryId: 'q1', value: 'mongo' }))
|
|
94
|
-
expect(hasInquiryTransport(KEY)).toBe(true)
|
|
95
|
-
expect(inquiryTransportFor(KEY)).toBeDefined()
|
|
96
|
-
releaseInquiryTransport(KEY)
|
|
97
|
-
expect(hasInquiryTransport(KEY)).toBe(false)
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
test('an unseated key refuses at once rather than waiting for one to arrive', () => {
|
|
101
|
-
expect(() => inquiryTransportFor(KEY)).toThrow(InquiryUnavailable)
|
|
102
|
-
expect(() => inquiryTransportFor(undefined)).toThrow(InquiryUnavailable)
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
test('an absent channel is fatal, so no retry ladder spends itself on it', () => {
|
|
106
|
-
expect(isFatalError(new InquiryUnavailable('x'))).not.toBeNull()
|
|
107
|
-
// A decline is an answer, not a fault: nothing above may abort a run over one.
|
|
108
|
-
expect(isFatalError(new InquiryDeclined('q1'))).toBeNull()
|
|
109
|
-
})
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
describe('@owlmeans/llm — ExecutionService.ask policy matrix', () => {
|
|
113
|
-
test('`ask` reaches the seated channel and caps what comes back', async () => {
|
|
114
|
-
seat(() => ({ inquiryId: 'q1', value: 'mongo', text: 'x'.repeat(10) }))
|
|
115
|
-
const answer = await service.ask(root(KEY, InquiryPolicy.Ask), inquiry())
|
|
116
|
-
expect(answer.value).toBe('mongo')
|
|
117
|
-
expect(answer.truncated).toBeUndefined()
|
|
118
|
-
expect(asked).toHaveLength(1)
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
test('an answer over the ceiling is cut here, and the cut is reported', async () => {
|
|
122
|
-
// The cap belongs to the service, not to the channel: nothing seated by an application is
|
|
123
|
-
// obliged to know the ceiling, and an answer that reached a pipeline state uncut is prose in
|
|
124
|
-
// a state made of keys.
|
|
125
|
-
seat(() => ({ inquiryId: 'q1', text: 'x'.repeat(DEFAULT_INQUIRY_ANSWER_CHARS + 5) }))
|
|
126
|
-
const answer = await service.ask(root(KEY, InquiryPolicy.Ask), inquiry({ kind: InquiryKind.Text }))
|
|
127
|
-
expect(answer.text).toHaveLength(DEFAULT_INQUIRY_ANSWER_CHARS)
|
|
128
|
-
expect(answer.truncated).toBe(true)
|
|
129
|
-
})
|
|
130
|
-
|
|
131
|
-
test('`ask` with nothing seated is an unavailable channel, never a decline', async () => {
|
|
132
|
-
await expect(service.ask(root(KEY, InquiryPolicy.Ask), inquiry()))
|
|
133
|
-
.rejects.toThrow(InquiryUnavailable)
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
test('`default` assumes the default the question carries, or declines — and asks nobody', async () => {
|
|
137
|
-
const exec = root(KEY, InquiryPolicy.Default)
|
|
138
|
-
seat(() => ({ inquiryId: 'q1', value: 'mongo' }))
|
|
139
|
-
expect(await service.ask(exec, inquiry({ default: 'postgres' })))
|
|
140
|
-
.toEqual({ inquiryId: 'q1', value: 'postgres' })
|
|
141
|
-
expect(await service.ask(exec, inquiry())).toEqual({ inquiryId: 'q1', declined: true })
|
|
142
|
-
expect(asked).toHaveLength(0)
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
test('`refuse` declines every question outright', async () => {
|
|
146
|
-
seat(() => ({ inquiryId: 'q1', value: 'mongo' }))
|
|
147
|
-
await expect(service.ask(root(KEY, InquiryPolicy.Refuse), inquiry({ default: 'postgres' })))
|
|
148
|
-
.rejects.toThrow(InquiryDeclined)
|
|
149
|
-
expect(asked).toHaveLength(0)
|
|
150
|
-
})
|
|
151
|
-
|
|
152
|
-
test('no configuration at all behaves as `default` — a run given no channel never blocks', async () => {
|
|
153
|
-
seat(() => ({ inquiryId: 'q1', value: 'mongo' }))
|
|
154
|
-
expect(await service.ask(root(), inquiry({ default: 'postgres' })))
|
|
155
|
-
.toEqual({ inquiryId: 'q1', value: 'postgres' })
|
|
156
|
-
expect(asked).toHaveLength(0)
|
|
157
|
-
})
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
describe('@owlmeans/llm — the executionInquiry bridge', () => {
|
|
161
|
-
test('an unavailable channel reads as "nobody is there"', async () => {
|
|
162
|
-
const ask = executionInquiry(service, root(KEY, InquiryPolicy.Ask))
|
|
163
|
-
expect(await ask(inquiry())).toBeNull()
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
test('a decline escapes — a person who would not decide is not an absent person', async () => {
|
|
167
|
-
const ask = executionInquiry(service, root(KEY, InquiryPolicy.Refuse))
|
|
168
|
-
await expect(ask(inquiry())).rejects.toThrow(InquiryDeclined)
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
test('an answered question comes back whole', async () => {
|
|
172
|
-
seat(() => ({ inquiryId: 'q1', value: 'postgres' }))
|
|
173
|
-
const ask = executionInquiry(service, root(KEY, InquiryPolicy.Ask))
|
|
174
|
-
expect(await ask(inquiry())).toEqual({ inquiryId: 'q1', value: 'postgres' })
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
test('a consumer\'s own execution shape wires through unannotated', async () => {
|
|
178
|
-
seat(() => ({ inquiryId: 'q1', value: 'postgres' }))
|
|
179
|
-
const scoped = makeExecutionService<SpecShape>(`spec-inquiry-shape-${asked.length}`)
|
|
180
|
-
const exec = scoped.root({
|
|
181
|
-
models: () => makeLlmService({ models: offlineConfigs }, 'spec-inquiry-shape-llm'),
|
|
182
|
-
policy: { effort: DEFAULT_EFFORT },
|
|
183
|
-
purpose: { type: 'spec' },
|
|
184
|
-
origin: 'legacy-app',
|
|
185
|
-
inquiry: { transport: KEY, policy: InquiryPolicy.Ask },
|
|
186
|
-
})
|
|
187
|
-
|
|
188
|
-
expect(exec.origin).toBe('legacy-app')
|
|
189
|
-
expect(await executionInquiry(scoped, exec)(inquiry()))
|
|
190
|
-
.toEqual({ inquiryId: 'q1', value: 'postgres' })
|
|
191
|
-
})
|
|
192
|
-
})
|
|
193
|
-
|
|
194
|
-
describe('@owlmeans/llm — the channel survives a snapshot', () => {
|
|
195
|
-
test('a resumed execution asks through the same channel under the same policy', () => {
|
|
196
|
-
const state = service.snapshot(root(KEY, InquiryPolicy.Ask))
|
|
197
|
-
expect(state.inquiry).toEqual({ transport: KEY, policy: InquiryPolicy.Ask })
|
|
198
|
-
expect(service.restore(state).inquiry).toEqual({ transport: KEY, policy: InquiryPolicy.Ask })
|
|
199
|
-
})
|
|
200
|
-
})
|