@owlmeans/llm 0.1.18-rc.21 → 0.1.18-rc.22
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 +2 -2
- package/agent-meta/manifest.json +9 -2
- package/agent-meta/skills/inquiry/SKILL.md +199 -0
- package/agent-meta/skills/llm/SKILL.md +9 -1
- 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 +15 -1
- package/build/execution/service.js.map +1 -1
- package/build/execution/types.d.ts +19 -1
- 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/model.d.ts.map +1 -1
- package/build/model.js +177 -150
- package/build/model.js.map +1 -1
- package/build/types.d.ts +12 -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 +17 -1
- package/src/execution/types.ts +22 -2
- 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/model.ts +42 -16
- package/src/types.ts +13 -0
- package/tests/inquiry.spec.ts +200 -0
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ abstraction that resolves models from an inheritable policy.
|
|
|
20
20
|
## Installation
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
bun add @owlmeans/llm@^0.1.18-rc.
|
|
23
|
+
bun add @owlmeans/llm@^0.1.18-rc.22 @owlmeans/llm-common@^0.1.18-rc.21
|
|
24
24
|
bun add @langchain/core @langchain/openai @langchain/anthropic # peer dependencies
|
|
25
25
|
```
|
|
26
26
|
|
|
@@ -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.21
|
|
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.22",
|
|
5
|
+
"generatedAt": "2026-09-15T12:21:31.905Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -12,6 +12,13 @@
|
|
|
12
12
|
"file": "skills/llm/SKILL.md",
|
|
13
13
|
"canonicalPath": ".agents/skills/llm/SKILL.md"
|
|
14
14
|
},
|
|
15
|
+
{
|
|
16
|
+
"kind": "skill",
|
|
17
|
+
"name": "inquiry",
|
|
18
|
+
"category": "multi-package",
|
|
19
|
+
"file": "skills/inquiry/SKILL.md",
|
|
20
|
+
"canonicalPath": ".agents/skills/inquiry/SKILL.md"
|
|
21
|
+
},
|
|
15
22
|
{
|
|
16
23
|
"kind": "skill",
|
|
17
24
|
"name": "llm-prompt-caching",
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: inquiry
|
|
3
|
+
description: The human-in-the-loop primitive — one question put to a person while a run is in flight. Covers the llm-common contracts (Inquiry, InquiryAnswer, InquiryPolicy, the one answer ceiling), the llm transport registry and ExecutionService.ask, the executionInquiry bridge, the agent ask_user plugin, and the pipeline Waiting/resume path. Use when a run needs a decision that is not its own, when seating or releasing an inquiry channel, or when a run parked Waiting and nothing answered it.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
<!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
|
|
7
|
+
|
|
8
|
+
# Inquiry — asking a person mid-run
|
|
9
|
+
|
|
10
|
+
One question, put to whoever is behind a run, answered in seconds or not at all. It is the only
|
|
11
|
+
supported way for an execution, an agent or a pipeline to obtain a decision that is genuinely not
|
|
12
|
+
its own — a missing sub-project, a choice between two products the code could be, a relocation
|
|
13
|
+
nobody may perform unasked.
|
|
14
|
+
|
|
15
|
+
It is deliberately NOT a form, a chat or a review queue: a question offers a choice, free text or a
|
|
16
|
+
yes/no, and a run that is not being watched must never block on one.
|
|
17
|
+
|
|
18
|
+
## Where each half lives
|
|
19
|
+
|
|
20
|
+
| Layer | Package | What it owns |
|
|
21
|
+
|---|---|---|
|
|
22
|
+
| Contracts | `@owlmeans/llm-common` (`src/inquiry/`) | `Inquiry`, `InquiryAnswer`, `InquiryOption`, `InquiryTransport`, `InquiryConfig`, `InquiryKind`, `InquiryPolicy`, the constants, and the pure helpers |
|
|
23
|
+
| Runtime | `@owlmeans/llm` (`src/inquiry/`) | The transport registry, `InquiryError`/`InquiryUnavailable`/`InquiryDeclined`, `executionInquiry`, and `ExecutionService.ask` |
|
|
24
|
+
| Pipeline | `@owlmeans/agent-common` | `PipelineRunStatus.Waiting`, `PipelineRunInquiry`, `INQUIRY_ANSWERS_KEY`, `PipelineNotResumableError` |
|
|
25
|
+
| Runner + tool | `@owlmeans/agent` | `PipelineRunContext.ask`, the `inquiry` stop reason, the answers merge, `inquiryPlugin` / the `ask_user` tool |
|
|
26
|
+
| Wire | `@owlmeans/viable-common` (`src/connect/`) | The connector's own copy — `ConnectInquiryKind`, `InquiryPayload`, `InquiryAnswerPayload` — renamed so both vocabularies can be imported into one file |
|
|
27
|
+
|
|
28
|
+
## The contracts
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
enum InquiryKind { Choice = 'choice', Text = 'text', Confirm = 'confirm' }
|
|
32
|
+
enum InquiryPolicy { Ask = 'ask', Default = 'default', Refuse = 'refuse' }
|
|
33
|
+
|
|
34
|
+
interface Inquiry {
|
|
35
|
+
id: string // chosen by whoever asks; the ONLY thing that routes an answer back
|
|
36
|
+
kind: InquiryKind
|
|
37
|
+
question: string // one question, in plain words
|
|
38
|
+
context?: string // one or two sentences of background — never the whole task
|
|
39
|
+
options?: InquiryOption[] // required for Choice, ignored otherwise
|
|
40
|
+
multiple?: boolean
|
|
41
|
+
allowText?: boolean // a Choice the answerer may answer in their own words instead
|
|
42
|
+
default?: string | string[] // what to assume when nobody answers
|
|
43
|
+
expiresAt?: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface InquiryAnswer {
|
|
47
|
+
inquiryId: string
|
|
48
|
+
value?: string | string[]
|
|
49
|
+
text?: string
|
|
50
|
+
declined?: boolean // nobody could decide — an ANSWER, never a failure
|
|
51
|
+
truncated?: boolean // set by capAnswer or stateAnswerOf, never by an answerer
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface InquiryTransport { ask: (inquiry: Inquiry, signal?: AbortSignal) => Promise<InquiryAnswer> }
|
|
55
|
+
interface InquiryConfig { transport?: string; policy: InquiryPolicy }
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The pure helpers are the ONE reading of an answer every layer uses — a second reading is a second
|
|
59
|
+
contract: `defaultAnswerFor(inquiry)` (the default, or a decline), `answeredWith(answer)` (the first
|
|
60
|
+
value, else the text, else `null`), `isDeclined(answer)`, `capAnswer(answer, max?)`,
|
|
61
|
+
`stateAnswerOf(answer)`, `renderInquiry(inquiry)` (a one-line label for a note or a run row).
|
|
62
|
+
|
|
63
|
+
## Three policies, and no fourth
|
|
64
|
+
|
|
65
|
+
`InquiryConfig` travels on `ExecutionState.inquiry` — serializable, and deliberately absent from
|
|
66
|
+
`COLLABORATOR_KEYS`, so a run resumed days later asks through the same channel under the same
|
|
67
|
+
policy.
|
|
68
|
+
|
|
69
|
+
| Policy | `ExecutionService.ask` does |
|
|
70
|
+
|---|---|
|
|
71
|
+
| `Ask` | Hands the question to the seated transport and waits for the answer |
|
|
72
|
+
| `Default` | Returns `defaultAnswerFor(inquiry)` and asks nobody. The caller is expected to RECORD the assumption where a user can read it |
|
|
73
|
+
| `Refuse` | Throws `InquiryDeclined` — nobody may be asked at all |
|
|
74
|
+
|
|
75
|
+
**No configuration means `Default`.** A run that was never given a channel must never block on one:
|
|
76
|
+
that is what makes the primitive safe to reach for from code that also runs unattended (a web
|
|
77
|
+
project pipeline, a scheduled job).
|
|
78
|
+
|
|
79
|
+
## One ceiling, referenced rather than restated
|
|
80
|
+
|
|
81
|
+
`DEFAULT_INQUIRY_ANSWER_CHARS` (2 000) is the only ceiling on a stored answer. The connector's
|
|
82
|
+
`CONNECT_INQUIRY_MAX_TEXT` equals it, the connector's answer schema caps `text` at it, and
|
|
83
|
+
`capAnswer` enforces it. Three ceilings for one value is how a user's 3 000-character answer is
|
|
84
|
+
accepted on the wire and silently halved further in — so never introduce a local cap; import this
|
|
85
|
+
one.
|
|
86
|
+
|
|
87
|
+
**Only the prose is ever cut.** A `value` is the decision itself — for a `Choice` it must equal one
|
|
88
|
+
of the question's own option values — so a shortened one is not a degraded answer but a different
|
|
89
|
+
answer, matching no option, which `answeredWith` would hand on as what the person chose. An
|
|
90
|
+
over-long `value` is a defect upstream (the connector's schema refuses one rather than shortening
|
|
91
|
+
it): `capAnswer` passes it through whole and raises `truncated` on it.
|
|
92
|
+
|
|
93
|
+
`capAnswer` **reports** the cut (`truncated: true`). A silent truncation is exactly the class of
|
|
94
|
+
failure the primitive exists to prevent.
|
|
95
|
+
|
|
96
|
+
A resumable pipeline **state** stores less: `stateAnswerOf` keeps the decision whole and cuts the
|
|
97
|
+
prose to `INQUIRY_STATE_TEXT_CHARS` (200), because a state is keys, markers and paths — two
|
|
98
|
+
full-size answers would make it prose. The full answer still goes back to whoever asked; long text
|
|
99
|
+
belongs in whatever document the application keeps for it (the converter writes
|
|
100
|
+
`docs/conversion/inquiries.md`, keyed by inquiry id).
|
|
101
|
+
|
|
102
|
+
## The transport registry, and why an absent channel is fatal
|
|
103
|
+
|
|
104
|
+
```typescript
|
|
105
|
+
registerInquiryTransport(key, transport) // seat on attach
|
|
106
|
+
releaseInquiryTransport(key) // release when the channel goes away
|
|
107
|
+
hasInquiryTransport(key)
|
|
108
|
+
inquiryTransportFor(key | undefined) // throws InquiryUnavailable — never waits
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Module-level and keyed by string, exactly like the delegate-transport and provider-plugin
|
|
112
|
+
registries beside it: a process holds many at once, and an execution names the one its run belongs
|
|
113
|
+
to. It is `inquiryTransportFor`, not `transportFor`, because `@owlmeans/llm` and
|
|
114
|
+
`@owlmeans/llm-delegate` are re-exported into one namespace by `@owlmeans/viable`.
|
|
115
|
+
|
|
116
|
+
**A transport that cannot serve a question THROWS.** A declined answer is a decision; a channel that
|
|
117
|
+
is gone is terminal, and the two must never look alike.
|
|
118
|
+
|
|
119
|
+
`InquiryUnavailable` is registered fatal (`registerFatalError`) **beside the throw**, so no caller
|
|
120
|
+
has to remember: every retry ladder aborts at once instead of spending itself on a channel nobody is
|
|
121
|
+
behind. `InquiryDeclined` is deliberately NOT fatal — the run decides for itself and carries on.
|
|
122
|
+
|
|
123
|
+
## `ExecutionService.ask` and the one bridge
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
const answer = await ctx.executions().ask(exec, inquiry) // policy-driven, may throw
|
|
127
|
+
const ask = executionInquiry(service, exec) // (inquiry, signal?) => answer | null
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
`executionInquiry` is the ONE adapter that maps `InquiryUnavailable → null` and rethrows everything
|
|
131
|
+
else. Wire a pipeline's `options.inquiry.ask` and an agent plugin's channel through it rather than
|
|
132
|
+
catching the error again: a consumer that folded a decline into the same `null` would turn "I will
|
|
133
|
+
not decide" into a run that parks forever, and one that folded them the other way would fail a run
|
|
134
|
+
because a browser tab closed.
|
|
135
|
+
|
|
136
|
+
It asks for the one METHOD it calls (`{ ask }`) and infers the execution type from the execution
|
|
137
|
+
handed to it, so a consumer's own service — `@owlmeans/viable`'s, instantiated with its own
|
|
138
|
+
`ViableExecutionShape` — passes with no type argument, and a facade or a test double stands in
|
|
139
|
+
just as well. Never make an adapter generic over the SHAPE instead: `S` appears in
|
|
140
|
+
`ExecutionService<S>` only through indexed accesses, which is not an inference site, so it silently
|
|
141
|
+
falls back to the bare `ExecutionShape` and refuses every real service contravariantly on `root`.
|
|
142
|
+
|
|
143
|
+
## The `ask_user` tool
|
|
144
|
+
|
|
145
|
+
`inquiryPlugin({ ask })` (`@owlmeans/agent`, alias `INQUIRY_PLUGIN`, order 45) adds the `ask_user`
|
|
146
|
+
tool and one Context paragraph. Both appear **only when `ask` is wired** — a tool nobody can serve
|
|
147
|
+
is a tool the model tries once and remembers as broken.
|
|
148
|
+
|
|
149
|
+
The body never throws, with exactly one exception: `InquiryUnavailable` is **rethrown**. No channel
|
|
150
|
+
is an answerable situation (`{ error: 'Nobody can answer …' }`); a channel that WAS there and
|
|
151
|
+
vanished is not. That escape only works if the agent passes `fatal: e => isFatalError(e) != null`
|
|
152
|
+
into `safeInvokeTool` — **an agent installing this plugin must**, or the loop spends its whole turn
|
|
153
|
+
budget on a dead channel.
|
|
154
|
+
|
|
155
|
+
## Parking a pipeline: `Waiting`
|
|
156
|
+
|
|
157
|
+
`PipelineRunContext.ask(inquiry)` has three outcomes, in order:
|
|
158
|
+
|
|
159
|
+
1. An answer already in the state (a resume) is returned at once — a question is never asked twice.
|
|
160
|
+
2. A live channel answers: the answer is recorded in the state (`stateAnswerOf(capAnswer(...))`
|
|
161
|
+
under `state[INQUIRY_ANSWERS_KEY][inquiry.id]`) and the FULL answer is returned.
|
|
162
|
+
3. Nobody is there: the run stops `Waiting` with the inquiry on its row, and the call never returns.
|
|
163
|
+
|
|
164
|
+
**`Inquiry.id` must be stable across re-entries of the same step.** It is the only thing an answer
|
|
165
|
+
is matched by, so derive it from the step and the thing being decided (`${step}:${entity}:tone`) —
|
|
166
|
+
never mint one per call. A fresh id can never match what the state holds, so the run asks again on
|
|
167
|
+
every entry and parks forever, which is the one way to break the asked-once contract from inside.
|
|
168
|
+
|
|
169
|
+
A `Waiting` run is resumable and **not stale** — it has no process, and its heartbeat will not move
|
|
170
|
+
again until somebody answers, so nothing that sweeps stale runs may pick it up. A run with no store
|
|
171
|
+
cannot park at all: it throws `PipelineNotResumableError`, because nothing would be there to resume.
|
|
172
|
+
|
|
173
|
+
Answers are merged **by the runner**, in both `invoke` and `resume` (`resume(runId, { answers })`),
|
|
174
|
+
never by a caller's mapping: the seed overwrites the restored state key by key, so a mapping that
|
|
175
|
+
forwarded the answers map would wipe the child's own recorded answers. The merge applies the same
|
|
176
|
+
`stateAnswerOf(capAnswer(...))` cut the live path does — a resume is how an answer usually arrives,
|
|
177
|
+
so a ceiling enforced on the live path alone is enforced where the least text comes in. Answers are
|
|
178
|
+
also the one state key that ACCUMULATES, so `ctx.ask` re-reads the map at write time: steps with no
|
|
179
|
+
edge between them run in one superstep, and a write built from a pre-await copy loses a sibling's
|
|
180
|
+
answer. When a composed child parks, `asStep` asks the parent's `ctx.ask` and re-invokes the child
|
|
181
|
+
if an answer comes back (bounded); only when the parent's own `ask` parks does the parent park too.
|
|
182
|
+
|
|
183
|
+
## Rules
|
|
184
|
+
|
|
185
|
+
- Ask only for a decision that is genuinely a person's. Anything discoverable by reading is not a
|
|
186
|
+
question.
|
|
187
|
+
- One question at a time, with a `default` wherever one is defensible — most runs answer themselves
|
|
188
|
+
under policy `Default`, and a question with no default costs them a decline.
|
|
189
|
+
- Never widen a `Choice` past `DEFAULT_INQUIRY_OPTIONS` (12); beyond that it is not a question.
|
|
190
|
+
- Never introduce a second answer ceiling, a second reading of "was this answered", or a second
|
|
191
|
+
mapping of `InquiryUnavailable`.
|
|
192
|
+
- A refusal a user can act on must be phrased for them — a raw `inquiry:declined:<id>` reaching a
|
|
193
|
+
screen is a bug in the consumer, not in this primitive.
|
|
194
|
+
|
|
195
|
+
## Related
|
|
196
|
+
|
|
197
|
+
- [[llm-common]] — where the contracts live · [[llm]] — the registry and `ExecutionService`
|
|
198
|
+
- [[llm-delegate]] — the same registry/fatal shape for model calls performed elsewhere
|
|
199
|
+
- [[agent]] — the pipeline runner and the `ask_user` plugin · [[agent-common]] — the run contracts
|
|
@@ -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.22"` 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
|
|
@@ -290,6 +290,14 @@ short-circuit · blank-content sanitization (whitespace-only text blocks are dro
|
|
|
290
290
|
— a blank block, e.g. an empty file read pasted into a prompt, is otherwise a fatal Anthropic 400;
|
|
291
291
|
blank tool results are stubbed to keep their `tool_use` pairing). Details: package `README.md`.
|
|
292
292
|
|
|
293
|
+
## Terminal failure observation
|
|
294
|
+
|
|
295
|
+
`LlmSpectator.error?({ action, error })` is a best-effort terminal observation hook. `makeLlmModel`
|
|
296
|
+
calls it once only after the entire retry ladder for `ask`, `talk`, `invoke`, or `request` has failed;
|
|
297
|
+
it never sees transient attempts and a failing observer never replaces the original error. Use it for
|
|
298
|
+
side-channel effects that must follow a confirmed stop (for example, a tenant notification), not for
|
|
299
|
+
retry control or persistence that the call itself depends on.
|
|
300
|
+
|
|
293
301
|
## Tests
|
|
294
302
|
|
|
295
303
|
`bun test ./tests` in the package; offline specs always run. In `tests/model.spec.ts` the anthropic live
|
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,MAAM,cAAc,gCAAgC,CAAA;AAE3D,6EAA6E;AAC7E,eAAO,MAAM,qBAAqB,IAAI,CAAA;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AqB,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;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,6DAA6D;MACzF,gHAAgH;MAChH,iGAAiG;MACj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,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;
|
|
@@ -142,6 +147,15 @@ export const executionServiceApi = (options, self) => {
|
|
|
142
147
|
}
|
|
143
148
|
return null;
|
|
144
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
|
+
},
|
|
145
159
|
snapshot: exec => {
|
|
146
160
|
if (exec.level === ExecutionLevel.Task) {
|
|
147
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,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAA;AAM7D,OAAO,EACL,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,WAAW,EACnF,WAAW,EAAE,WAAW,GACzB,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,OAAgC,EAChC,IAA+B,EACV,EAAE;IACvB,MAAM,OAAO,GAAsB,EAAE,CAAA;IACrC,MAAM,gBAAgB,GAAG,CAAC,GAAG,iBAAiB,EAAE,GAAG,CAAC,OAAO,CAAC,gBAAgB,IAAI,EAAE,CAAC,CAAC,CAAA;IAEpF,8EAA8E;IAC9E,MAAM,SAAS,GAAG,CAAsB,IAAO,EAAK,EAAE;QACpD,IAAI,IAAI,CAAC,KAAK,KAAK,cAAc,CAAC,IAAI,EAAE,CAAC;YACvC,MAAM,IAAI,GAAG,IAAgC,CAC5C;YAAC,IAAsC,CAAC,KAAK,GAAG,gBAAgB,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;IAExB,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,KAAK,GAAW,iBAAiB,EACjC,OAAO,GAA4B,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, 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
|
}
|
|
@@ -177,6 +182,19 @@ export interface ExecutionService<S extends ExecutionShape = ExecutionShape> ext
|
|
|
177
182
|
*/
|
|
178
183
|
snapshot: (exec: S['exec']) => ExecutionState;
|
|
179
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>;
|
|
180
198
|
/**
|
|
181
199
|
* Ask the registered plugins about the project this execution runs in. Plugins are
|
|
182
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,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GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,CAAA;IAExF;;;;;OAKG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;CAC5E;AAED,MAAM,WAAW,uBAAuB;IACtC;;;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
|