@fayegram-ai/decision-bridge 0.1.1 → 0.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.
Files changed (79) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/CONTRIBUTING.md +5 -3
  3. package/README.md +26 -10
  4. package/SECURITY.md +18 -11
  5. package/docs/README.md +19 -5
  6. package/docs/development/ARCHITECTURE.md +36 -7
  7. package/docs/development/DESIGN.md +21 -3
  8. package/docs/development/RELEASING.md +7 -3
  9. package/docs/development/REPOSITORY_LAYOUT.md +2 -0
  10. package/docs/development/TESTING.md +31 -3
  11. package/docs/guides/BROWSER.md +8 -0
  12. package/docs/guides/CLOUDFLARE_DECISIONS.md +24 -46
  13. package/docs/guides/CUSTOMIZATION.md +8 -2
  14. package/docs/guides/CUSTOM_GENERATIVE.md +5 -3
  15. package/docs/guides/CUSTOM_PROVIDERS.md +5 -3
  16. package/docs/guides/EXTRACTION.md +125 -0
  17. package/docs/guides/GETTING_STARTED.md +8 -4
  18. package/docs/guides/JEV.md +167 -0
  19. package/docs/guides/LIVE_DECISIONS.md +163 -0
  20. package/docs/guides/OPENAI_DECISIONS.md +52 -24
  21. package/docs/guides/PLATFORMS.md +3 -3
  22. package/docs/guides/SWITCHING_MODELS.md +6 -2
  23. package/docs/guides/TROUBLESHOOTING.md +25 -0
  24. package/docs/reference/CLI.md +60 -11
  25. package/docs/reference/CONFIGURATION.md +34 -6
  26. package/docs/reference/ERRORS.md +41 -12
  27. package/docs/reference/PROVIDERS.md +31 -8
  28. package/docs/reference/SDK.md +72 -26
  29. package/docs/reference/SOURCES.md +11 -0
  30. package/examples/extraction.mjs +16 -0
  31. package/examples/live-decisions.mjs +24 -0
  32. package/package.json +11 -1
  33. package/schemas/decision.config.schema.json +102 -11
  34. package/src/bridge.mjs +9 -6
  35. package/src/capabilities.mjs +34 -4
  36. package/src/cli/config-validation.mjs +13 -5
  37. package/src/cli/config.mjs +19 -4
  38. package/src/cli/decisions.mjs +8 -0
  39. package/src/cli/initialize.mjs +8 -4
  40. package/src/cli/live.mjs +63 -0
  41. package/src/cli/main.mjs +50 -16
  42. package/src/cli/provider-loader.mjs +3 -2
  43. package/src/cloudflare-decisions.d.mts +12 -5
  44. package/src/decisions.d.mts +28 -4
  45. package/src/errors.mjs +7 -1
  46. package/src/extraction/index.d.mts +66 -0
  47. package/src/extraction/index.mjs +78 -0
  48. package/src/extraction/validation.mjs +105 -0
  49. package/src/index.d.mts +42 -9
  50. package/src/index.mjs +1 -1
  51. package/src/input.mjs +21 -3
  52. package/src/jev.d.mts +16 -0
  53. package/src/live/index.d.mts +73 -0
  54. package/src/live/index.mjs +170 -0
  55. package/src/live/state.mjs +125 -0
  56. package/src/live/validation.mjs +122 -0
  57. package/src/probabilities.mjs +6 -3
  58. package/src/providers/cloudflare-images.mjs +5 -67
  59. package/src/providers/cloudflare-media.mjs +5 -10
  60. package/src/providers/cloudflare-preflight.mjs +4 -3
  61. package/src/providers/cloudflare-profile.mjs +10 -14
  62. package/src/providers/cloudflare-transport.mjs +12 -5
  63. package/src/providers/cloudflare-validation.mjs +3 -1
  64. package/src/providers/decisions-codec.mjs +10 -5
  65. package/src/providers/decisions-input.mjs +120 -0
  66. package/src/providers/decisions-validation.mjs +37 -69
  67. package/src/providers/image-header.mjs +59 -0
  68. package/src/providers/jev-images.mjs +84 -0
  69. package/src/providers/jev-preflight.mjs +62 -0
  70. package/src/providers/jev-profile.mjs +37 -0
  71. package/src/providers/jev.mjs +32 -13
  72. package/src/providers/media-binary.mjs +0 -7
  73. package/src/providers/openai-decisions.mjs +2 -1
  74. package/src/providers/openai-errors.mjs +23 -0
  75. package/src/providers/openai-profile.mjs +2 -1
  76. package/src/questions.mjs +2 -0
  77. package/src/response-transport.mjs +84 -17
  78. package/src/validation.mjs +39 -20
  79. package/src/version.mjs +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  Notable user-facing changes by version.
4
4
 
5
+ ## 0.1.3
6
+
7
+ - Expand OpenAI Decisions with conversation/tool history, remote images and
8
+ prompt caching, including common input, extensions and schema version 5.
9
+ - Add Clairic extraction over REST and Workers bindings, with nine field types,
10
+ native predictive metadata and extraction CLI commands.
11
+ - Add an existing-connection Live Decisions controller and offline protocol
12
+ validation/replay tools through a dedicated package export.
13
+ - Leave service quotas and admission ceilings upstream; preserve explicit client
14
+ resource budgets and improve safe errors and error-aware retries.
15
+ - Preserve requested Clairic model aliases in batch diagnostics and parse valid
16
+ retry hints without losing HTTP status or safe IDs when an error body fails.
17
+ - Harden Live configuration/history correlation, transcript ordering, item
18
+ acknowledgements, observer isolation, cancellation and connection cleanup.
19
+ Offline event validation and replay retain their respective input/server error
20
+ contracts.
21
+ - Document the expanded SDK and CLI APIs, extraction and Live operations, and
22
+ client resource controls.
23
+
24
+ ## 0.1.2
25
+
26
+ - Add opt-in Jev images, typed bounding boxes, native JSON assets, and long context
27
+ across SDK and CLI, with capability preflight and nullable token usage.
28
+
5
29
  ## 0.1.1
6
30
 
7
31
  - Add OpenAI `default`/`luna` selectors and requested/resolved model metadata; improve CLI configuration and documentation.
package/CONTRIBUTING.md CHANGED
@@ -20,9 +20,11 @@ configuration-schema validator from the lockfile. See the
20
20
  Start with the [architecture](docs/development/ARCHITECTURE.md),
21
21
  [design rationale](docs/development/DESIGN.md), and
22
22
  [repository layout](docs/development/REPOSITORY_LAYOUT.md).
23
- Preserve the provider-independent contract of `state` or ordered `input` plus
24
- `questions`, and explicit probability provenance. Add focused regression tests for bug fixes and wire-level
25
- tests for protocol changes. Fixtures must not contain credentials or live-account
23
+ Preserve the provider-independent contract of exactly one of `state`, ordered
24
+ `input` or `conversation`, plus `questions`, and explicit probability provenance.
25
+ Extraction and Live use dedicated operation contracts. Keep service admission
26
+ limits upstream and client resource controls explicit. Add focused regression
27
+ tests for bug fixes and wire-level tests for protocol changes. Fixtures must not contain credentials or live-account
26
28
  data; label synthetic responses as synthetic.
27
29
 
28
30
  ## Make and verify a change
package/README.md CHANGED
@@ -7,7 +7,7 @@ A JavaScript SDK that turns supplied information into structured decisions insid
7
7
  your application. An optional Node command runner is included for evaluating files.
8
8
  Give it a `state` (text or JSON to assess) and one or more `questions`; it returns
9
9
  validated choices, probabilities for yes/no (`noul`) questions, or rubric-based
10
- scores.
10
+ scores. Capable providers also accept ordered media input or conversation history.
11
11
  For example, pass a failed test log to classify the failure and estimate whether
12
12
  a missing dependency caused it. Your application decides what to do with the result.
13
13
 
@@ -21,7 +21,7 @@ OpenRouter, and Anthropic presets. The bridge handles the shared request and res
21
21
  contract; each provider handles its API protocol and model capabilities.
22
22
 
23
23
  [OpenAI Decisions](docs/guides/OPENAI_DECISIONS.md) also supports ordered text/image
24
- input, typed string/boolean choices, labelled scores, and dedicated native access.
24
+ input, typed string/boolean choices, labelled scores, conversation/tool history, remote images, prompt caching, and dedicated native access.
25
25
  [Cloudflare Clef, Clef-flash, and Clef-omni](docs/guides/CLOUDFLARE_DECISIONS.md) provide
26
26
  common/native access, embedded images, typed choices, labelled scores, REST,
27
27
  Workers AI bindings, and optional AI Gateway routing. Omni additionally supports
@@ -29,7 +29,12 @@ embedded WAV/MP3 audio and MP4/WebM video, ordered images → audio → videos
29
29
  The common API checks provider/model capabilities before dispatch; refusals are
30
30
  errors.
31
31
 
32
- **Version 0.1.1 · Node.js 22.16+ or modern browsers (SDK) · ESM · zero runtime dependencies**
32
+ **Version 0.1.3 · Node.js 22.16+ or modern browsers (SDK) · ESM · zero runtime dependencies**
33
+
34
+ These docs cover 0.1.3. For supported features by version, see
35
+ [version availability](docs/README.md#version-availability) and the
36
+ [changelog](CHANGELOG.md). Start with the
37
+ [installation options](docs/guides/GETTING_STARTED.md#install-into-your-application).
33
38
 
34
39
  The npm package is
35
40
  [@fayegram-ai/decision-bridge](https://www.npmjs.com/package/@fayegram-ai/decision-bridge).
@@ -53,7 +58,7 @@ Use these model selectors with the built-in decision providers:
53
58
  | Cloudflare (`cloudflare-decisions`) | `clef-flash`, `@cf/cloudflare/clef-flash` | — |
54
59
  | Cloudflare (`cloudflare-decisions`) | `clef-omni`, `@cf/cloudflare/clef-omni` | — |
55
60
 
56
- `jev-latest` is Jev's default alias. Jev also accepts explicit model IDs available through your TypeSafe account;
61
+ `jev-latest` is Jev's default alias. Jev also accepts `jev-preview` and explicit model IDs available through your TypeSafe account;
57
62
  use `bridge.listModels()` or the CLI `models` command to inspect that catalog.
58
63
  The bridge does not maintain a static list of Jev versions. A moving alias or a
59
64
  catalog entry does not guarantee inference access or reproducible model quality.
@@ -64,7 +69,7 @@ Decision Bridge release. Explicit supported model IDs can also be selected; see
64
69
  the [OpenAI model selection guide](docs/guides/OPENAI_DECISIONS.md#model-selection)
65
70
  for details. Results retain the selected value in `meta.requestedModel`,
66
71
  the outgoing ID in `meta.resolvedModel`, and the service-reported model in `model`.
67
- Cloudflare accepts only the three models above, in short or full form.
72
+ The Cloudflare decision provider accepts the three decision models above, in short or full form.
68
73
  Model discovery is unsupported for OpenAI Decisions and Cloudflare.
69
74
 
70
75
  Additional decision protocols use [custom decision providers](docs/guides/CUSTOM_DECISION.md).
@@ -73,6 +78,16 @@ entry point, with `openai-compatible`, `openrouter`, or `anthropic` presets, or
73
78
  an explicit provider module. Those presets require a model ID supported by your
74
79
  configured service and have no default model or fixed model catalog.
75
80
 
81
+ Clairic uses the dedicated [extraction API](docs/guides/EXTRACTION.md), with
82
+ selectors `clairic` and `@cf/cloudflare/clairic` (default `clairic`). It returns
83
+ typed values, estimates and forecasts through REST or Workers bindings.
84
+ [Live Decisions](docs/guides/LIVE_DECISIONS.md) attaches to an application-owned
85
+ GPT-Live connection for delegation, transcript triggers and Decision events.
86
+ These operations have dedicated `/extraction` and `/live` package exports.
87
+
88
+ Service quotas and admission limits are handled upstream. The SDK validates its
89
+ contracts and configurable client resource budgets and returns structured errors.
90
+
76
91
  ## Choose a provider
77
92
 
78
93
  All native providers support shared state and the common `choice`, `noul`, and
@@ -80,8 +95,8 @@ All native providers support shared state and the common `choice`, `noul`, and
80
95
 
81
96
  | Provider | Additional supported features | Guide |
82
97
  | --- | --- | --- |
83
- | Jev | Native decisions through the TypeSafe API | [Provider reference](docs/reference/PROVIDERS.md#native-jev) |
84
- | OpenAI Decisions | Ordered text/images, typed choices, labelled scores, safety identifiers, native access | [OpenAI Decisions](docs/guides/OPENAI_DECISIONS.md) |
98
+ | Jev | Native decisions, opt-in images, boxes, and long context through TypeSafe | [Jev guide](docs/guides/JEV.md) |
99
+ | OpenAI Decisions | Ordered text/images, conversation/tool history, remote images, prompt caching, typed choices, labelled scores, safety identifiers, native access | [OpenAI Decisions](docs/guides/OPENAI_DECISIONS.md) |
85
100
  | Cloudflare Clef / Clef-flash | Embedded images before text, typed choices, labelled scores, native access, Workers AI binding, optional Gateway | [Cloudflare decisions](docs/guides/CLOUDFLARE_DECISIONS.md) |
86
101
  | Cloudflare Clef-omni | The same decision and transport features, plus embedded audio/video | [Omni media and limits](docs/guides/CLOUDFLARE_DECISIONS.md#omni-audio-and-video) |
87
102
  | Custom decision service | Explicit decision provider contract | [Custom decision providers](docs/guides/CUSTOM_DECISION.md) |
@@ -254,12 +269,13 @@ test suite and development scripts.
254
269
 
255
270
  | Area | Implementation |
256
271
  | --- | --- |
257
- | Stable contract | Runtime-defined [questions](docs/reference/SDK.md#question-builders), structured state or ordered input, typed answers, immutable results |
272
+ | Stable contract | Runtime-defined [questions](docs/reference/SDK.md#question-builders), state, ordered input or conversation according to capabilities, typed answers, immutable results |
258
273
  | Native providers | Jev, OpenAI Decisions, Cloudflare Clef/Clef-flash/Clef-omni |
259
274
  | Custom providers | Separate decision and generative contracts; opt-in Chat Completions, OpenRouter, and Anthropic presets |
260
275
  | SDK | Provider factory, [capability preflight](docs/reference/SDK.md#bridgegetcapabilitiesmodel-and-bridgevalidaterequest), [cancellation](docs/reference/SDK.md#cancellation-and-deadlines), and [ordered batch evaluation](docs/reference/SDK.md#sdk-batch-evaluation) |
261
- | Application extensions | [State/input preparation and result observation](docs/guides/CUSTOMIZATION.md), plus [choice thresholds and abstention policies](docs/guides/CUSTOMIZATION.md#application-policy-is-a-separate-stage) |
262
- | Node command | [Initialize, evaluate, validate, schema, models, and ordered JSONL batches](docs/reference/CLI.md#commands), with [explicit JSON profiles](docs/reference/CONFIGURATION.md) |
276
+ | Dedicated operations | [Clairic extraction](docs/guides/EXTRACTION.md) and [Live Decisions](docs/guides/LIVE_DECISIONS.md), with separate exports and native results |
277
+ | Application extensions | [State/input/conversation preparation and result observation](docs/guides/CUSTOMIZATION.md), plus [choice thresholds and abstention policies](docs/guides/CUSTOMIZATION.md#application-policy-is-a-separate-stage) |
278
+ | Node command | [Decision/extraction commands and offline Live validation/replay](docs/reference/CLI.md#commands), with [explicit JSON profiles](docs/reference/CONFIGURATION.md) |
263
279
  | Reliability | [Transport byte limits and fetch injection](docs/reference/SDK.md#provider-transport-options), deadlines, [limited retries and safe errors](docs/reference/ERRORS.md), strict response validation, atomic output |
264
280
  | Development | Functional tests, coverage, TypeScript and Workers binding contracts, offline tarball-install checks, cross-platform CI configuration |
265
281
 
package/SECURITY.md CHANGED
@@ -5,8 +5,11 @@
5
5
  Keep keys in the process environment or an explicitly loaded local environment
6
6
  file. Never place them in request JSON, committed profiles, command-line arguments,
7
7
  or shared logs. The package contains no key, telemetry client, or background job.
8
- By design it sends the supplied state and question definitions to the selected
9
- provider when evaluation is explicitly requested. Review data-sharing requirements
8
+ It sends supplied decision evidence/question definitions or extraction evidence/
9
+ fields to the selected provider when the operation is explicitly requested.
10
+ Conversation/tool history is also request data. Remote HTTP(S) image references
11
+ are forwarded to OpenAI without being fetched by the SDK; the provider handles
12
+ their retrieval. Review data-sharing requirements
10
13
  before sending private repository content or documents.
11
14
  Optional Cloudflare Gateway routing can cache requests/responses or collect logs
12
15
  according to explicit options and the Gateway's configuration. Review that
@@ -32,8 +35,9 @@ verbose HTTP logger that prints Authorization or x-api-key headers.
32
35
  ## Input and output
33
36
 
34
37
  Strict plain-JSON checks reject accessors, cycles, non-finite numbers, lossy objects,
35
- and unknown fields. Bytes, nesting, nodes, retries, concurrency, and waiting time
36
- are bounded. These checks do not establish decision accuracy or resist every
38
+ and unknown request fields. Clairic additionally preserves safe native response
39
+ fields, including predictive JSON and truncation. Bytes, nesting, nodes, retries,
40
+ concurrency, and waiting time are bounded. These checks do not establish decision accuracy or resist every
37
41
  adversarial semantic input. Question instructions are trusted configuration;
38
42
  state is untrusted evidence. Prompt separation is a mitigation, not a guarantee.
39
43
 
@@ -51,6 +55,13 @@ the bridge can stop awaiting a non-cooperative promise, not terminate arbitrary
51
55
  code or undo side effects. A provider timeout or cancellation does not prove remote
52
56
  inference stopped before billing.
53
57
 
58
+ The Live controller attaches to a connection supplied by the application. That
59
+ application owns authentication, audio, connection setup and reconnection. The
60
+ controller sends Decisions commands and consumes parsed notifications; disposing
61
+ it releases its listeners/waits without closing the application connection or
62
+ undoing actions. Decisions with unmatched or stale correlation require application
63
+ policy; receipt of a decision is not proof that an action completed.
64
+
54
65
  ## Dependencies and CI
55
66
 
56
67
  There are zero runtime dependencies. This reduces dependency surface but is not a
@@ -63,13 +74,9 @@ commits under your organization's policy before using CI in a privileged setting
63
74
 
64
75
  ## Reporting
65
76
 
66
- For a hosted public repository, use its **Security** tab and **Report a
67
- vulnerability** to submit a private report. The repository owner must enable
68
- private vulnerability reporting when making the repository public, before
69
- announcing the release; this source tree has no dedicated security inbox or other
70
- private contact channel. If the reporting button is absent, ask the maintainer
71
- for a private contact method without
72
- including vulnerability details in a public issue.
77
+ Use the repository's **Security** tab and **Report a vulnerability** to submit a
78
+ private report. If the reporting button is unavailable, ask the maintainer for a
79
+ private contact method without including vulnerability details in a public issue.
73
80
 
74
81
  Include the affected version, impact, and a minimal redacted reproduction. Do
75
82
  not publish credentials, confidential inputs, or exploit details in an issue.
package/docs/README.md CHANGED
@@ -11,13 +11,24 @@ See [model selectors and provider defaults](../README.md#model-selectors) for
11
11
  built-in decision models and the separate custom generative presets.
12
12
 
13
13
  Decision Bridge is a JavaScript SDK with an optional command runner. It evaluates
14
- supplied `state` or ordered `input`, plus `questions`, with an explicitly selected
15
- provider and returns
16
- validated, structured decisions.
14
+ exactly one of `state`, ordered `input` or `conversation`, plus `questions`, with
15
+ an explicitly selected capable provider and returns validated, structured decisions.
16
+ Dedicated extraction and Live APIs have their own operation contracts.
17
17
  For provider-specific input forms, consult the
18
18
  [capability comparison](reference/PROVIDERS.md#common-request-capabilities).
19
19
  The common bridge API and dedicated native APIs have separate request shapes;
20
- the OpenAI and Cloudflare guides cover both.
20
+ the Jev, OpenAI and Cloudflare guides cover both.
21
+
22
+ ## Version availability
23
+
24
+ These guides cover **0.1.3**. Use the documentation bundled with your installed
25
+ package. For version 0.1.2, see the
26
+ [0.1.2 documentation](https://github.com/Fayegram-AI/decision-bridge/tree/decision-bridge-v0.1.2/docs).
27
+
28
+ OpenAI conversation/tool history, remote images and prompt caching, plus Clairic
29
+ extraction and Live Decisions, require 0.1.3 or later. See
30
+ [installation](guides/GETTING_STARTED.md#install-into-your-application).
31
+ See the [changelog](../CHANGELOG.md) for version history.
21
32
 
22
33
  ## Use the bridge
23
34
 
@@ -27,8 +38,11 @@ the OpenAI and Cloudflare guides cover both.
27
38
  | [Browser integration](guides/BROWSER.md) | Direct browser use, CORS requirements, and credential exposure |
28
39
  | [Platforms](guides/PLATFORMS.md) | Windows, macOS, and Linux setup |
29
40
  | [Switching models](guides/SWITCHING_MODELS.md) | Backend and model selection |
30
- | [OpenAI Decisions](guides/OPENAI_DECISIONS.md) | Model selectors and upstream targets, selection metadata, common/native access, ordered images, and typed values |
41
+ | [Jev](guides/JEV.md) | Common/native images, boxes, experimental long context, model selection, and CLI opt-ins |
42
+ | [OpenAI Decisions](guides/OPENAI_DECISIONS.md) | Model selectors, common/native access, conversation/tool history, remote images, cache controls and typed values |
31
43
  | [Cloudflare Clef / Clef-flash / Clef-omni](guides/CLOUDFLARE_DECISIONS.md) | Common/native decisions, embedded images and Omni audio/video, REST and Workers AI binding, busy-mode compatibility, and optional Gateway |
44
+ | [Clairic extraction](guides/EXTRACTION.md) | Nine extraction/prediction types, REST/binding, native results and extraction CLI |
45
+ | [Live Decisions](guides/LIVE_DECISIONS.md) | Existing-connection controller, acknowledgements, correlation and offline replay |
32
46
  | [Customization](guides/CUSTOMIZATION.md) | Questions, templates, extensions, and policies |
33
47
  | [Custom providers](guides/CUSTOM_PROVIDERS.md) | Common classified contract and explicit CLI module loading |
34
48
  | [Custom decision](guides/CUSTOM_DECISION.md) | Extend a native decision model protocol |
@@ -17,12 +17,12 @@ and Jev default before constructing the SDK bridge.
17
17
 
18
18
  ```text
19
19
  Application / CLI
20
- state or ordered input + question definitions + optional model
20
+ state, ordered input or conversation + question definitions + optional model
21
21
  |
22
22
  v
23
23
  request snapshot, common validation, capabilities, provider preflight
24
24
  |
25
- ordered prepareState or prepareInput extensions + revalidation
25
+ ordered prepareState, prepareInput or prepareConversation extensions + revalidation
26
26
  |
27
27
  Provider.evaluate (explicit decision/generative kind)
28
28
  +-- Jev: native systemone
@@ -38,7 +38,7 @@ Application / CLI
38
38
  application policy / storage / downstream action
39
39
  ```
40
40
 
41
- Native OpenAI and Cloudflare providers also expose `createDecision` directly.
41
+ Native Jev, OpenAI and Cloudflare providers also expose `createDecision` directly.
42
42
  Common and native paths share provider validation, codecs, and bounded transport.
43
43
  Direct native calls use provider deadlines; bridge calls additionally enforce the
44
44
  shared evaluation deadline and extension lifecycle.
@@ -82,6 +82,11 @@ See [OpenAI model selection](../guides/OPENAI_DECISIONS.md#model-selection).
82
82
  | `schemas/decision.config.schema.json` | Shipped CLI configuration structure and editor support |
83
83
  | `src/providers/` | API orchestration, model profiles, preflight, codecs, bounded image/audio/video inspection, and transports |
84
84
  | `src/providers/openai-profile.mjs`, `src/providers/decisions-preflight.mjs` | Release-owned OpenAI selection, capabilities, and preparation of selected and outgoing requests |
85
+ | `src/providers/jev-profile.mjs`, `src/providers/jev-preflight.mjs`, `src/providers/jev-images.mjs` | Jev experimental policy, common/native assets, and image preflight |
86
+ | `src/providers/decisions-input.mjs`, `src/providers/decisions-codec.mjs` | Decisions item/cache validation and lossless common/native encoding |
87
+ | `src/providers/cloudflare-transport.mjs` | Shared decision/extraction REST and binding authentication, dispatch and diagnostics |
88
+ | `src/extraction/` | Clairic native field/request/response validation, provider, ordered batches and declarations |
89
+ | `src/live/` | Live protocol validation, bounded correlation state, supplied-connection controller and declarations |
85
90
  | `src/embedded.mjs` | Shared embedded data URL and canonical base64 checks |
86
91
  | `src/transport.mjs`, `src/response-transport.mjs` | Credential destinations, bounded bodies, safe errors, retries |
87
92
  | `src/async.mjs` | Deadlines and cancellation races |
@@ -102,20 +107,31 @@ claiming equivalent statistical semantics across models.
102
107
 
103
108
  The bridge takes result-validation policy from the provider contract. Cloudflare
104
109
  uses an allowance for four-decimal distributions; other built-ins retain the
105
- baseline. Response metadata cannot relax validation. See the [SDK reference](../reference/SDK.md).
110
+ baseline. Jev additionally permits explicitly unknown token counts while requiring
111
+ native confidence. Response metadata cannot relax validation. See the [SDK reference](../reference/SDK.md).
106
112
  Application code passes that precision explicitly when using `decideChoice`; the
107
113
  policy helper does not infer it from the answer or its metadata.
108
114
 
109
115
  ## Reliability and configuration
110
116
 
117
+ Built-in validators check structure, representation, adapter capabilities and
118
+ response integrity. They leave service-owned question/media counts, text/context
119
+ ceilings, quotas and RPM/TPM upstream. Custom quantitative capability limits remain
120
+ part of those providers' contracts. Client byte budgets, JSON safeguards,
121
+ cancellation and deadlines remain local controls.
122
+
111
123
  Provider deadlines include dispatch, configured retries, backoff, and bounded body
112
124
  reading. The bridge deadline additionally covers validation, preparation, provider
113
125
  waiting, and result processing. Expired synchronous work cannot dispatch a call.
114
126
  Cancellation bounds waiting for custom promises; custom code must honor signals
115
127
  to release its own resources. Observations use a separate bounded budget.
116
128
 
117
- Retries cover selected explicit transient responses. Ambiguous failures and failed
118
- observers do not trigger another inference. CLI atomic files protect previous
129
+ Retries cover selected explicit transient responses, with machine-code
130
+ classification preventing billing/allocation retries. OpenAI Decisions and
131
+ Clairic default to zero retries. Valid Retry-After hints share the total deadline;
132
+ attempt counts describe adapter dispatches, not hidden Gateway retries.
133
+ Malformed rejection bodies retain known safe HTTP diagnostics. Ambiguous failures
134
+ and failed observers do not trigger another inference. CLI atomic files protect previous
119
135
  output but cannot undo remote work or emitted stdout.
120
136
 
121
137
  JSON configuration is explicit. Custom ESM executes only when selected. Custom
@@ -133,7 +149,20 @@ mutable request limit or response identifiers. Header/container inspection is
133
149
  bounded and does not perform full media decoding.
134
150
 
135
151
  The SDK does not host models or provide a server API, persistent state, autonomous
136
- actions, streaming, transcription, transcoding, frame extraction,
152
+ actions, HTTP decision streaming, audio transcription, transcoding, frame extraction,
137
153
  provider-side asynchronous batch jobs, platform
138
154
  management, automatic model search, or automatic provider failover. SDK arrays and
139
155
  CLI JSONL batches provide bounded client-side concurrency.
156
+
157
+ Extraction owns its request/result contract and uses shared Cloudflare dispatch.
158
+ Its inference options remain in model input; binding execution options use the
159
+ third `ai.run` argument. Native nulls, empty lists, predictive JSON and truncation
160
+ are preserved in an immutable `{ extraction, meta }` envelope.
161
+ Live owns protocol validation, a bounded pure correlation reducer and a supplied-
162
+ connection controller. Offline replay uses that same reducer. Their dedicated
163
+ exports do not widen the existing decision/generative provider contract.
164
+ Live configuration changes activate on acknowledgement. Source snapshots and
165
+ observed per-direction transcript order support correlation; unavailable evidence
166
+ stays unmatched. Manual evaluation and commentary return submission receipts;
167
+ completed decisions arrive through subscriptions, preserving native refusals.
168
+ The application owns authentication, audio, connection setup and reconnection.
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Native decisions as the application contract
4
4
 
5
- Use shared state or ordered input and independent typed questions as the public
5
+ Use shared state, ordered input or conversation and independent typed questions as the public
6
6
  contract. The bridge owns orchestration; providers own their model API protocols.
7
7
  This gives applications a stable decision interface and makes customization
8
8
  explicit at each call. Native decision models are the main package scope;
@@ -10,6 +10,11 @@ generative protocols are opt-in custom strategies with their own public subpath.
10
10
  Every provider declares its decision/generative kind. Consequence: not every model can satisfy this contract
11
11
  reliably; compatibility and quality must be tested separately.
12
12
 
13
+ Extraction and Live are dedicated operations. Clairic keeps its native fields
14
+ and predictive response envelope; Live attaches commands and events to an
15
+ application-owned connection. Each has its own API and result contract, separate
16
+ from the bridge's `evaluate` interface.
17
+
13
18
  ## ESM JavaScript with declarations and no runtime dependencies
14
19
 
15
20
  Use standard fetch, streams, and JSON in the SDK; keep Node's test runner,
@@ -30,13 +35,26 @@ calibration or correctness.
30
35
 
31
36
  ## Fail explicitly instead of silently repairing or falling back
32
37
 
33
- Reject invalid JSON, extra fields, wrong labels, distributions outside the provider
34
- precision allowance, explicit output truncation, and refusals. Require explicit
38
+ Decision calls reject invalid JSON, unsupported request fields, wrong labels,
39
+ distributions outside the provider precision allowance, malformed results and
40
+ refusals; generative paths also reject explicit output truncation. Require explicit
35
41
  output modes and models. Services may truncate input without reporting it; local
36
42
  byte limits do not guarantee token fit. Consequence:
37
43
  some calls fail that a permissive wrapper might guess at, but failures remain
38
44
  observable and cannot silently change budgets or decision policies.
39
45
 
46
+ Clairic preserves additional safe native JSON and its truncation flag. Live
47
+ preserves native refusal events and marks ambiguous correlation as unmatched.
48
+ Those operation contracts avoid inventing success or discarding native evidence.
49
+
50
+ ## Service admission and client resources
51
+
52
+ The server owns quotas, rate limits, service counts, context admission and media
53
+ ceilings. Report rejection through safe structured errors; do not estimate tokens,
54
+ track account allocations, split requests or schedule service capacity. Local
55
+ byte/JSON safeguards, cancellation, deadlines and caller-selected concurrency
56
+ bound client resources. Custom-provider quantitative contracts remain explicit.
57
+
40
58
  ## Trusted extensions and explicit configuration
41
59
 
42
60
  Read JSON config only when named. Load custom ESM only when explicitly selected.
@@ -30,8 +30,10 @@ node scripts/package-smoke.mjs --tarball release/fayegram-ai-decision-bridge-VER
30
30
  Check public documentation against the implementation, including supported API
31
31
  shapes, examples, limits, errors, and service compatibility notes. Inspect the MIT
32
32
  copyright notice and package contents. Complete hosted checks relevant to changed
33
- features using an authorized account/runtime;
34
- fixture and declaration checks do not establish hosted binding/Gateway behavior.
33
+ features only when needed to resolve a specific wire-contract uncertainty, using
34
+ an explicitly authorized account/runtime. Offline fixtures are sufficient for
35
+ routine development and CI; fixture and declaration checks do not establish
36
+ hosted binding/Gateway/Live behavior. Report the actual verification scope.
35
37
  Keep completed verification evidence separate from maintained consumer guidance.
36
38
  These content and verification checks do not depend on publication account setup.
37
39
 
@@ -49,7 +51,9 @@ name and registry are `@fayegram-ai/decision-bridge` and the public npm registry
49
51
  Coordinate the GitHub source release and publication of the verified tarball to
50
52
  npm as one release. The source release commit and archive must contain the same
51
53
  intended files, including README and documentation. A packed or uploaded archive
52
- is a snapshot: subsequent source edits do not change its contents.
54
+ is a snapshot: subsequent source edits do not change its contents. Finalize the
55
+ changelog and version-availability notices before building. If packaged files
56
+ change afterward, rebuild and verify the archive before publication.
53
57
 
54
58
  The tracked `.npmrc` routes this scope to npm in this checkout without changing
55
59
  the user's npm configuration. Keep credentials in the user configuration, never
@@ -15,6 +15,8 @@ package-lock.json Pinned development dependency metadata
15
15
  .env.example Provider credential placeholders
16
16
  src/ Common SDK, native providers, CLI, declarations
17
17
  src/custom/ Explicit decision definitions and generative presets
18
+ src/extraction/ Dedicated Clairic provider, validation, batches and types
19
+ src/live/ Supplied-connection Live controller, protocol state and types
18
20
  bin/ Node.js CLI entry point
19
21
  examples/ Native SDK examples and request profiles
20
22
  examples/custom/ Opt-in generative and native delegation examples
@@ -16,7 +16,7 @@ Source and installed-consumer type checks use the same local compiler.
16
16
  | `npm test` | SDK, CLI, provider, and file/transport behavior using fixtures and loopback servers |
17
17
  | `npm run test:coverage` | The functional suite with production source/bin coverage floors |
18
18
  | `npm run typecheck` | Positive and expected-negative TypeScript API contracts |
19
- | `npm run test:package` | Pack, offline install, root/custom exports and types, browser-safe imports, presets/modules, contents and docs |
19
+ | `npm run test:package` | Pack, offline install, root/custom/extraction/Live exports and types, browser-safe imports, presets/modules, contents and docs |
20
20
  | `npm run build` | Retain a versioned npm tarball after checking its offline installation |
21
21
  | `npm run verify` | Source checks, tests, type contracts, and package smoke check |
22
22
 
@@ -44,6 +44,11 @@ as evidence that every environment passed.
44
44
  - `result-validation.test.mjs`: provider-selected precision and policy-hook boundaries.
45
45
  - `decisions*.test.mjs`: native/common OpenAI codecs, selectors and model identities, boundaries, preflight, CLI, and smoke-helper fixtures.
46
46
  - `cloudflare*.test.mjs`: models, images, codecs, REST/binding/Gateway arguments, errors, and CLI limits.
47
+ - `jev*.test.mjs`: native/common assets, reference substitution, boxes, opt-ins, nullable usage and CLI behavior.
48
+ - `capability-expansion.test.mjs`: conversation/tool history, remote images, cache controls, extension revalidation, service-limit ownership and safe rejection diagnostics.
49
+ - `extraction.test.mjs`: all nine Clairic field families, native JSON preservation, REST/binding options, batch preflight and model-selection diagnostics.
50
+ - `live.test.mjs`: commands/acknowledgements, configuration history, transcript ordering, unmatched/stale/duplicate results, observer isolation and lifecycle cleanup.
51
+ - `expansion-cli.test.mjs`: extraction commands/configuration, offline Live validation/replay, per-row errors and provider-switch isolation.
47
52
  - `custom-providers.test.mjs`, `custom-config.test.mjs`: classified SDK paths, provenance, presets/modules, schema and initialization.
48
53
  - `generative-helpers.test.mjs`: exported prompt/normalization helper contracts and unsupported input rejection.
49
54
  - `config.test.mjs`: file/environment/flag precedence and provider transitions.
@@ -54,6 +59,7 @@ as evidence that every environment passed.
54
59
  - `types.mts`, `providers.types.mts`, `custom.types.mts`: public type inference and rejected API usage.
55
60
  - `decisions.types.mts`, `cloudflare.types.mts`: richer questions, native APIs, and precision settings.
56
61
  - `cloudflare-worker.types.mts`: compatibility with official Workers binding declarations.
62
+ - `expansion.types.mts`: conversation/cache inputs, extraction value inference, unions, batches and Live transport/notification contracts.
57
63
 
58
64
  Node's reported test count includes each row of a parameterized input table. It
59
65
  is not a count of independent features; retain separate rows when they protect
@@ -85,6 +91,23 @@ the complete integration check. A selector mapping change must be verified again
85
91
  the target model's protocol and capabilities; local fixtures alone do not establish
86
92
  compatibility with a newly selected upstream model.
87
93
 
94
+ ### Capability expansion coverage
95
+
96
+ For changes across expanded OpenAI input, Clairic or Live, use the existing
97
+ functional fixtures and declaration checks. A focused source-root command is:
98
+
99
+ ```text
100
+ node --test test/capability-expansion.test.mjs test/extraction.test.mjs test/live.test.mjs test/expansion-cli.test.mjs
101
+ npm run typecheck
102
+ ```
103
+
104
+ REST doubles and binding doubles verify inference/execution option separation and
105
+ safe upstream errors. Live uses a supplied in-memory connection adapter and the
106
+ same state reducer as offline replay. No test intentionally exhausts service
107
+ quotas or treats accepted local structure as hosted admission. Installed-package
108
+ checks exercise the dedicated exports, CLI tools, declarations and SDK imports
109
+ without Node globals.
110
+
88
111
  ## Optional authenticated provider smoke check
89
112
 
90
113
  Live inference is explicitly opted in and can incur charges. Configure credentials
@@ -132,13 +155,18 @@ Header/dimension preflight does not fully decode images, so live image fixtures
132
155
  must also contain valid encoded image data.
133
156
  Omni fixtures must contain genuinely decodable WAV/MP3 and MP4/WebM media for
134
157
  hosted tests. Local authored container fixtures verify inspection and protocol
135
- behavior without claiming codec validity. Include grouped modalities, duration
136
- and size boundaries, effective-model overrides, request bodies above 13 MiB,
158
+ behavior without claiming codec validity. Cover grouped modalities, container
159
+ validity, configured client byte budgets, effective-model overrides, request bodies above 13 MiB,
137
160
  and explicit smaller ceilings. Gateway caching/logging should be disabled for
138
161
  test payloads, and each bounded run should have a request and total time budget.
139
162
 
140
163
  The SDK, CLI, and ordinary checks do not create Workers or Gateways. Provisioning
141
164
  and cleanup belong to the application's separately authorized environment setup.
165
+ The smoke helper does not qualify Clairic or a GPT-Live connection. When a specific
166
+ wire-contract uncertainty requires hosted verification, use the intended
167
+ application-owned runtime/connection and a bounded, explicitly authorized case.
168
+ Offline fixtures remain sufficient for routine development and CI; record hosted
169
+ behavior only when that exact path was exercised.
142
170
 
143
171
  ## Package verification
144
172
 
@@ -6,6 +6,11 @@ The SDK exports browser-compatible ESM. Follow the
6
6
  optional `decision-bridge` command still requires Node.js.
7
7
  Omni's embedded audio/video validation is browser-safe and adds no runtime media
8
8
  library. Build data URLs in the application; the SDK does not fetch remote media.
9
+ The dedicated [extraction](EXTRACTION.md) and [Live](LIVE_DECISIONS.md) exports
10
+ also use browser-compatible APIs. Clairic REST still requires provider CORS and
11
+ explicit credentials. Live attaches to an already established application-owned
12
+ connection; it does not create or authenticate one. OpenAI remote-image URLs are
13
+ forwarded to the provider without a browser-side SDK fetch.
9
14
 
10
15
  Built-in REST providers need explicitly supplied credentials in browser code;
11
16
  Node environment-variable defaults and `.env` files are not available. Cloudflare
@@ -35,6 +40,9 @@ headers used by the SDK. For Jev evaluation those include `POST`, `Authorization
35
40
  and `Content-Type`. If the preflight is rejected, the browser sends no evaluation
36
41
  request; neither the SDK nor a browser setting can override that server policy.
37
42
  Check your intended origin with TypeSafe before relying on direct Jev calls.
43
+ When Jev experimental features are enabled, CORS must also permit the selected
44
+ `TypeSafe-Danger-Zone-Images` and `TypeSafe-Danger-Zone-Long-Context` headers.
45
+ The [Jev guide](JEV.md) covers browser-safe embedded assets and boxes.
38
46
 
39
47
  Any key delivered to browser JavaScript can be read by the app's users. Only use
40
48
  a credential that the provider explicitly permits for browser exposure. If an