ommlds 0.0.0.dev494__py3-none-any.whl → 0.0.0.dev496__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 (85) hide show
  1. ommlds/cli/_dataclasses.py +7 -7
  2. ommlds/cli/backends/inject.py +49 -8
  3. ommlds/cli/backends/meta.py +35 -0
  4. ommlds/cli/content/messages.py +1 -1
  5. ommlds/cli/inject.py +1 -1
  6. ommlds/cli/sessions/chat/drivers/{driver.py → impl.py} +2 -9
  7. ommlds/cli/sessions/chat/drivers/inject.py +5 -3
  8. ommlds/cli/sessions/chat/drivers/state/inject.py +2 -3
  9. ommlds/cli/sessions/chat/drivers/tools/injection.py +4 -4
  10. ommlds/cli/sessions/chat/drivers/types.py +21 -0
  11. ommlds/cli/sessions/chat/drivers/user/inject.py +4 -3
  12. ommlds/cli/sessions/chat/facades/commands/inject.py +0 -2
  13. ommlds/cli/sessions/chat/facades/commands/simple.py +2 -8
  14. ommlds/cli/sessions/chat/facades/facade.py +1 -1
  15. ommlds/cli/sessions/chat/facades/inject.py +5 -0
  16. ommlds/cli/sessions/chat/facades/ui.py +11 -0
  17. ommlds/cli/sessions/chat/interfaces/bare/interactive.py +1 -1
  18. ommlds/cli/sessions/chat/interfaces/bare/oneshot.py +1 -1
  19. ommlds/cli/sessions/chat/interfaces/textual/app.py +21 -3
  20. ommlds/cli/sessions/chat/interfaces/textual/inject.py +2 -5
  21. ommlds/cli/sessions/chat/interfaces/textual/styles/messages.tcss +2 -0
  22. ommlds/cli/sessions/chat/interfaces/textual/widgets/messages.py +12 -5
  23. ommlds/minichain/__init__.py +81 -35
  24. ommlds/minichain/_dataclasses.py +7688 -3344
  25. ommlds/minichain/backends/impls/anthropic/protocol.py +2 -2
  26. ommlds/minichain/backends/impls/cerebras/protocol.py +2 -2
  27. ommlds/minichain/backends/impls/google/tools.py +2 -2
  28. ommlds/minichain/backends/impls/groq/protocol.py +2 -2
  29. ommlds/minichain/backends/impls/ollama/protocol.py +2 -2
  30. ommlds/minichain/backends/impls/openai/format.py +2 -2
  31. ommlds/minichain/backends/strings/resolving.py +1 -1
  32. ommlds/minichain/chat/messages.py +22 -25
  33. ommlds/minichain/chat/templating.py +1 -1
  34. ommlds/minichain/content/__init__.py +9 -2
  35. ommlds/minichain/content/_marshal.py +162 -49
  36. ommlds/minichain/content/code.py +17 -0
  37. ommlds/minichain/content/dynamic.py +12 -0
  38. ommlds/minichain/content/images.py +3 -2
  39. ommlds/minichain/content/json.py +3 -2
  40. ommlds/minichain/content/namespaces.py +9 -0
  41. ommlds/minichain/content/placeholders.py +11 -9
  42. ommlds/minichain/content/quote.py +17 -0
  43. ommlds/minichain/content/raw.py +49 -0
  44. ommlds/minichain/content/section.py +14 -0
  45. ommlds/minichain/content/sequence.py +7 -2
  46. ommlds/minichain/content/{simple.py → standard.py} +3 -13
  47. ommlds/minichain/content/tag.py +19 -0
  48. ommlds/minichain/content/templates.py +14 -0
  49. ommlds/minichain/content/text.py +3 -2
  50. ommlds/minichain/content/transform/base.py +63 -0
  51. ommlds/minichain/content/transform/interleave.py +68 -0
  52. ommlds/minichain/content/transform/materialize.py +110 -0
  53. ommlds/minichain/content/{prepare.py → transform/prepare.py} +12 -13
  54. ommlds/minichain/content/transform/squeeze.py +59 -0
  55. ommlds/minichain/content/{transforms → transform}/stringify.py +0 -6
  56. ommlds/minichain/content/types.py +5 -17
  57. ommlds/minichain/lib/fs/tools/read.py +1 -1
  58. ommlds/minichain/lib/fs/tools/recursivels/rendering.py +1 -1
  59. ommlds/minichain/lib/fs/tools/recursivels/running.py +1 -1
  60. ommlds/minichain/lib/todo/tools/write.py +2 -1
  61. ommlds/minichain/lib/todo/types.py +1 -1
  62. ommlds/minichain/meta/__init__.py +0 -0
  63. ommlds/minichain/meta/firstinwins.py +131 -0
  64. ommlds/minichain/text/applypatch.py +2 -1
  65. ommlds/minichain/text/toolparsing/llamacpp/types.py +1 -1
  66. ommlds/minichain/tokens/specials.py +1 -1
  67. ommlds/minichain/tools/execution/errorhandling.py +35 -0
  68. ommlds/minichain/tools/execution/errors.py +2 -2
  69. ommlds/minichain/tools/jsonschema.py +2 -2
  70. ommlds/minichain/tools/reflect.py +3 -3
  71. ommlds/minichain/tools/types.py +11 -14
  72. ommlds/minichain/vectors/_marshal.py +1 -1
  73. {ommlds-0.0.0.dev494.dist-info → ommlds-0.0.0.dev496.dist-info}/METADATA +4 -4
  74. {ommlds-0.0.0.dev494.dist-info → ommlds-0.0.0.dev496.dist-info}/RECORD +80 -70
  75. ommlds/cli/sessions/chat/interfaces/bare/user.py +0 -31
  76. ommlds/minichain/content/materialize.py +0 -196
  77. ommlds/minichain/content/transforms/base.py +0 -46
  78. ommlds/minichain/content/transforms/interleave.py +0 -70
  79. ommlds/minichain/content/transforms/squeeze.py +0 -72
  80. /ommlds/minichain/content/{transforms → transform}/__init__.py +0 -0
  81. /ommlds/minichain/content/{transforms → transform}/strings.py +0 -0
  82. {ommlds-0.0.0.dev494.dist-info → ommlds-0.0.0.dev496.dist-info}/WHEEL +0 -0
  83. {ommlds-0.0.0.dev494.dist-info → ommlds-0.0.0.dev496.dist-info}/entry_points.txt +0 -0
  84. {ommlds-0.0.0.dev494.dist-info → ommlds-0.0.0.dev496.dist-info}/licenses/LICENSE +0 -0
  85. {ommlds-0.0.0.dev494.dist-info → ommlds-0.0.0.dev496.dist-info}/top_level.txt +0 -0
@@ -1,70 +0,0 @@
1
- import typing as ta
2
-
3
- from omlish import dataclasses as dc
4
- from omlish import dispatch
5
- from omlish import lang
6
-
7
- from ..sequence import BlockContent
8
- from ..sequence import InlineContent
9
- from ..types import Content
10
-
11
-
12
- ##
13
-
14
-
15
- class ContentInterleaver:
16
- def __init__(
17
- self,
18
- *,
19
- separator: Content | None = None,
20
- sequence_separator: Content | None = None,
21
- inline_separator: Content | None = None,
22
- block_separator: Content | None = None,
23
- ) -> None:
24
- super().__init__()
25
-
26
- self._sequence_separator = sequence_separator if sequence_separator is not None else separator
27
- self._inline_separator = inline_separator if inline_separator is not None else separator
28
- self._block_separator = block_separator if block_separator is not None else separator
29
-
30
- def _interleave(self, l: ta.Iterable[Content], separator: Content | None) -> ta.Sequence[Content]:
31
- cs: ta.Iterable[Content] = map(self.interleave, l)
32
- if separator is not None:
33
- cs = lang.interleave(cs, separator)
34
- return list(cs)
35
-
36
- @dispatch.method()
37
- def interleave(self, c: Content) -> Content:
38
- return c
39
-
40
- @interleave.register
41
- def interleave_str(self, c: str) -> Content:
42
- return c
43
-
44
- @interleave.register
45
- def interleave_sequence(self, c: ta.Sequence) -> Content:
46
- return self._interleave(c, self._sequence_separator)
47
-
48
- @interleave.register
49
- def interleave_inline_content(self, c: InlineContent) -> Content:
50
- return dc.replace(c, l=self._interleave(c.l, self._inline_separator))
51
-
52
- @interleave.register
53
- def interleave_block_content(self, c: BlockContent) -> Content:
54
- return dc.replace(c, l=self._interleave(c.l, self._block_separator))
55
-
56
-
57
- def interleave_content(
58
- c: Content,
59
- *,
60
- separator: Content | None = None,
61
- sequence_separator: Content | None = None,
62
- inline_separator: Content | None = None,
63
- block_separator: Content | None = None,
64
- ) -> Content:
65
- return ContentInterleaver(
66
- separator=separator,
67
- sequence_separator=sequence_separator,
68
- inline_separator=inline_separator,
69
- block_separator=block_separator,
70
- ).interleave(c)
@@ -1,72 +0,0 @@
1
- import typing as ta
2
-
3
- from omlish import dataclasses as dc
4
- from omlish import dispatch
5
-
6
- from ..sequence import SequenceContent
7
- from ..text import TextContent
8
- from ..types import Content
9
- from ..types import SingleContent
10
-
11
-
12
- ##
13
-
14
-
15
- class ContentSqueezer:
16
- def __init__(
17
- self,
18
- *,
19
- strip_strings: bool = False,
20
- ) -> None:
21
- super().__init__()
22
-
23
- self._strip_strings = strip_strings
24
-
25
- @dispatch.method()
26
- def squeeze(self, c: Content) -> ta.Iterable[SingleContent]:
27
- raise TypeError(c)
28
-
29
- #
30
-
31
- @squeeze.register
32
- def squeeze_str(self, c: str) -> ta.Iterable[SingleContent]:
33
- if self._strip_strings:
34
- c = c.strip()
35
-
36
- if c:
37
- yield c
38
-
39
- @squeeze.register
40
- def squeeze_sequence(self, c: ta.Sequence) -> ta.Iterable[SingleContent]:
41
- for e in c:
42
- yield from self.squeeze(e)
43
-
44
- #
45
-
46
- @squeeze.register
47
- def squeeze_single_content(self, c: SingleContent) -> ta.Iterable[SingleContent]:
48
- return [c]
49
-
50
- @squeeze.register
51
- def squeeze_text_content(self, c: TextContent) -> ta.Iterable[SingleContent]:
52
- if self._strip_strings:
53
- if (ss := c.s.strip()) != c.s:
54
- c = dc.replace(c, s=ss)
55
-
56
- if c.s:
57
- yield c.s
58
-
59
- @squeeze.register
60
- def squeeze_sequence_content(self, c: SequenceContent) -> ta.Iterable[SingleContent]:
61
- for e in c.l:
62
- yield from self.squeeze(e)
63
-
64
-
65
- def squeeze_content(
66
- c: Content,
67
- *,
68
- strip_strings: bool = False,
69
- ) -> ta.Sequence[SingleContent]:
70
- return list(ContentSqueezer(
71
- strip_strings=strip_strings,
72
- ).squeeze(c))