ommlds 0.0.0.dev466__py3-none-any.whl → 0.0.0.dev512__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.
- ommlds/.omlish-manifests.json +404 -31
- ommlds/README.md +11 -0
- ommlds/__about__.py +21 -12
- ommlds/_hacks/__init__.py +4 -0
- ommlds/_hacks/funcs.py +110 -0
- ommlds/_hacks/names.py +158 -0
- ommlds/_hacks/params.py +73 -0
- ommlds/_hacks/patches.py +0 -3
- ommlds/backends/anthropic/protocol/__init__.py +13 -1
- ommlds/backends/anthropic/protocol/_dataclasses.py +1625 -0
- ommlds/backends/anthropic/protocol/sse/events.py +2 -0
- ommlds/backends/anthropic/protocol/types.py +5 -7
- ommlds/backends/cerebras/__init__.py +7 -0
- ommlds/backends/cerebras/_dataclasses.py +4254 -0
- ommlds/backends/cerebras/_marshal.py +24 -0
- ommlds/backends/cerebras/clients.py +9 -0
- ommlds/backends/cerebras/protocol.py +310 -0
- ommlds/backends/google/protocol/__init__.py +13 -0
- ommlds/backends/google/protocol/_dataclasses.py +5997 -0
- ommlds/backends/google/protocol/types.py +6 -8
- ommlds/backends/groq/__init__.py +7 -0
- ommlds/backends/groq/_dataclasses.py +3901 -0
- ommlds/backends/groq/_marshal.py +23 -0
- ommlds/backends/groq/clients.py +9 -0
- ommlds/backends/groq/protocol.py +247 -0
- ommlds/{huggingface.py → backends/huggingface/cache.py} +1 -6
- ommlds/backends/huggingface/cli.py +208 -0
- ommlds/backends/llamacpp/logging.py +4 -1
- ommlds/backends/mlx/caching.py +7 -3
- ommlds/backends/mlx/cli.py +10 -7
- ommlds/backends/mlx/generation.py +18 -16
- ommlds/backends/mlx/limits.py +10 -6
- ommlds/backends/mlx/loading.py +7 -4
- ommlds/backends/ollama/__init__.py +7 -0
- ommlds/backends/ollama/_dataclasses.py +3940 -0
- ommlds/backends/ollama/cli.py +36 -0
- ommlds/backends/ollama/protocol.py +201 -0
- ommlds/backends/openai/protocol/__init__.py +15 -1
- ommlds/backends/openai/protocol/_common.py +3 -5
- ommlds/backends/openai/protocol/_dataclasses.py +7708 -0
- ommlds/backends/tavily/__init__.py +7 -0
- ommlds/backends/tavily/_dataclasses.py +1734 -0
- ommlds/backends/tavily/protocol.py +299 -0
- ommlds/backends/tinygrad/models/llama3/__init__.py +22 -14
- ommlds/backends/torch/backends.py +1 -1
- ommlds/backends/transformers/__init__.py +14 -0
- ommlds/backends/transformers/filecache.py +109 -0
- ommlds/backends/transformers/streamers.py +73 -0
- ommlds/cli/__init__.py +7 -0
- ommlds/cli/_dataclasses.py +3835 -0
- ommlds/cli/asyncs.py +30 -0
- ommlds/cli/backends/catalog.py +88 -0
- ommlds/cli/backends/configs.py +9 -0
- ommlds/cli/backends/inject.py +100 -42
- ommlds/cli/{sessions/chat/backends → backends}/injection.py +1 -1
- ommlds/cli/backends/meta.py +82 -0
- ommlds/cli/{sessions/chat/backends → backends}/types.py +11 -1
- ommlds/cli/{sessions/chat/content → content}/messages.py +2 -2
- ommlds/cli/{sessions/chat/content → content}/strings.py +1 -1
- ommlds/cli/inject.py +17 -8
- ommlds/cli/inputs/asyncs.py +32 -0
- ommlds/cli/inputs/sync.py +75 -0
- ommlds/cli/main.py +346 -114
- ommlds/cli/rendering/configs.py +9 -0
- ommlds/cli/{sessions/chat/rendering → rendering}/inject.py +4 -5
- ommlds/cli/{sessions/chat/rendering → rendering}/markdown.py +1 -1
- ommlds/cli/{sessions/chat/rendering → rendering}/raw.py +1 -1
- ommlds/cli/{sessions/chat/rendering → rendering}/types.py +7 -1
- ommlds/cli/secrets.py +22 -0
- ommlds/cli/sessions/base.py +1 -10
- ommlds/cli/sessions/chat/configs.py +13 -30
- ommlds/cli/sessions/chat/drivers/ai/configs.py +13 -0
- ommlds/cli/sessions/chat/drivers/ai/events.py +57 -0
- ommlds/cli/sessions/chat/{chat → drivers}/ai/inject.py +15 -12
- ommlds/cli/sessions/chat/{chat → drivers}/ai/rendering.py +8 -8
- ommlds/cli/sessions/chat/{chat → drivers}/ai/services.py +5 -5
- ommlds/cli/sessions/chat/{chat → drivers}/ai/tools.py +4 -8
- ommlds/cli/sessions/chat/{chat → drivers}/ai/types.py +10 -1
- ommlds/cli/sessions/chat/drivers/configs.py +25 -0
- ommlds/cli/sessions/chat/drivers/events/inject.py +27 -0
- ommlds/cli/sessions/chat/drivers/events/injection.py +14 -0
- ommlds/cli/sessions/chat/drivers/events/manager.py +16 -0
- ommlds/cli/sessions/chat/drivers/events/types.py +44 -0
- ommlds/cli/sessions/chat/drivers/impl.py +50 -0
- ommlds/cli/sessions/chat/drivers/inject.py +70 -0
- ommlds/cli/sessions/chat/drivers/state/configs.py +13 -0
- ommlds/cli/sessions/chat/drivers/state/ids.py +25 -0
- ommlds/cli/sessions/chat/drivers/state/inject.py +83 -0
- ommlds/cli/sessions/chat/{chat → drivers}/state/inmemory.py +1 -6
- ommlds/cli/sessions/chat/{chat → drivers}/state/storage.py +18 -12
- ommlds/cli/sessions/chat/{chat → drivers}/state/types.py +11 -6
- ommlds/cli/sessions/chat/drivers/tools/configs.py +22 -0
- ommlds/cli/sessions/chat/drivers/tools/confirmation.py +44 -0
- ommlds/cli/sessions/chat/drivers/tools/errorhandling.py +39 -0
- ommlds/cli/sessions/chat/{tools → drivers/tools}/execution.py +3 -4
- ommlds/cli/sessions/chat/drivers/tools/fs/__init__.py +0 -0
- ommlds/cli/sessions/chat/drivers/tools/fs/configs.py +12 -0
- ommlds/cli/sessions/chat/drivers/tools/fs/inject.py +35 -0
- ommlds/cli/sessions/chat/drivers/tools/inject.py +83 -0
- ommlds/cli/sessions/chat/{tools → drivers/tools}/injection.py +20 -5
- ommlds/cli/sessions/chat/{tools → drivers/tools}/rendering.py +3 -3
- ommlds/cli/sessions/chat/drivers/tools/todo/__init__.py +0 -0
- ommlds/cli/sessions/chat/drivers/tools/todo/configs.py +12 -0
- ommlds/cli/sessions/chat/drivers/tools/todo/inject.py +31 -0
- ommlds/cli/sessions/chat/drivers/tools/weather/__init__.py +0 -0
- ommlds/cli/sessions/chat/drivers/tools/weather/configs.py +12 -0
- ommlds/cli/sessions/chat/drivers/tools/weather/inject.py +22 -0
- ommlds/cli/sessions/chat/{tools/weather.py → drivers/tools/weather/tools.py} +1 -1
- ommlds/cli/sessions/chat/drivers/types.py +31 -0
- ommlds/cli/sessions/chat/drivers/user/__init__.py +0 -0
- ommlds/cli/sessions/chat/drivers/user/configs.py +14 -0
- ommlds/cli/sessions/chat/drivers/user/inject.py +41 -0
- ommlds/cli/sessions/chat/facades/__init__.py +0 -0
- ommlds/cli/sessions/chat/facades/commands/__init__.py +0 -0
- ommlds/cli/sessions/chat/facades/commands/base.py +83 -0
- ommlds/cli/sessions/chat/facades/commands/configs.py +9 -0
- ommlds/cli/sessions/chat/facades/commands/inject.py +41 -0
- ommlds/cli/sessions/chat/facades/commands/injection.py +15 -0
- ommlds/cli/sessions/chat/facades/commands/manager.py +59 -0
- ommlds/cli/sessions/chat/facades/commands/simple.py +34 -0
- ommlds/cli/sessions/chat/facades/commands/types.py +13 -0
- ommlds/cli/sessions/chat/facades/configs.py +11 -0
- ommlds/cli/sessions/chat/facades/facade.py +26 -0
- ommlds/cli/sessions/chat/facades/inject.py +35 -0
- ommlds/cli/sessions/chat/facades/ui.py +34 -0
- ommlds/cli/sessions/chat/inject.py +10 -49
- ommlds/cli/sessions/chat/interfaces/__init__.py +0 -0
- ommlds/cli/sessions/chat/interfaces/bare/__init__.py +0 -0
- ommlds/cli/sessions/chat/interfaces/bare/configs.py +15 -0
- ommlds/cli/sessions/chat/interfaces/bare/inject.py +69 -0
- ommlds/cli/sessions/chat/interfaces/bare/interactive.py +49 -0
- ommlds/cli/sessions/chat/interfaces/bare/oneshot.py +21 -0
- ommlds/cli/sessions/chat/{tools/confirmation.py → interfaces/bare/tools.py} +3 -22
- ommlds/cli/sessions/chat/interfaces/base.py +13 -0
- ommlds/cli/sessions/chat/interfaces/configs.py +11 -0
- ommlds/cli/sessions/chat/interfaces/inject.py +29 -0
- ommlds/cli/sessions/chat/interfaces/textual/__init__.py +0 -0
- ommlds/cli/sessions/chat/interfaces/textual/app.py +429 -0
- ommlds/cli/sessions/chat/interfaces/textual/configs.py +11 -0
- ommlds/cli/sessions/chat/interfaces/textual/facades.py +19 -0
- ommlds/cli/sessions/chat/interfaces/textual/inject.py +111 -0
- ommlds/cli/sessions/chat/interfaces/textual/inputhistory.py +174 -0
- ommlds/cli/sessions/chat/interfaces/textual/interface.py +24 -0
- ommlds/cli/sessions/chat/interfaces/textual/styles/__init__.py +29 -0
- ommlds/cli/sessions/chat/interfaces/textual/styles/input.tcss +53 -0
- ommlds/cli/sessions/chat/interfaces/textual/styles/markdown.tcss +7 -0
- ommlds/cli/sessions/chat/interfaces/textual/styles/messages.tcss +167 -0
- ommlds/cli/sessions/chat/interfaces/textual/tools.py +38 -0
- ommlds/cli/sessions/chat/interfaces/textual/widgets/__init__.py +0 -0
- ommlds/cli/sessions/chat/interfaces/textual/widgets/input.py +70 -0
- ommlds/cli/sessions/chat/interfaces/textual/widgets/messages.py +207 -0
- ommlds/cli/sessions/chat/session.py +8 -13
- ommlds/cli/sessions/completion/configs.py +5 -6
- ommlds/cli/sessions/completion/inject.py +15 -2
- ommlds/cli/sessions/completion/session.py +10 -18
- ommlds/cli/sessions/configs.py +10 -0
- ommlds/cli/sessions/embedding/configs.py +5 -6
- ommlds/cli/sessions/embedding/inject.py +15 -2
- ommlds/cli/sessions/embedding/session.py +10 -18
- ommlds/cli/sessions/inject.py +15 -15
- ommlds/cli/state/storage.py +8 -2
- ommlds/minichain/__init__.py +217 -60
- ommlds/minichain/_dataclasses.py +20640 -0
- ommlds/minichain/_typedvalues.py +15 -8
- ommlds/minichain/backends/catalogs/base.py +20 -1
- ommlds/minichain/backends/catalogs/simple.py +2 -2
- ommlds/minichain/backends/catalogs/strings.py +13 -10
- ommlds/minichain/backends/impls/anthropic/chat.py +28 -5
- ommlds/minichain/backends/impls/anthropic/names.py +3 -3
- ommlds/minichain/backends/impls/anthropic/protocol.py +2 -2
- ommlds/minichain/backends/impls/anthropic/stream.py +23 -18
- ommlds/minichain/backends/impls/cerebras/__init__.py +0 -0
- ommlds/minichain/backends/impls/cerebras/chat.py +82 -0
- ommlds/minichain/backends/impls/cerebras/names.py +45 -0
- ommlds/minichain/backends/impls/cerebras/protocol.py +143 -0
- ommlds/minichain/backends/impls/cerebras/stream.py +114 -0
- ommlds/minichain/backends/impls/duckduckgo/search.py +5 -1
- ommlds/minichain/backends/impls/dummy/__init__.py +0 -0
- ommlds/minichain/backends/impls/dummy/chat.py +69 -0
- ommlds/minichain/backends/impls/google/chat.py +20 -84
- ommlds/minichain/backends/impls/google/names.py +6 -0
- ommlds/minichain/backends/impls/google/protocol.py +105 -0
- ommlds/minichain/backends/impls/google/search.py +10 -5
- ommlds/minichain/backends/impls/google/stream.py +64 -142
- ommlds/minichain/backends/impls/google/tools.py +2 -2
- ommlds/minichain/backends/impls/groq/__init__.py +0 -0
- ommlds/minichain/backends/impls/groq/chat.py +77 -0
- ommlds/minichain/backends/impls/groq/names.py +48 -0
- ommlds/minichain/backends/impls/groq/protocol.py +143 -0
- ommlds/minichain/backends/impls/groq/stream.py +114 -0
- ommlds/minichain/backends/impls/huggingface/repos.py +1 -5
- ommlds/minichain/backends/impls/llamacpp/chat.py +15 -3
- ommlds/minichain/backends/impls/llamacpp/completion.py +7 -3
- ommlds/minichain/backends/impls/llamacpp/stream.py +38 -19
- ommlds/minichain/backends/impls/mistral.py +9 -2
- ommlds/minichain/backends/impls/mlx/chat.py +100 -23
- ommlds/minichain/backends/impls/ollama/__init__.py +0 -0
- ommlds/minichain/backends/impls/ollama/chat.py +193 -0
- ommlds/minichain/backends/impls/ollama/protocol.py +144 -0
- ommlds/minichain/backends/impls/openai/chat.py +14 -7
- ommlds/minichain/backends/impls/openai/completion.py +9 -2
- ommlds/minichain/backends/impls/openai/embedding.py +9 -2
- ommlds/minichain/backends/impls/openai/format.py +117 -115
- ommlds/minichain/backends/impls/openai/names.py +33 -5
- ommlds/minichain/backends/impls/openai/stream.py +61 -70
- ommlds/minichain/backends/impls/sentencepiece/tokens.py +9 -6
- ommlds/minichain/backends/impls/tavily.py +66 -0
- ommlds/minichain/backends/impls/tinygrad/chat.py +17 -14
- ommlds/minichain/backends/impls/tokenizers/tokens.py +9 -6
- ommlds/minichain/backends/impls/transformers/sentence.py +5 -2
- ommlds/minichain/backends/impls/transformers/tokens.py +9 -6
- ommlds/minichain/backends/impls/transformers/transformers.py +139 -20
- ommlds/minichain/backends/strings/parsing.py +2 -2
- ommlds/minichain/backends/strings/resolving.py +7 -2
- ommlds/minichain/chat/choices/stream/__init__.py +0 -0
- ommlds/minichain/chat/{stream → choices/stream}/adapters.py +7 -7
- ommlds/minichain/chat/choices/stream/joining.py +31 -0
- ommlds/minichain/chat/choices/stream/services.py +45 -0
- ommlds/minichain/chat/choices/stream/types.py +43 -0
- ommlds/minichain/chat/content.py +42 -0
- ommlds/minichain/chat/messages.py +46 -42
- ommlds/minichain/chat/stream/_marshal.py +4 -4
- ommlds/minichain/chat/stream/joining.py +56 -43
- ommlds/minichain/chat/stream/services.py +15 -15
- ommlds/minichain/chat/stream/types.py +17 -24
- ommlds/minichain/chat/templating.py +3 -3
- ommlds/minichain/content/__init__.py +20 -3
- ommlds/minichain/content/_marshal.py +181 -55
- ommlds/minichain/content/code.py +26 -0
- ommlds/minichain/content/composite.py +28 -0
- ommlds/minichain/content/content.py +27 -0
- ommlds/minichain/content/dynamic.py +12 -0
- ommlds/minichain/content/emphasis.py +27 -0
- ommlds/minichain/content/images.py +2 -2
- ommlds/minichain/content/json.py +2 -2
- ommlds/minichain/content/link.py +13 -0
- ommlds/minichain/content/markdown.py +12 -0
- ommlds/minichain/content/metadata.py +10 -0
- ommlds/minichain/content/namespaces.py +8 -0
- ommlds/minichain/content/placeholders.py +10 -9
- ommlds/minichain/content/quote.py +26 -0
- ommlds/minichain/content/raw.py +49 -0
- ommlds/minichain/content/recursive.py +12 -0
- ommlds/minichain/content/resources.py +22 -0
- ommlds/minichain/content/section.py +26 -0
- ommlds/minichain/content/sequence.py +17 -3
- ommlds/minichain/content/standard.py +32 -0
- ommlds/minichain/content/tag.py +28 -0
- ommlds/minichain/content/templates.py +13 -0
- ommlds/minichain/content/text.py +2 -2
- ommlds/minichain/content/transform/__init__.py +0 -0
- ommlds/minichain/content/transform/json.py +55 -0
- ommlds/minichain/content/transform/markdown.py +8 -0
- ommlds/minichain/content/transform/materialize.py +59 -0
- ommlds/minichain/content/transform/metadata.py +16 -0
- ommlds/minichain/content/transform/namespaces.py +20 -0
- ommlds/minichain/content/transform/placeholders.py +60 -0
- ommlds/minichain/content/{prepare.py → transform/prepare.py} +10 -15
- ommlds/minichain/content/transform/recursive.py +54 -0
- ommlds/minichain/content/transform/resources.py +58 -0
- ommlds/minichain/content/transform/standard.py +43 -0
- ommlds/minichain/content/{transforms → transform}/stringify.py +1 -7
- ommlds/minichain/content/transform/strings.py +33 -0
- ommlds/minichain/content/transform/templates.py +25 -0
- ommlds/minichain/content/transform/types.py +18 -0
- ommlds/minichain/content/transform/visitors.py +38 -0
- ommlds/minichain/content/visitors.py +218 -0
- ommlds/minichain/http/__init__.py +0 -0
- ommlds/minichain/http/stream.py +195 -0
- ommlds/minichain/lib/fs/tools/read.py +1 -1
- ommlds/minichain/lib/fs/tools/recursivels/rendering.py +1 -1
- ommlds/minichain/lib/fs/tools/recursivels/running.py +1 -1
- ommlds/minichain/lib/todo/tools/write.py +2 -1
- ommlds/minichain/lib/todo/types.py +1 -1
- ommlds/minichain/llms/types.py +4 -0
- ommlds/minichain/metadata.py +56 -2
- ommlds/minichain/models/configs.py +2 -2
- ommlds/minichain/models/names.py +2 -0
- ommlds/minichain/registries/globals.py +18 -4
- ommlds/minichain/resources.py +49 -3
- ommlds/minichain/search.py +1 -1
- ommlds/minichain/services/README.md +154 -0
- ommlds/minichain/services/__init__.py +6 -2
- ommlds/minichain/services/_marshal.py +46 -10
- ommlds/minichain/services/_origclasses.py +11 -0
- ommlds/minichain/services/_typedvalues.py +8 -3
- ommlds/minichain/services/requests.py +73 -3
- ommlds/minichain/services/responses.py +73 -3
- ommlds/minichain/services/services.py +9 -0
- ommlds/minichain/standard.py +8 -0
- ommlds/minichain/stream/services.py +43 -17
- ommlds/minichain/text/applypatch.py +2 -1
- ommlds/minichain/text/toolparsing/llamacpp/types.py +1 -1
- ommlds/minichain/tokens/specials.py +1 -1
- ommlds/minichain/tools/execution/catalog.py +2 -2
- ommlds/minichain/tools/execution/errorhandling.py +36 -0
- ommlds/minichain/tools/execution/errors.py +2 -2
- ommlds/minichain/tools/execution/executors.py +1 -1
- ommlds/minichain/tools/fns.py +1 -1
- ommlds/minichain/tools/jsonschema.py +2 -2
- ommlds/minichain/tools/reflect.py +11 -7
- ommlds/minichain/tools/types.py +16 -19
- ommlds/minichain/vectors/_marshal.py +1 -1
- ommlds/minichain/vectors/embeddings.py +1 -1
- ommlds/minichain/wrappers/__init__.py +7 -0
- ommlds/minichain/wrappers/firstinwins.py +144 -0
- ommlds/minichain/wrappers/instrument.py +146 -0
- ommlds/minichain/wrappers/retry.py +168 -0
- ommlds/minichain/wrappers/services.py +98 -0
- ommlds/minichain/wrappers/stream.py +57 -0
- ommlds/nanochat/LICENSE +21 -0
- ommlds/nanochat/__init__.py +0 -0
- ommlds/nanochat/rustbpe/LICENSE +21 -0
- ommlds/nanochat/rustbpe/README.md +10 -0
- ommlds/nanochat/tokenizers.py +440 -0
- ommlds/specs/__init__.py +0 -0
- ommlds/specs/mcp/__init__.py +0 -0
- ommlds/specs/mcp/_marshal.py +23 -0
- ommlds/specs/mcp/clients.py +146 -0
- ommlds/specs/mcp/protocol.py +369 -0
- ommlds/tools/git.py +84 -64
- ommlds/tools/ocr.py +1 -1
- ommlds/wiki/analyze.py +2 -2
- ommlds/wiki/models.py +4 -4
- ommlds/wiki/text/mfh.py +9 -9
- ommlds/wiki/utils/xml.py +5 -5
- {ommlds-0.0.0.dev466.dist-info → ommlds-0.0.0.dev512.dist-info}/METADATA +28 -21
- ommlds-0.0.0.dev512.dist-info/RECORD +534 -0
- {ommlds-0.0.0.dev466.dist-info → ommlds-0.0.0.dev512.dist-info}/WHEEL +1 -1
- ommlds/cli/backends/standard.py +0 -20
- ommlds/cli/sessions/chat/backends/catalog.py +0 -56
- ommlds/cli/sessions/chat/backends/inject.py +0 -37
- ommlds/cli/sessions/chat/chat/state/inject.py +0 -40
- ommlds/cli/sessions/chat/chat/user/inject.py +0 -61
- ommlds/cli/sessions/chat/chat/user/interactive.py +0 -29
- ommlds/cli/sessions/chat/chat/user/oneshot.py +0 -25
- ommlds/cli/sessions/chat/chat/user/types.py +0 -15
- ommlds/cli/sessions/chat/driver.py +0 -43
- ommlds/cli/sessions/chat/tools/inject.py +0 -145
- ommlds/minichain/backends/impls/openai/format2.py +0 -210
- ommlds/minichain/content/materialize.py +0 -196
- ommlds/minichain/content/simple.py +0 -47
- ommlds/minichain/content/transforms/base.py +0 -46
- ommlds/minichain/content/transforms/interleave.py +0 -70
- ommlds/minichain/content/transforms/squeeze.py +0 -72
- ommlds/minichain/content/transforms/strings.py +0 -24
- ommlds/minichain/content/types.py +0 -43
- ommlds/minichain/stream/wrap.py +0 -62
- ommlds-0.0.0.dev466.dist-info/RECORD +0 -376
- /ommlds/{cli/sessions/chat/backends → backends/huggingface}/__init__.py +0 -0
- /ommlds/cli/{sessions/chat/chat → content}/__init__.py +0 -0
- /ommlds/cli/{sessions/chat/chat/ai → inputs}/__init__.py +0 -0
- /ommlds/cli/{sessions/chat/chat/state → rendering}/__init__.py +0 -0
- /ommlds/cli/sessions/chat/{chat/user → drivers}/__init__.py +0 -0
- /ommlds/cli/sessions/chat/{content → drivers/ai}/__init__.py +0 -0
- /ommlds/cli/sessions/chat/{chat → drivers}/ai/injection.py +0 -0
- /ommlds/cli/sessions/chat/{phases → drivers/events}/__init__.py +0 -0
- /ommlds/cli/sessions/chat/{rendering → drivers/phases}/__init__.py +0 -0
- /ommlds/cli/sessions/chat/{phases → drivers/phases}/inject.py +0 -0
- /ommlds/cli/sessions/chat/{phases → drivers/phases}/injection.py +0 -0
- /ommlds/cli/sessions/chat/{phases → drivers/phases}/manager.py +0 -0
- /ommlds/cli/sessions/chat/{phases → drivers/phases}/types.py +0 -0
- /ommlds/cli/sessions/chat/{tools → drivers/state}/__init__.py +0 -0
- /ommlds/{minichain/content/transforms → cli/sessions/chat/drivers/tools}/__init__.py +0 -0
- {ommlds-0.0.0.dev466.dist-info → ommlds-0.0.0.dev512.dist-info}/entry_points.txt +0 -0
- {ommlds-0.0.0.dev466.dist-info → ommlds-0.0.0.dev512.dist-info}/licenses/LICENSE +0 -0
- {ommlds-0.0.0.dev466.dist-info → ommlds-0.0.0.dev512.dist-info}/top_level.txt +0 -0
ommlds/__about__.py
CHANGED
|
@@ -8,37 +8,44 @@ class Project(ProjectBase):
|
|
|
8
8
|
description = 'ommlds'
|
|
9
9
|
|
|
10
10
|
dependencies = [
|
|
11
|
-
f'omdev == {__version__}',
|
|
12
11
|
f'omlish == {__version__}',
|
|
13
12
|
]
|
|
14
13
|
|
|
15
14
|
optional_dependencies = {
|
|
15
|
+
'omdev': [
|
|
16
|
+
f'omdev == {__version__}',
|
|
17
|
+
],
|
|
18
|
+
|
|
16
19
|
'backends': [
|
|
17
|
-
# 'diffusers ~= 0.
|
|
20
|
+
# 'diffusers ~= 0.36',
|
|
18
21
|
|
|
19
22
|
'llama-cpp-python ~= 0.3',
|
|
20
23
|
|
|
21
|
-
'mlx ~= 0.
|
|
22
|
-
'mlx-lm ~= 0.
|
|
24
|
+
'mlx ~= 0.30; sys_platform == "darwin"',
|
|
25
|
+
'mlx-lm ~= 0.29; sys_platform == "darwin"',
|
|
23
26
|
|
|
24
|
-
|
|
27
|
+
'sentencepiece ~= 0.2',
|
|
25
28
|
|
|
26
29
|
'tiktoken ~= 0.12',
|
|
27
30
|
|
|
28
31
|
# 'tinygrad @ git+https://github.com/tinygrad/tinygrad',
|
|
29
|
-
'tinygrad ~= 0.
|
|
32
|
+
'tinygrad ~= 0.12',
|
|
30
33
|
|
|
31
34
|
'tokenizers ~= 0.22',
|
|
32
35
|
|
|
33
|
-
'torch ~= 2.
|
|
36
|
+
'torch ~= 2.10',
|
|
34
37
|
|
|
35
38
|
'transformers ~= 4.57',
|
|
36
|
-
'sentence-transformers ~= 5.
|
|
39
|
+
'sentence-transformers ~= 5.2',
|
|
37
40
|
],
|
|
38
41
|
|
|
39
42
|
'huggingface': [
|
|
40
|
-
'huggingface-hub ~= 0.
|
|
41
|
-
'datasets ~= 4.
|
|
43
|
+
'huggingface-hub ~= 0.36',
|
|
44
|
+
'datasets ~= 4.5',
|
|
45
|
+
],
|
|
46
|
+
|
|
47
|
+
'nanochat': [
|
|
48
|
+
'regex >= 2026.1',
|
|
42
49
|
],
|
|
43
50
|
|
|
44
51
|
'numpy': [
|
|
@@ -52,11 +59,11 @@ class Project(ProjectBase):
|
|
|
52
59
|
],
|
|
53
60
|
|
|
54
61
|
'pillow': [
|
|
55
|
-
'pillow ~= 12.
|
|
62
|
+
'pillow ~= 12.1',
|
|
56
63
|
],
|
|
57
64
|
|
|
58
65
|
'search': [
|
|
59
|
-
'ddgs ~= 9.
|
|
66
|
+
'ddgs ~= 9.10',
|
|
60
67
|
],
|
|
61
68
|
|
|
62
69
|
'wiki': [
|
|
@@ -76,6 +83,8 @@ class Project(ProjectBase):
|
|
|
76
83
|
|
|
77
84
|
|
|
78
85
|
class Setuptools(SetuptoolsBase):
|
|
86
|
+
rs = True
|
|
87
|
+
|
|
79
88
|
find_packages = {
|
|
80
89
|
'include': [Project.name, f'{Project.name}.*'],
|
|
81
90
|
'exclude': [*SetuptoolsBase.find_packages['exclude']],
|
ommlds/_hacks/__init__.py
CHANGED
ommlds/_hacks/funcs.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import dataclasses as dc
|
|
2
|
+
import linecache
|
|
3
|
+
import textwrap
|
|
4
|
+
import threading
|
|
5
|
+
import types
|
|
6
|
+
import typing as ta
|
|
7
|
+
import uuid
|
|
8
|
+
import warnings
|
|
9
|
+
|
|
10
|
+
from omlish import check
|
|
11
|
+
from omlish import lang
|
|
12
|
+
|
|
13
|
+
from .names import NamespaceBuilder
|
|
14
|
+
from .params import render_param_spec_call
|
|
15
|
+
from .params import render_param_spec_def
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
##
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dc.dataclass()
|
|
22
|
+
class _ReservedFilenameEntry:
|
|
23
|
+
unique_id: str
|
|
24
|
+
seq: int = 0
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_RESERVED_FILENAME_UUID_TLS = threading.local()
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def reserve_linecache_filename(prefix: str) -> str:
|
|
31
|
+
try:
|
|
32
|
+
e = _RESERVED_FILENAME_UUID_TLS.unique_id
|
|
33
|
+
except AttributeError:
|
|
34
|
+
e = _RESERVED_FILENAME_UUID_TLS.unique_id = _ReservedFilenameEntry(str(uuid.uuid4()))
|
|
35
|
+
|
|
36
|
+
while True:
|
|
37
|
+
unique_filename = f'<generated:{prefix}:{e.seq}>'
|
|
38
|
+
cache_line = (1, None, (e.unique_id,), unique_filename)
|
|
39
|
+
e.seq += 1
|
|
40
|
+
if linecache.cache.setdefault(unique_filename, cache_line) == cache_line: # type: ignore
|
|
41
|
+
return unique_filename
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
##
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def create_function(
|
|
48
|
+
name: str,
|
|
49
|
+
params: lang.CanParamSpec,
|
|
50
|
+
body: str,
|
|
51
|
+
*,
|
|
52
|
+
globals: ta.Mapping[str, ta.Any] | None = None, # noqa
|
|
53
|
+
locals: ta.Mapping[str, ta.Any] | None = None, # noqa
|
|
54
|
+
indent: str = ' ',
|
|
55
|
+
) -> types.FunctionType:
|
|
56
|
+
params = lang.ParamSpec.of(params)
|
|
57
|
+
check.isinstance(body, str)
|
|
58
|
+
locals = dict(locals or {}) # noqa
|
|
59
|
+
|
|
60
|
+
nsb = NamespaceBuilder(reserved_names=set(locals) | set(globals or []))
|
|
61
|
+
sig = render_param_spec_def(params, nsb)
|
|
62
|
+
for k, v in nsb.items():
|
|
63
|
+
check.not_in(k, locals)
|
|
64
|
+
locals[k] = v
|
|
65
|
+
|
|
66
|
+
body_txt = '\n'.join([
|
|
67
|
+
f'def {name}{sig}:',
|
|
68
|
+
textwrap.indent(textwrap.dedent(body.strip()), indent),
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
exec_txt = '\n'.join([
|
|
72
|
+
f'def __create_fn__({", ".join(locals.keys())}):',
|
|
73
|
+
textwrap.indent(body_txt, indent),
|
|
74
|
+
f'{indent}return {name}',
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
ns: dict = {}
|
|
78
|
+
filename = reserve_linecache_filename(name)
|
|
79
|
+
bytecode = compile(exec_txt, filename, 'exec')
|
|
80
|
+
eval(bytecode, globals or {}, ns) # type: ignore # noqa
|
|
81
|
+
|
|
82
|
+
fn = ns['__create_fn__'](**locals)
|
|
83
|
+
fn.__source__ = body_txt
|
|
84
|
+
linecache.cache[filename] = (len(exec_txt), None, exec_txt.splitlines(True), filename)
|
|
85
|
+
return fn
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
##
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def create_detour(
|
|
92
|
+
params: lang.CanParamSpec,
|
|
93
|
+
target: ta.Callable,
|
|
94
|
+
*,
|
|
95
|
+
as_kwargs: bool = False,
|
|
96
|
+
) -> types.CodeType:
|
|
97
|
+
params = lang.ParamSpec.of(params)
|
|
98
|
+
check.callable(target)
|
|
99
|
+
|
|
100
|
+
with warnings.catch_warnings():
|
|
101
|
+
warnings.filterwarnings('ignore', category=SyntaxWarning)
|
|
102
|
+
|
|
103
|
+
gfn = create_function(
|
|
104
|
+
'_',
|
|
105
|
+
params,
|
|
106
|
+
f'return 1{render_param_spec_call(params, as_kwargs=as_kwargs)}',
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
check.state(gfn.__code__.co_consts[:2] == (None, 1))
|
|
110
|
+
return gfn.__code__.replace(co_consts=(None, target, *gfn.__code__.co_consts[2:]))
|
ommlds/_hacks/names.py
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"""
|
|
2
|
+
TODO:
|
|
3
|
+
- releaseable names
|
|
4
|
+
"""
|
|
5
|
+
import string
|
|
6
|
+
import typing as ta
|
|
7
|
+
|
|
8
|
+
from omlish import check
|
|
9
|
+
from omlish import collections as col
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
##
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class NameGenerator(ta.Protocol):
|
|
16
|
+
def __call__(self, prefix: str = '') -> str: ...
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
#
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class NameGeneratorImpl:
|
|
23
|
+
DEFAULT_PREFIX: ta.ClassVar[str] = '_'
|
|
24
|
+
|
|
25
|
+
def __init__(
|
|
26
|
+
self,
|
|
27
|
+
*,
|
|
28
|
+
reserved_names: ta.Iterable[str] | None = None,
|
|
29
|
+
global_prefix: str | None = None,
|
|
30
|
+
use_global_prefix_if_present: bool = False,
|
|
31
|
+
add_global_prefix_before_number: bool = False,
|
|
32
|
+
) -> None:
|
|
33
|
+
super().__init__()
|
|
34
|
+
|
|
35
|
+
check.arg(not isinstance(reserved_names, str))
|
|
36
|
+
self._reserved_names = {check.isinstance(n, str) for n in (reserved_names or [])}
|
|
37
|
+
self._global_prefix = global_prefix if global_prefix is not None else self.DEFAULT_PREFIX
|
|
38
|
+
self._use_global_prefix_if_present = bool(use_global_prefix_if_present)
|
|
39
|
+
self._add_global_prefix_before_number = bool(add_global_prefix_before_number)
|
|
40
|
+
|
|
41
|
+
self._name_counts: dict[str, int] = {}
|
|
42
|
+
|
|
43
|
+
def __call__(self, prefix: str = '') -> str:
|
|
44
|
+
if self._use_global_prefix_if_present and prefix.startswith(self._global_prefix):
|
|
45
|
+
base_name = prefix
|
|
46
|
+
else:
|
|
47
|
+
base_name = self._global_prefix + prefix
|
|
48
|
+
|
|
49
|
+
base_count = -1
|
|
50
|
+
if base_name[-1] in string.digits:
|
|
51
|
+
i = len(base_name) - 2
|
|
52
|
+
while i >= 0 and base_name[i] in string.digits:
|
|
53
|
+
i -= 1
|
|
54
|
+
i += 1
|
|
55
|
+
base_count = int(base_name[i:])
|
|
56
|
+
base_name = base_name[:i]
|
|
57
|
+
|
|
58
|
+
if self._add_global_prefix_before_number:
|
|
59
|
+
if not (self._use_global_prefix_if_present and base_name.endswith(self._global_prefix)):
|
|
60
|
+
base_name += self._global_prefix
|
|
61
|
+
|
|
62
|
+
if base_count >= 0:
|
|
63
|
+
count = self._name_counts.setdefault(base_name, 0)
|
|
64
|
+
if base_count > count:
|
|
65
|
+
self._name_counts[base_name] = base_count
|
|
66
|
+
|
|
67
|
+
while True:
|
|
68
|
+
count = self._name_counts.get(base_name, 0)
|
|
69
|
+
self._name_counts[base_name] = count + 1
|
|
70
|
+
name = base_name + str(count)
|
|
71
|
+
if name not in self._reserved_names:
|
|
72
|
+
return name
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
name_generator = NameGeneratorImpl
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
##
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class NamespaceBuilder(ta.Mapping[str, ta.Any]):
|
|
82
|
+
def __init__(
|
|
83
|
+
self,
|
|
84
|
+
*,
|
|
85
|
+
reserved_names: ta.Iterable[str] | None = None,
|
|
86
|
+
name_generator: NameGenerator | None = None, # noqa
|
|
87
|
+
) -> None:
|
|
88
|
+
super().__init__()
|
|
89
|
+
|
|
90
|
+
self._reserved_names = {
|
|
91
|
+
check.isinstance(n, str)
|
|
92
|
+
for n in (check.not_isinstance(reserved_names, str) or [])
|
|
93
|
+
}
|
|
94
|
+
self._name_generator = check.callable(name_generator) if name_generator is not None else \
|
|
95
|
+
NameGeneratorImpl(reserved_names=self._reserved_names, use_global_prefix_if_present=True)
|
|
96
|
+
|
|
97
|
+
self._dct: ta.MutableMapping[str, ta.Any] = {}
|
|
98
|
+
self._dedupe_dct: ta.MutableMapping[ta.Any, str] = col.IdentityKeyDict()
|
|
99
|
+
|
|
100
|
+
@property
|
|
101
|
+
def reserved_names(self) -> ta.AbstractSet[str]:
|
|
102
|
+
return self._reserved_names
|
|
103
|
+
|
|
104
|
+
@property
|
|
105
|
+
def name_generator(self) -> NameGenerator:
|
|
106
|
+
return self._name_generator
|
|
107
|
+
|
|
108
|
+
def __getitem__(self, k: str) -> ta.Any:
|
|
109
|
+
return self._dct[k]
|
|
110
|
+
|
|
111
|
+
def __len__(self):
|
|
112
|
+
return len(self._dct)
|
|
113
|
+
|
|
114
|
+
def __iter__(self) -> ta.Iterator[str]:
|
|
115
|
+
return iter(self._dct)
|
|
116
|
+
|
|
117
|
+
def items(self) -> ta.ItemsView[str, ta.Any]:
|
|
118
|
+
return self._dct.items()
|
|
119
|
+
|
|
120
|
+
def put(
|
|
121
|
+
self,
|
|
122
|
+
value: ta.Any,
|
|
123
|
+
name: str | None = None,
|
|
124
|
+
*,
|
|
125
|
+
exact: bool = False,
|
|
126
|
+
dedupe: bool = False,
|
|
127
|
+
) -> str:
|
|
128
|
+
check.arg(not (name is None and exact))
|
|
129
|
+
if name is not None:
|
|
130
|
+
check.isinstance(name, str)
|
|
131
|
+
|
|
132
|
+
if dedupe:
|
|
133
|
+
try:
|
|
134
|
+
return self._dedupe_dct[value]
|
|
135
|
+
except KeyError:
|
|
136
|
+
pass
|
|
137
|
+
|
|
138
|
+
if name is not None:
|
|
139
|
+
if name not in self._reserved_names:
|
|
140
|
+
try:
|
|
141
|
+
existing = self._dct[name]
|
|
142
|
+
except KeyError:
|
|
143
|
+
self._dct[name] = value
|
|
144
|
+
if dedupe:
|
|
145
|
+
self._dedupe_dct[value] = name
|
|
146
|
+
return name
|
|
147
|
+
else:
|
|
148
|
+
if existing is value:
|
|
149
|
+
return name
|
|
150
|
+
if exact:
|
|
151
|
+
raise KeyError(name)
|
|
152
|
+
|
|
153
|
+
gen_name = self._name_generator(name or '')
|
|
154
|
+
check.not_in(gen_name, self._dct)
|
|
155
|
+
self._dct[gen_name] = value
|
|
156
|
+
if dedupe:
|
|
157
|
+
self._dedupe_dct[value] = gen_name
|
|
158
|
+
return gen_name
|
ommlds/_hacks/params.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import typing as ta
|
|
2
|
+
|
|
3
|
+
from omlish import lang
|
|
4
|
+
|
|
5
|
+
from .names import NamespaceBuilder
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
##
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def render_param_spec_call(
|
|
12
|
+
params: lang.ParamSpec,
|
|
13
|
+
*,
|
|
14
|
+
as_kwargs: bool = False,
|
|
15
|
+
) -> str:
|
|
16
|
+
src = ['(']
|
|
17
|
+
|
|
18
|
+
for i, p in enumerate(params):
|
|
19
|
+
if isinstance(p, lang.ParamSeparator):
|
|
20
|
+
continue
|
|
21
|
+
|
|
22
|
+
if i:
|
|
23
|
+
src.append(', ')
|
|
24
|
+
|
|
25
|
+
if as_kwargs:
|
|
26
|
+
if isinstance(p, lang.Param):
|
|
27
|
+
src.append(f'{p.name}={p.name}')
|
|
28
|
+
else:
|
|
29
|
+
raise TypeError(p)
|
|
30
|
+
|
|
31
|
+
else:
|
|
32
|
+
if isinstance(p, lang.ArgsParam):
|
|
33
|
+
src.append(f'*{p.name}')
|
|
34
|
+
elif isinstance(p, lang.KwargsParam):
|
|
35
|
+
src.append(f'**{p.name}')
|
|
36
|
+
elif isinstance(p, lang.PosOnlyParam):
|
|
37
|
+
src.append(p.name)
|
|
38
|
+
elif isinstance(p, lang.KwOnlyParam):
|
|
39
|
+
src.append(f'{p.name}={p.name}')
|
|
40
|
+
elif isinstance(p, lang.ValParam):
|
|
41
|
+
src.append(p.name)
|
|
42
|
+
else:
|
|
43
|
+
raise TypeError(p)
|
|
44
|
+
|
|
45
|
+
src.append(')')
|
|
46
|
+
|
|
47
|
+
return ''.join(src)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def render_param_spec_def(
|
|
51
|
+
params: lang.ParamSpec,
|
|
52
|
+
nsb: NamespaceBuilder,
|
|
53
|
+
*,
|
|
54
|
+
return_ann: lang.Maybe[ta.Any] = lang.empty(),
|
|
55
|
+
) -> str:
|
|
56
|
+
src = ['(']
|
|
57
|
+
|
|
58
|
+
for i, p in enumerate(params):
|
|
59
|
+
if i:
|
|
60
|
+
src.append(', ')
|
|
61
|
+
|
|
62
|
+
src.append(lang.param_render(
|
|
63
|
+
p,
|
|
64
|
+
render_annotation=lambda ann: nsb.put(ann, f'ann_{p.name}'), # noqa
|
|
65
|
+
render_default=lambda dfl: nsb.put(dfl, f'dfl_{p.name}'), # noqa
|
|
66
|
+
))
|
|
67
|
+
|
|
68
|
+
src.append(')')
|
|
69
|
+
|
|
70
|
+
if return_ann.present:
|
|
71
|
+
src.append(f' -> {nsb.put(return_ann.must(), "ann_return")}')
|
|
72
|
+
|
|
73
|
+
return ''.join(src)
|
ommlds/_hacks/patches.py
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
+
from omlish import dataclasses as _dc # noqa
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
_dc.init_package(
|
|
5
|
+
globals(),
|
|
6
|
+
codegen=True,
|
|
7
|
+
)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
##
|
|
11
|
+
|
|
12
|
+
|
|
1
13
|
from . import types # noqa
|
|
2
14
|
|
|
3
15
|
|
|
4
16
|
##
|
|
5
17
|
|
|
6
18
|
|
|
7
|
-
from omlish import marshal as _msh
|
|
19
|
+
from omlish import marshal as _msh # noqa
|
|
8
20
|
|
|
9
21
|
_msh.register_global_module_import('._marshal', __package__)
|