katsoft-llm-kit 1.0.0__py3-none-any.whl

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 (177) hide show
  1. katsoft_llm_kit-1.0.0.dist-info/METADATA +59 -0
  2. katsoft_llm_kit-1.0.0.dist-info/RECORD +177 -0
  3. katsoft_llm_kit-1.0.0.dist-info/WHEEL +4 -0
  4. katsoft_llm_kit-1.0.0.dist-info/entry_points.txt +2 -0
  5. katsoft_llm_kit-1.0.0.dist-info/licenses/LICENSE +21 -0
  6. llm_kit/__init__.py +0 -0
  7. llm_kit/_deployment.py +7 -0
  8. llm_kit/_runtime.py +252 -0
  9. llm_kit/adapters/__init__.py +18 -0
  10. llm_kit/adapters/_swapper_errors.py +30 -0
  11. llm_kit/adapters/_swapper_process.py +314 -0
  12. llm_kit/adapters/account.py +433 -0
  13. llm_kit/adapters/backends.py +938 -0
  14. llm_kit/adapters/capabilities.py +918 -0
  15. llm_kit/adapters/claude_runner.py +242 -0
  16. llm_kit/adapters/client.py +99 -0
  17. llm_kit/adapters/codex_backend.py +769 -0
  18. llm_kit/adapters/endpoint_profile.py +145 -0
  19. llm_kit/adapters/harness_adapters.py +432 -0
  20. llm_kit/adapters/harness_auth.py +214 -0
  21. llm_kit/adapters/opencode_backend.py +490 -0
  22. llm_kit/adapters/swapper.py +865 -0
  23. llm_kit/adapters/swapper_acceptance.py +322 -0
  24. llm_kit/adapters/usage_sources.py +534 -0
  25. llm_kit/bootstrap_guard.py +240 -0
  26. llm_kit/cli/__init__.py +180 -0
  27. llm_kit/cli/__main__.py +5 -0
  28. llm_kit/cli/_common.py +156 -0
  29. llm_kit/cli/_compose.py +31 -0
  30. llm_kit/cli/account.py +151 -0
  31. llm_kit/cli/completion.py +654 -0
  32. llm_kit/cli/consent.py +98 -0
  33. llm_kit/cli/jobs.py +505 -0
  34. llm_kit/cli/local.py +352 -0
  35. llm_kit/cli/models.py +576 -0
  36. llm_kit/cli/pipeline.py +69 -0
  37. llm_kit/cli/run.py +590 -0
  38. llm_kit/completion/__init__.py +15 -0
  39. llm_kit/completion/capabilities.py +493 -0
  40. llm_kit/completion/contract.py +465 -0
  41. llm_kit/completion/contract_types.py +470 -0
  42. llm_kit/completion/factory_protocols.py +85 -0
  43. llm_kit/completion/halt.py +545 -0
  44. llm_kit/completion/prompt_fold.py +33 -0
  45. llm_kit/completion/request_protocol.py +408 -0
  46. llm_kit/completion/requirements.py +422 -0
  47. llm_kit/completion/results.py +201 -0
  48. llm_kit/completion/skill_context.py +342 -0
  49. llm_kit/completion/skill_context_types.py +136 -0
  50. llm_kit/completion/types.py +377 -0
  51. llm_kit/dispatch/__init__.py +18 -0
  52. llm_kit/dispatch/declaration.py +1279 -0
  53. llm_kit/dispatch/endpoint_profile.py +26 -0
  54. llm_kit/dispatch/endpoint_resolver.py +157 -0
  55. llm_kit/dispatch/factory.py +167 -0
  56. llm_kit/dispatch/observer.py +33 -0
  57. llm_kit/dispatch/pipeline_backends.py +228 -0
  58. llm_kit/dispatch/reachability.py +444 -0
  59. llm_kit/dispatch/review_lane.py +802 -0
  60. llm_kit/dispatch/seats.py +353 -0
  61. llm_kit/dispatch/usage_budget.py +433 -0
  62. llm_kit/execution/__init__.py +22 -0
  63. llm_kit/execution/contract_probe.py +170 -0
  64. llm_kit/execution/event_probe.py +197 -0
  65. llm_kit/execution/interrupts.py +274 -0
  66. llm_kit/execution/probe.py +197 -0
  67. llm_kit/execution/schema_validator.py +90 -0
  68. llm_kit/execution/values.py +85 -0
  69. llm_kit/frontdoor/__init__.py +10 -0
  70. llm_kit/frontdoor/__main__.py +5 -0
  71. llm_kit/frontdoor/acceptance.py +402 -0
  72. llm_kit/frontdoor/server.py +527 -0
  73. llm_kit/index.html +58 -0
  74. llm_kit/jobs/__init__.py +196 -0
  75. llm_kit/jobs/events.py +295 -0
  76. llm_kit/jobs/interrupts.py +438 -0
  77. llm_kit/jobs/model.py +1514 -0
  78. llm_kit/jobs/run.py +2007 -0
  79. llm_kit/jobs/select.py +399 -0
  80. llm_kit/jobs/store.py +3170 -0
  81. llm_kit/jobs/workspace.py +1072 -0
  82. llm_kit/pipeline/__init__.py +1 -0
  83. llm_kit/pipeline/analysis/__init__.py +1 -0
  84. llm_kit/pipeline/analysis/audit/__init__.py +37 -0
  85. llm_kit/pipeline/analysis/audit/auditor.py +233 -0
  86. llm_kit/pipeline/analysis/audit/reasoning_chain.py +235 -0
  87. llm_kit/pipeline/analysis/audit/report.py +149 -0
  88. llm_kit/pipeline/analysis/provenance/__init__.py +16 -0
  89. llm_kit/pipeline/analysis/provenance/call_audit.py +186 -0
  90. llm_kit/pipeline/analysis/provenance/record.py +314 -0
  91. llm_kit/pipeline/analysis/provenance/replay.py +167 -0
  92. llm_kit/pipeline/analysis/provenance/snapshot.py +169 -0
  93. llm_kit/pipeline/artifacts/__init__.py +1 -0
  94. llm_kit/pipeline/artifacts/cli/__init__.py +1 -0
  95. llm_kit/pipeline/artifacts/cli/unsupported.py +177 -0
  96. llm_kit/pipeline/artifacts/deliver/__init__.py +35 -0
  97. llm_kit/pipeline/artifacts/deliver/inplace.py +468 -0
  98. llm_kit/pipeline/artifacts/deliver/projection.py +153 -0
  99. llm_kit/pipeline/artifacts/freshness/__init__.py +59 -0
  100. llm_kit/pipeline/artifacts/freshness/classify.py +128 -0
  101. llm_kit/pipeline/artifacts/freshness/ensure.py +136 -0
  102. llm_kit/pipeline/artifacts/freshness/hashing.py +201 -0
  103. llm_kit/pipeline/artifacts/freshness/tier.py +61 -0
  104. llm_kit/pipeline/artifacts/providers/__init__.py +48 -0
  105. llm_kit/pipeline/artifacts/providers/assembly.py +214 -0
  106. llm_kit/pipeline/artifacts/providers/registry.py +213 -0
  107. llm_kit/pipeline/artifacts/roundtrip/__init__.py +28 -0
  108. llm_kit/pipeline/artifacts/roundtrip/questions.py +164 -0
  109. llm_kit/pipeline/artifacts/roundtrip/returns.py +130 -0
  110. llm_kit/pipeline/artifacts/store/__init__.py +69 -0
  111. llm_kit/pipeline/artifacts/store/attributed.py +319 -0
  112. llm_kit/pipeline/artifacts/store/candidate.py +485 -0
  113. llm_kit/pipeline/artifacts/store/intermediary.py +139 -0
  114. llm_kit/pipeline/artifacts/store/projection.py +113 -0
  115. llm_kit/pipeline/artifacts/vcs/__init__.py +28 -0
  116. llm_kit/pipeline/artifacts/vcs/git_vcs.py +268 -0
  117. llm_kit/pipeline/artifacts/vcs/null_vcs.py +30 -0
  118. llm_kit/pipeline/core/__init__.py +38 -0
  119. llm_kit/pipeline/core/cell_policy.py +116 -0
  120. llm_kit/pipeline/core/convergence.py +161 -0
  121. llm_kit/pipeline/core/convergence_loop.py +381 -0
  122. llm_kit/pipeline/core/gate.py +51 -0
  123. llm_kit/pipeline/core/seed.py +54 -0
  124. llm_kit/pipeline/core/single_pass.py +48 -0
  125. llm_kit/pipeline/core/stage.py +38 -0
  126. llm_kit/pipeline/core/validate/__init__.py +51 -0
  127. llm_kit/pipeline/core/validate/contract.py +157 -0
  128. llm_kit/pipeline/core/validate/floor_guard.py +125 -0
  129. llm_kit/pipeline/core/validate/riders.py +109 -0
  130. llm_kit/pipeline/core/vcs_seam.py +20 -0
  131. llm_kit/pipeline/core/workunit.py +136 -0
  132. llm_kit/pipeline/execution/__init__.py +106 -0
  133. llm_kit/pipeline/execution/adapter.py +708 -0
  134. llm_kit/pipeline/execution/controller.py +760 -0
  135. llm_kit/pipeline/execution/deadlines.py +275 -0
  136. llm_kit/pipeline/execution/drivers/__init__.py +38 -0
  137. llm_kit/pipeline/execution/drivers/claude_bg.py +2475 -0
  138. llm_kit/pipeline/execution/drivers/inline.py +369 -0
  139. llm_kit/pipeline/execution/events.py +449 -0
  140. llm_kit/pipeline/execution/failure_cache.py +181 -0
  141. llm_kit/pipeline/execution/interrupts.py +475 -0
  142. llm_kit/pipeline/execution/model.py +659 -0
  143. llm_kit/pipeline/execution/parallel_graph.py +100 -0
  144. llm_kit/pipeline/execution/protocol.py +667 -0
  145. llm_kit/pipeline/execution/scheduler.py +357 -0
  146. llm_kit/pipeline/execution/status.py +344 -0
  147. llm_kit/pipeline/execution/store.py +1935 -0
  148. llm_kit/pipeline/execution/wave.py +580 -0
  149. llm_kit/pipeline/execution/workerpack.py +926 -0
  150. llm_kit/pipeline/runtime/__init__.py +222 -0
  151. llm_kit/pipeline/runtime/backends.py +1256 -0
  152. llm_kit/pipeline/runtime/budget.py +175 -0
  153. llm_kit/pipeline/runtime/gate.py +226 -0
  154. llm_kit/pipeline/runtime/platform.py +2526 -0
  155. llm_kit/pipeline/runtime/spend_ledger.py +1436 -0
  156. llm_kit/pipeline/runtime/yaml_extract.py +124 -0
  157. llm_kit/registry/__init__.py +9 -0
  158. llm_kit/registry/api_key.py +262 -0
  159. llm_kit/registry/consent.py +113 -0
  160. llm_kit/registry/conserve.py +197 -0
  161. llm_kit/registry/constants.py +101 -0
  162. llm_kit/registry/cost.py +155 -0
  163. llm_kit/registry/declaration_syntax.py +62 -0
  164. llm_kit/registry/effort.py +382 -0
  165. llm_kit/registry/env_file.py +128 -0
  166. llm_kit/registry/model_endpoints.py +782 -0
  167. llm_kit/registry/models.py +940 -0
  168. llm_kit/scaffold/__init__.py +170 -0
  169. llm_kit/schema/__init__.py +5 -0
  170. llm_kit/schema/json_repair.py +562 -0
  171. llm_kit/schema/json_schema.py +445 -0
  172. llm_kit/storage/__init__.py +18 -0
  173. llm_kit/storage/atomic_json.py +56 -0
  174. llm_kit/storage/connection.py +171 -0
  175. llm_kit/storage/network.py +45 -0
  176. llm_kit/storage/schema_version.py +32 -0
  177. llm_kit/storage/transaction.py +77 -0
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.5
2
+ Name: katsoft-llm-kit
3
+ Version: 1.0.0
4
+ Summary: LLM access, durable agent jobs and batch content pipelines in one library (import package llm_kit)
5
+ Project-URL: Source, https://github.com/kitaekatt/plugins-kit/tree/katsoft-llm-kit-v1.0.0
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.12
9
+ Requires-Dist: katsoft-contracts<2,>=1.0
10
+ Provides-Extra: config
11
+ Requires-Dist: pyyaml>=6.0; extra == 'config'
12
+ Provides-Extra: frontdoor
13
+ Requires-Dist: fastapi>=0.110; extra == 'frontdoor'
14
+ Requires-Dist: httpx>=0.27; extra == 'frontdoor'
15
+ Requires-Dist: uvicorn>=0.29; extra == 'frontdoor'
16
+ Provides-Extra: jobs
17
+ Requires-Dist: pyyaml>=6.0; extra == 'jobs'
18
+ Provides-Extra: local
19
+ Requires-Dist: psutil>=6.0; extra == 'local'
20
+ Provides-Extra: pipeline
21
+ Requires-Dist: pyyaml>=6.0; extra == 'pipeline'
22
+ Provides-Extra: sdk
23
+ Requires-Dist: openai>=1.0.0; extra == 'sdk'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # katsoft-llm-kit
27
+
28
+ LLM access, durable agent jobs and batch content pipelines in one library.
29
+ The import package is `llm_kit`; the console script is `llm-kit`.
30
+
31
+ ```
32
+ pip install katsoft-llm-kit
33
+ pip install "katsoft-llm-kit[sdk,jobs,config]"
34
+ llm-kit --help
35
+ ```
36
+
37
+ The base install depends on `katsoft-contracts` (execution-event envelope,
38
+ interrupt contract, model declaration parser) and nothing else. Extras:
39
+ `config`, `jobs` and `pipeline` bring PyYAML; `sdk` brings the OpenAI client
40
+ (the OpenRouter HTTP path); `local` brings psutil; `frontdoor` brings
41
+ FastAPI, uvicorn and httpx.
42
+
43
+ ## Runtime mode
44
+
45
+ `llm_kit._runtime.mode()` reports how the library is deployed. This
46
+ distribution is `"package"`: the contracts come from `katsoft-contracts`, and
47
+ the features that need the plugin marketplace's `bootstrap_lib` (the Codex
48
+ adapter, claudx propagation, skill context, the code-review lane) raise
49
+ `UnsupportedInPackageMode`. The model registry reads the shipped defaults;
50
+ point `MODEL_ENDPOINTS_REGISTRY` at a registry file to change them.
51
+
52
+ Do not install this distribution into an environment that also holds the
53
+ plugin's linked `llm_kit` copy.
54
+
55
+ ## Source
56
+
57
+ The source lives in the plugins-kit repository (`plugins/llm-kit/lib/llm_kit`).
58
+ Releases are tagged `katsoft-llm-kit-v<version>` in the repository named by the
59
+ `Source` project URL.
@@ -0,0 +1,177 @@
1
+ llm_kit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ llm_kit/_runtime.py,sha256=s45_AUkrfs4RZYiA5lmWu7KGWSMxdeZgCJhW6vVMuEk,10223
3
+ llm_kit/bootstrap_guard.py,sha256=HuZyhwh5HGRrbQUNz_uHJkcUJ6lAXD0m2RVSSwZ3NHI,11954
4
+ llm_kit/index.html,sha256=hx8HanvKqGeETZki6TDA8IELKYBAEmymIxgC4Erklvs,6815
5
+ llm_kit/adapters/__init__.py,sha256=3iK3aksaiLBiBGsP-94s7ASPGSY6gHJdQTs10sZXuMA,1003
6
+ llm_kit/adapters/_swapper_errors.py,sha256=ZpmlSzeLuKlQbPJGtIaV4lksjARSnREjir0ABnquuHo,888
7
+ llm_kit/adapters/_swapper_process.py,sha256=YE-r4XVPhteACT97-qm2XdlvLmI9NMItE9ersVYFYn0,11541
8
+ llm_kit/adapters/account.py,sha256=gTIGvFzTchDE3K5rqPjRmqUB_dg_waXgpVjiFvHhZw4,16649
9
+ llm_kit/adapters/backends.py,sha256=6oG35mF6hZpPdzLRhKd8XgnNaOO0CI4ALkD-ScRdd5w,43990
10
+ llm_kit/adapters/capabilities.py,sha256=XcamCE1IIWiISaV2yIt4T07255yOjFdKpmLGWHpRW-w,37550
11
+ llm_kit/adapters/claude_runner.py,sha256=4_D5Ym_F7neT_ZE8Xk8Gfkpj_qXnBjrQgtxbJl2v6xQ,9312
12
+ llm_kit/adapters/client.py,sha256=CJM068251pPTTkm89GHjRXY9fYJqnrNexAN31iu-FO8,4330
13
+ llm_kit/adapters/codex_backend.py,sha256=GLpFj72JkELeAkAbE2l4zV62X53dba7Tad6t5L8Mf7s,35054
14
+ llm_kit/adapters/endpoint_profile.py,sha256=zXvoO8gjjgpZucr5IQwQaA2lZYhQugagTVNhcgQVz5M,5300
15
+ llm_kit/adapters/harness_adapters.py,sha256=XnTWuMEZnA1C_xMyQvKGfBK1AjhI1sCvc2a0qVXCqL4,16108
16
+ llm_kit/adapters/harness_auth.py,sha256=nn47dZ330SKWJOZxCKzWDEQEe-MGde8Ie0YEwVMTTi0,8938
17
+ llm_kit/adapters/opencode_backend.py,sha256=J40NVjjTRmsauB4cdy7RymeZ_Jvp4bdAmVNDTI0NXSE,21392
18
+ llm_kit/adapters/swapper.py,sha256=P1fBJX94-dQGhG0dFQMxjcd_gXGimxFJo-L_qofYWwk,31917
19
+ llm_kit/adapters/swapper_acceptance.py,sha256=nWLkyMmT9EnpO-TLAkv8fDTcXZBbRtqp5wc6Pcj5nZc,13213
20
+ llm_kit/adapters/usage_sources.py,sha256=otJ9wLQ705XViG0iNSGGds2eF4Lo0_fDrt9G5NwOJiI,22115
21
+ llm_kit/cli/__init__.py,sha256=pcRD1JSZa8TQ6XZrmHx9ki3DOkCTYrcQZJqzP9BPMy8,7617
22
+ llm_kit/cli/__main__.py,sha256=q_ZgF8A5sm66CeudRvbP5TZACDFS0zjDxY_G_935dMU,162
23
+ llm_kit/cli/_common.py,sha256=77uXgcuof86plCWQKKLDRUSpRtmuMnu67T-cCyunUlo,6216
24
+ llm_kit/cli/_compose.py,sha256=H4R3tG7bSTdjB4Kg-Vj-yQBvBQmCTbmrRiKKg1Pko2A,1289
25
+ llm_kit/cli/account.py,sha256=uy3XrmKjYmBfAQzOvYXFyRJAAnDA25lVLFkUB8yWtl4,5612
26
+ llm_kit/cli/completion.py,sha256=OI3VRtNPhUv1z_5twlHDjrc9Fwvsp2YhdJbHWcKx_uw,26670
27
+ llm_kit/cli/consent.py,sha256=I-iYBVzTSJanWXg24OqI69XzqwN41SsVsL75U2aaB_Q,3656
28
+ llm_kit/cli/jobs.py,sha256=0vRgTzP9c_4bVSiTbfMEvd1_Fa4bltT96gTi6FYwgps,17636
29
+ llm_kit/cli/local.py,sha256=K0hjzvj3XaNW3NzowJiegZ1_Zi7FdoQw3LFBw6RbN3g,13438
30
+ llm_kit/cli/models.py,sha256=E2rQx8_13kWPRzOfvDSozVVx1B7aMdj5WFSSK3-2q-4,23569
31
+ llm_kit/cli/pipeline.py,sha256=YJmgZaBxplOFi2811ooxyKz-uOiHlaDL3iX4UBvNfuY,2674
32
+ llm_kit/cli/run.py,sha256=CM7ImmchZYQhf_Nhashs8uDQko28bWbDV-U6R-ic76o,29205
33
+ llm_kit/completion/__init__.py,sha256=UNXnc1sJZ9vzfybi7hrhqniruGU9fD8jgrYK_w7kguQ,840
34
+ llm_kit/completion/capabilities.py,sha256=d-ED9ETKE0n_tx8EjhqBC3iipKKf3oM95kIvRR8h8ks,19599
35
+ llm_kit/completion/contract.py,sha256=2kJm1kTP2ZtduabECTNBiKr78s_FY5ArCpYoFfFiI4o,18767
36
+ llm_kit/completion/contract_types.py,sha256=bir-jzmkf_Vc2pGQS0rHK_-prP3H9ihhKjRDTtoh3jM,18814
37
+ llm_kit/completion/factory_protocols.py,sha256=GU2bVAlPiZjC0VEjRfs-Uqi_Dgt7MzDGgZGBeDv3xP8,3651
38
+ llm_kit/completion/halt.py,sha256=9e_DmrCYG6WII54Ebki_WQ0qUqd13w6mpsVkJQwrfpA,22925
39
+ llm_kit/completion/prompt_fold.py,sha256=ELq8Eb6F6duX1GVRSbQNCmMFTbVPkXMq2tqlmfMmGMs,1357
40
+ llm_kit/completion/request_protocol.py,sha256=DxIrA3bX9hGspTgnLvryECpFRtqCGlGCjP9jRnQh6Zw,16452
41
+ llm_kit/completion/requirements.py,sha256=Yj_uFw0mH0n6VayUKOWzwdaOuzmc7KcJKpaTh9fBiO8,17457
42
+ llm_kit/completion/results.py,sha256=nIEchY5ML0k9JjuLpCGgIKXUv40BUT8NKa_LdE6DL8c,8748
43
+ llm_kit/completion/skill_context.py,sha256=ryi3N79sx0StH7ySVXS_-WdiNJQabtERrnujXB12hX8,13770
44
+ llm_kit/completion/skill_context_types.py,sha256=vhtvRHEOg4YH43mxzvPLMvCZSK5-xY9c4ZsnP5Ddg2Q,5182
45
+ llm_kit/completion/types.py,sha256=_otAmYp06ZInVMFZgJikRsOF1zBRfNbSuM9IiILqlco,18823
46
+ llm_kit/dispatch/__init__.py,sha256=jq516vPT3hQsF75SXbv3vnbwB6ucKfQ0hlStcPzPoHM,951
47
+ llm_kit/dispatch/declaration.py,sha256=Sts0BAduq6sH_7tZ-CHZaoFYSCqj3T60rkmdlmQUJoA,57710
48
+ llm_kit/dispatch/endpoint_profile.py,sha256=kQwFmsWourT2QD4P2usGJB5Ks5U0beyaYh08PsvNBIY,754
49
+ llm_kit/dispatch/endpoint_resolver.py,sha256=08wjvsoPOajs5iz8xTgrPEEKmDrgxwwy-1t5-pxtq8s,6347
50
+ llm_kit/dispatch/factory.py,sha256=BSsih-1A1NoVA22e7p7OsyJrwOoahukCRFXRhqTaJtA,6694
51
+ llm_kit/dispatch/observer.py,sha256=Bea1ppufgbqbjoaDXDWB3kGxAZdQCkg2BVO5LFyEK8Y,1002
52
+ llm_kit/dispatch/pipeline_backends.py,sha256=3ttibBBEZ3cmQrlOMChp4jh9w-jahFH-5GC16cqTY8E,8515
53
+ llm_kit/dispatch/reachability.py,sha256=MAPQoJEtoHISHNBfxVvHnFe9uMVgYzI3T1bLTXC8p8M,20127
54
+ llm_kit/dispatch/review_lane.py,sha256=AzD7NosLOEhreaZfoPNAmpJLWVPyeipou9_7Ej-_c-k,34190
55
+ llm_kit/dispatch/seats.py,sha256=dFRAriA267bBrvqQr70eqhink3rd8F4lLhgnZuN6cPo,11876
56
+ llm_kit/dispatch/usage_budget.py,sha256=XsHbfZMYyncdDsfzZptCglXpepmXuk9fp0lqhKucpyk,18538
57
+ llm_kit/execution/__init__.py,sha256=zhuS8MQ8WJH_5iT_UeYjT8Lg7Xcme1zljpyqu3tFDew,1166
58
+ llm_kit/execution/contract_probe.py,sha256=UtqYSfqufyoAidQutr25beidHhFbtm8XyPVQw7WNQ30,5855
59
+ llm_kit/execution/event_probe.py,sha256=-CgBHjqcOpGIACs4WkxheLILqYtvD4l4z0mkAkDZ4a8,7157
60
+ llm_kit/execution/interrupts.py,sha256=2vOVL6xd-XEb0wzNrl41LI2mHuiiCnJqjUmShUOkyt8,11072
61
+ llm_kit/execution/probe.py,sha256=vGx0-a8gD1ZeRwRmPb66nH8VU58ywtWgaXZsSWBeFWc,6424
62
+ llm_kit/execution/schema_validator.py,sha256=TqweCvlS5Na65FUha1cwYqAYL60wcyecSL0WJMucguo,3643
63
+ llm_kit/execution/values.py,sha256=dwV6rAtnR5M5s5hZ_hwtbC4zbPyp6BOqOleexmVH-Y0,3335
64
+ llm_kit/frontdoor/__init__.py,sha256=IuTWxMQ7oGCvkFLL0UKycGYCsxO0tgkwwl1JzLnhd7o,358
65
+ llm_kit/frontdoor/__main__.py,sha256=DVaoKF89eJjH0ktT8s4I58zJ29Aak_M0lSsQESXheQM,83
66
+ llm_kit/frontdoor/acceptance.py,sha256=xelSVFN9tveL0PhDXpcecwbkJb4psKeWdk9phZSq80g,18028
67
+ llm_kit/frontdoor/server.py,sha256=owJjljR2E6boBYCl0L1X2lx6UZ7H-F2xVYm8eQS2bBY,23313
68
+ llm_kit/jobs/__init__.py,sha256=_uESZeUbsoCZTajfeVEVtBCz-fzpgZ4Imx9ghx0_wk8,4711
69
+ llm_kit/jobs/events.py,sha256=F5XoWT0QuzTvKshqitxnOXhUPBrdaeOjyPotwk6ZIIg,10223
70
+ llm_kit/jobs/interrupts.py,sha256=-dUT7CRGQtv3MKL8EirNQb4BKYG0bkW1tU-xSna485c,16173
71
+ llm_kit/jobs/model.py,sha256=_HWrEXbEWpUxIt-mVSGl0-SNGs_Be7-cOZgmxZLM1aQ,56681
72
+ llm_kit/jobs/run.py,sha256=yil3seVUXVSjHaIqXD9UyPDDdLE7L8VetYBgXy3MvDA,76414
73
+ llm_kit/jobs/select.py,sha256=D97hFsuEzF1eRDlQNCplGue9IHq2afbqbcahMMkrYxA,16007
74
+ llm_kit/jobs/store.py,sha256=DaVGEvgBCfD8EW-Fnjpfz7FgLe0dyIGYKbHJlerwHn0,132782
75
+ llm_kit/jobs/workspace.py,sha256=MCM46tGw7RopVc_NdE7n9ZGxLrT4WxYeQId_bealspg,40926
76
+ llm_kit/pipeline/__init__.py,sha256=5I0NhAlQsWQtBj0NL1c_4BV0-V0SXq3nK6EdHHg0R40,68
77
+ llm_kit/pipeline/analysis/__init__.py,sha256=WgXSm9OalsyFw0kJMfSNfY8nflRn2mK9kSDXZMxRPCc,122
78
+ llm_kit/pipeline/analysis/audit/__init__.py,sha256=LwccmNovcVujDlT0fZtb0EXLLg-GyvxVGQoZnU2x2jg,2145
79
+ llm_kit/pipeline/analysis/audit/auditor.py,sha256=Io7BtAs2wuiuj8exMTv_4AUwN3BOcOs_sZYk3Lyzxg0,8694
80
+ llm_kit/pipeline/analysis/audit/reasoning_chain.py,sha256=oV-jTbQDXGGva4jkjZpnFrY8V7EqG34VcVLczYqnGek,8703
81
+ llm_kit/pipeline/analysis/audit/report.py,sha256=o9rCO_vZAFM74u4AeIZpUZPhrn1cNRRbg_Kq3QLmFxk,5580
82
+ llm_kit/pipeline/analysis/provenance/__init__.py,sha256=JEM6eq45XnvVM2W-KJhAe7DpKuZVl2m3NBirmRd_I6w,771
83
+ llm_kit/pipeline/analysis/provenance/call_audit.py,sha256=DHpuf1jonb1KbYr6OcVrxbLN9bRL3Et4psf5bhwSvjE,7918
84
+ llm_kit/pipeline/analysis/provenance/record.py,sha256=elhVDHDzAHC_ygLsk4JmQJ18jSxFgUQOX9T0fhlJQx4,9628
85
+ llm_kit/pipeline/analysis/provenance/replay.py,sha256=TJBbpo247Sl7-PMnr4tS3GUOiV8NulJwOvktlLJA_dA,5951
86
+ llm_kit/pipeline/analysis/provenance/snapshot.py,sha256=YjNh1ZyMmiAIN9lT_lAm4fIuiIVqUuktURvqZTkqu1E,6502
87
+ llm_kit/pipeline/artifacts/__init__.py,sha256=mfPzph98umt6MI_2GREKg6r58y6ULf4t73QKyxSSevQ,143
88
+ llm_kit/pipeline/artifacts/cli/__init__.py,sha256=qIQqJskY2BaH3jm4qbfl66in8N2YNMY4eBMwuaGIiDM,76
89
+ llm_kit/pipeline/artifacts/cli/unsupported.py,sha256=r9YnTDy03lN7Lu3K6gzQXp3lX-7IlbqFWgkGXCVY_cg,6806
90
+ llm_kit/pipeline/artifacts/deliver/__init__.py,sha256=A0s_1QRwUtKTrEl6px2dhCQXWo7U_NQDFMRdo8OIpKw,2047
91
+ llm_kit/pipeline/artifacts/deliver/inplace.py,sha256=z_Un0i8Ya7RdfPjWuoKP75qGZwi7gIEplof0Qj6jXNY,20820
92
+ llm_kit/pipeline/artifacts/deliver/projection.py,sha256=aR4yjmRzBJsQ3tqqBzFFPHxwHj1hpR3hCMb8Ql6TopM,6199
93
+ llm_kit/pipeline/artifacts/freshness/__init__.py,sha256=QswlBBkH0EIU1zjQCOFOaW3Whb8qxVkWK_MyrHAlDFY,3403
94
+ llm_kit/pipeline/artifacts/freshness/classify.py,sha256=uyp3FpWakT0qv_fhLW22h7FeP2OgbmtRMSw3bQSGUkI,5036
95
+ llm_kit/pipeline/artifacts/freshness/ensure.py,sha256=rGha33ttL1uyngbl1GWG2Z6_omPuLYNHwbld2fIwuEg,5879
96
+ llm_kit/pipeline/artifacts/freshness/hashing.py,sha256=niWM_3ltrABeXI1S6KR6qTT40AzvzRh3cOmEXwmTvYI,8881
97
+ llm_kit/pipeline/artifacts/freshness/tier.py,sha256=pgv8hMlC0eSJoUswp9w3SSZck2OW0xcCExmK7fewPRE,2329
98
+ llm_kit/pipeline/artifacts/providers/__init__.py,sha256=9rti1HyQ6csbJHw1TM8-nEIMGkIkNhW4gX16E3jxA-o,2573
99
+ llm_kit/pipeline/artifacts/providers/assembly.py,sha256=9TTUXL12WMwuNX1e0DFiVwRJF-xGNTln6S5rduxdCW4,8268
100
+ llm_kit/pipeline/artifacts/providers/registry.py,sha256=ApgL9FcoiWqJMXVRLTboM01MY0Y3yLA7rv1XFCZtP4M,7796
101
+ llm_kit/pipeline/artifacts/roundtrip/__init__.py,sha256=DyFR5AWNUM6fFpWorhV1-gBmxC2MtWYDfUtilYLuY7w,1539
102
+ llm_kit/pipeline/artifacts/roundtrip/questions.py,sha256=qGdr2ErRdwUq7KZC_FkA4o-7kyZo72qw6ewFGWF821c,5796
103
+ llm_kit/pipeline/artifacts/roundtrip/returns.py,sha256=EtLwb1ghMxFUAq1LOKueqC2yTge90CGAud21koNCnYY,4705
104
+ llm_kit/pipeline/artifacts/store/__init__.py,sha256=O9L1AzsJ6Mrpkj1JWBRXXAIrEvd1ib7kvwhfEwiHlLE,4297
105
+ llm_kit/pipeline/artifacts/store/attributed.py,sha256=gSr6tDaPUcVSOkOj_TEt78T_m6plTfhaj8fmrGh7CL0,13313
106
+ llm_kit/pipeline/artifacts/store/candidate.py,sha256=3lRMDoM35VKQMjPzMTnZD3wsN0x4cZwI0EV6C57N7Bg,18460
107
+ llm_kit/pipeline/artifacts/store/intermediary.py,sha256=wejKLNxUM5KyP9QS2HPQMdaxX2CnhvTsQKLfvg9ZWVc,6566
108
+ llm_kit/pipeline/artifacts/store/projection.py,sha256=540w0-GwpTObEc_7LZR2LirFc8HNTyVhYF48E1VOtBk,4573
109
+ llm_kit/pipeline/artifacts/vcs/__init__.py,sha256=r3blDEk9dnzlvV-QPslhTD0xLqCOeOxoupyVx3A3lAY,1617
110
+ llm_kit/pipeline/artifacts/vcs/git_vcs.py,sha256=Rh0yDtKahffDfTrhI7kduiJd7w0k0jp-JBZh0SJq2Ag,12096
111
+ llm_kit/pipeline/artifacts/vcs/null_vcs.py,sha256=XBBIkOjDbJrH5w4kBLy7Cu79xZmg8uZcY3ShjqjWZ2g,755
112
+ llm_kit/pipeline/core/__init__.py,sha256=r8M9We4OaJaVnLzC7jdZoXAPNHvR_0HGmEWBbiYYXes,2407
113
+ llm_kit/pipeline/core/cell_policy.py,sha256=7Qr5X_YjHINb5E-D0Ffrddke02Z5TMMU0rI0BQ8p79s,3788
114
+ llm_kit/pipeline/core/convergence.py,sha256=X7ByTtm-J66cGZyKB3CJeZ5WYqRGnQm6R4lZQZnNR0U,6319
115
+ llm_kit/pipeline/core/convergence_loop.py,sha256=5gGStSQRtcoCmq8g--doLi5U06HkAVp19OgZTJFKf14,13222
116
+ llm_kit/pipeline/core/gate.py,sha256=Tc7fNF4lQ1i6nwf2bRSaiZsV-jfNrzcCpTgwTSoK1qQ,1770
117
+ llm_kit/pipeline/core/seed.py,sha256=EOcl1JGnlAWKrpc9Xky_VYSE6QAj4qq-RpUwJwt1Uoc,2547
118
+ llm_kit/pipeline/core/single_pass.py,sha256=t7mN0NrqSOgEcNelP-lXhtePhKSzU4SnBsHeNL1YA2w,1704
119
+ llm_kit/pipeline/core/stage.py,sha256=Zi2g7EYslA9EbDUon15mtwKWpsxeel40kAB0m3y7fLc,1343
120
+ llm_kit/pipeline/core/vcs_seam.py,sha256=qdfZBO3vPhosdQBCqRpM1iQtfLFT5fnX6oRx0tCMCpo,809
121
+ llm_kit/pipeline/core/workunit.py,sha256=YSYbpsltNM50FtEWcgbKCy8-3GClxNbPSg4SKlxSViA,5624
122
+ llm_kit/pipeline/core/validate/__init__.py,sha256=s7CAc9MVoe3jPjQxc9oMeLWuw3H7wL1vznRyYnVUAo8,3003
123
+ llm_kit/pipeline/core/validate/contract.py,sha256=w8d7p_CY72BZlJc8ffbFygrU2GEwte2UjiPEQ0NiqsQ,5866
124
+ llm_kit/pipeline/core/validate/floor_guard.py,sha256=lpaLrZvGtRXPsC70UVxUA3GiL-Y45MTGUv0Z7zvf_Bg,4550
125
+ llm_kit/pipeline/core/validate/riders.py,sha256=iH7-qbZX1PlF8tFS4qsEsn3lb6DRsj3BpZ2Re5L_x_E,4398
126
+ llm_kit/pipeline/execution/__init__.py,sha256=Yj7FqxQ2FK3lxX7Y0vj6sZx438-hoQHqX0dPbQ7L9hU,6810
127
+ llm_kit/pipeline/execution/adapter.py,sha256=ceutnKmf6ivsJ_k5of2oTP-RkZLTIetXlrqXPrhsPwQ,36625
128
+ llm_kit/pipeline/execution/controller.py,sha256=qPwz8icgCL_94gDBRTcgajLUulVVL5X39JOH_kVxDuU,36465
129
+ llm_kit/pipeline/execution/deadlines.py,sha256=bHsnspUpOUBUeJRuDnSW_b0NOiFFDVu5Bbz5kercsLo,10559
130
+ llm_kit/pipeline/execution/events.py,sha256=I63MzPY9rpLHq8ejIhWIs6MFkY9DBE9ogys7UxXFuDM,17955
131
+ llm_kit/pipeline/execution/failure_cache.py,sha256=4pqSzBYPB0gIR_GhwLnOO2Fc72EVcWThHFXLXlNRs30,6849
132
+ llm_kit/pipeline/execution/interrupts.py,sha256=cPAinyW-OkrUN8TsqVpNxJXr-9VIHXNQ7_NbFi1HmQM,17101
133
+ llm_kit/pipeline/execution/model.py,sha256=4zSdrxNVQIKAgPaK2BjquyeAXMrVHOJAt2fxYKKuoU4,24824
134
+ llm_kit/pipeline/execution/parallel_graph.py,sha256=5PxndyUoy6LsEZxYgmXJC3kTDLblUKCBYCy80OOITXU,4450
135
+ llm_kit/pipeline/execution/protocol.py,sha256=jTyRoS_p2RMjH2lpJrOrr8_Bjhjffiw-a1NlBOn0dXg,32270
136
+ llm_kit/pipeline/execution/scheduler.py,sha256=3qT6m1k1qRnKHBGiop883cjdmTKIymX-nsQgRuVYWUg,13871
137
+ llm_kit/pipeline/execution/status.py,sha256=ikHDDTfWtYojiZrGcoAjLYA3YlQ9GpKBUm4Tu-xEsrA,14433
138
+ llm_kit/pipeline/execution/store.py,sha256=jWC6PbEtNDE_bwJVMsep4h8gjid-G3vezFI_ib7uApQ,85030
139
+ llm_kit/pipeline/execution/wave.py,sha256=KTqYlr1ZIWYkD8X6aw0ITaISxjNK7WndVByRnl0JtVk,27092
140
+ llm_kit/pipeline/execution/workerpack.py,sha256=xtH7O_6OW7WUauNi4jXyfC6As3CZFjiOJFzncBLVdUc,43736
141
+ llm_kit/pipeline/execution/drivers/__init__.py,sha256=lGi2Nsntms8Zbt2_a2f8L7ZDR0qP01H183wUr7AQRyg,2071
142
+ llm_kit/pipeline/execution/drivers/claude_bg.py,sha256=I4Vf43mlfvQa9kdnCHNrRhMTPyFWR7f_AO2wxEmt6ls,117172
143
+ llm_kit/pipeline/execution/drivers/inline.py,sha256=Bx3Jlz4gxtsOj0M4OnFLrimjZ3tV3eBxkDb8sIy_gVk,18134
144
+ llm_kit/pipeline/runtime/__init__.py,sha256=4mkY5ixfJO2p-rs3ijYoHYyNDIRnnAw3XrT_JJ5jxDQ,10217
145
+ llm_kit/pipeline/runtime/backends.py,sha256=dU8PWT38vaOzT3dOI8_X719IG1ZqKukr85fksw4BsnE,57707
146
+ llm_kit/pipeline/runtime/budget.py,sha256=oSiieSPVwyEWQBxndP-MEpB8ZaS9JmG0-DusYJnm3Mc,7136
147
+ llm_kit/pipeline/runtime/gate.py,sha256=KGj_bCLFsngSHcDlfN-gJ9zgxGrpB1BWOoii-LSvDUE,9191
148
+ llm_kit/pipeline/runtime/platform.py,sha256=eYOMoQ9ErsTSXIa04OmYsf5eBmb-NwXN2GmN_6HXjH0,108486
149
+ llm_kit/pipeline/runtime/spend_ledger.py,sha256=nRqR3JiHJKi9-BO0IdR5dTwj0k3cKez4Qq9JFDsgX9o,61312
150
+ llm_kit/pipeline/runtime/yaml_extract.py,sha256=GQ0_T9HYu0d7myirLOq_GTJqYJ9DOa25lTKXeI_HplI,4588
151
+ llm_kit/registry/__init__.py,sha256=db5pg84htFTpmEn6IztpTbjPW7u_EshwVEKmRNl76NQ,467
152
+ llm_kit/registry/api_key.py,sha256=RgPWFbeF7lP0a769lGRT2HApA2QGntBTe6zE2RtUZ2g,11701
153
+ llm_kit/registry/consent.py,sha256=w9uMVJaQSmsWH0EduEk0651gtxgYrvSAoukCcVyVLX8,4457
154
+ llm_kit/registry/conserve.py,sha256=5Lwbyvy2KYCrPsl6-8uDYtfhw1qLwehexzfwzYMAaiY,7916
155
+ llm_kit/registry/constants.py,sha256=eJ2nOPnBI_bA9QBYS7QYqDm39uteac7roQgQXcFT7fY,4670
156
+ llm_kit/registry/cost.py,sha256=6sxvGE4NzC9TRkMqCYSYRWxKt2AXDWSUd_MUbuXxw1E,5871
157
+ llm_kit/registry/declaration_syntax.py,sha256=A9NGy2e0k5qZEewNs_OJX3mAeJSHBhdBGI7bvLdheik,2597
158
+ llm_kit/registry/effort.py,sha256=TSMiosIBJz7kiSW0nnKCly7C4EqQ9WONPExrSlmZwbk,14285
159
+ llm_kit/registry/env_file.py,sha256=mhShwePAwTxzqQdIZ8vW1n1OYGf1RZWJtXotF24fz5E,5171
160
+ llm_kit/registry/model_endpoints.py,sha256=FoVe9hBtYgQXFmZI2h_qX_I9Ew-kHAGndcjKAg1KX9c,31488
161
+ llm_kit/registry/models.py,sha256=KRXS0itS55oZ1ji-oMx4z_1SWAqjhudkzg0WVqUViAg,40274
162
+ llm_kit/scaffold/__init__.py,sha256=EYpSTYROuPE4uESncaWgKPbUMXsUj4wvSq20uUJ2kEs,5782
163
+ llm_kit/schema/__init__.py,sha256=JSPwzlWJadhXupSI68JBwd6tbRE8BuQX0D0hYGtrugc,176
164
+ llm_kit/schema/json_repair.py,sha256=FZMCOxiwCEbbT1C8sKNJPL5iKk4mSd6Z7QE33lNFckg,22109
165
+ llm_kit/schema/json_schema.py,sha256=tz9j1ciXRTxDtWHh66ocz1p1R3ggECnKhq9ZL1TQ7ZI,16419
166
+ llm_kit/storage/__init__.py,sha256=8WRsdaV_5MiCdpjIt4QBgHv8eflpfKfGO1m7Y_tJsXk,834
167
+ llm_kit/storage/atomic_json.py,sha256=_hc_dE42WHoVyfpbLMxIuzxfwKicRW0hWCdcAHgjgEI,2016
168
+ llm_kit/storage/connection.py,sha256=YU25NO5GNjHvgtj5yZkCSGS7FVM_u-6yeZcNBfH83vY,6735
169
+ llm_kit/storage/network.py,sha256=cDf3o94icw4FEK21eVto3P5pMMJBjrjm603GjiMEYUs,1882
170
+ llm_kit/storage/schema_version.py,sha256=P-P001bgEQkoKn88YUJriC_gJ4zQzXpTQkhfZjuxw-A,1258
171
+ llm_kit/storage/transaction.py,sha256=b3OMzIIdfAvoE_ojyZPD9rKiYno5g-zRRBArIhh2rKg,2477
172
+ llm_kit/_deployment.py,sha256=3TBAA-JLhgrIaTQexElxia_LIO7OgmsEgOCzLV5ZkKA,303
173
+ katsoft_llm_kit-1.0.0.dist-info/METADATA,sha256=kUmFMMaCvluHC8AJ0PwViwXiW3y93AudxI8h5WjwJR8,2262
174
+ katsoft_llm_kit-1.0.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
175
+ katsoft_llm_kit-1.0.0.dist-info/entry_points.txt,sha256=2oTHYfDc81QhYEqogzPEjsUE6WrJN5WJj50Mce05muc,45
176
+ katsoft_llm_kit-1.0.0.dist-info/licenses/LICENSE,sha256=Sz-E7czerfZKqa2AwHbTimnPuV3RgQ4O6ebbGNwM5K4,1066
177
+ katsoft_llm_kit-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ llm-kit = llm_kit.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Christina
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
llm_kit/__init__.py ADDED
File without changes
llm_kit/_deployment.py ADDED
@@ -0,0 +1,7 @@
1
+ """Release identity written by packages/_build/hatch_build.py. Do not edit."""
2
+ MODE = "package"
3
+ DIST = 'katsoft-llm-kit'
4
+ VERSION = '1.0.0'
5
+ TAG = 'katsoft-llm-kit-v1.0.0'
6
+ COMMIT = '5f44fbbd87c433b740dcfd2f07efc23c4a61f731'
7
+ TAG_URL = 'https://github.com/kitaekatt/plugins-kit/tree/katsoft-llm-kit-v1.0.0'
llm_kit/_runtime.py ADDED
@@ -0,0 +1,252 @@
1
+ """Which deployment this ``llm_kit`` runs in, and the seams that depend on it.
2
+
3
+ Two deployments exist and they must never be mixed in one environment:
4
+
5
+ ``legacy``
6
+ The plugin's copy. Bootstrap links ``lib/llm_kit`` onto the plugin venv
7
+ through a ``.pth`` file, ``bootstrap_lib`` is linked the same way, and the
8
+ shared contracts (``execution_event``, ``interrupt_contract``,
9
+ ``model_declaration``) are read from ``bootstrap_lib``. The committed
10
+ ``llm_kit/_deployment.py`` says ``MODE = "legacy"``.
11
+
12
+ ``package``
13
+ The ``katsoft-llm-kit`` wheel. It carries a build-hook-written
14
+ ``llm_kit/_deployment.py`` (``MODE = "package"``, ``DIST``, ``VERSION``,
15
+ ``TAG``, ``COMMIT``, ``TAG_URL``), depends on ``katsoft-contracts`` and
16
+ never meets ``bootstrap_lib``.
17
+
18
+ ``mode()`` decides once per process and refuses an environment whose identity
19
+ cannot be established. Nothing here reads the network or the clock, and nothing
20
+ is repaired: an ambiguous environment raises and says what to separate.
21
+
22
+ Standard library only; imports no other ``llm_kit`` module besides the marker.
23
+ """
24
+ from __future__ import annotations
25
+
26
+ import base64
27
+ import hashlib
28
+ import importlib
29
+ import importlib.metadata as metadata
30
+ import json
31
+ import os
32
+ import re
33
+ import sys
34
+ from importlib.machinery import SourceFileLoader
35
+ from typing import Any, Optional
36
+
37
+ #: The distribution that ships the package deployment.
38
+ DIST = "katsoft-llm-kit"
39
+ #: The distribution and import package that carry the shared contracts.
40
+ CONTRACTS_DIST = "katsoft-contracts"
41
+ CONTRACTS_PACKAGE = "katsoft_contracts"
42
+ #: The only contracts the library routes; everything else from ``bootstrap_lib``
43
+ #: is a legacy-only feature (``require_legacy``).
44
+ ROUTED_CONTRACTS = ("execution_event", "interrupt_contract", "model_declaration")
45
+
46
+ LEGACY = "legacy"
47
+ PACKAGE = "package"
48
+ _MODES = (LEGACY, PACKAGE)
49
+ _MARKER_MEMBER = "llm_kit/_deployment.py"
50
+
51
+
52
+ class RuntimeIdentityError(RuntimeError):
53
+ """The deployment of this ``llm_kit`` cannot be established or is ambiguous."""
54
+
55
+
56
+ class UnsupportedLayout(RuntimeError):
57
+ """``llm_kit`` is loaded in a layout the runtime-mode check cannot verify.
58
+
59
+ Frozen interpreters, zip imports, bytecode-only files and editable
60
+ installs have no on-disk file the installed metadata can be checked
61
+ against, so they are refused rather than guessed at.
62
+ """
63
+
64
+
65
+ class ContractsMissing(ImportError):
66
+ """Package mode needs ``katsoft-contracts``, which is not importable."""
67
+
68
+
69
+ class UnsupportedInPackageMode(RuntimeError):
70
+ """A feature that needs the marketplace's ``bootstrap_lib`` was used in package mode."""
71
+
72
+ def __init__(self, feature: str) -> None:
73
+ self.feature = feature
74
+ super().__init__(
75
+ f"{feature} needs the plugin marketplace's bootstrap_lib, which the "
76
+ f"{DIST} package does not provide; use the llm-kit plugin for it"
77
+ )
78
+
79
+
80
+ _MODE: Optional[str] = None
81
+
82
+
83
+ def _normalize(name: str) -> str:
84
+ return re.sub(r"[-_.]+", "-", name).lower()
85
+
86
+
87
+ def _real(path: Any) -> str:
88
+ return os.path.normcase(os.path.realpath(os.fspath(path)))
89
+
90
+
91
+ def mode() -> str:
92
+ """``"legacy"`` or ``"package"``; decided once per process, cached on success."""
93
+ global _MODE
94
+ if _MODE is None:
95
+ _MODE = _identify()
96
+ return _MODE
97
+
98
+
99
+ def _identify() -> str:
100
+ # (1) The marker.
101
+ try:
102
+ from llm_kit import _deployment # noqa: PLC0415
103
+ except ImportError as exc:
104
+ raise RuntimeIdentityError(
105
+ "llm_kit/_deployment.py is missing, so the deployment of this llm_kit "
106
+ "cannot be identified"
107
+ ) from exc
108
+ declared = getattr(_deployment, "MODE", None)
109
+ if declared not in _MODES:
110
+ raise RuntimeIdentityError(
111
+ f"llm_kit/_deployment.py states MODE = {declared!r}; expected one of {_MODES}"
112
+ )
113
+ # (2) The layout.
114
+ _check_layout(_deployment)
115
+ named = _named_distributions()
116
+ if declared == LEGACY:
117
+ # (3) A linked plugin copy beside an installed package: two llm_kit.
118
+ if named:
119
+ raise RuntimeIdentityError(
120
+ "this environment holds both the plugin's llm_kit (bootstrap "
121
+ f"shared-lib .pth) and the {DIST} package; use separate "
122
+ "environments -- the plugin venv for the plugin, a consumer venv "
123
+ "without the bootstrap llm_kit link for the package"
124
+ )
125
+ return LEGACY
126
+ # (4) The package.
127
+ _check_package(_deployment, named)
128
+ return PACKAGE
129
+
130
+
131
+ def _check_layout(deployment: Any) -> None:
132
+ if getattr(sys, "frozen", False):
133
+ raise UnsupportedLayout("llm_kit does not support a frozen interpreter")
134
+ spec = getattr(deployment, "__spec__", None)
135
+ if spec is None or type(spec.loader) is not SourceFileLoader:
136
+ raise UnsupportedLayout(
137
+ "llm_kit must be loaded from source files on disk; this layout "
138
+ f"(loader {type(getattr(spec, 'loader', None)).__name__}) is not supported"
139
+ )
140
+ path = getattr(deployment, "__file__", None)
141
+ if not path or not os.path.isfile(path):
142
+ raise UnsupportedLayout("llm_kit/_deployment.py is not a file on disk")
143
+
144
+
145
+ def _named_distributions() -> list:
146
+ """Every distinct installed distribution named ``DIST``.
147
+
148
+ One physical location is one distribution, however many ``sys.path``
149
+ entries lead to it; two locations are a duplicate.
150
+ """
151
+ wanted = _normalize(DIST)
152
+ found: dict[str, Any] = {}
153
+ for dist in metadata.distributions():
154
+ name = dist.metadata["Name"]
155
+ if name and _normalize(name) == wanted:
156
+ found.setdefault(_real(dist.locate_file("")), dist)
157
+ return list(found.values())
158
+
159
+
160
+ def _check_package(deployment: Any, named: list) -> None:
161
+ if not named:
162
+ raise RuntimeIdentityError(
163
+ f"llm_kit/_deployment.py states MODE = 'package' but no {DIST} "
164
+ "distribution is installed"
165
+ )
166
+ if len(named) > 1:
167
+ where = ", ".join(sorted(_real(d.locate_file("")) for d in named))
168
+ raise RuntimeIdentityError(f"{DIST} is installed more than once ({where})")
169
+ dist = named[0]
170
+ direct = dist.read_text("direct_url.json")
171
+ if direct:
172
+ try:
173
+ editable = bool(json.loads(direct).get("dir_info", {}).get("editable"))
174
+ except (ValueError, AttributeError) as exc:
175
+ raise RuntimeIdentityError(f"{DIST} has an unreadable direct_url.json") from exc
176
+ if editable:
177
+ raise UnsupportedLayout(f"{DIST} is an editable install; install the built wheel")
178
+ loaded = os.fspath(deployment.__file__)
179
+ entries = [f for f in (dist.files or ()) if str(f).replace("\\", "/") == _MARKER_MEMBER]
180
+ if len(entries) != 1 or entries[0].hash is None or entries[0].hash.mode != "sha256":
181
+ raise RuntimeIdentityError(
182
+ f"the RECORD of {DIST} does not list {_MARKER_MEMBER} with a sha256"
183
+ )
184
+ with open(loaded, "rb") as handle:
185
+ digest = base64.urlsafe_b64encode(hashlib.sha256(handle.read()).digest()).rstrip(b"=").decode()
186
+ if digest != entries[0].hash.value:
187
+ raise RuntimeIdentityError(
188
+ f"{_MARKER_MEMBER} does not match the RECORD of {DIST}; the package was modified"
189
+ )
190
+ if _real(dist.locate_file(entries[0])) != _real(loaded):
191
+ raise RuntimeIdentityError(
192
+ f"the llm_kit loaded from {loaded} is not the copy {DIST} installed"
193
+ )
194
+ stated = (getattr(deployment, "DIST", None), getattr(deployment, "VERSION", None))
195
+ if stated != (DIST, dist.version):
196
+ raise RuntimeIdentityError(
197
+ f"llm_kit/_deployment.py states {stated[0]!r} {stated[1]!r} but the "
198
+ f"installed distribution is {DIST!r} {dist.version!r}"
199
+ )
200
+ for other in metadata.distributions():
201
+ if any(other is d or _real(other.locate_file("")) == _real(d.locate_file("")) for d in named):
202
+ continue
203
+ if any(str(f).replace("\\", "/").startswith("llm_kit/") for f in (other.files or ())):
204
+ raise RuntimeIdentityError(
205
+ f"{other.metadata['Name']!r} also provides llm_kit files; "
206
+ f"{DIST} must be the only provider of the llm_kit package"
207
+ )
208
+
209
+
210
+ def load(name: str, error: Optional[type] = None) -> Any:
211
+ """Import the routed contract ``name`` from ``katsoft_contracts`` (package mode).
212
+
213
+ Only a ``ModuleNotFoundError`` that names ``katsoft_contracts`` or the
214
+ routed submodule means the contracts distribution is missing; it becomes
215
+ :class:`ContractsMissing`, or ``error`` (the calling product's own
216
+ ``ImportError`` subclass) worded the same. Absent (``katsoft_contracts``
217
+ does not import: install) and too old (it imports but lacks the routed
218
+ module: upgrade) read differently. Every other ``ImportError``
219
+ propagates unchanged: a broken contracts install must not read as an absent
220
+ one.
221
+ """
222
+ if name not in ROUTED_CONTRACTS:
223
+ raise ValueError(f"{name!r} is not a routed contract; routed: {ROUTED_CONTRACTS}")
224
+ if mode() != PACKAGE:
225
+ raise RuntimeIdentityError(f"load({name!r}) is a package-mode seam; this llm_kit is {mode()}")
226
+ qualified = f"{CONTRACTS_PACKAGE}.{name}"
227
+ try:
228
+ return importlib.import_module(qualified)
229
+ except ModuleNotFoundError as exc:
230
+ if exc.name not in (CONTRACTS_PACKAGE, qualified):
231
+ raise
232
+ if exc.name == qualified:
233
+ # The package imports but lacks the routed module: too old (or
234
+ # stale), a different remedy from an absent install.
235
+ missing = ContractsMissing(
236
+ f"{CONTRACTS_DIST} is installed but has no {name}; upgrade "
237
+ f"{CONTRACTS_DIST} ({DIST} requires >=1.0,<2)"
238
+ )
239
+ else:
240
+ missing = ContractsMissing(
241
+ f"{qualified} is not importable: install {CONTRACTS_DIST} "
242
+ f"(the {DIST} package depends on it)"
243
+ )
244
+ if error is None:
245
+ raise missing from exc
246
+ raise error(str(missing)) from exc
247
+
248
+
249
+ def require_legacy(feature: str) -> None:
250
+ """Refuse ``feature`` in package mode, before any ``bootstrap_lib`` import."""
251
+ if mode() == PACKAGE:
252
+ raise UnsupportedInPackageMode(feature)
@@ -0,0 +1,18 @@
1
+ """llm_kit.adapters: concrete integrations behind the completion contracts.
2
+
3
+ OpenAI-compatible, Claude, Codex and OpenCode backends; the CLI streaming
4
+ runner; the harness command adapters; the llama-swap swapper client and its
5
+ process layer; the raw Claude/Codex usage-source readers; the account and
6
+ endpoint probes; endpoint profiles; and the filled adapter capability tables.
7
+
8
+ Depends only on ``llm_kit.completion`` and ``llm_kit.registry``. Pacing policy,
9
+ backend factories and reachability live in ``llm_kit.dispatch``.
10
+
11
+ No root re-exports; import from the owning module (``llm_kit.adapters.account``,
12
+ ``llm_kit.adapters.backends``, ``llm_kit.adapters.capabilities``,
13
+ ``llm_kit.adapters.claude_runner``, ``llm_kit.adapters.client``,
14
+ ``llm_kit.adapters.codex_backend``, ``llm_kit.adapters.endpoint_profile``,
15
+ ``llm_kit.adapters.harness_adapters``, ``llm_kit.adapters.opencode_backend``,
16
+ ``llm_kit.adapters.swapper``, ``llm_kit.adapters.swapper_acceptance``,
17
+ ``llm_kit.adapters.usage_sources``).
18
+ """
@@ -0,0 +1,30 @@
1
+ """Error vocabulary shared by the swapper service and its process layer.
2
+
3
+ ``swapper`` (the service) and ``_swapper_process`` (the process primitive)
4
+ both raise these. They live in this leaf so the process layer imports no
5
+ service module; ``swapper`` re-exports every name, so
6
+ ``swapper.ProcessNotFound`` is this very class. ``exit_code`` is the CLI
7
+ contract, so the facade maps without logic.
8
+ """
9
+
10
+ from __future__ import annotations
11
+
12
+ EXIT_FAILURE = 1
13
+ EXIT_USAGE = 2
14
+ EXIT_INDETERMINATE = 5
15
+
16
+
17
+ class SwapperError(Exception):
18
+ """Base error. Operation failure unless a subclass says otherwise."""
19
+
20
+ exit_code = EXIT_FAILURE
21
+
22
+
23
+ class ProcessNotFound(SwapperError):
24
+ """A PID does not exist, or was reused (different create_time)."""
25
+
26
+
27
+ class InspectionIndeterminate(SwapperError):
28
+ """The process table could not be read well enough to decide."""
29
+
30
+ exit_code = EXIT_INDETERMINATE