lex-llm-azure-foundry 0.3.5 → 0.4.8

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 (28) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +6 -0
  3. data/.gitignore +1 -0
  4. data/.rubocop.yml +0 -1
  5. data/CHANGELOG.md +183 -0
  6. data/Gemfile +12 -2
  7. data/README.md +247 -163
  8. data/RULES.md +97 -0
  9. data/lex-llm-azure-foundry.gemspec +2 -1
  10. data/lib/legion/extensions/llm/azure_foundry/actors/discovery.rb +20 -0
  11. data/lib/legion/extensions/llm/azure_foundry/actors/fleet_worker.rb +4 -18
  12. data/lib/legion/extensions/llm/azure_foundry/authentication.rb +101 -0
  13. data/lib/legion/extensions/llm/azure_foundry/declared_catalog_parser.rb +93 -0
  14. data/lib/legion/extensions/llm/azure_foundry/deployment_catalog_parser.rb +93 -0
  15. data/lib/legion/extensions/llm/azure_foundry/endpoint.rb +70 -0
  16. data/lib/legion/extensions/llm/azure_foundry/helpers/endpoint_access.rb +122 -0
  17. data/lib/legion/extensions/llm/azure_foundry/helpers/offering_evidence.rb +139 -0
  18. data/lib/legion/extensions/llm/azure_foundry/helpers/project_catalog.rb +116 -0
  19. data/lib/legion/extensions/llm/azure_foundry/helpers/project_connection.rb +68 -0
  20. data/lib/legion/extensions/llm/azure_foundry/model_catalog_parser.rb +55 -0
  21. data/lib/legion/extensions/llm/azure_foundry/provider.rb +92 -457
  22. data/lib/legion/extensions/llm/azure_foundry/runners/discovery.rb +128 -0
  23. data/lib/legion/extensions/llm/azure_foundry/runners/fleet_worker.rb +1 -5
  24. data/lib/legion/extensions/llm/azure_foundry/settings.rb +31 -0
  25. data/lib/legion/extensions/llm/azure_foundry/version.rb +1 -1
  26. data/lib/legion/extensions/llm/azure_foundry.rb +71 -97
  27. metadata +16 -4
  28. data/lib/legion/extensions/llm/azure_foundry/actors/discovery_refresh.rb +0 -1124
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 49e5d8dc9a03ec7e353324aaf22050bf23a28ff085da22a8f779c7b01b28ffe0
4
- data.tar.gz: 3c8c342a9bc24b2133a2060f9cc9dc9a9743d4d69bda1205e26db02f6d5a4f59
3
+ metadata.gz: a8a8de79561aa047b730c51a625ea7fae9a1acb8825d6c52767c4da09069573a
4
+ data.tar.gz: 2d96e9474562236789c973fd7800802a20c88e86422dbc26f79e5ac99413d69a
5
5
  SHA512:
6
- metadata.gz: ba398b8cdb7dcd17fa6138c9edccc482b66abb201c8ce198d4373d83ced0de5f8c1c756be4b55ec3b3a64921278db4d3b6673d146a77ed2121d6e7317622be79
7
- data.tar.gz: d1c2877ae02270b74dba8be1daa23c9c676070c4d705194fa35933d31206d3c9bd5eccb0d2837c80ffe2fe278153766f0865d1e53d077cd4b9e84ce67c5fdef0
6
+ metadata.gz: 72d7ca008c76373ceb1fe3bb0f171a31ab22968c82ededb00148454514e730167a1855ad35101783a512620cdf2e3bb9b4d3757104b4d113074948568cb9e93f
7
+ data.tar.gz: 77cc491ae1c8fc3d0890af213b1a580bdb8c32a156b2a12de967c4e66a86fb9353eee23531eee02f6c7c422ceb2a8bf97d580b9077fc2da79b157f87353debe7
@@ -7,12 +7,18 @@ on:
7
7
  jobs:
8
8
  ci:
9
9
  uses: LegionIO/.github/.github/workflows/ci.yml@main
10
+ with:
11
+ companion-gems: >-
12
+ {"lex-llm":{"repository":"LegionIO/lex-llm","ref":"c283d5e7db85a736cc9394d448dea98f32eee311"}}
10
13
 
11
14
  excluded-files:
12
15
  uses: LegionIO/.github/.github/workflows/excluded-files.yml@main
13
16
 
14
17
  security:
15
18
  uses: LegionIO/.github/.github/workflows/security-scan.yml@main
19
+ with:
20
+ companion-gems: >-
21
+ {"lex-llm":{"repository":"LegionIO/lex-llm","ref":"c283d5e7db85a736cc9394d448dea98f32eee311"}}
16
22
 
17
23
  version-changelog:
18
24
  uses: LegionIO/.github/.github/workflows/version-changelog.yml@main
data/.gitignore CHANGED
@@ -1,4 +1,5 @@
1
1
  /.bundle/
2
+ /.ci-dependencies/
2
3
  /coverage/
3
4
  /pkg/
4
5
  /tmp/
data/.rubocop.yml CHANGED
@@ -22,5 +22,4 @@ RSpec/MultipleMemoizedHelpers:
22
22
  Enabled: false
23
23
  RSpec/DescribeClass:
24
24
  Exclude:
25
- - spec/legion/extensions/llm/azure_foundry/capability_policy_spec.rb
26
25
  - spec/legion/extensions/llm/azure_foundry/context_window_spec.rb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,188 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.8] - 2026-11-20
4
+
5
+ ### Fixed
6
+ - Use the shared `output_token_limit_key` protocol hook to render OpenAI v1 output allowances as `max_completion_tokens`; keep model-inference allowances as `max_tokens`. Preserve the canonical budget unchanged, emit only one native key, and omit absent limits in buffered and streaming requests.
7
+ - Publish documented GPT-5-mini 2025-08-07 GlobalStandard metadata: 400,000-token context, 128,000-token output allowance, and reasoning/tool/vision/streaming support. Explicit live facts retain precedence and unknown versions remain unknown.
8
+ - Require `lex-llm >= 0.8.11` for the shared output-token key hook. Native reasoning effort values remain unchanged; unsupported effort values are not silently reduced.
9
+
10
+ ## [0.4.7] - 2026-11-20
11
+
12
+ ### Fixed
13
+ - Publish documented unsupported thinking evidence for the exact GPT-4o-mini 2024-07-18 GlobalStandard and GPT-4.1 2025-04-14 GlobalStandard tuples, using `model_metadata` provenance instead of leaving their thinking capability unknown.
14
+ - Preserve explicit live catalog capability precedence, including positive thinking evidence. Other models, versions, and deployment types remain unknown unless their own evidence establishes support.
15
+
16
+ ## [0.4.6] - 2026-11-20
17
+
18
+ ### Fixed
19
+ - Replace unsupported project API-key discovery with explicit `model_info`, `project`, or `declared` discovery sources. Project discovery requires Entra bearer/broker authentication; there is no runtime fallback between sources.
20
+ - Support API-key access through declared deployment identity bindings joined to exact authenticated resource model-catalog records. Publish only declared names through the shared inventory with `declared: true` metadata and `provider_static_catalog` provenance; reject missing/conflicting model records, duplicate names, and capability/limit overrides.
21
+ - Preserve normal snapshot replacement, withdrawal, callable retirement, and last-good retention after failed observations. Readiness remains a non-inference catalog GET.
22
+ - Withdraw an explicitly empty declaration set without fetching remote model facts, even during a catalog outage. Keep startup and cadence readiness checks unchanged.
23
+ - Validate all catalog record identities, but check duplicate/conflicting records only for declared base-model IDs so unrelated catalog duplicates cannot block the selected deployments.
24
+ - Add one immutable vendor metadata owner for exact GPT-4o-mini 2024-07-18 GlobalStandard and GPT-4.1 2025-04-14 GlobalStandard facts. Live catalog facts take precedence, including false capabilities; unknown tuples remain unknown.
25
+ - Normalize observed project model version, SKU, and capability limit fields at the project parser boundary. Both project and declared sources select the same vendor metadata using one explicit tuple, while declared identity remains distinct from observed revision evidence.
26
+ - Require `lex-llm >= 0.8.10` for shared OpenAI-compatible streaming finish-reason preservation; Azure adds no separate completion handling.
27
+
28
+ ## [0.4.5] - 2026-11-20
29
+
30
+ ### Fixed
31
+ - Support an explicitly configured `credentials.project_api_key` for project deployment pages and connected-resource metadata lookup through the existing authentication and discovery pipeline.
32
+ - Keep project credentials isolated from resource inference/readiness credentials. Reject ambiguous project API-key, bearer-token, and broker combinations without falling back to another source.
33
+ - Verify real inventory publication, project-key pagination and connection lookup, resource credential isolation, malformed credentials, off-origin continuation rejection, and last-good snapshot retention after a project network-policy failure.
34
+
35
+ ## [0.4.4] - 2026-11-20
36
+
37
+ ### Fixed
38
+ - Register the actual Azure provider instance as the inventory callable. Delete the redundant callable wrapper, duplicate dispatch checks, lazy provider construction, and separate disconnect state; execution and connection disposal use the shared provider directly.
39
+ - Carry the configured instance name into that provider so registry reads and health attribution use the claimed instance instead of defaulting to `default`.
40
+ - Refine shared error classification only when a structured Azure error code and matching HTTP status establish the outcome. Preserve authentication and authorization failures, and stop treating generic 404s or error-message phrases as deployment or endpoint-health facts.
41
+ - Require `lex-llm >= 0.8.9` for canonical tools, thinking, and sampling parameters to be reconstructed at the shared fleet boundary. Remove Azure-specific parameter reconstruction.
42
+ - Load actors through the standard host actor loader. Remove guarded fleet requires, the unused chat URL alias and authentication hook, and unqualified fleet references.
43
+ - Replace fake actor/runtime and provider dispatch classes in specs with real host classes and real provider execution over controlled HTTP transport. Require the shared conformance kit without an optional-load guard.
44
+
45
+ ## [0.4.3] - 2026-11-20
46
+
47
+ ### Fixed
48
+ - Keep the shared `lex-llm` discovery lifecycle and registry as the sole inventory owner. Azure resource model catalogs no longer become deployed offerings merely because their catalog GET succeeds.
49
+ - Discover deployed model names through the Foundry project deployment API, including bounded pagination, distinct project authentication, and retention of the last good snapshot after malformed or partial responses.
50
+ - Support native and connected-resource deployments through normal configured instances. Bind connected instances with `provider.project_connection_name`, verify the connection's endpoint, and filter before duplicate checking. Preserve deployment names across distinct instance/callable identities. Conclusive retargeting removes stale offerings; transport failures retain the last complete snapshot.
51
+ - Resolve configured resource/project broker references through the real host identity broker on every provider call, page, connection lookup, and readiness request. Require one credential source per scope, reject unavailable/expired or unspecified leases, and leave token renewal to the existing broker.
52
+ - Snapshot credential-reference bindings and include endpoint/auth-reference changes in the physical binding fingerprint, reclaiming captured callables on configuration changes while retaining them across broker lease renewal.
53
+ - Accept the documented single-model `/models/info` response and share endpoint normalization between discovery and inference, including endpoints already ending in `/models`.
54
+ - Publish explicit operation and capability evidence. Missing facts remain unknown; model-name guesses and operator limits no longer masquerade as provider evidence.
55
+ - Remove invented quota-domain groupings based only on deployment names, which can repeat across unrelated resources.
56
+ - Preserve distinct deployments of a shared base model, deduplicate identical records, and reject contradictory duplicate records instead of silently choosing capabilities.
57
+
58
+ ### Changed
59
+ - Provider connection and discovery defaults live in `azure_foundry/settings.rb`.
60
+ - OpenAI-compatible resources exposing only a base-model catalog require `provider.project_endpoint` and a project bearer credential or explicit project broker reference for deployment discovery. Data-plane credentials are not forwarded to the project API.
61
+ - Use the native settings helper for configured instances and test broker integration against the actual LegionIO host lease service.
62
+ - Updated provider documentation to describe registry snapshot reads and the actual discovery actor and runner.
63
+ - Remove the custom completion/streaming/embedding funnel and legacy capability-name guesses. Inherit shared provider execution and preserve thinking, schemas, headers, and sampling controls through the standard callable contract; regression tests reproduce the previously dropped controls.
64
+ - Remove top-level/flat configuration aliases, model-object coercion, resource-catalog fallback, alternate catalog envelopes, and model-family guesses. Use the shared default merge/deep copy, explicit named-instance configuration, and documented Azure response fields.
65
+
66
+ ## [0.4.2] - 2026-08-25
67
+
68
+ ### Fixed
69
+ - **Duplicate `provider_native_key` on discovery (collapsing distinct
70
+ deployments).** Model-id resolution used a multi-key fallback
71
+ (`id name model_name deployment_name model`) that could resolve two
72
+ DISTINCT deployments of one base model to the SAME id — the shared base
73
+ keys `model_name` / `model` ranked at or above the unique
74
+ `deployment_name`. Two drafts then carried the same `provider_native_key`
75
+ and the registry `Store#build_records` raised
76
+ `Legion::Extensions::Llm::Inventory::Errors::ValidationError:
77
+ duplicate provider_native_key`, so the instance failed to publish.
78
+ `MODEL_ID_KEYS` now resolves only the unique per-deployment identity
79
+ (`id deployment_name name`) and never the shared base model — one
80
+ unambiguous key per offering, matching the bedrock provider's single
81
+ `:model_id`. Envelope recognition (`looks_like_model?`) keeps its
82
+ original breadth via a separate `MODEL_SHAPE_KEYS` set, so a model-shaped
83
+ entry without a unique id is still recognized and then dropped by the
84
+ empty-id filter rather than raising an unrecognized-envelope error.
85
+
86
+ ## [0.4.1] - 2026-08-20
87
+
88
+ ### Changed
89
+ - **0.8.0 conformance (lex-llm SSOT v4 contract cut).** Legacy type usage
90
+ is gone: the dispatch entries accept
91
+ `Legion::Extensions::Llm::Canonical::Message` only, and the shared
92
+ lex-llm `enforce_canonical_messages!` helper runs at every
93
+ message-operation entry on both entry forms (the provider entries and
94
+ the `AzureFoundryCallable` — 08 F2, 12/O05). The per-provider
95
+ `enforce_message_boundary!` re-implementation (which still accepted the
96
+ deleted legacy `Llm::Message` shape) is removed.
97
+ - **Render from canonical, model untouched (08 R1/F3, B4).** `chat`/`stream`
98
+ build `Canonical::Params` from the canonical-spelling dispatch kwargs
99
+ (temperature lives only in `Canonical::Params`, 05 O4) and pass the
100
+ Selection-derived model String to the wire unchanged — the
101
+ `Model::Info` dispatch-time wrapping (and the callable's `to_model_info`
102
+ fabrication) is deleted.
103
+ - **Offering read path is the Registry snapshot (07 C5).** The legacy
104
+ `offering_from_model` → `Routing::ModelOffering` production (with its
105
+ `CapabilityPolicy` cascade) is deleted; the discovery actor's writer
106
+ (`OfferingDraft` + `Registry` publication) is the sole offering path and
107
+ `discover_offerings` serves the activated inventory offerings.
108
+ - **Legacy coordinator wiring removed.** The
109
+ `Inventory::ScopedRefresher::LegacyCoordinatorAdapter` compatibility
110
+ adapter is deleted from the discovery actor's `Inventory::Publisher`
111
+ construction (the file no longer exists in lex-llm 0.8.0).
112
+ - **count_tokens returns the 05 §2 Integer heuristic.** The legacy Hash
113
+ artifact (`supported: false`, `estimated_input_characters`) is deleted
114
+ and the base heuristic estimate is inherited — operation support is
115
+ carried by the SSOT data plane (writer operation evidence +
116
+ `WorkerExecution.require_supported!`), not by a per-call artifact.
117
+ - **§2 single publication engine (0.8.0 core contract).** The gem-level
118
+ `registry_publisher` singleton and the `Provider.registry_publisher`
119
+ class method are removed: nothing in the gem, the lex-llm core, or
120
+ legion-llm calls them (the discovery actor publishes through
121
+ `Inventory::Publisher`, the sole engine), and the 0.8.0
122
+ `RegistryPublisher` now carries the operator's `provider_instance`
123
+ identity — a gem-level construction site has no instance scope to
124
+ carry one.
125
+ - **L6 fleet responder kwargs.** `FleetWorker.handle_fleet_request` no
126
+ longer passes the `provider_class:`/`provider_instances:` params the
127
+ 0.8.0 core deleted from `ProviderResponder.call` (v3 dispatch is
128
+ exact-only and never constructs a provider at the runner).
129
+ - **Dependency floor** — `lex-llm` raised to `>= 0.8.0` for the SSOT v4
130
+ contract cut (Canonical types, shared boundary helper, Registry read
131
+ path).
132
+
133
+ ### Added
134
+ - **Dispatch-boundary regression coverage.** Loud-reject examples at each
135
+ public entry for plain-Hash input, and a canonical passthrough example
136
+ verifying canonical messages reach the rendered wire payload unchanged
137
+ and the sync response is a `Canonical::Response`.
138
+ - **Raw-string-model passthrough spec.** The fleet model id travels to the
139
+ provider boundary verbatim for every operation (no Model::Info
140
+ fabrication, 08 F3/B4).
141
+
142
+ ## [0.4.0] - 2026-08-19
143
+
144
+ ### Changed
145
+ - **Live model catalog discovery — standard lex-llm interface.**
146
+ `list_models` and `discover_offerings` now fetch the model catalog from
147
+ the instance's discovery endpoint (`GET models/info?api-version=...` on the
148
+ model-inference surface, `GET /models` on the OpenAI-compatible surface)
149
+ and derive offerings through the shared base-class flow — the same
150
+ endpoint-driven discovery every other provider uses. Offerings are
151
+ published with `publication_source: :provider_catalog`.
152
+ - **Shared `ModelCatalogParser`.** Both the Provider's `list_models` and the
153
+ SSOT v3 `DiscoveryRefresh` actor parse the wire catalog through one module
154
+ (envelope: `data` / `models` / `value` / `deployments` list keys, bare
155
+ arrays, or a single model object). An unrecognized envelope raises instead
156
+ of producing a silent empty catalog.
157
+ - **Discovery actor fetches the live catalog.** `discover_offerings_for_instance`
158
+ hits the same endpoint (and auth) as the readiness probe and builds one
159
+ OfferingDraft per catalog entry. A failed fetch yields nil so the refresh
160
+ loop keeps the last complete snapshot rather than deleting it.
161
+
162
+ ### Removed
163
+ - **Configured deployments — the static discovery path is gone.**
164
+ `azure_foundry_deployments` (and the `deployments` / `provider.deployments`
165
+ settings aliases) no longer exist. `ProviderClassMethods#resolve_model_id`,
166
+ `#deployment_config`, `#normalize_deployments`, and the config-driven
167
+ offering path (`allowed_offerings` / `configured_deployments` /
168
+ `offering_from_config`) are deleted. The model set is whatever the endpoint
169
+ reports — nothing about models lives in settings.
170
+ - `provider_native_key` and `model` are both the catalog model id (the
171
+ routable id the endpoint accepts); the base model name rides along as
172
+ `canonical_model_alias` when the catalog reports one.
173
+
174
+ ### Fixed
175
+ - **Bearer-token auth on the actor path.** `apply_auth_headers` now sends
176
+ `Authorization: Bearer` when the instance carries a bearer token
177
+ (previously api-key only — bearer-only instances failed the readiness
178
+ probe and stayed `:initializing` forever).
179
+
180
+ ### Notes
181
+ - No captured fixture of the model-inference `models/info` list envelope
182
+ exists in the monorepo. The parser accepts the known shapes; live
183
+ confirmation of the wire response against a real project is the one
184
+ remaining UAT item for this change.
185
+
3
186
  ## [0.3.5] - 2026-08-19
4
187
 
5
188
  ### Changed
data/Gemfile CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- gem 'lex-llm'
6
-
7
5
  gemspec
8
6
 
9
7
  group :development do
@@ -15,3 +13,15 @@ group :development do
15
13
  gem 'rubocop-rake', '>= 0.6'
16
14
  gem 'rubocop-rspec'
17
15
  end
16
+
17
+ group :test do
18
+ # Broker integration is exercised against the actual host lease service.
19
+ legionio_path = File.expand_path('../../LegionIO', __dir__)
20
+ legionio_options = File.directory?(legionio_path) ? { path: legionio_path } : {}
21
+ gem 'legionio', **legionio_options
22
+
23
+ # Use the standard immutable CI companion or adjacent development checkout.
24
+ lex_llm_path = File.expand_path('.ci-dependencies/lex-llm', __dir__)
25
+ lex_llm_path = File.expand_path('../lex-llm', __dir__) unless Dir.exist?(lex_llm_path)
26
+ gem 'lex-llm', path: lex_llm_path if Dir.exist?(lex_llm_path)
27
+ end