@gobing-ai/ts-ai-decision 0.5.21 → 0.5.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/dist/params.d.ts.map +1 -1
- package/dist/params.js +4 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +12 -1
- package/package.json +5 -5
- package/src/params.ts +5 -1
- package/src/registry.ts +12 -3
package/dist/params.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../src/params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAY,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAExG;;;GAGG;AAEH,iGAAiG;AACjG,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,2BAA4B,CAAC;AAKvE,+EAA+E;AAC/E,wBAAgB,yBAAyB,IAAI,aAAa,CAEzD;AA8BD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM,GAAG,cAAc,CA2BnH;AAiCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,GAAG,WAAW,
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../src/params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAEpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAY,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAExG;;;GAGG;AAEH,iGAAiG;AACjG,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD,iFAAiF;AACjF,eAAO,MAAM,6BAA6B,2BAA4B,CAAC;AAKvE,+EAA+E;AAC/E,wBAAgB,yBAAyB,IAAI,aAAa,CAEzD;AA8BD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,IAAI,CAAM,GAAG,cAAc,CA2BnH;AAiCD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,GAAG,WAAW,CAoChG;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,CAS5G"}
|
package/dist/params.js
CHANGED
|
@@ -98,7 +98,10 @@ function renderEntry(decisionId, entry, params) {
|
|
|
98
98
|
* `maker` and `model` are never templated, so the answer vocabulary stays static.
|
|
99
99
|
*/
|
|
100
100
|
export function renderQuestion(decision, params) {
|
|
101
|
-
const
|
|
101
|
+
const rendered = renderEntry(decision.id, decision.instructions, params);
|
|
102
|
+
const instructions = typeof rendered === 'string' && rendered.trim().length === 0 && decision.description
|
|
103
|
+
? decision.description
|
|
104
|
+
: rendered;
|
|
102
105
|
const criteria = decision.criteria;
|
|
103
106
|
switch (criteria.kind) {
|
|
104
107
|
case 'choice': {
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC7G,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAoB,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;A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,CAAC,EAAE;QAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,eAAe,CAAC;QAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,iBAAiB,CAAA;KAAE,CAAC;CACjH;AAID;;;;;;;;GAQG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAGpB;IAEJ,sFAAsF;gBAC1E,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,mBAAmB,GAAG,KAAK,CAAA;KAAE;IAqBhE,oGAAoG;IACpG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI;IAWjD,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI1B,KAAK,IAAI,MAAM,EAAE;IAIjB;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CA2BtD"}
|
package/dist/registry.js
CHANGED
|
@@ -21,7 +21,18 @@ export class DecisionMakerRegistry {
|
|
|
21
21
|
const { makerOptions = {}, driverOptions = {} } = options?.builtins ?? {};
|
|
22
22
|
this.register('typesafe', () => createDecisionMaker({ backend: 'typesafe', ...makerOptions }));
|
|
23
23
|
this.register('fm-local', () => createDecisionMaker({ driver: createFmDriver(driverOptions['fm-local'] ?? {}), ...makerOptions }));
|
|
24
|
-
this.register('laya-local', () =>
|
|
24
|
+
this.register('laya-local', () => {
|
|
25
|
+
const driverOpts = {
|
|
26
|
+
...driverOptions['laya-local'],
|
|
27
|
+
};
|
|
28
|
+
if (makerOptions.env && driverOpts.env === undefined) {
|
|
29
|
+
driverOpts.env = makerOptions.env;
|
|
30
|
+
}
|
|
31
|
+
return createDecisionMaker({
|
|
32
|
+
driver: createLayaDriver(driverOpts),
|
|
33
|
+
...makerOptions,
|
|
34
|
+
});
|
|
35
|
+
});
|
|
25
36
|
}
|
|
26
37
|
/** Register a maker or factory under `name`; chains. Throws on a bad or already-registered name. */
|
|
27
38
|
register(name, source) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gobing-ai/ts-ai-decision",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.22",
|
|
4
4
|
"description": "@gobing-ai/ts-ai-decision — Declarative YAML decision catalog over the ts-ai-runner DecisionMaker surface.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -51,10 +51,10 @@
|
|
|
51
51
|
"release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-ai-decision-v<version> && git push --tags' && exit 1"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@gobing-ai/ts-ai-runner": "^0.5.
|
|
55
|
-
"@gobing-ai/ts-decision-fm": "^0.5.
|
|
56
|
-
"@gobing-ai/ts-laya-mlx": "^0.5.
|
|
57
|
-
"@gobing-ai/ts-runtime": "^0.5.
|
|
54
|
+
"@gobing-ai/ts-ai-runner": "^0.5.22",
|
|
55
|
+
"@gobing-ai/ts-decision-fm": "^0.5.22",
|
|
56
|
+
"@gobing-ai/ts-laya-mlx": "^0.5.22",
|
|
57
|
+
"@gobing-ai/ts-runtime": "^0.5.22",
|
|
58
58
|
"zod": "^4.1.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
package/src/params.ts
CHANGED
|
@@ -121,7 +121,11 @@ function renderEntry(decisionId: string, entry: JevEntry, params: ResolvedParams
|
|
|
121
121
|
* `maker` and `model` are never templated, so the answer vocabulary stays static.
|
|
122
122
|
*/
|
|
123
123
|
export function renderQuestion(decision: DecisionDefinition, params: ResolvedParams): JevQuestion {
|
|
124
|
-
const
|
|
124
|
+
const rendered = renderEntry(decision.id, decision.instructions, params);
|
|
125
|
+
const instructions =
|
|
126
|
+
typeof rendered === 'string' && rendered.trim().length === 0 && decision.description
|
|
127
|
+
? decision.description
|
|
128
|
+
: rendered;
|
|
125
129
|
const criteria = decision.criteria;
|
|
126
130
|
switch (criteria.kind) {
|
|
127
131
|
case 'choice': {
|
package/src/registry.ts
CHANGED
|
@@ -39,9 +39,18 @@ export class DecisionMakerRegistry {
|
|
|
39
39
|
this.register('fm-local', () =>
|
|
40
40
|
createDecisionMaker({ driver: createFmDriver(driverOptions['fm-local'] ?? {}), ...makerOptions }),
|
|
41
41
|
);
|
|
42
|
-
this.register('laya-local', () =>
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
this.register('laya-local', () => {
|
|
43
|
+
const driverOpts: LayaDriverOptions = {
|
|
44
|
+
...driverOptions['laya-local'],
|
|
45
|
+
};
|
|
46
|
+
if (makerOptions.env && driverOpts.env === undefined) {
|
|
47
|
+
driverOpts.env = makerOptions.env as Record<string, string | undefined>;
|
|
48
|
+
}
|
|
49
|
+
return createDecisionMaker({
|
|
50
|
+
driver: createLayaDriver(driverOpts),
|
|
51
|
+
...makerOptions,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
45
54
|
}
|
|
46
55
|
|
|
47
56
|
/** Register a maker or factory under `name`; chains. Throws on a bad or already-registered name. */
|