@molecule/api-ai-decisions-laya 1.1.1 → 1.1.3
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 +59 -55
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -3,15 +3,11 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-10-
|
|
6
|
+
Generated: 2026-10-26T04:21:55.999Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/api-ai-decisions-laya
|
|
10
10
|
|
|
11
|
-
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
-
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
-
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
-
|
|
15
11
|
Laya decisions provider for molecule.dev — typed decisions from the
|
|
16
12
|
open-weights Laya model (Apache-2.0) on a `laya-serve` host you run.
|
|
17
13
|
|
|
@@ -22,6 +18,10 @@ with no text generation. This bond speaks `laya-serve`'s `/v1/systemone`
|
|
|
22
18
|
route, the same wire protocol as TypeSafe's Jev, so swapping to
|
|
23
19
|
`@molecule/api-ai-decisions-jev` is a one-line change.
|
|
24
20
|
|
|
21
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
22
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
23
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
24
|
+
|
|
25
25
|
## Quick Start
|
|
26
26
|
|
|
27
27
|
```bash
|
|
@@ -92,26 +92,15 @@ interface LayaConfig {
|
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
#### `
|
|
95
|
+
#### `WireQuestion`
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
One question as sent on the wire.
|
|
98
98
|
|
|
99
99
|
```typescript
|
|
100
|
-
interface
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
apiKey?: string
|
|
105
|
-
/** Extra headers resolved before the request (merged over the defaults). */
|
|
106
|
-
headers?: () => Record<string, string> | Promise<Record<string, string>>
|
|
107
|
-
/** Request body. */
|
|
108
|
-
body: Record<string, unknown>
|
|
109
|
-
/** Abort signal. */
|
|
110
|
-
signal?: AbortSignal
|
|
111
|
-
/** Label for error messages (`'Laya'`, `'Jev'`). */
|
|
112
|
-
label: string
|
|
113
|
-
/** Max retries on a retryable status (default 3). */
|
|
114
|
-
maxRetries?: number
|
|
100
|
+
interface WireQuestion {
|
|
101
|
+
type: 'choice' | 'score' | 'noul'
|
|
102
|
+
instructions: string
|
|
103
|
+
criteria?: Record<string, string> | string[]
|
|
115
104
|
}
|
|
116
105
|
```
|
|
117
106
|
|
|
@@ -129,18 +118,6 @@ interface WireAnswer {
|
|
|
129
118
|
}
|
|
130
119
|
```
|
|
131
120
|
|
|
132
|
-
#### `WireQuestion`
|
|
133
|
-
|
|
134
|
-
One question as sent on the wire.
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
interface WireQuestion {
|
|
138
|
-
type: 'choice' | 'score' | 'noul'
|
|
139
|
-
instructions: string
|
|
140
|
-
criteria?: Record<string, string> | string[]
|
|
141
|
-
}
|
|
142
|
-
```
|
|
143
|
-
|
|
144
121
|
#### `WireResponse`
|
|
145
122
|
|
|
146
123
|
The response body (only the fields we read).
|
|
@@ -153,6 +130,29 @@ interface WireResponse {
|
|
|
153
130
|
}
|
|
154
131
|
```
|
|
155
132
|
|
|
133
|
+
#### `PostOptions`
|
|
134
|
+
|
|
135
|
+
Options for {@link postSystemOne}.
|
|
136
|
+
|
|
137
|
+
```typescript
|
|
138
|
+
interface PostOptions {
|
|
139
|
+
/** Full endpoint URL. */
|
|
140
|
+
url: string
|
|
141
|
+
/** Bearer token, if any. */
|
|
142
|
+
apiKey?: string
|
|
143
|
+
/** Extra headers resolved before the request (merged over the defaults). */
|
|
144
|
+
headers?: () => Record<string, string> | Promise<Record<string, string>>
|
|
145
|
+
/** Request body. */
|
|
146
|
+
body: Record<string, unknown>
|
|
147
|
+
/** Abort signal. */
|
|
148
|
+
signal?: AbortSignal
|
|
149
|
+
/** Label for error messages (`'Laya'`, `'Jev'`). */
|
|
150
|
+
label: string
|
|
151
|
+
/** Max retries on a retryable status (default 3). */
|
|
152
|
+
maxRetries?: number
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
156
|
### Functions
|
|
157
157
|
|
|
158
158
|
#### `createProvider(config)`
|
|
@@ -167,6 +167,18 @@ function createProvider(config?: LayaConfig): AIDecisionsProvider
|
|
|
167
167
|
|
|
168
168
|
**Returns:** An `AIDecisionsProvider` backed by a `laya-serve` host.
|
|
169
169
|
|
|
170
|
+
#### `toWireQuestions(questions)`
|
|
171
|
+
|
|
172
|
+
Converts the core's questions into wire questions (`yesNo` → `noul`).
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
function toWireQuestions(questions: Record<string, DecisionQuestion>): Record<string, WireQuestion>
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
- `questions` — The questions keyed by id.
|
|
179
|
+
|
|
180
|
+
**Returns:** The wire `questions` object.
|
|
181
|
+
|
|
170
182
|
#### `fromWireAnswer(id, question, wire, minConfidence)`
|
|
171
183
|
|
|
172
184
|
Converts one wire answer into the core's answer for `question`.
|
|
@@ -192,7 +204,11 @@ function fromWireAnswer(
|
|
|
192
204
|
Converts a whole wire response into the core's result.
|
|
193
205
|
|
|
194
206
|
```typescript
|
|
195
|
-
function fromWireResponse
|
|
207
|
+
function fromWireResponse<Q extends Record<string, DecisionQuestion>>(
|
|
208
|
+
questions: Q,
|
|
209
|
+
body: WireResponse,
|
|
210
|
+
minConfidence?: number,
|
|
211
|
+
): DecideResult<Q>
|
|
196
212
|
```
|
|
197
213
|
|
|
198
214
|
- `questions` — The questions that were asked.
|
|
@@ -214,28 +230,8 @@ function postSystemOne(opts: PostOptions): Promise<WireResponse>
|
|
|
214
230
|
|
|
215
231
|
**Returns:** The parsed response body.
|
|
216
232
|
|
|
217
|
-
#### `toWireQuestions(questions)`
|
|
218
|
-
|
|
219
|
-
Converts the core's questions into wire questions (`yesNo` → `noul`).
|
|
220
|
-
|
|
221
|
-
```typescript
|
|
222
|
-
function toWireQuestions(questions: Record<string, DecisionQuestion>): Record<string, WireQuestion>
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
- `questions` — The questions keyed by id.
|
|
226
|
-
|
|
227
|
-
**Returns:** The wire `questions` object.
|
|
228
|
-
|
|
229
233
|
### Constants
|
|
230
234
|
|
|
231
|
-
#### `aiDecisionsLayaSecretDefinitions`
|
|
232
|
-
|
|
233
|
-
Secret definitions used by the Laya decisions bond.
|
|
234
|
-
|
|
235
|
-
```typescript
|
|
236
|
-
const aiDecisionsLayaSecretDefinitions: SecretDefinition[]
|
|
237
|
-
```
|
|
238
|
-
|
|
239
235
|
#### `DEFAULT_LAYA_URL`
|
|
240
236
|
|
|
241
237
|
`laya-serve`'s default bind (`LAYA_PORT` defaults to 8000).
|
|
@@ -252,6 +248,14 @@ The provider implementation — lazy, so env vars are read on first use.
|
|
|
252
248
|
const provider: AIDecisionsProvider
|
|
253
249
|
```
|
|
254
250
|
|
|
251
|
+
#### `aiDecisionsLayaSecretDefinitions`
|
|
252
|
+
|
|
253
|
+
Secret definitions used by the Laya decisions bond.
|
|
254
|
+
|
|
255
|
+
```typescript
|
|
256
|
+
const aiDecisionsLayaSecretDefinitions: SecretDefinition[]
|
|
257
|
+
```
|
|
258
|
+
|
|
255
259
|
## Core Interface
|
|
256
260
|
|
|
257
261
|
Implements `@molecule/api-ai-decisions` interface.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/api-ai-decisions-laya",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Laya decisions provider for molecule.dev — typed choice/score/yes-no answers from the open-weights Laya model on your own laya-serve host",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"@molecule/api-secrets": "^1.0.1"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@molecule/api-ai-decisions": "1.1.
|
|
38
|
+
"@molecule/api-ai-decisions": "1.1.2",
|
|
39
39
|
"@molecule/api-secrets": "1.0.2",
|
|
40
|
-
"@types/node": "26.
|
|
40
|
+
"@types/node": "26.6.5",
|
|
41
41
|
"typescript": "6.0.3",
|
|
42
|
-
"vitest": "4.1.
|
|
42
|
+
"vitest": "4.1.12"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
45
45
|
"type": "git",
|