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
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import abc
|
|
2
|
+
import json
|
|
3
|
+
import os
|
|
4
|
+
import typing as ta
|
|
5
|
+
|
|
6
|
+
from omlish import lang
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class InputHistoryStorage(lang.Abstract):
|
|
13
|
+
@abc.abstractmethod
|
|
14
|
+
def load(self) -> list[str]:
|
|
15
|
+
raise NotImplementedError
|
|
16
|
+
|
|
17
|
+
@abc.abstractmethod
|
|
18
|
+
def save(self, entries: ta.Sequence[str]) -> None:
|
|
19
|
+
raise NotImplementedError
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class InMemoryInputHistoryStorage(InputHistoryStorage):
|
|
23
|
+
def __init__(self) -> None:
|
|
24
|
+
super().__init__()
|
|
25
|
+
|
|
26
|
+
self._entries: list[str] = []
|
|
27
|
+
|
|
28
|
+
def load(self) -> list[str]:
|
|
29
|
+
return list(self._entries)
|
|
30
|
+
|
|
31
|
+
def save(self, entries: ta.Sequence[str]) -> None:
|
|
32
|
+
self._entries = list(entries)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class FileInputHistoryStorage(InputHistoryStorage):
|
|
36
|
+
def __init__(self, *, path: str) -> None:
|
|
37
|
+
super().__init__()
|
|
38
|
+
|
|
39
|
+
self._path = path
|
|
40
|
+
|
|
41
|
+
def load(self) -> list[str]:
|
|
42
|
+
if not os.path.exists(self._path):
|
|
43
|
+
return []
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
with open(self._path) as f:
|
|
47
|
+
data = json.load(f)
|
|
48
|
+
if isinstance(data, list) and all(isinstance(e, str) for e in data):
|
|
49
|
+
return data
|
|
50
|
+
return []
|
|
51
|
+
except (json.JSONDecodeError, OSError):
|
|
52
|
+
return []
|
|
53
|
+
|
|
54
|
+
def save(self, entries: ta.Sequence[str]) -> None:
|
|
55
|
+
try:
|
|
56
|
+
dir_path = os.path.dirname(self._path)
|
|
57
|
+
if dir_path:
|
|
58
|
+
os.makedirs(dir_path, exist_ok=True)
|
|
59
|
+
with open(self._path, 'w') as f:
|
|
60
|
+
json.dump(list(entries), f, indent=2)
|
|
61
|
+
except OSError:
|
|
62
|
+
pass
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
##
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class InputHistoryManager:
|
|
69
|
+
"""
|
|
70
|
+
Manages input history with readline-style navigation.
|
|
71
|
+
|
|
72
|
+
History position semantics:
|
|
73
|
+
- Position starts at len(history) (one past the end)
|
|
74
|
+
- Moving 'previous' decrements position
|
|
75
|
+
- Moving 'next' increments position
|
|
76
|
+
- Position is clamped to [0, len(history)]
|
|
77
|
+
- Position len(history) represents 'no history item selected'
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
def __init__(
|
|
81
|
+
self,
|
|
82
|
+
*,
|
|
83
|
+
storage: InputHistoryStorage,
|
|
84
|
+
max_entries: int = 1000,
|
|
85
|
+
) -> None:
|
|
86
|
+
super().__init__()
|
|
87
|
+
|
|
88
|
+
self._storage = storage
|
|
89
|
+
self._max_entries = max_entries
|
|
90
|
+
|
|
91
|
+
self._entries: list[str] = self._storage.load()
|
|
92
|
+
self._position: int = len(self._entries)
|
|
93
|
+
self._current_draft: str = ''
|
|
94
|
+
|
|
95
|
+
def add(self, text: str) -> None:
|
|
96
|
+
"""Add a new history entry and reset position."""
|
|
97
|
+
|
|
98
|
+
if not text.strip():
|
|
99
|
+
return
|
|
100
|
+
|
|
101
|
+
# Don't add duplicate consecutive entries
|
|
102
|
+
if self._entries and self._entries[-1] == text:
|
|
103
|
+
self.reset_position()
|
|
104
|
+
return
|
|
105
|
+
|
|
106
|
+
self._entries.append(text)
|
|
107
|
+
|
|
108
|
+
# Trim to max size
|
|
109
|
+
if len(self._entries) > self._max_entries:
|
|
110
|
+
self._entries = self._entries[-self._max_entries:]
|
|
111
|
+
|
|
112
|
+
self._storage.save(self._entries)
|
|
113
|
+
self.reset_position()
|
|
114
|
+
|
|
115
|
+
def get_previous(self, text: str | None = None) -> str | None:
|
|
116
|
+
"""
|
|
117
|
+
Navigate to previous (older) history entry.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
text: Current text in the input field (saved as draft when at end of history)
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
The previous history entry, or None if at the beginning
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
if not self._entries:
|
|
127
|
+
return None
|
|
128
|
+
|
|
129
|
+
# Save current draft if we're at the end
|
|
130
|
+
if self._position == len(self._entries) and text is not None:
|
|
131
|
+
self._current_draft = text
|
|
132
|
+
|
|
133
|
+
# Move to previous entry
|
|
134
|
+
if self._position > 0:
|
|
135
|
+
self._position -= 1
|
|
136
|
+
return self._entries[self._position]
|
|
137
|
+
|
|
138
|
+
# Already at oldest entry
|
|
139
|
+
return self._entries[0] if self._entries else None
|
|
140
|
+
|
|
141
|
+
def get_next(self, text: str | None = None) -> str | None:
|
|
142
|
+
"""
|
|
143
|
+
Navigate to next (newer) history entry.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
text: Current text in the input field (unused for now)
|
|
147
|
+
|
|
148
|
+
Returns:
|
|
149
|
+
The next history entry, the saved draft if moving past the end, or None
|
|
150
|
+
"""
|
|
151
|
+
|
|
152
|
+
if not self._entries:
|
|
153
|
+
return None
|
|
154
|
+
|
|
155
|
+
# Move to next entry
|
|
156
|
+
if self._position < len(self._entries):
|
|
157
|
+
self._position += 1
|
|
158
|
+
|
|
159
|
+
# If we moved past the end, return the draft
|
|
160
|
+
if self._position == len(self._entries):
|
|
161
|
+
draft = self._current_draft
|
|
162
|
+
self._current_draft = ''
|
|
163
|
+
return draft
|
|
164
|
+
|
|
165
|
+
return self._entries[self._position]
|
|
166
|
+
|
|
167
|
+
# Already at newest position
|
|
168
|
+
return None
|
|
169
|
+
|
|
170
|
+
def reset_position(self) -> None:
|
|
171
|
+
"""Reset history position to the end (no history item selected)."""
|
|
172
|
+
|
|
173
|
+
self._position = len(self._entries)
|
|
174
|
+
self._current_draft = ''
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from omdev.tui import textual as tx
|
|
2
|
+
|
|
3
|
+
from ..base import ChatInterface
|
|
4
|
+
from .app import ChatApp
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class TextualChatInterface(ChatInterface):
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
*,
|
|
14
|
+
app: ChatApp,
|
|
15
|
+
) -> None:
|
|
16
|
+
super().__init__()
|
|
17
|
+
|
|
18
|
+
self._app = app
|
|
19
|
+
|
|
20
|
+
async def run(self) -> None:
|
|
21
|
+
# FIXME: move lol
|
|
22
|
+
tx.set_root_logger_to_devtools(self._app.devtools)
|
|
23
|
+
|
|
24
|
+
await self._app.run_async()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import io as _io
|
|
2
|
+
|
|
3
|
+
from omlish import lang as _lang
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
##
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@_lang.cached_function
|
|
10
|
+
def read_app_css() -> str:
|
|
11
|
+
tcss_rsrcs = [
|
|
12
|
+
rsrc
|
|
13
|
+
for rsrc in _lang.get_relative_resources(globals=globals()).values()
|
|
14
|
+
if rsrc.name.endswith('.tcss')
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
out = _io.StringIO()
|
|
18
|
+
|
|
19
|
+
for i, rsrc in enumerate(tcss_rsrcs):
|
|
20
|
+
if i:
|
|
21
|
+
out.write('\n\n')
|
|
22
|
+
|
|
23
|
+
out.write(f'/*** {rsrc.name} ***/\n')
|
|
24
|
+
out.write('\n')
|
|
25
|
+
|
|
26
|
+
out.write(rsrc.read_text().strip())
|
|
27
|
+
out.write('\n')
|
|
28
|
+
|
|
29
|
+
return out.getvalue()
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#input-outer {
|
|
2
|
+
width: 100%;
|
|
3
|
+
height: auto;
|
|
4
|
+
|
|
5
|
+
background: $background-darken-3;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
#input-vertical {
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: auto;
|
|
11
|
+
|
|
12
|
+
margin: 0 1 1 1;
|
|
13
|
+
|
|
14
|
+
padding: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#input-vertical2 {
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: auto;
|
|
20
|
+
|
|
21
|
+
border: round $foreground-muted;
|
|
22
|
+
|
|
23
|
+
padding: 0 1;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#input-horizontal {
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#input-glyph {
|
|
32
|
+
width: auto;
|
|
33
|
+
|
|
34
|
+
padding: 0 1 0 0;
|
|
35
|
+
|
|
36
|
+
background: transparent;
|
|
37
|
+
color: $primary;
|
|
38
|
+
|
|
39
|
+
text-style: bold;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#input {
|
|
43
|
+
width: 1fr;
|
|
44
|
+
height: auto;
|
|
45
|
+
max-height: 16;
|
|
46
|
+
|
|
47
|
+
border: none;
|
|
48
|
+
|
|
49
|
+
padding: 0;
|
|
50
|
+
|
|
51
|
+
background: transparent;
|
|
52
|
+
color: $text;
|
|
53
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* Container */
|
|
2
|
+
|
|
3
|
+
#messages-container {
|
|
4
|
+
width: 100%;
|
|
5
|
+
height: 1fr;
|
|
6
|
+
|
|
7
|
+
scrollbar-gutter: stable;
|
|
8
|
+
|
|
9
|
+
background: $background-darken-3;
|
|
10
|
+
|
|
11
|
+
text-align: left;
|
|
12
|
+
|
|
13
|
+
scrollbar-size: 1 1;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
/* Divider */
|
|
18
|
+
|
|
19
|
+
.message-divider {
|
|
20
|
+
height: 1;
|
|
21
|
+
margin: 1 0 0 0;
|
|
22
|
+
|
|
23
|
+
border-top: solid $primary;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
/* Base Message */
|
|
28
|
+
|
|
29
|
+
.message {
|
|
30
|
+
width: 1fr;
|
|
31
|
+
height: auto;
|
|
32
|
+
|
|
33
|
+
margin: 1 0 0 0;
|
|
34
|
+
|
|
35
|
+
padding-right: 1;
|
|
36
|
+
|
|
37
|
+
layout: stream;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.message-glyph {
|
|
41
|
+
width: auto;
|
|
42
|
+
height: auto;
|
|
43
|
+
|
|
44
|
+
background: transparent;
|
|
45
|
+
color: $primary;
|
|
46
|
+
|
|
47
|
+
text-style: bold;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.message-outer {
|
|
51
|
+
width: 1fr;
|
|
52
|
+
height: auto;
|
|
53
|
+
|
|
54
|
+
align: left top;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.message-inner {
|
|
58
|
+
width: 1fr;
|
|
59
|
+
height: auto;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/* Welcome Message */
|
|
64
|
+
|
|
65
|
+
.welcome-message {
|
|
66
|
+
margin: 0;
|
|
67
|
+
|
|
68
|
+
padding: 1 2 1 1;
|
|
69
|
+
|
|
70
|
+
border: round;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.welcome-message-outer {
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.welcome-message-content {
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/* User Message */
|
|
81
|
+
|
|
82
|
+
.user-message {
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.user-message-outer {
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.user-message-glyph {
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.user-message-inner {
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
/* Ai Message */
|
|
96
|
+
|
|
97
|
+
.ai-message {
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.ai-message-outer {
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.ai-message-glyph {
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.ai-message-inner {
|
|
107
|
+
padding: 0;
|
|
108
|
+
|
|
109
|
+
Markdown {
|
|
110
|
+
width: 100%;
|
|
111
|
+
height: auto;
|
|
112
|
+
|
|
113
|
+
margin: 0;
|
|
114
|
+
padding: 0;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
/* Tool Confirmation Message */
|
|
120
|
+
|
|
121
|
+
.tool-confirmation-message {
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.tool-confirmation-message-outer {
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.tool-confirmation-message-glyph {
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.tool-confirmation-message-inner {
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.tool-confirmation-message-inner-open {
|
|
134
|
+
background: $warning-lighten-3 15%;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.tool-confirmation-message-inner-closed {
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.tool-confirmation-message-outer-content {
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.tool-confirmation-message-inner-content {
|
|
144
|
+
background: $background;
|
|
145
|
+
|
|
146
|
+
margin: 1;
|
|
147
|
+
padding: 1;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
.tool-confirmation-message-controls {
|
|
151
|
+
margin: 1;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
/* Ui Message */
|
|
156
|
+
|
|
157
|
+
.ui-message {
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.ui-message-glyph {
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.ui-message-outer {
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.ui-message-inner {
|
|
167
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
from omlish.formats import json
|
|
2
|
+
|
|
3
|
+
from ...... import minichain as mc
|
|
4
|
+
from ...drivers.tools.confirmation import ToolExecutionConfirmation
|
|
5
|
+
from ...drivers.tools.confirmation import ToolExecutionRequestDeniedError
|
|
6
|
+
from .app import ChatAppGetter
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
##
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ChatAppToolExecutionConfirmation(ToolExecutionConfirmation):
|
|
13
|
+
def __init__(
|
|
14
|
+
self,
|
|
15
|
+
*,
|
|
16
|
+
app: ChatAppGetter,
|
|
17
|
+
) -> None:
|
|
18
|
+
super().__init__()
|
|
19
|
+
|
|
20
|
+
self._app = app
|
|
21
|
+
|
|
22
|
+
async def confirm_tool_execution_or_raise(
|
|
23
|
+
self,
|
|
24
|
+
use: 'mc.ToolUse',
|
|
25
|
+
entry: 'mc.ToolCatalogEntry',
|
|
26
|
+
) -> None:
|
|
27
|
+
tr_dct = dict(
|
|
28
|
+
id=use.id,
|
|
29
|
+
name=entry.spec.name,
|
|
30
|
+
args=use.args,
|
|
31
|
+
# spec=msh.marshal(tce.spec),
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
if not await (await self._app()).confirm_tool_use(
|
|
35
|
+
'Execute requested tool?',
|
|
36
|
+
json.dumps_pretty(tr_dct),
|
|
37
|
+
):
|
|
38
|
+
raise ToolExecutionRequestDeniedError
|
|
File without changes
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import dataclasses as dc
|
|
2
|
+
import typing as ta
|
|
3
|
+
|
|
4
|
+
from omdev.tui import textual as tx
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
##
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class InputTextArea(tx.TextArea):
|
|
11
|
+
@dc.dataclass()
|
|
12
|
+
class Submitted(tx.Message):
|
|
13
|
+
text: str
|
|
14
|
+
|
|
15
|
+
@dc.dataclass()
|
|
16
|
+
class HistoryPrevious(tx.Message):
|
|
17
|
+
text: str
|
|
18
|
+
|
|
19
|
+
@dc.dataclass()
|
|
20
|
+
class HistoryNext(tx.Message):
|
|
21
|
+
text: str
|
|
22
|
+
|
|
23
|
+
@dc.dataclass()
|
|
24
|
+
class HistoryReset(tx.Message):
|
|
25
|
+
pass
|
|
26
|
+
|
|
27
|
+
def __init__(self, **kwargs: ta.Any) -> None:
|
|
28
|
+
super().__init__(**kwargs)
|
|
29
|
+
|
|
30
|
+
BINDINGS: ta.ClassVar[ta.Sequence[tx.Binding]] = [ # type: ignore[assignment]
|
|
31
|
+
tx.Binding(
|
|
32
|
+
'enter',
|
|
33
|
+
'submit',
|
|
34
|
+
priority=True,
|
|
35
|
+
),
|
|
36
|
+
tx.Binding(
|
|
37
|
+
'ctrl+p',
|
|
38
|
+
'history_previous',
|
|
39
|
+
),
|
|
40
|
+
tx.Binding(
|
|
41
|
+
'ctrl+n',
|
|
42
|
+
'history_next',
|
|
43
|
+
),
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
def action_submit(self) -> None:
|
|
47
|
+
if text := self.text.strip():
|
|
48
|
+
self.post_message(self.Submitted(text))
|
|
49
|
+
|
|
50
|
+
def action_cursor_up(self, select: bool = False) -> None:
|
|
51
|
+
# FIXME: if empty -> history_previous
|
|
52
|
+
super().action_cursor_up(select=select)
|
|
53
|
+
|
|
54
|
+
def action_cursor_down(self, select: bool = False) -> None:
|
|
55
|
+
super().action_cursor_down(select=select)
|
|
56
|
+
|
|
57
|
+
def action_history_previous(self) -> None:
|
|
58
|
+
self.post_message(self.HistoryPrevious(self.text))
|
|
59
|
+
|
|
60
|
+
def action_history_next(self) -> None:
|
|
61
|
+
self.post_message(self.HistoryNext(self.text))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class InputOuter(tx.Static):
|
|
65
|
+
def compose(self) -> tx.ComposeResult:
|
|
66
|
+
with tx.Vertical(id='input-vertical'):
|
|
67
|
+
with tx.Vertical(id='input-vertical2'):
|
|
68
|
+
with tx.Horizontal(id='input-horizontal'):
|
|
69
|
+
yield tx.Static('>', id='input-glyph')
|
|
70
|
+
yield InputTextArea(placeholder='...', id='input')
|