@orkestrel/interpret 0.0.1
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/LICENSE +21 -0
- package/README.md +84 -0
- package/dist/src/core/index.cjs +2705 -0
- package/dist/src/core/index.cjs.map +1 -0
- package/dist/src/core/index.d.cts +2133 -0
- package/dist/src/core/index.d.ts +2133 -0
- package/dist/src/core/index.js +2636 -0
- package/dist/src/core/index.js.map +1 -0
- package/package.json +86 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Orkestrel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# @orkestrel/interpret
|
|
2
|
+
|
|
3
|
+
A zero-dependency, synchronous, deterministic bidirectional bridge between
|
|
4
|
+
natural language and the [`@orkestrel/reason`](https://github.com/orkestrel/reason)
|
|
5
|
+
engine. FORWARD: raw text is normalized, classified into an intent, matched
|
|
6
|
+
against a registered `Template`, mined for numeric entities, clarified
|
|
7
|
+
(carry-over / defaults / computed fields), formatted into a refined prompt,
|
|
8
|
+
then generated into a `Subject` + `Definition` pair ready for
|
|
9
|
+
`Reason.reason`. REVERSE: a `Definition` / `Subject` / `ReasonResult`
|
|
10
|
+
renders to display-neutral prose through a lexicon-driven `Narrator`.
|
|
11
|
+
Nothing here is an LLM, provider, or agent. Environment-agnostic — no I/O,
|
|
12
|
+
no browser or server assumptions. Part of the `@orkestrel` line.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @orkestrel/interpret
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Requirements
|
|
21
|
+
|
|
22
|
+
- Node.js >= 24
|
|
23
|
+
- ESM-only (no CommonJS build)
|
|
24
|
+
- Runtime dependencies: [`@orkestrel/reason`](https://github.com/orkestrel/reason),
|
|
25
|
+
[`@orkestrel/contract`](https://github.com/orkestrel/contract),
|
|
26
|
+
[`@orkestrel/emitter`](https://github.com/orkestrel/emitter)
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { createInterpret } from '@orkestrel/interpret'
|
|
32
|
+
import { factorGroup, fieldFactor, quantitativeDefinition } from '@orkestrel/reason'
|
|
33
|
+
|
|
34
|
+
const interpret = createInterpret({
|
|
35
|
+
extractor: {
|
|
36
|
+
extract: () => ({
|
|
37
|
+
intent: { action: 'calculate', domain: 'arithmetic', confidence: 1 },
|
|
38
|
+
numbers: [42],
|
|
39
|
+
complete: true,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
templates: [
|
|
43
|
+
{
|
|
44
|
+
id: 't1',
|
|
45
|
+
name: 'Arithmetic',
|
|
46
|
+
domain: 'arithmetic',
|
|
47
|
+
intents: ['calculate'],
|
|
48
|
+
mappings: [{ entity: 'value', aliases: [], field: 'value' }],
|
|
49
|
+
defaults: [],
|
|
50
|
+
computations: [],
|
|
51
|
+
definition: quantitativeDefinition('t1', 'Arithmetic', [
|
|
52
|
+
factorGroup('total', 'sum', [fieldFactor('value', 'value')]),
|
|
53
|
+
]),
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
const result = interpret.interpret('calculate arithmetic 42')
|
|
59
|
+
result.subject // { value: 42 }
|
|
60
|
+
|
|
61
|
+
interpret.destroy()
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`interpret()` is genuinely synchronous and runs the fixed five-stage
|
|
65
|
+
pipeline `[normalize, extract, clarify, format, generate]`. A `NO_TEMPLATE`
|
|
66
|
+
/ `LOW_CONFIDENCE` non-match, or a thrown stage, both yield a visible
|
|
67
|
+
INCOMPLETE result rather than an arbitrary fallback.
|
|
68
|
+
|
|
69
|
+
## Guide
|
|
70
|
+
|
|
71
|
+
For the full surface — the `Interpret` orchestrator, the five pipeline
|
|
72
|
+
stages, the template/subject/definition managers, the cross-turn context,
|
|
73
|
+
the lexicon-driven `Narrator`, helpers, validators, factories, errors, and
|
|
74
|
+
the observation surface — see
|
|
75
|
+
[`guides/src/interpret.md`](guides/src/interpret.md).
|
|
76
|
+
|
|
77
|
+
## Package
|
|
78
|
+
|
|
79
|
+
Published as a single typed entry point per the `exports` field in
|
|
80
|
+
`package.json`.
|
|
81
|
+
|
|
82
|
+
## License
|
|
83
|
+
|
|
84
|
+
MIT © [Orkestrel](https://github.com/orkestrel) — see [LICENSE](./LICENSE).
|