drift-lang 0.1.0__tar.gz

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 (32) hide show
  1. drift_lang-0.1.0/LICENSE +21 -0
  2. drift_lang-0.1.0/PKG-INFO +140 -0
  3. drift_lang-0.1.0/README.md +99 -0
  4. drift_lang-0.1.0/drift/__init__.py +2 -0
  5. drift_lang-0.1.0/drift/ast_nodes.py +522 -0
  6. drift_lang-0.1.0/drift/cli.py +495 -0
  7. drift_lang-0.1.0/drift/codegen.py +1176 -0
  8. drift_lang-0.1.0/drift/data/__init__.py +46 -0
  9. drift_lang-0.1.0/drift/formatter.py +136 -0
  10. drift_lang-0.1.0/drift/io/__init__.py +48 -0
  11. drift_lang-0.1.0/drift/lexer.py +296 -0
  12. drift_lang-0.1.0/drift/mcp_server.py +216 -0
  13. drift_lang-0.1.0/drift/notify/__init__.py +42 -0
  14. drift_lang-0.1.0/drift/observe/__init__.py +52 -0
  15. drift_lang-0.1.0/drift/parser.py +1527 -0
  16. drift_lang-0.1.0/drift/runtime/__init__.py +63 -0
  17. drift_lang-0.1.0/drift/runtime/core.py +1419 -0
  18. drift_lang-0.1.0/drift/runtime/dendric_store.py +374 -0
  19. drift_lang-0.1.0/drift/runtime/mcp_client.py +225 -0
  20. drift_lang-0.1.0/drift/safety/__init__.py +65 -0
  21. drift_lang-0.1.0/drift/templates/env.example +8 -0
  22. drift_lang-0.1.0/drift/templates/starter.drift +18 -0
  23. drift_lang-0.1.0/drift/text/__init__.py +51 -0
  24. drift_lang-0.1.0/drift/time/__init__.py +35 -0
  25. drift_lang-0.1.0/drift_lang.egg-info/PKG-INFO +140 -0
  26. drift_lang-0.1.0/drift_lang.egg-info/SOURCES.txt +30 -0
  27. drift_lang-0.1.0/drift_lang.egg-info/dependency_links.txt +1 -0
  28. drift_lang-0.1.0/drift_lang.egg-info/entry_points.txt +2 -0
  29. drift_lang-0.1.0/drift_lang.egg-info/requires.txt +21 -0
  30. drift_lang-0.1.0/drift_lang.egg-info/top_level.txt +1 -0
  31. drift_lang-0.1.0/pyproject.toml +48 -0
  32. drift_lang-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Riley Coleman
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.
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: drift-lang
3
+ Version: 0.1.0
4
+ Summary: An intent-based language for agentic systems — write agents in English, run them as async Python.
5
+ Author: Riley Coleman
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/rileyq7/drift
8
+ Project-URL: Repository, https://github.com/rileyq7/drift
9
+ Project-URL: Issues, https://github.com/rileyq7/drift/issues
10
+ Keywords: agents,llm,transpiler,dsl,ai
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Software Development :: Code Generators
19
+ Classifier: Topic :: Software Development :: Compilers
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: httpx>=0.27
24
+ Provides-Extra: mcp
25
+ Requires-Dist: mcp>=1.0; extra == "mcp"
26
+ Provides-Extra: dendric
27
+ Requires-Dist: dendric; extra == "dendric"
28
+ Requires-Dist: psycopg2-binary; extra == "dendric"
29
+ Requires-Dist: pgvector; extra == "dendric"
30
+ Requires-Dist: openai>=1.0; extra == "dendric"
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=8; extra == "dev"
33
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
34
+ Provides-Extra: all
35
+ Requires-Dist: mcp>=1.0; extra == "all"
36
+ Requires-Dist: dendric; extra == "all"
37
+ Requires-Dist: psycopg2-binary; extra == "all"
38
+ Requires-Dist: pgvector; extra == "all"
39
+ Requires-Dist: openai>=1.0; extra == "all"
40
+ Dynamic: license-file
41
+
42
+ # Drift
43
+
44
+ **An intent-based language for agentic systems.** Write your agent in English-shaped blocks, run it as async Python.
45
+
46
+ ```drift
47
+ agent GrantChecker {
48
+ model: "claude-haiku"
49
+ budget: $0.10 per run
50
+
51
+ step assess(application: string) -> Decision {
52
+ let summary = summarize the application as string
53
+ let score = score eligibility from 1 to 10 as int
54
+
55
+ if confident<score> {
56
+ return Decision { approved: score > 7, summary: summary }
57
+ } else {
58
+ escalate to human review
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ That's a full agent — model choice, budget, an intent verb (`summarize`), confidence-gated branching, structured return. The transpiler turns it into async Python that runs on Drift's thin runtime.
65
+
66
+ ## Install
67
+
68
+ ```bash
69
+ pip install drift-lang
70
+ ```
71
+
72
+ Optional extras:
73
+
74
+ ```bash
75
+ pip install "drift-lang[mcp]" # MCP tool support
76
+ pip install "drift-lang[dendric]" # Dendric memory backend
77
+ pip install "drift-lang[all]"
78
+ ```
79
+
80
+ ## 30 seconds to your first agent
81
+
82
+ ```bash
83
+ drift new hello
84
+ cd hello
85
+ drift run hello.drift --input '{"name":"Riley"}'
86
+ ```
87
+
88
+ No API key required — Drift falls back to a mock provider so you see something work immediately. Drop an `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` into `.env` to use a real model.
89
+
90
+ ## CLI
91
+
92
+ ```
93
+ drift new <name> Scaffold a starter project
94
+ drift run <file.drift> Transpile and execute
95
+ drift check <file.drift> Validate syntax
96
+ drift transpile <file> Emit Python (use -o to write to a file)
97
+ drift lex / parse Debug tooling
98
+ ```
99
+
100
+ ## What's in the language
101
+
102
+ - **`agent`** — top-level unit. Has `model`, `budget`, `state`, `memory`, and `step`s.
103
+ - **`step`** — typed sub-procedure. Body is a sequence of declarative statements.
104
+ - **Intent verbs** — `summarize`, `extract`, `classify`, `translate`, `match`, `generate`, etc. Each one becomes a typed LLM call.
105
+ - **`confident<T>`** — confidence-gated branching. Run the cheap path when sure, escalate when not.
106
+ - **`model { … }`** — multi-provider routing with `prefer`, `fallback`, `upgrade when confidence < 0.7`, and `stream "fast" then "slow"`.
107
+ - **`tool name from python|mcp|rest`** — declare external tools. MCP runs against the official SDK.
108
+ - **`pipeline`** — composable flow with `->`, `=>`, `~>`, `|>` operators.
109
+ - **`for each x in xs parallel`** — `asyncio.gather` underneath.
110
+ - **`attempt / recover`** — structured error handling with retry, fail, and named arms.
111
+ - **`memory`** — short-term scratchpad or durable backend (Dendric). `remember`, `recall`, `deja_vu`, `forget`.
112
+ - **`define verb`** — extend the intent vocabulary with your own typed verbs.
113
+ - **Cross-agent calls** — `OtherAgent.step(args)` just works.
114
+
115
+ ## Docs
116
+
117
+ | File | For |
118
+ |---|---|
119
+ | [`LLM.md`](./LLM.md) | Coding agents (Claude, Cursor, Copilot) — complete reference for one-shot loading |
120
+ | [`docs/language.md`](./docs/language.md) | Humans learning Drift |
121
+ | [`docs/cookbook.md`](./docs/cookbook.md) | Copy-paste patterns |
122
+ | [`docs/gotchas.md`](./docs/gotchas.md) | Common mistakes |
123
+
124
+ ## Examples
125
+
126
+ See [`examples/`](./examples) for working `.drift` programs and their generated Python:
127
+
128
+ - `hello.drift` — minimal agent
129
+ - `confident_demo.drift` — `confident<T>` branching
130
+ - `grant_checker.drift` — end-to-end intent + structured return
131
+ - `inbox_sorter.drift` — `for each … parallel` triage
132
+ - `grant_checker_with_memory.drift` — Dendric-backed long-term memory
133
+
134
+ ## Status
135
+
136
+ Alpha — language surface is stable, runtime works, 344/344 tests passing. Voice primitives parse but adapters aren't wired yet. Type system beyond `confident<T>` is on the roadmap.
137
+
138
+ ## License
139
+
140
+ MIT
@@ -0,0 +1,99 @@
1
+ # Drift
2
+
3
+ **An intent-based language for agentic systems.** Write your agent in English-shaped blocks, run it as async Python.
4
+
5
+ ```drift
6
+ agent GrantChecker {
7
+ model: "claude-haiku"
8
+ budget: $0.10 per run
9
+
10
+ step assess(application: string) -> Decision {
11
+ let summary = summarize the application as string
12
+ let score = score eligibility from 1 to 10 as int
13
+
14
+ if confident<score> {
15
+ return Decision { approved: score > 7, summary: summary }
16
+ } else {
17
+ escalate to human review
18
+ }
19
+ }
20
+ }
21
+ ```
22
+
23
+ That's a full agent — model choice, budget, an intent verb (`summarize`), confidence-gated branching, structured return. The transpiler turns it into async Python that runs on Drift's thin runtime.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ pip install drift-lang
29
+ ```
30
+
31
+ Optional extras:
32
+
33
+ ```bash
34
+ pip install "drift-lang[mcp]" # MCP tool support
35
+ pip install "drift-lang[dendric]" # Dendric memory backend
36
+ pip install "drift-lang[all]"
37
+ ```
38
+
39
+ ## 30 seconds to your first agent
40
+
41
+ ```bash
42
+ drift new hello
43
+ cd hello
44
+ drift run hello.drift --input '{"name":"Riley"}'
45
+ ```
46
+
47
+ No API key required — Drift falls back to a mock provider so you see something work immediately. Drop an `ANTHROPIC_API_KEY` or `OPENAI_API_KEY` into `.env` to use a real model.
48
+
49
+ ## CLI
50
+
51
+ ```
52
+ drift new <name> Scaffold a starter project
53
+ drift run <file.drift> Transpile and execute
54
+ drift check <file.drift> Validate syntax
55
+ drift transpile <file> Emit Python (use -o to write to a file)
56
+ drift lex / parse Debug tooling
57
+ ```
58
+
59
+ ## What's in the language
60
+
61
+ - **`agent`** — top-level unit. Has `model`, `budget`, `state`, `memory`, and `step`s.
62
+ - **`step`** — typed sub-procedure. Body is a sequence of declarative statements.
63
+ - **Intent verbs** — `summarize`, `extract`, `classify`, `translate`, `match`, `generate`, etc. Each one becomes a typed LLM call.
64
+ - **`confident<T>`** — confidence-gated branching. Run the cheap path when sure, escalate when not.
65
+ - **`model { … }`** — multi-provider routing with `prefer`, `fallback`, `upgrade when confidence < 0.7`, and `stream "fast" then "slow"`.
66
+ - **`tool name from python|mcp|rest`** — declare external tools. MCP runs against the official SDK.
67
+ - **`pipeline`** — composable flow with `->`, `=>`, `~>`, `|>` operators.
68
+ - **`for each x in xs parallel`** — `asyncio.gather` underneath.
69
+ - **`attempt / recover`** — structured error handling with retry, fail, and named arms.
70
+ - **`memory`** — short-term scratchpad or durable backend (Dendric). `remember`, `recall`, `deja_vu`, `forget`.
71
+ - **`define verb`** — extend the intent vocabulary with your own typed verbs.
72
+ - **Cross-agent calls** — `OtherAgent.step(args)` just works.
73
+
74
+ ## Docs
75
+
76
+ | File | For |
77
+ |---|---|
78
+ | [`LLM.md`](./LLM.md) | Coding agents (Claude, Cursor, Copilot) — complete reference for one-shot loading |
79
+ | [`docs/language.md`](./docs/language.md) | Humans learning Drift |
80
+ | [`docs/cookbook.md`](./docs/cookbook.md) | Copy-paste patterns |
81
+ | [`docs/gotchas.md`](./docs/gotchas.md) | Common mistakes |
82
+
83
+ ## Examples
84
+
85
+ See [`examples/`](./examples) for working `.drift` programs and their generated Python:
86
+
87
+ - `hello.drift` — minimal agent
88
+ - `confident_demo.drift` — `confident<T>` branching
89
+ - `grant_checker.drift` — end-to-end intent + structured return
90
+ - `inbox_sorter.drift` — `for each … parallel` triage
91
+ - `grant_checker_with_memory.drift` — Dendric-backed long-term memory
92
+
93
+ ## Status
94
+
95
+ Alpha — language surface is stable, runtime works, 344/344 tests passing. Voice primitives parse but adapters aren't wired yet. Type system beyond `confident<T>` is on the roadmap.
96
+
97
+ ## License
98
+
99
+ MIT
@@ -0,0 +1,2 @@
1
+ """Drift — An intent-based programming language for agentic systems."""
2
+ __version__ = "0.1.0"