@owlmeans/llm-common 0.1.18-rc.3 → 0.1.18-rc.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +2 -2
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/llm-common/SKILL.md +29 -6
  4. package/build/consts.d.ts +22 -1
  5. package/build/consts.d.ts.map +1 -1
  6. package/build/consts.js +21 -0
  7. package/build/consts.js.map +1 -1
  8. package/build/delegate/index.d.ts +2 -0
  9. package/build/delegate/index.d.ts.map +1 -0
  10. package/build/delegate/index.js +2 -0
  11. package/build/delegate/index.js.map +1 -0
  12. package/build/delegate/types.d.ts +108 -0
  13. package/build/delegate/types.d.ts.map +1 -0
  14. package/build/delegate/types.js +39 -0
  15. package/build/delegate/types.js.map +1 -0
  16. package/build/files/types.d.ts +10 -0
  17. package/build/files/types.d.ts.map +1 -1
  18. package/build/index.d.ts +2 -0
  19. package/build/index.d.ts.map +1 -1
  20. package/build/index.js +2 -0
  21. package/build/index.js.map +1 -1
  22. package/build/inquiry/consts.d.ts +48 -0
  23. package/build/inquiry/consts.d.ts.map +1 -0
  24. package/build/inquiry/consts.js +50 -0
  25. package/build/inquiry/consts.js.map +1 -0
  26. package/build/inquiry/index.d.ts +4 -0
  27. package/build/inquiry/index.d.ts.map +1 -0
  28. package/build/inquiry/index.js +3 -0
  29. package/build/inquiry/index.js.map +1 -0
  30. package/build/inquiry/types.d.ts +72 -0
  31. package/build/inquiry/types.d.ts.map +1 -0
  32. package/build/inquiry/types.js +2 -0
  33. package/build/inquiry/types.js.map +1 -0
  34. package/build/inquiry/utils.d.ts +45 -0
  35. package/build/inquiry/utils.d.ts.map +1 -0
  36. package/build/inquiry/utils.js +72 -0
  37. package/build/inquiry/utils.js.map +1 -0
  38. package/build/types.d.ts +35 -2
  39. package/build/types.d.ts.map +1 -1
  40. package/package.json +2 -2
  41. package/src/consts.ts +22 -0
  42. package/src/delegate/index.ts +1 -0
  43. package/src/delegate/types.ts +116 -0
  44. package/src/files/types.ts +11 -0
  45. package/src/index.ts +2 -0
  46. package/src/inquiry/consts.ts +52 -0
  47. package/src/inquiry/index.ts +3 -0
  48. package/src/inquiry/types.ts +77 -0
  49. package/src/inquiry/utils.ts +84 -0
  50. package/src/types.ts +35 -2
  51. package/tests/inquiry.spec.ts +112 -0
  52. package/tsconfig.json +3 -1
package/README.md CHANGED
@@ -20,7 +20,7 @@ extends these; `@owlmeans/llm` implements against them.
20
20
  ## Installation
21
21
 
22
22
  ```bash
23
- bun add @owlmeans/llm-common
23
+ bun add @owlmeans/llm-common@^0.1.18-rc.30
24
24
  ```
25
25
 
26
26
  ## Usage
@@ -96,7 +96,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
96
96
  your project's skill store (`.agents/skills/`):
97
97
 
98
98
  ```sh
99
- npx @owlmeans/agent-skills
99
+ npx @owlmeans/agent-skills@^0.1.18-rc.31
100
100
  ```
101
101
 
102
102
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/llm-common",
4
- "version": "0.1.18-rc.0",
5
- "generatedAt": "2026-08-16T22:20:50.510Z",
4
+ "version": "0.1.18-rc.30",
5
+ "generatedAt": "2026-09-21T21:55:20.673Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -8,7 +8,7 @@ user-invocable: false
8
8
  # @owlmeans/llm-common
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/llm-common": "^0.1.18-rc.0"` in `dependencies`
11
+ **Install:** `"@owlmeans/llm-common": "^0.1.18-rc.30"` in `dependencies`
12
12
 
13
13
  The contracts half of the LLM stack. **No `@langchain/*` runtime dependency** — importable
14
14
  from a browser bundle, a queue worker, or any package that must not pull an inference SDK.
@@ -25,29 +25,52 @@ The dependency direction is one-way: a domain contracts package extends these;
25
25
  | `StructuredMode` | `Native` (provider JSON-schema mode) vs `Tool` (forced tool call). |
26
26
  | `SpectatorContentType`, `SPECTATOR_GENERAL` | Observability record enums/defaults. |
27
27
  | `ModelRole` | Open `string` — declare your own enum, its values stay assignable. |
28
- | `ModelConfigPatch` / `ModelConfigOverride` | The JSON-safe config subset; never credentials. |
29
- | `ModelPolicy` | `{ effort, roleOverrides?, modelOverrides? }` — inherited by every refinement. |
28
+ | `ModelConfigPatch` / `ModelConfigOverride` | The JSON-safe config subset; never credentials. Carries the model-capability fields (`contextWindow`, `maxOutput`, `combinedWindow`) alongside the budget ones — see the `llm` skill for what each means. |
29
+ | `ModelPolicy` | `{ effort, roleOverrides?, modelOverrides?, utilityRole? }` — inherited by every refinement. |
30
+ | `UTILITY_ROLE` | `'utility'` — the conventional cheap tier for side calls (a relevance pick, a classification). `ModelPolicy.utilityRole` points it at another alias; `ExecutionService.utility` resolves it. |
30
31
  | `ExecutionState` / `TaskExecutionState` | The persistable core (`level`/`purpose`/`policy`, plus `phase`/`completed`/`cursor`/`data`). |
31
32
  | `LlmPurpose` | `{ type?, dedication? }` — metadata carried on every model call. |
32
33
  | `PromptBlock`, `PROMPT_BLOCK_ORDER`, `DEFAULT_SKILL_ORDER` | The ordered sections of a composed system prompt — the order IS the cache key. |
33
34
  | `SkillDefinition` | One named block of reusable prompt knowledge. `body` must be a pure constant. |
34
35
  | `PromptPolicy` | `{ role?, skills?, cacheSystem?, cacheTtl? }` — carried on `ExecutionState`, merged downward. |
35
36
  | `CacheTtl`, `CacheUsage` | `'5m' \| '1h'`; normalized prompt-cache accounting. |
36
- | `LlmFileProvider`, `FileProviderRef`, `resolveFileProvider` | The minimal read/write file contract prompt plugins work against. |
37
+ | `LlmFileProvider`, `FileProviderRef`, `resolveFileProvider` | The file contract prompt plugins work against — four members, every path relative to the host's project root. `FileProviderRef` accepts the provider or a thunk returning one; `resolveFileProvider` unwraps whichever form arrived, or `undefined`. |
37
38
  | `NullCapture`, `NullKind` | Full diagnostics of a call that returned nothing usable. |
38
39
  | `SpectatorArgument`, `SpectatorEntry`, `SpectatorEntryLogged`, `SpectatorEntryMessage` | What an observability sink stores. |
39
40
 
41
+ ## `LlmFileProvider` — what a host must supply
42
+
43
+ A consumer's own file helper satisfies it structurally (`interface FileHelper extends
44
+ LlmFileProvider`); implementing it from scratch means all four:
45
+
46
+ | Member | Contract |
47
+ |---|---|
48
+ | `readFile(path, noThrow?)` | Read a file relative to the root. With `noThrow`, a missing file yields `''`. |
49
+ | `getSourceList(pattern?)` | Glob for files relative to the root. Project-skill discovery in `@owlmeans/agent-skills` is built on it, so a provider that stubs it indexes nothing. |
50
+ | `writeFile(path, content)` | Write relative to the root, creating parent directories. |
51
+ | `deleteFile(path, noThrow?)` | Delete relative to the root. With `noThrow`, a missing file is a no-op. |
52
+ | `key?` | Optional. The provider's stable identity (project root, sandbox id) — the only thing a plugin caching per-project reads can key on, since providers are rebuilt per request. A provider without one is treated as uncacheable. |
53
+
54
+ Resolving the project root is deliberately NOT part of the contract, and an implementation must not
55
+ narrow an inherited signature — that is what stops a rich helper from satisfying this one.
56
+
40
57
  ## Extension rules
41
58
 
42
59
  Open types are open **on purpose** — extend, do not fork:
43
60
 
44
61
  ```typescript
62
+ import type {
63
+ ExecutionState as LlmExecutionState, LlmPurpose,
64
+ TaskExecutionState as LlmTaskExecutionState,
65
+ } from '@owlmeans/llm-common'
66
+
45
67
  // Your roles: an enum whose values satisfy the open `ModelRole` string.
46
68
  export enum MyRole { Analyst = 'analyst', Coder = 'coder' }
47
69
 
48
- // Your purpose and state: extend, never redeclare.
70
+ // Your purpose and state: extend, never redeclare. Aliasing the imports keeps your own
71
+ // `ExecutionState` the name the rest of your domain uses.
49
72
  export interface MyPurpose extends LlmPurpose { agent?: string }
50
- export interface MyExecutionState extends ExecutionState {
73
+ export interface MyExecutionState extends LlmExecutionState {
51
74
  purpose: MyPurpose
52
75
  projectId?: string
53
76
  }
package/build/consts.d.ts CHANGED
@@ -9,7 +9,21 @@ export declare enum ModelProvider {
9
9
  /** Anthropic messages API. */
10
10
  Anthropic = "anthropic",
11
11
  /** Any OpenAI-compatible endpoint — OpenRouter, HuggingFace router, Together, vLLM, … */
12
- Compatible = "compatible"
12
+ Compatible = "compatible",
13
+ /**
14
+ * No endpoint at all: the call is handed to whoever holds the execution.
15
+ *
16
+ * A delegated model does not talk to a provider. It packages the call — the system prompt, the
17
+ * conversation, the tools or the schema — and hands it to a transport the application seated,
18
+ * which carries it to something outside this process entirely: a coding agent driving the
19
+ * application through a connector, a human, a test. The answer comes back the same way and is
20
+ * turned into a completion the rest of the stack cannot tell apart from a provider's.
21
+ *
22
+ * It exists so that "who performs this call" can be a property of the SESSION rather than of the
23
+ * code: the same pipeline, the same prompts and the same retry rules, billed to somebody else's
24
+ * model.
25
+ */
26
+ Delegated = "delegated"
13
27
  }
14
28
  /**
15
29
  * Refinement level of an execution. An execution is refined downward only:
@@ -82,4 +96,11 @@ export declare enum PromptBlock {
82
96
  export declare const PROMPT_BLOCK_ORDER: readonly PromptBlock[];
83
97
  /** Sort weight of a skill that declares none — see `SkillDefinition.order`. */
84
98
  export declare const DEFAULT_SKILL_ORDER = 100;
99
+ /**
100
+ * Conventional {@link ModelRole} for the cheap side calls the layer makes on its own
101
+ * behalf — a relevance pick, a classification, a one-line judgement — rather than for the
102
+ * work a caller asked for. A deployment that names its cheap tier differently points
103
+ * `ModelPolicy.utilityRole` at its own alias; nothing else has to change.
104
+ */
105
+ export declare const UTILITY_ROLE = "utility";
85
106
  //# sourceMappingURL=consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,yFAAyF;IACzF,MAAM,WAAW;IACjB,8BAA8B;IAC9B,SAAS,cAAc;IACvB,yFAAyF;IACzF,UAAU,eAAe;CAC1B;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED;;;;GAIG;AACH,oBAAY,eAAe;IACzB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED;;;;;;;;;GASG;AACH,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,0DAA0D;AAC1D,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,cAAc;CACvB;AAED,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,YAAY,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,WAAW,EAK3C,CAAA;AAEV,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,MAAM,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,oBAAY,aAAa;IACvB,yFAAyF;IACzF,MAAM,WAAW;IACjB,8BAA8B;IAC9B,SAAS,cAAc;IACvB,yFAAyF;IACzF,UAAU,eAAe;IACzB;;;;;;;;;;;;OAYG;IACH,SAAS,cAAc;CACxB;AAED;;;GAGG;AACH,oBAAY,cAAc;IACxB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;CAClB;AAED;;;;GAIG;AACH,oBAAY,eAAe;IACzB,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED;;;;;;;;;GASG;AACH,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,0DAA0D;AAC1D,oBAAY,oBAAoB;IAC9B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,cAAc;CACvB;AAED,mFAAmF;AACnF,eAAO,MAAM,iBAAiB,YAAY,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,oBAAY,WAAW;IACrB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,QAAQ,aAAa;IACrB,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,WAAW,EAK3C,CAAA;AAEV,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,YAAY,YAAY,CAAA"}
package/build/consts.js CHANGED
@@ -11,6 +11,20 @@ export var ModelProvider;
11
11
  ModelProvider["Anthropic"] = "anthropic";
12
12
  /** Any OpenAI-compatible endpoint — OpenRouter, HuggingFace router, Together, vLLM, … */
13
13
  ModelProvider["Compatible"] = "compatible";
14
+ /**
15
+ * No endpoint at all: the call is handed to whoever holds the execution.
16
+ *
17
+ * A delegated model does not talk to a provider. It packages the call — the system prompt, the
18
+ * conversation, the tools or the schema — and hands it to a transport the application seated,
19
+ * which carries it to something outside this process entirely: a coding agent driving the
20
+ * application through a connector, a human, a test. The answer comes back the same way and is
21
+ * turned into a completion the rest of the stack cannot tell apart from a provider's.
22
+ *
23
+ * It exists so that "who performs this call" can be a property of the SESSION rather than of the
24
+ * code: the same pipeline, the same prompts and the same retry rules, billed to somebody else's
25
+ * model.
26
+ */
27
+ ModelProvider["Delegated"] = "delegated";
14
28
  })(ModelProvider || (ModelProvider = {}));
15
29
  /**
16
30
  * Refinement level of an execution. An execution is refined downward only:
@@ -93,4 +107,11 @@ export const PROMPT_BLOCK_ORDER = [
93
107
  ];
94
108
  /** Sort weight of a skill that declares none — see `SkillDefinition.order`. */
95
109
  export const DEFAULT_SKILL_ORDER = 100;
110
+ /**
111
+ * Conventional {@link ModelRole} for the cheap side calls the layer makes on its own
112
+ * behalf — a relevance pick, a classification, a one-line judgement — rather than for the
113
+ * work a caller asked for. A deployment that names its cheap tier differently points
114
+ * `ModelPolicy.utilityRole` at its own alias; nothing else has to change.
115
+ */
116
+ export const UTILITY_ROLE = 'utility';
96
117
  //# sourceMappingURL=consts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,yFAAyF;IACzF,kCAAiB,CAAA;IACjB,8BAA8B;IAC9B,wCAAuB,CAAA;IACvB,yFAAyF;IACzF,0CAAyB,CAAA;AAC3B,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,mCAAiB,CAAA;AACnB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,wCAAqB,CAAA;IACrB,gCAAa,CAAA;IACb,8BAAW,CAAA;AACb,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,0DAA0D;AAC1D,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,qCAAa,CAAA;IACb,8CAAsB,CAAA;AACxB,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B;AAED,mFAAmF;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;AACrB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,WAAW,CAAC,IAAI;IAChB,WAAW,CAAC,MAAM;IAClB,WAAW,CAAC,QAAQ;IACpB,WAAW,CAAC,OAAO;CACX,CAAA;AAEV,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA"}
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,MAAM,CAAN,IAAY,aAqBX;AArBD,WAAY,aAAa;IACvB,yFAAyF;IACzF,kCAAiB,CAAA;IACjB,8BAA8B;IAC9B,wCAAuB,CAAA;IACvB,yFAAyF;IACzF,0CAAyB,CAAA;IACzB;;;;;;;;;;;;OAYG;IACH,wCAAuB,CAAA;AACzB,CAAC,EArBW,aAAa,KAAb,aAAa,QAqBxB;AAED;;;GAGG;AACH,MAAM,CAAN,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,qCAAmB,CAAA;IACnB,+BAAa,CAAA;IACb,mCAAiB,CAAA;AACnB,CAAC,EAJW,cAAc,KAAd,cAAc,QAIzB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,wCAAqB,CAAA;IACrB,gCAAa,CAAA;IACb,8BAAW,CAAA;AACb,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+BAAa,CAAA;AACf,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,0DAA0D;AAC1D,MAAM,CAAN,IAAY,oBAIX;AAJD,WAAY,oBAAoB;IAC9B,qCAAa,CAAA;IACb,qCAAa,CAAA;IACb,8CAAsB,CAAA;AACxB,CAAC,EAJW,oBAAoB,KAApB,oBAAoB,QAI/B;AAED,mFAAmF;AACnF,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAA;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;AACrB,CAAC,EALW,WAAW,KAAX,WAAW,QAKtB;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAA2B;IACxD,WAAW,CAAC,IAAI;IAChB,WAAW,CAAC,MAAM;IAClB,WAAW,CAAC,QAAQ;IACpB,WAAW,CAAC,OAAO;CACX,CAAA;AAEV,+EAA+E;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/delegate/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './types.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/delegate/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * The serializable form of one model call, for a performer outside this process.
3
+ *
4
+ * A delegated call cannot pass a `BaseChatModel` or a langchain message anywhere: the thing that
5
+ * answers it is a coding agent on somebody's laptop, a test double, or a person. So the call is
6
+ * reduced to what any of them can act on — a persona, a conversation, and the shape the answer
7
+ * must take — and everything provider-specific is left behind.
8
+ *
9
+ * There is no vocabulary here from whatever pipeline asked. A `role` and a `tier` travel because
10
+ * the performer has to choose a model; nothing else about the caller does.
11
+ */
12
+ /** What the answer must be. */
13
+ export declare enum DelegatedMode {
14
+ /** Prose or code. */
15
+ Text = "text",
16
+ /** Exactly one JSON object satisfying `outputSchema`. */
17
+ Json = "json",
18
+ /** A list of calls chosen from `tools`. */
19
+ Tools = "tools"
20
+ }
21
+ /** Who a message came from. Deliberately the four roles every chat API agrees on. */
22
+ export declare enum DelegatedRole {
23
+ System = "system",
24
+ User = "user",
25
+ Assistant = "assistant",
26
+ Tool = "tool"
27
+ }
28
+ /** What shape an answer came back in. */
29
+ export declare enum DelegatedResultKind {
30
+ Text = "text",
31
+ Json = "json",
32
+ ToolCalls = "tool-calls",
33
+ /** The performer could not answer. Treated as a malformed answer: asked again, with the reason. */
34
+ Error = "error"
35
+ }
36
+ export interface DelegatedToolCall {
37
+ id?: string;
38
+ name: string;
39
+ args: Record<string, unknown>;
40
+ }
41
+ export interface DelegatedMessage {
42
+ role: DelegatedRole;
43
+ content: string;
44
+ /** Assistant turns that called tools. */
45
+ toolCalls?: DelegatedToolCall[];
46
+ /** Tool turns answer one call, and name the tool they answer. */
47
+ toolCallId?: string;
48
+ name?: string;
49
+ }
50
+ export interface DelegatedTool {
51
+ name: string;
52
+ description?: string;
53
+ /** JSON Schema of the arguments. */
54
+ parameters: Record<string, unknown>;
55
+ }
56
+ export type DelegatedToolChoice = 'auto' | 'none' | {
57
+ name: string;
58
+ };
59
+ export interface DelegatedTask {
60
+ id: string;
61
+ /** Which transport is expected to answer it — the key the application seated it under. */
62
+ delegate: string;
63
+ /** The performer's role name, for its own logging. Never load-bearing. */
64
+ role?: string;
65
+ /** Which power class the performer should run this on. */
66
+ tier?: string;
67
+ /** 0-based. Above zero means a previous answer was refused; `feedback` says why. */
68
+ attempt: number;
69
+ mode: DelegatedMode;
70
+ system?: string;
71
+ messages: DelegatedMessage[];
72
+ tools?: DelegatedTool[];
73
+ toolChoice?: DelegatedToolChoice;
74
+ outputSchema?: Record<string, unknown>;
75
+ /** A soft cap, stated so a performer can size its own call. */
76
+ maxOutputChars?: number;
77
+ feedback?: string;
78
+ /** ISO. A performer past this may say so rather than answer. */
79
+ expiresAt?: string;
80
+ }
81
+ export interface DelegatedUsage {
82
+ inputTokens?: number;
83
+ outputTokens?: number;
84
+ }
85
+ export interface DelegatedResult {
86
+ taskId: string;
87
+ kind: DelegatedResultKind;
88
+ text?: string;
89
+ json?: unknown;
90
+ toolCalls?: DelegatedToolCall[];
91
+ error?: string;
92
+ /** What the performer spent. Recorded; it costs this deployment nothing. */
93
+ usage?: DelegatedUsage;
94
+ /** What the performer actually ran. Display only. */
95
+ model?: string;
96
+ }
97
+ /**
98
+ * How a delegated call reaches its performer.
99
+ *
100
+ * One method, because that is the whole seam: everything about routing, waiting, redelivery and
101
+ * giving up belongs to whoever implements it. A transport that cannot serve the call must THROW
102
+ * rather than answer with an error result — an error result is a bad answer, which is retried,
103
+ * while a transport that is gone is terminal.
104
+ */
105
+ export interface DelegateTransport {
106
+ dispatch: (task: DelegatedTask, signal?: AbortSignal) => Promise<DelegatedResult>;
107
+ }
108
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/delegate/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,+BAA+B;AAC/B,oBAAY,aAAa;IACvB,qBAAqB;IACrB,IAAI,SAAS;IACb,yDAAyD;IACzD,IAAI,SAAS;IACb,2CAA2C;IAC3C,KAAK,UAAU;CAChB;AAED,qFAAqF;AACrF,oBAAY,aAAa;IACvB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,IAAI,SAAS;CACd;AAED,yCAAyC;AACzC,oBAAY,mBAAmB;IAC7B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,SAAS,eAAe;IACxB,mGAAmG;IACnG,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC/B,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oCAAoC;IACpC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACpC;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEpE,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,0FAA0F;IAC1F,QAAQ,EAAE,MAAM,CAAA;IAChB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,0DAA0D;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,aAAa,CAAA;IACnB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,gBAAgB,EAAE,CAAA;IAC5B,KAAK,CAAC,EAAE,aAAa,EAAE,CAAA;IACvB,UAAU,CAAC,EAAE,mBAAmB,CAAA;IAChC,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,mBAAmB,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,4EAA4E;IAC5E,KAAK,CAAC,EAAE,cAAc,CAAA;IACtB,qDAAqD;IACrD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA;CAClF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The serializable form of one model call, for a performer outside this process.
3
+ *
4
+ * A delegated call cannot pass a `BaseChatModel` or a langchain message anywhere: the thing that
5
+ * answers it is a coding agent on somebody's laptop, a test double, or a person. So the call is
6
+ * reduced to what any of them can act on — a persona, a conversation, and the shape the answer
7
+ * must take — and everything provider-specific is left behind.
8
+ *
9
+ * There is no vocabulary here from whatever pipeline asked. A `role` and a `tier` travel because
10
+ * the performer has to choose a model; nothing else about the caller does.
11
+ */
12
+ /** What the answer must be. */
13
+ export var DelegatedMode;
14
+ (function (DelegatedMode) {
15
+ /** Prose or code. */
16
+ DelegatedMode["Text"] = "text";
17
+ /** Exactly one JSON object satisfying `outputSchema`. */
18
+ DelegatedMode["Json"] = "json";
19
+ /** A list of calls chosen from `tools`. */
20
+ DelegatedMode["Tools"] = "tools";
21
+ })(DelegatedMode || (DelegatedMode = {}));
22
+ /** Who a message came from. Deliberately the four roles every chat API agrees on. */
23
+ export var DelegatedRole;
24
+ (function (DelegatedRole) {
25
+ DelegatedRole["System"] = "system";
26
+ DelegatedRole["User"] = "user";
27
+ DelegatedRole["Assistant"] = "assistant";
28
+ DelegatedRole["Tool"] = "tool";
29
+ })(DelegatedRole || (DelegatedRole = {}));
30
+ /** What shape an answer came back in. */
31
+ export var DelegatedResultKind;
32
+ (function (DelegatedResultKind) {
33
+ DelegatedResultKind["Text"] = "text";
34
+ DelegatedResultKind["Json"] = "json";
35
+ DelegatedResultKind["ToolCalls"] = "tool-calls";
36
+ /** The performer could not answer. Treated as a malformed answer: asked again, with the reason. */
37
+ DelegatedResultKind["Error"] = "error";
38
+ })(DelegatedResultKind || (DelegatedResultKind = {}));
39
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/delegate/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,+BAA+B;AAC/B,MAAM,CAAN,IAAY,aAOX;AAPD,WAAY,aAAa;IACvB,qBAAqB;IACrB,8BAAa,CAAA;IACb,yDAAyD;IACzD,8BAAa,CAAA;IACb,2CAA2C;IAC3C,gCAAe,CAAA;AACjB,CAAC,EAPW,aAAa,KAAb,aAAa,QAOxB;AAED,qFAAqF;AACrF,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,kCAAiB,CAAA;IACjB,8BAAa,CAAA;IACb,wCAAuB,CAAA;IACvB,8BAAa,CAAA;AACf,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAED,yCAAyC;AACzC,MAAM,CAAN,IAAY,mBAMX;AAND,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,oCAAa,CAAA;IACb,+CAAwB,CAAA;IACxB,mGAAmG;IACnG,sCAAe,CAAA;AACjB,CAAC,EANW,mBAAmB,KAAnB,mBAAmB,QAM9B"}
@@ -17,6 +17,16 @@
17
17
  * that stops a rich helper from satisfying this one.
18
18
  */
19
19
  export interface LlmFileProvider {
20
+ /**
21
+ * Stable identity of WHAT this provider reads — a project root, a sandbox id.
22
+ *
23
+ * A prompt plugin that caches resolved reads across calls has nothing else to key on:
24
+ * providers are late-bound and often rebuilt per request, so object identity says
25
+ * nothing, and a cache shared between two projects serves the first one's files to the
26
+ * second. A provider that supplies no key is treated as uncacheable rather than as one
27
+ * more anonymous member of a shared bucket.
28
+ */
29
+ key?: string;
20
30
  /** Read a file relative to the root. With `noThrow`, a missing file yields `''`. */
21
31
  readFile: (filePath: string, noThrow?: boolean) => Promise<string>;
22
32
  /** Glob for files relative to the root. */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/files/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,eAAe;IAC9B,oFAAoF;IACpF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAElE,2CAA2C;IAC3C,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAEtD,gFAAgF;IAChF,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/D,qFAAqF;IACrF,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACnE;AAED;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,CAAC,MAAM,eAAe,CAAC,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/files/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IAEZ,oFAAoF;IACpF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IAElE,2CAA2C;IAC3C,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;IAEtD,gFAAgF;IAChF,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IAE/D,qFAAqF;IACrF,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACnE;AAED;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,CAAC,MAAM,eAAe,CAAC,CAAA"}
package/build/index.d.ts CHANGED
@@ -3,4 +3,6 @@ export type * from './types.js';
3
3
  export type * from './spectator/types.js';
4
4
  export type * from './files/types.js';
5
5
  export * from './files/utils.js';
6
+ export * from './delegate/index.js';
7
+ export * from './inquiry/index.js';
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,kBAAkB,CAAA;AACrC,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,mBAAmB,sBAAsB,CAAA;AACzC,mBAAmB,kBAAkB,CAAA;AACrC,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA"}
package/build/index.js CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from './consts.js';
2
2
  export * from './files/utils.js';
3
+ export * from './delegate/index.js';
4
+ export * from './inquiry/index.js';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAI3B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAA;AAI3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * What shape of answer a question expects. Deliberately three, because a question a person is
3
+ * asked mid-run is answered in seconds or not at all: pick one of these, say it in your own
4
+ * words, or say yes/no. Anything richer is a form, and a form belongs to an application screen.
5
+ */
6
+ export declare enum InquiryKind {
7
+ Choice = "choice",
8
+ Text = "text",
9
+ Confirm = "confirm"
10
+ }
11
+ /**
12
+ * What a run is allowed to do when it needs a decision that is not its own.
13
+ *
14
+ * - `Ask` — put it to a person through the seated transport and wait.
15
+ * - `Default` — assume the question's own default (or record a decline) and carry on. The caller
16
+ * is expected to RECORD the assumption; a run nobody is watching must never block.
17
+ * - `Refuse` — nobody may be asked at all; the attempt is an error.
18
+ */
19
+ export declare enum InquiryPolicy {
20
+ Ask = "ask",
21
+ Default = "default",
22
+ Refuse = "refuse"
23
+ }
24
+ /**
25
+ * The ONE ceiling on a stored answer, in characters. An answer is a decision, not a document.
26
+ *
27
+ * Every layer that carries an answer references this constant rather than choosing its own:
28
+ * `viable-common`'s `CONNECT_INQUIRY_MAX_TEXT` (the wire copy) equals it, `capAnswer` enforces it,
29
+ * and the connector's answer schema caps `text` at it. Three ceilings for one value is how a
30
+ * user's answer gets accepted on the wire and silently halved further in.
31
+ */
32
+ export declare const DEFAULT_INQUIRY_ANSWER_CHARS = 2000;
33
+ /** How many options one question may offer. Beyond this it is not a question. */
34
+ export declare const DEFAULT_INQUIRY_OPTIONS = 12;
35
+ /**
36
+ * How much of an answer's free text a resumable pipeline STATE may hold.
37
+ *
38
+ * A pipeline state is keys, markers and paths — a couple of full-size answers would make it prose,
39
+ * which is the invariant the whole pipeline design rests on. The decision (`value`/`declined`)
40
+ * stays whole; the prose is cut here and belongs in whatever document the application keeps for
41
+ * it (`stateAnswerOf`).
42
+ */
43
+ export declare const INQUIRY_STATE_TEXT_CHARS = 200;
44
+ /** The answer value of a confirmed {@link InquiryKind.Confirm}. */
45
+ export declare const CONFIRM_YES = "yes";
46
+ /** The answer value of a refused {@link InquiryKind.Confirm}. */
47
+ export declare const CONFIRM_NO = "no";
48
+ //# sourceMappingURL=consts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../src/inquiry/consts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,WAAW;IACrB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED;;;;;;;GAOG;AACH,oBAAY,aAAa;IACvB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,4BAA4B,OAAQ,CAAA;AAEjD,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,KAAK,CAAA;AAEzC;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAA;AAE3C,mEAAmE;AACnE,eAAO,MAAM,WAAW,QAAQ,CAAA;AAChC,iEAAiE;AACjE,eAAO,MAAM,UAAU,OAAO,CAAA"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * What shape of answer a question expects. Deliberately three, because a question a person is
3
+ * asked mid-run is answered in seconds or not at all: pick one of these, say it in your own
4
+ * words, or say yes/no. Anything richer is a form, and a form belongs to an application screen.
5
+ */
6
+ export var InquiryKind;
7
+ (function (InquiryKind) {
8
+ InquiryKind["Choice"] = "choice";
9
+ InquiryKind["Text"] = "text";
10
+ InquiryKind["Confirm"] = "confirm";
11
+ })(InquiryKind || (InquiryKind = {}));
12
+ /**
13
+ * What a run is allowed to do when it needs a decision that is not its own.
14
+ *
15
+ * - `Ask` — put it to a person through the seated transport and wait.
16
+ * - `Default` — assume the question's own default (or record a decline) and carry on. The caller
17
+ * is expected to RECORD the assumption; a run nobody is watching must never block.
18
+ * - `Refuse` — nobody may be asked at all; the attempt is an error.
19
+ */
20
+ export var InquiryPolicy;
21
+ (function (InquiryPolicy) {
22
+ InquiryPolicy["Ask"] = "ask";
23
+ InquiryPolicy["Default"] = "default";
24
+ InquiryPolicy["Refuse"] = "refuse";
25
+ })(InquiryPolicy || (InquiryPolicy = {}));
26
+ /**
27
+ * The ONE ceiling on a stored answer, in characters. An answer is a decision, not a document.
28
+ *
29
+ * Every layer that carries an answer references this constant rather than choosing its own:
30
+ * `viable-common`'s `CONNECT_INQUIRY_MAX_TEXT` (the wire copy) equals it, `capAnswer` enforces it,
31
+ * and the connector's answer schema caps `text` at it. Three ceilings for one value is how a
32
+ * user's answer gets accepted on the wire and silently halved further in.
33
+ */
34
+ export const DEFAULT_INQUIRY_ANSWER_CHARS = 2_000;
35
+ /** How many options one question may offer. Beyond this it is not a question. */
36
+ export const DEFAULT_INQUIRY_OPTIONS = 12;
37
+ /**
38
+ * How much of an answer's free text a resumable pipeline STATE may hold.
39
+ *
40
+ * A pipeline state is keys, markers and paths — a couple of full-size answers would make it prose,
41
+ * which is the invariant the whole pipeline design rests on. The decision (`value`/`declined`)
42
+ * stays whole; the prose is cut here and belongs in whatever document the application keeps for
43
+ * it (`stateAnswerOf`).
44
+ */
45
+ export const INQUIRY_STATE_TEXT_CHARS = 200;
46
+ /** The answer value of a confirmed {@link InquiryKind.Confirm}. */
47
+ export const CONFIRM_YES = 'yes';
48
+ /** The answer value of a refused {@link InquiryKind.Confirm}. */
49
+ export const CONFIRM_NO = 'no';
50
+ //# sourceMappingURL=consts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consts.js","sourceRoot":"","sources":["../../src/inquiry/consts.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,kCAAmB,CAAA;AACrB,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AAED;;;;;;;GAOG;AACH,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,4BAAW,CAAA;IACX,oCAAmB,CAAA;IACnB,kCAAiB,CAAA;AACnB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,KAAK,CAAA;AAEjD,iFAAiF;AACjF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAA;AAEzC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAA;AAE3C,mEAAmE;AACnE,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,CAAA;AAChC,iEAAiE;AACjE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * from './consts.js';
2
+ export type * from './types.js';
3
+ export * from './utils.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/inquiry/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,mBAAmB,YAAY,CAAA;AAC/B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from './consts.js';
2
+ export * from './utils.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/inquiry/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAE3B,cAAc,YAAY,CAAA"}
@@ -0,0 +1,72 @@
1
+ import type { InquiryKind, InquiryPolicy } from './consts.js';
2
+ /**
3
+ * One question put to a person while a run is in flight, and the answer that comes back.
4
+ *
5
+ * Everything here is serializable for the same reason a delegated task is: whoever answers is
6
+ * outside this process — a browser dialog, a coding agent driving the application through a
7
+ * connector, a test double — and the question may outlive the process that asked it, parked on a
8
+ * pipeline run row until somebody comes back to it.
9
+ */
10
+ export interface InquiryOption {
11
+ value: string;
12
+ label: string;
13
+ description?: string;
14
+ }
15
+ export interface Inquiry {
16
+ /** Stable id, chosen by whoever asks. The ONLY thing that routes an answer back. */
17
+ id: string;
18
+ kind: InquiryKind;
19
+ /** One question, in plain words. */
20
+ question: string;
21
+ /** One or two sentences of background. Never the whole task. */
22
+ context?: string;
23
+ /** Required for {@link InquiryKind.Choice}; ignored otherwise. */
24
+ options?: InquiryOption[];
25
+ multiple?: boolean;
26
+ /** A `Choice` the answerer may answer in their own words instead. */
27
+ allowText?: boolean;
28
+ /** What to assume when nobody answers. {@link InquiryPolicy.Default} returns exactly this. */
29
+ default?: string | string[];
30
+ expiresAt?: string;
31
+ }
32
+ export interface InquiryAnswer {
33
+ inquiryId: string;
34
+ value?: string | string[];
35
+ text?: string;
36
+ /** Nobody could decide. A legitimate ANSWER, never a failure. */
37
+ declined?: boolean;
38
+ /**
39
+ * This answer is not exactly the one that was given. Never an answerer's own flag.
40
+ *
41
+ * Two writers, two ceilings: `capAnswer` cuts the text to `DEFAULT_INQUIRY_ANSWER_CHARS` (and
42
+ * raises this WITHOUT cutting when a `value` arrived over that ceiling, since a shortened
43
+ * identifier matches no option), while `stateAnswerOf` cuts the text again to the much smaller
44
+ * `INQUIRY_STATE_TEXT_CHARS` a pipeline state may hold. So a flag read back off a resumed run
45
+ * says the state's copy is short — not that the person hit the answer ceiling.
46
+ *
47
+ * It exists so no cut is silent: whoever records the answer can say that the rest of it was
48
+ * dropped, instead of the answerer discovering it in the work that followed.
49
+ */
50
+ truncated?: boolean;
51
+ }
52
+ /**
53
+ * How a question reaches a person.
54
+ *
55
+ * One method, like `DelegateTransport` beside it, and for the same reason: routing, waiting,
56
+ * redelivery and giving up all belong to whoever implements it. A transport that cannot serve the
57
+ * question must THROW rather than answer — a declined answer is a decision, while a channel that
58
+ * is not there is terminal, and the two must never look alike.
59
+ */
60
+ export interface InquiryTransport {
61
+ ask: (inquiry: Inquiry, signal?: AbortSignal) => Promise<InquiryAnswer>;
62
+ }
63
+ /**
64
+ * How one run may put a question to a person. Carried on an execution's serializable state, so a
65
+ * resumed run keeps the channel and the policy it was started with.
66
+ */
67
+ export interface InquiryConfig {
68
+ /** The key the application seated an {@link InquiryTransport} under. */
69
+ transport?: string;
70
+ policy: InquiryPolicy;
71
+ }
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/inquiry/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAE7D;;;;;;;GAOG;AAEH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,OAAO;IACtB,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,WAAW,CAAA;IACjB,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAA;IAChB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,kEAAkE;IAClE,OAAO,CAAC,EAAE,aAAa,EAAE,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,qEAAqE;IACrE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,8FAA8F;IAC9F,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACzB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iEAAiE;IACjE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,aAAa,CAAC,CAAA;CACxE;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,aAAa,CAAA;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/inquiry/types.ts"],"names":[],"mappings":""}