@gobing-ai/ts-decision-clef 0.5.25 → 0.5.27

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.
@@ -1 +1 @@
1
- {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,KAAK,cAAc,EAQtB,MAAM,yBAAyB,CAAC;AAGjC,yEAAyE;AACzE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;AAE9C,0FAA0F;AAC1F,MAAM,WAAW,iBAAiB;IAC9B,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACnC;AAoJD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CA2Q3E"}
1
+ {"version":3,"file":"driver.d.ts","sourceRoot":"","sources":["../src/driver.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,KAAK,cAAc,EAQtB,MAAM,yBAAyB,CAAC;AAGjC,yEAAyE;AACzE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;AAE9C,0FAA0F;AAC1F,MAAM,WAAW,iBAAiB;IAC9B,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;IACjB,wFAAwF;IACxF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yFAAyF;IACzF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;CACnC;AAoJD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAkR3E"}
package/dist/driver.js CHANGED
@@ -206,11 +206,18 @@ export function createClefDriver(options) {
206
206
  }
207
207
  }
208
208
  }
209
- assertJsonSerializable(state, 'state');
209
+ // `undefined` means "no caller context" exactly as `null` does — the neutral contract
210
+ // has one absent state, so validate it as such rather than rejecting it as unserializable.
211
+ assertJsonSerializable(state ?? null, 'state');
210
212
  const mappedQuestions = Object.fromEntries(questionEntries.map(([name, q]) => [name, mapQuestion(name, q)]));
211
213
  const requestBody = {
212
214
  model: resolvedModel,
213
- state: state ?? null,
215
+ // Cloudflare's Clef endpoint requires `state` to be a string, dictionary or list:
216
+ // `"state": null` fails request-body validation with HTTP 422, which degraded every
217
+ // parameterless decision (the hub's `buildState` returns null) to its declared
218
+ // fallback. Same null→'' mapping the laya and fm drivers already apply; structured
219
+ // state passes through untouched.
220
+ state: state ?? '',
214
221
  questions: mappedQuestions,
215
222
  };
216
223
  assertJsonSerializable(requestBody, 'request');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/ts-decision-clef",
3
- "version": "0.5.25",
3
+ "version": "0.5.27",
4
4
  "description": "@gobing-ai/ts-decision-clef — Hosted Clef decision backend driving Cloudflare Workers AI over the portable ts-infra APIClient seam.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -51,11 +51,11 @@
51
51
  "release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-decision-clef-v<version> && git push --tags' && exit 1"
52
52
  },
53
53
  "dependencies": {
54
- "@gobing-ai/ts-ai-runner": "^0.5.25",
55
- "@gobing-ai/ts-infra": "^0.5.25"
54
+ "@gobing-ai/ts-ai-runner": "^0.5.27",
55
+ "@gobing-ai/ts-infra": "^0.5.27"
56
56
  },
57
57
  "devDependencies": {
58
- "@gobing-ai/ts-ai-decision": "^0.5.25",
58
+ "@gobing-ai/ts-ai-decision": "^0.5.27",
59
59
  "@types/bun": "1.4.3"
60
60
  },
61
61
  "publishConfig": {
package/src/driver.ts CHANGED
@@ -284,7 +284,9 @@ export function createClefDriver(options: ClefDriverOptions): DecisionDriver {
284
284
  }
285
285
  }
286
286
 
287
- assertJsonSerializable(state, 'state');
287
+ // `undefined` means "no caller context" exactly as `null` does — the neutral contract
288
+ // has one absent state, so validate it as such rather than rejecting it as unserializable.
289
+ assertJsonSerializable(state ?? null, 'state');
288
290
 
289
291
  const mappedQuestions = Object.fromEntries(
290
292
  questionEntries.map(([name, q]) => [name, mapQuestion(name, q)]),
@@ -292,7 +294,12 @@ export function createClefDriver(options: ClefDriverOptions): DecisionDriver {
292
294
 
293
295
  const requestBody = {
294
296
  model: resolvedModel,
295
- state: state ?? null,
297
+ // Cloudflare's Clef endpoint requires `state` to be a string, dictionary or list:
298
+ // `"state": null` fails request-body validation with HTTP 422, which degraded every
299
+ // parameterless decision (the hub's `buildState` returns null) to its declared
300
+ // fallback. Same null→'' mapping the laya and fm drivers already apply; structured
301
+ // state passes through untouched.
302
+ state: state ?? '',
296
303
  questions: mappedQuestions,
297
304
  };
298
305