@owlmeans/llm 0.1.18-rc.13 → 0.1.18-rc.14
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 +39 -11
- package/build/consts.d.ts +4 -0
- package/build/consts.d.ts.map +1 -1
- package/build/consts.js +4 -0
- package/build/consts.js.map +1 -1
- package/build/execution/service.d.ts.map +1 -1
- package/build/execution/service.js +25 -10
- package/build/execution/service.js.map +1 -1
- package/build/execution/types.d.ts +40 -13
- package/build/execution/types.d.ts.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/inquiry/bridge.d.ts +22 -0
- package/build/inquiry/bridge.d.ts.map +1 -0
- package/build/inquiry/bridge.js +29 -0
- package/build/inquiry/bridge.js.map +1 -0
- package/build/inquiry/errors.d.ts +29 -0
- package/build/inquiry/errors.d.ts.map +1 -0
- package/build/inquiry/errors.js +40 -0
- package/build/inquiry/errors.js.map +1 -0
- package/build/inquiry/index.d.ts +4 -0
- package/build/inquiry/index.d.ts.map +1 -0
- package/build/inquiry/index.js +4 -0
- package/build/inquiry/index.js.map +1 -0
- package/build/inquiry/transport.d.ts +12 -0
- package/build/inquiry/transport.d.ts.map +1 -0
- package/build/inquiry/transport.js +35 -0
- package/build/inquiry/transport.js.map +1 -0
- package/build/types.d.ts +8 -0
- package/build/types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/consts.ts +4 -0
- package/src/execution/service.ts +26 -11
- package/src/execution/types.ts +44 -15
- package/src/index.ts +1 -0
- package/src/inquiry/bridge.ts +33 -0
- package/src/inquiry/errors.ts +46 -0
- package/src/inquiry/index.ts +3 -0
- package/src/inquiry/transport.ts +42 -0
- package/src/types.ts +8 -0
- package/tests/execution.spec.ts +16 -21
- package/tests/inquiry.spec.ts +200 -0
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.13
|
|
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.14",
|
|
5
|
+
"generatedAt": "2026-09-10T18:54:42.495Z",
|
|
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.14"` 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
|
|
@@ -23,7 +23,7 @@ symbol "because a test needs it".
|
|
|
23
23
|
|--------|-------------|
|
|
24
24
|
| `makeLlmModel({ model, purpose, prompt?, prompts?, files?, utility?, retries?, … }, spectator)` | The four-method model: `ask` / `talk` / `invoke(input, schema, opts)` / `request`. `model` is an already-resolved `BaseChatModel`. |
|
|
25
25
|
| `makeLlmService(options, alias?)` · `appendLlmService(ctx, options, alias?)` · `llmServiceApi(options, self)` | Model factory/registry — `makeLlmService({ models: () => configs }).getModel(alias, override?)` resolves a `ModelConfig` by alias, memoized per alias+override. The `…Api` half omits `createService`, to compose into your own service (role accessors, domain helpers). |
|
|
26
|
-
| `makeExecutionService(alias?, options?)` · `appendExecutionService(ctx, alias?, options?)` · `executionServiceApi(options, self)` | Frozen 3-level executions + policy resolution + snapshot/restore
|
|
26
|
+
| `makeExecutionService(alias?, options?)` · `appendExecutionService(ctx, alias?, options?)` · `executionServiceApi(options, self)` | Frozen 3-level executions + policy resolution + snapshot/restore + advice, and the same composable half. |
|
|
27
27
|
| `makePromptService(options?, alias?)` · `appendPromptService(ctx, options?, alias?)` · `promptServiceApi(options, self)` | Skill registry + the composition plugin chain. Also at `@owlmeans/llm/prompt`. |
|
|
28
28
|
| `rolePlugin`, `skillsPlugin`, `contextPlugin`, `BUILT_IN_PROMPT_PLUGINS` | The built-in composition plugins. |
|
|
29
29
|
| `PromptContext.claim(key)` · `PromptComposeParams.utility` | Per-composition ownership of a key; a cheap model for one plugin-side call. |
|
|
@@ -33,6 +33,8 @@ 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. |
|
|
36
38
|
| `mergePrompt`, `mergePolicy`, `resolveRole`, `effortPatch` | Execution merge helpers; `mergePrompt` unions skills and takes the deepest role. |
|
|
37
39
|
| `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. |
|
|
38
40
|
|
|
@@ -125,15 +127,39 @@ handle comes from the other end — `PromptComposeParams.utility` (and `AgentOpt
|
|
|
125
127
|
OPTIONAL resolver, unset wherever no cheap tier is wired, so a plugin that cannot get one degrades
|
|
126
128
|
rather than fails.
|
|
127
129
|
|
|
128
|
-
###
|
|
130
|
+
### Asking a person: `ask(exec, inquiry, signal?)`
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
`
|
|
132
|
-
`
|
|
133
|
-
`
|
|
134
|
-
|
|
135
|
-
`
|
|
136
|
-
|
|
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
|
+
### The plugin seam is `advise`-only, and `use()` seats by alias
|
|
145
|
+
|
|
146
|
+
`ExecutionPlugin` carries one hook: `advise` — answer a performer's question about the project it
|
|
147
|
+
works in (`ExecutionService.advise(exec, request)`, first usable answer wins, a throwing plugin is
|
|
148
|
+
skipped, `null` when nobody answers). Advice is advisory by contract: a caller appends whatever
|
|
149
|
+
comes back and proceeds unchanged on `null`.
|
|
150
|
+
|
|
151
|
+
**There is no checkpoint pair here, and that is a decision rather than a gap.** An execution is a
|
|
152
|
+
COLLABORATOR — a model policy, a purpose, a file helper — rebuilt per run from durable inputs, not
|
|
153
|
+
an artifact something restores. Resumability belongs to `@owlmeans/agent`'s pipeline runner, where
|
|
154
|
+
the persisted run ROW is the authority on where a run stands. Two half-truths about that would be
|
|
155
|
+
worse than one; `ExecutionService.checkpoint` and `ExecutionPlugin.onCheckpoint|onRestore` were
|
|
156
|
+
deleted for exactly that reason, having never been implemented by anything.
|
|
157
|
+
`TaskExecutionState.{phase, completed, cursor}` survive as **labels** for traces and prompts — a
|
|
158
|
+
human-readable "where am I" for a model to read, never a position anything resumes from.
|
|
159
|
+
|
|
160
|
+
`use(plugin)` seats **by alias**, replacing a plugin already registered under the same one. Mixins
|
|
161
|
+
compose, and a layer wired twice would otherwise answer twice — silently, since the first usable
|
|
162
|
+
answer wins.
|
|
137
163
|
|
|
138
164
|
## Classify a provider error by walking `cause`, never by `instanceof` or a surface read
|
|
139
165
|
|
|
@@ -286,7 +312,8 @@ blank tool results are stubbed to keep their `tool_use` pairing). Details: packa
|
|
|
286
312
|
suite is gated on `ANTHROPIC_SECRET` and self-skips with a printed reason without it, and the OpenRouter
|
|
287
313
|
suite is disabled unconditionally: an aggregator on a separate account serving models no deployment runs,
|
|
288
314
|
whose `402 requires more credits` reads as a failure of the code under test. `plugins.spec.ts` covers the
|
|
289
|
-
`Compatible` provider offline.
|
|
315
|
+
`Compatible` provider offline, and `inquiry.spec.ts` covers the channel registry, the `ask` policy
|
|
316
|
+
matrix and the `executionInquiry` bridge — no provider, no network.
|
|
290
317
|
|
|
291
318
|
## Depends On
|
|
292
319
|
|
|
@@ -298,4 +325,5 @@ whose `402 requires more credits` reads as a failure of the code under test. `pl
|
|
|
298
325
|
|
|
299
326
|
- [[llm-common]] — the serializable contracts · [[llm-prompt-caching]] — prompt composition, block
|
|
300
327
|
order and the cache invariants
|
|
328
|
+
- [[inquiry]] — the human-in-the-loop primitive: contracts, the registry, `ask`, and the pipeline park
|
|
301
329
|
- [[context]] — service registration · [[error]] — the `ResilientError` family
|
package/build/consts.d.ts
CHANGED
|
@@ -102,6 +102,10 @@ 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.
|
|
105
109
|
*/
|
|
106
110
|
export declare const COLLABORATOR_KEYS: string[];
|
|
107
111
|
//# 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,MAA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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,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;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAErC,CAAA"}
|
package/build/consts.js
CHANGED
|
@@ -109,6 +109,10 @@ 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.
|
|
112
116
|
*/
|
|
113
117
|
export const COLLABORATOR_KEYS = [
|
|
114
118
|
'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,GAAG,gCAAgC,CAAA;AAEjE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,cAAc,GAAG,6BAA6B,CAAA;AAE3D,6EAA6E;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAEtC;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AAEpD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAA;AAExC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,GAAG,KAAK,CAAA;AAE/C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAA;AAEtC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAA;AAEvC,kFAAkF;AAClF,MAAM,CAAC,MAAM,iBAAiB,GAAa,IAAI,CAAA;AAE/C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAA;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAA;AAEhC;;;;;GAKG;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AE,YAAY,EAAE,KAAK,EAAE;CACjE,CAAA;AAED;;;;;;;;;;;GAWG;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;AASlE,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,CAiLpB,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,6 +1,8 @@
|
|
|
1
1
|
import { createService } from '@owlmeans/context';
|
|
2
|
-
import { ExecutionEffort, ExecutionLevel, UTILITY_ROLE } from '@owlmeans/llm-common';
|
|
2
|
+
import { capAnswer, defaultAnswerFor, ExecutionEffort, ExecutionLevel, InquiryPolicy, 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';
|
|
4
6
|
import { composeExecState, composeTaskState, effortPatch, freeze, mergeOverride, mergePolicy, mergePrompt, resolveRole, } from './utils.js';
|
|
5
7
|
/**
|
|
6
8
|
* Build the execution service implementation WITHOUT registering it as a context
|
|
@@ -35,6 +37,9 @@ export const executionServiceApi = (options, self) => {
|
|
|
35
37
|
purpose: { ...input.purpose },
|
|
36
38
|
policy: { ...input.policy },
|
|
37
39
|
...(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 } } : {}),
|
|
38
43
|
}),
|
|
39
44
|
forTask: (parent, input) => {
|
|
40
45
|
const { effort, phase, data, prompt, ...extras } = input;
|
|
@@ -113,16 +118,17 @@ export const executionServiceApi = (options, self) => {
|
|
|
113
118
|
...(temperature != null && temperature > 0.2 ? { topP: 0.8 } : {}),
|
|
114
119
|
}),
|
|
115
120
|
use: plugin => {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
if (
|
|
122
|
-
|
|
121
|
+
// Seated by alias when it has one: mixins compose, and a layer wired twice would otherwise
|
|
122
|
+
// answer twice — silently, since the first usable answer wins.
|
|
123
|
+
const at = plugin.alias != null
|
|
124
|
+
? plugins.findIndex(entry => entry.alias === plugin.alias)
|
|
125
|
+
: -1;
|
|
126
|
+
if (at < 0) {
|
|
127
|
+
plugins.push(plugin);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
plugins[at] = plugin;
|
|
123
131
|
}
|
|
124
|
-
const state = self().snapshot(exec);
|
|
125
|
-
await Promise.all(plugins.map(plugin => plugin.onCheckpoint?.(state, exec, key)));
|
|
126
132
|
},
|
|
127
133
|
advise: async (exec, request) => {
|
|
128
134
|
for (const plugin of plugins) {
|
|
@@ -141,6 +147,15 @@ export const executionServiceApi = (options, self) => {
|
|
|
141
147
|
}
|
|
142
148
|
return null;
|
|
143
149
|
},
|
|
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
|
+
},
|
|
144
159
|
snapshot: exec => {
|
|
145
160
|
if (exec.level === ExecutionLevel.Task) {
|
|
146
161
|
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,EAAE,eAAe,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/execution/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAEjD,OAAO,EACL,SAAS,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,YAAY,GAC1F,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EA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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, LlmPurpose, ModelConfigOverride, ModelPolicy, ModelRole, PromptPolicy, TaskExecutionState } from '@owlmeans/llm-common';
|
|
3
|
+
import type { ExecutionEffort, ExecutionLevel, ExecutionState, FileProviderRef, Inquiry, InquiryAnswer, InquiryConfig, 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,6 +45,11 @@ 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;
|
|
48
53
|
outputErrors?: boolean;
|
|
49
54
|
captureNull?: boolean;
|
|
50
55
|
}
|
|
@@ -99,17 +104,22 @@ export interface AdviceRequest {
|
|
|
99
104
|
hints?: Record<string, unknown>;
|
|
100
105
|
}
|
|
101
106
|
/**
|
|
102
|
-
* Extension seam. A plugin
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
+
* Extension seam. A plugin ANSWERS a performer's question about its surroundings.
|
|
108
|
+
*
|
|
109
|
+
* It used to carry a checkpoint pair as well (`onCheckpoint`/`onRestore`), and that is gone: an
|
|
110
|
+
* execution is a bundle of collaborators and domain context, not a workflow position, and the only
|
|
111
|
+
* position it ever carried was three optional fields nothing ever read back. Recoverable work is a
|
|
112
|
+
* PIPELINE — `@owlmeans/agent`'s `makePipeline` — whose steps are named, whose state is scalars and
|
|
113
|
+
* keys, and whose run row is a single authority on where it stands. Two mechanisms answering "where
|
|
114
|
+
* is this run" is two half-truths, which is exactly what this deletion removes.
|
|
107
115
|
*/
|
|
108
116
|
export interface ExecutionPlugin {
|
|
109
|
-
/**
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Identity for de-duplication. A plugin registered twice — two `append*` calls composing the
|
|
119
|
+
* same layer — would otherwise answer twice, and the first usable answer wins, so the duplicate
|
|
120
|
+
* is silent rather than loud.
|
|
121
|
+
*/
|
|
122
|
+
alias?: string;
|
|
113
123
|
/**
|
|
114
124
|
* Answer a performer's question about the project it is working in. Return the text to
|
|
115
125
|
* hand the model, or `null` when this plugin does not own the request's `kind` — or
|
|
@@ -162,12 +172,29 @@ export interface ExecutionService<S extends ExecutionShape = ExecutionShape> ext
|
|
|
162
172
|
* `HelperExecutionInput.output`) survives the refinement.
|
|
163
173
|
*/
|
|
164
174
|
temperatureFactory: (exec: S['exec'], role?: ModelRole, baseOverride?: ModelConfigOverride) => TemperatureFactory;
|
|
165
|
-
/** Register an execution plugin (
|
|
175
|
+
/** Register an execution plugin (advice). Seated by `alias` when it carries one. */
|
|
166
176
|
use: (plugin: ExecutionPlugin) => void;
|
|
167
|
-
/**
|
|
168
|
-
|
|
177
|
+
/**
|
|
178
|
+
* The JSON-safe half of an execution — everything that is not a collaborator.
|
|
179
|
+
*
|
|
180
|
+
* A transport-level convenience, not a workflow position: nothing here says where a run has got
|
|
181
|
+
* to, and nothing should. See {@link ExecutionPlugin}.
|
|
182
|
+
*/
|
|
169
183
|
snapshot: (exec: S['exec']) => ExecutionState;
|
|
170
184
|
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>;
|
|
171
198
|
/**
|
|
172
199
|
* Ask the registered plugins about the project this execution runs in. Plugins are
|
|
173
200
|
* 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,UAAU,
|
|
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,C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;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC5B;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc;IAC7E,UAAU,EAAE,MAAM,gBAAgB,CAAC,CAAC,CAAC,CAAA;CACtC"}
|
package/build/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ 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';
|
|
8
9
|
export * from './prompt/index.js';
|
|
9
10
|
export type * from './plugins/types.js';
|
|
10
11
|
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,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"}
|
|
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,oBAAoB,CAAA;AAClC,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,6 +4,7 @@ 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';
|
|
7
8
|
export * from './prompt/index.js';
|
|
8
9
|
export { plugins, registerLlmPlugin, pluginOf, pluginFor, resolvePlugin } from './plugins/index.js';
|
|
9
10
|
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,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"}
|
|
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,oBAAoB,CAAA;AAClC,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"}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|