amv-aichain 1.3.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 (72) hide show
  1. amv_aichain-1.3.0/LICENSE +17 -0
  2. amv_aichain-1.3.0/PKG-INFO +112 -0
  3. amv_aichain-1.3.0/README.md +78 -0
  4. amv_aichain-1.3.0/amv_aichain.egg-info/PKG-INFO +112 -0
  5. amv_aichain-1.3.0/amv_aichain.egg-info/SOURCES.txt +70 -0
  6. amv_aichain-1.3.0/amv_aichain.egg-info/dependency_links.txt +1 -0
  7. amv_aichain-1.3.0/amv_aichain.egg-info/entry_points.txt +5 -0
  8. amv_aichain-1.3.0/amv_aichain.egg-info/requires.txt +2 -0
  9. amv_aichain-1.3.0/amv_aichain.egg-info/top_level.txt +1 -0
  10. amv_aichain-1.3.0/pyproject.toml +50 -0
  11. amv_aichain-1.3.0/setup.cfg +4 -0
  12. amv_aichain-1.3.0/setup.py +28 -0
  13. amv_aichain-1.3.0/termux_aichain/__init__.py +151 -0
  14. amv_aichain-1.3.0/termux_aichain/adapter.py +156 -0
  15. amv_aichain-1.3.0/termux_aichain/cli.py +591 -0
  16. amv_aichain-1.3.0/termux_aichain/core/__init__.py +81 -0
  17. amv_aichain-1.3.0/termux_aichain/core/agent_types.py +196 -0
  18. amv_aichain-1.3.0/termux_aichain/core/base.py +200 -0
  19. amv_aichain-1.3.0/termux_aichain/core/local_agent.py +1046 -0
  20. amv_aichain-1.3.0/termux_aichain/core/parsers.py +132 -0
  21. amv_aichain-1.3.0/termux_aichain/core/process_identity.py +148 -0
  22. amv_aichain-1.3.0/termux_aichain/core/prompt.py +128 -0
  23. amv_aichain-1.3.0/termux_aichain/core/providers/__init__.py +25 -0
  24. amv_aichain-1.3.0/termux_aichain/core/providers/bitnet.py +33 -0
  25. amv_aichain-1.3.0/termux_aichain/core/providers/local_server.py +277 -0
  26. amv_aichain-1.3.0/termux_aichain/core/providers/openai_compatible.py +201 -0
  27. amv_aichain-1.3.0/termux_aichain/core/schema.py +105 -0
  28. amv_aichain-1.3.0/termux_aichain/core/splitters.py +307 -0
  29. amv_aichain-1.3.0/termux_aichain/device/__init__.py +31 -0
  30. amv_aichain-1.3.0/termux_aichain/device/ecosystem.py +388 -0
  31. amv_aichain-1.3.0/termux_aichain/device/tools.py +361 -0
  32. amv_aichain-1.3.0/termux_aichain/graph/__init__.py +29 -0
  33. amv_aichain-1.3.0/termux_aichain/graph/agent.py +275 -0
  34. amv_aichain-1.3.0/termux_aichain/graph/state.py +299 -0
  35. amv_aichain-1.3.0/termux_aichain/memory/__init__.py +18 -0
  36. amv_aichain-1.3.0/termux_aichain/memory/buffer.py +46 -0
  37. amv_aichain-1.3.0/termux_aichain/memory/embeddings.py +202 -0
  38. amv_aichain-1.3.0/termux_aichain/memory/extractor.py +41 -0
  39. amv_aichain-1.3.0/termux_aichain/memory/simd.py +186 -0
  40. amv_aichain-1.3.0/termux_aichain/memory/sqlite.py +432 -0
  41. amv_aichain-1.3.0/termux_aichain/output/normalizer.py +288 -0
  42. amv_aichain-1.3.0/termux_aichain/output/scanner.py +138 -0
  43. amv_aichain-1.3.0/termux_aichain/serve/__init__.py +16 -0
  44. amv_aichain-1.3.0/termux_aichain/serve/dashboard.py +257 -0
  45. amv_aichain-1.3.0/termux_aichain/serve/server.py +338 -0
  46. amv_aichain-1.3.0/termux_aichain/trace/__init__.py +15 -0
  47. amv_aichain-1.3.0/termux_aichain/trace/tracer.py +153 -0
  48. amv_aichain-1.3.0/tests/test_audit_script.py +96 -0
  49. amv_aichain-1.3.0/tests/test_cli.py +178 -0
  50. amv_aichain-1.3.0/tests/test_core_bitnet.py +8 -0
  51. amv_aichain-1.3.0/tests/test_core_chain.py +44 -0
  52. amv_aichain-1.3.0/tests/test_core_parser.py +46 -0
  53. amv_aichain-1.3.0/tests/test_core_prompt.py +49 -0
  54. amv_aichain-1.3.0/tests/test_core_provider.py +102 -0
  55. amv_aichain-1.3.0/tests/test_core_splitter.py +43 -0
  56. amv_aichain-1.3.0/tests/test_dashboard.py +44 -0
  57. amv_aichain-1.3.0/tests/test_device.py +80 -0
  58. amv_aichain-1.3.0/tests/test_ecosystem.py +96 -0
  59. amv_aichain-1.3.0/tests/test_facade_ux.py +52 -0
  60. amv_aichain-1.3.0/tests/test_graph_agent.py +56 -0
  61. amv_aichain-1.3.0/tests/test_graph_parallel_fanout.py +156 -0
  62. amv_aichain-1.3.0/tests/test_graph_state.py +111 -0
  63. amv_aichain-1.3.0/tests/test_local_agent_modes.py +127 -0
  64. amv_aichain-1.3.0/tests/test_local_server.py +78 -0
  65. amv_aichain-1.3.0/tests/test_memory.py +197 -0
  66. amv_aichain-1.3.0/tests/test_microscopic_edge_cases.py +147 -0
  67. amv_aichain-1.3.0/tests/test_output_normalizer.py +92 -0
  68. amv_aichain-1.3.0/tests/test_p0_release_blockers.py +687 -0
  69. amv_aichain-1.3.0/tests/test_rag_pipeline.py +191 -0
  70. amv_aichain-1.3.0/tests/test_serve.py +117 -0
  71. amv_aichain-1.3.0/tests/test_simd_vector.py +105 -0
  72. amv_aichain-1.3.0/tests/test_trace.py +60 -0
@@ -0,0 +1,17 @@
1
+  Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 UnoKim & AMEVA Open-Source Foundation
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: amv-aichain
3
+ Version: 1.3.0
4
+ Summary: Zero-dependency AI chaining and autonomous agent framework utilizing device resources for Android Termux & Edge
5
+ Home-page: https://github.com/uno-km/termux-aichain
6
+ Author: UnoKim
7
+ Author-email: UnoKim <uno-km@users.noreply.github.com>
8
+ License: Apache-2.0
9
+ Project-URL: Homepage, https://github.com/uno-km/amv-aichain
10
+ Project-URL: Repository, https://github.com/uno-km/amv-aichain.git
11
+ Project-URL: Issues, https://github.com/uno-km/amv-aichain/issues
12
+ Keywords: termux,android,edge-ai,langchain,llama-cpp,bitnet,agent,zero-dependency
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Operating System :: POSIX :: Linux
22
+ Classifier: Operating System :: Android
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: ameva-runtime>=2.0.0
29
+ Requires-Dist: ameva-component-sdk<2.0,>=0.1.0
30
+ Dynamic: author
31
+ Dynamic: home-page
32
+ Dynamic: license-file
33
+ Dynamic: requires-python
34
+
35
+ # AMV-AIChain
36
+
37
+ > **마이그레이션 안내**: 이 패키지는 `termux-aichain`에서 `amv-aichain`로 이름이 바뀌었습니다. 기존 `termux-aichain` 배포본(PyPI/npm)은 호환을 위해 당분간 유지되나 deprecated 상태이며 더 이상 갱신되지 않습니다. `pip install amv-aichain` / `npm install amv-aichain`로 전환하십시오.
38
+ >
39
+ > Android **Termux 환경** 또는 **안드로이드 Linux 커널(루팅 없이 Linux 환경이 구동되는 모든 디바이스)** 에서 동작합니다 — Termux 전용이 아닙니다.
40
+
41
+ [![PyPI](https://img.shields.io/pypi/v/amv-aichain.svg?style=flat-square&color=0369a1)](https://pypi.org/project/amv-aichain/)
42
+ [![Python](https://img.shields.io/pypi/pyversions/amv-aichain.svg?style=flat-square)](https://pypi.org/project/amv-aichain/)
43
+ [![npm](https://img.shields.io/npm/v/amv-aichain.svg?style=flat-square&color=b91c1c)](https://www.npmjs.com/package/amv-aichain)
44
+ [![npm downloads](https://img.shields.io/npm/dm/amv-aichain.svg?style=flat-square&color=b91c1c)](https://www.npmjs.com/package/amv-aichain)
45
+ [![License](https://img.shields.io/badge/License-Apache_2.0-004499.svg?style=flat-square)](https://github.com/uno-km/amv-aichain)
46
+
47
+ > **왜 터먹스에선 랭체인 대신 AIChain인가? 수백MB 의존성 폭탄 vs 94KB 제로-의존성 LCEL 및 하드웨어 액추에이션**
48
+ > *Why LangChain on Termux? Bloat & Crash vs 94KB Zero-Dep LCEL & Hardware Native Agents*
49
+
50
+ ---
51
+
52
+ ## Architecture & Overview
53
+
54
+ 외부 의존성 0개(Zero-Dependency)의 순수 표준 라이브러리 기반으로 LangChain 호환 LCEL 파이프 체이닝(prompt | llm | parser), StateGraph 자율 에이전트, 온디바이스 SQLite 코사인 벡터 검색, 스마트폰 하드웨어 직접 제어(배터리, 온도, 진동, GPS)를 94KB 초경량 코어로 완벽히 제공합니다.
55
+
56
+ Termux-AIChain provides 100% pure standard-library LCEL pipe chaining (prompt | llm | parser), autonomous StateGraph agents, on-device SQLite vector RAG, and first-class Android smartphone hardware actuation (battery, temperature, haptics, GPS) in a tiny 94KB footprint.
57
+
58
+ ---
59
+
60
+ ## Installation & Quickstart
61
+
62
+ ### Python (PyPI)
63
+ ```bash
64
+ pip install amv-aichain
65
+ ```
66
+ ```python
67
+ from termux_aichain import PromptTemplate, OpenAICompatibleChat, StringOutputParser, get_battery_status
68
+
69
+ # 1. Read physical smartphone hardware telemetry
70
+ battery = get_battery_status()
71
+
72
+ # 2. Build LCEL Chain connected to local llama-server (port 8080)
73
+ prompt = PromptTemplate.from_template("Phone Telemetry: {status}. Diagnose in 1 sentence:")
74
+ llm = OpenAICompatibleChat(base_url="http://127.0.0.1:8080/v1", model="llama3", temperature=0.3)
75
+ chain = prompt | llm | StringOutputParser()
76
+
77
+ # 3. Execute with 0 external dependencies
78
+ report = chain.invoke({"status": battery})
79
+ print("AI Diagnostic:", report)
80
+ ```
81
+
82
+ ### Node.js / TypeScript (npm)
83
+ ```bash
84
+ npm install amv-aichain
85
+ ```
86
+ ```typescript
87
+ import { PromptTemplate, OpenAICompatibleChat, StringOutputParser, getBatteryStatus } from 'amv-aichain';
88
+
89
+ // 1. Read physical smartphone hardware telemetry
90
+ const battery = await getBatteryStatus.func();
91
+
92
+ // 2. Build LCEL Chain connected to local llama-server (port 8080)
93
+ const prompt = PromptTemplate.fromTemplate('Phone Telemetry: {status}. Diagnose in 1 sentence:');
94
+ const llm = new OpenAICompatibleChat({ baseUrl: 'http://127.0.0.1:8080/v1', model: 'llama3', temperature: 0.3 });
95
+ const chain = prompt.pipe(llm).pipe(new StringOutputParser());
96
+
97
+ // 3. Execute with 0 npm dependencies
98
+ const report = await chain.invoke({ status: JSON.stringify(battery) });
99
+ console.log('AI Diagnostic:', report);
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Official Documentation & Benchmarks
105
+ - [Official Architecture & API Reference](https://uno-km.vercel.app/lib/aichain/)
106
+ - [Ecosystem Metrics & Registry Stats](https://uno-km.vercel.app/foundation/metrics)
107
+ - [AMEVA Open-Source Foundation Portal](https://uno-km.vercel.app/foundation/index.html)
108
+
109
+ ---
110
+
111
+ ## License
112
+ Licensed under the Apache-2.0 License. Copyright (c) 2026 Eunho Kim ([@uno-km](https://github.com/uno-km)).
@@ -0,0 +1,78 @@
1
+ # AMV-AIChain
2
+
3
+ > **마이그레이션 안내**: 이 패키지는 `termux-aichain`에서 `amv-aichain`로 이름이 바뀌었습니다. 기존 `termux-aichain` 배포본(PyPI/npm)은 호환을 위해 당분간 유지되나 deprecated 상태이며 더 이상 갱신되지 않습니다. `pip install amv-aichain` / `npm install amv-aichain`로 전환하십시오.
4
+ >
5
+ > Android **Termux 환경** 또는 **안드로이드 Linux 커널(루팅 없이 Linux 환경이 구동되는 모든 디바이스)** 에서 동작합니다 — Termux 전용이 아닙니다.
6
+
7
+ [![PyPI](https://img.shields.io/pypi/v/amv-aichain.svg?style=flat-square&color=0369a1)](https://pypi.org/project/amv-aichain/)
8
+ [![Python](https://img.shields.io/pypi/pyversions/amv-aichain.svg?style=flat-square)](https://pypi.org/project/amv-aichain/)
9
+ [![npm](https://img.shields.io/npm/v/amv-aichain.svg?style=flat-square&color=b91c1c)](https://www.npmjs.com/package/amv-aichain)
10
+ [![npm downloads](https://img.shields.io/npm/dm/amv-aichain.svg?style=flat-square&color=b91c1c)](https://www.npmjs.com/package/amv-aichain)
11
+ [![License](https://img.shields.io/badge/License-Apache_2.0-004499.svg?style=flat-square)](https://github.com/uno-km/amv-aichain)
12
+
13
+ > **왜 터먹스에선 랭체인 대신 AIChain인가? 수백MB 의존성 폭탄 vs 94KB 제로-의존성 LCEL 및 하드웨어 액추에이션**
14
+ > *Why LangChain on Termux? Bloat & Crash vs 94KB Zero-Dep LCEL & Hardware Native Agents*
15
+
16
+ ---
17
+
18
+ ## Architecture & Overview
19
+
20
+ 외부 의존성 0개(Zero-Dependency)의 순수 표준 라이브러리 기반으로 LangChain 호환 LCEL 파이프 체이닝(prompt | llm | parser), StateGraph 자율 에이전트, 온디바이스 SQLite 코사인 벡터 검색, 스마트폰 하드웨어 직접 제어(배터리, 온도, 진동, GPS)를 94KB 초경량 코어로 완벽히 제공합니다.
21
+
22
+ Termux-AIChain provides 100% pure standard-library LCEL pipe chaining (prompt | llm | parser), autonomous StateGraph agents, on-device SQLite vector RAG, and first-class Android smartphone hardware actuation (battery, temperature, haptics, GPS) in a tiny 94KB footprint.
23
+
24
+ ---
25
+
26
+ ## Installation & Quickstart
27
+
28
+ ### Python (PyPI)
29
+ ```bash
30
+ pip install amv-aichain
31
+ ```
32
+ ```python
33
+ from termux_aichain import PromptTemplate, OpenAICompatibleChat, StringOutputParser, get_battery_status
34
+
35
+ # 1. Read physical smartphone hardware telemetry
36
+ battery = get_battery_status()
37
+
38
+ # 2. Build LCEL Chain connected to local llama-server (port 8080)
39
+ prompt = PromptTemplate.from_template("Phone Telemetry: {status}. Diagnose in 1 sentence:")
40
+ llm = OpenAICompatibleChat(base_url="http://127.0.0.1:8080/v1", model="llama3", temperature=0.3)
41
+ chain = prompt | llm | StringOutputParser()
42
+
43
+ # 3. Execute with 0 external dependencies
44
+ report = chain.invoke({"status": battery})
45
+ print("AI Diagnostic:", report)
46
+ ```
47
+
48
+ ### Node.js / TypeScript (npm)
49
+ ```bash
50
+ npm install amv-aichain
51
+ ```
52
+ ```typescript
53
+ import { PromptTemplate, OpenAICompatibleChat, StringOutputParser, getBatteryStatus } from 'amv-aichain';
54
+
55
+ // 1. Read physical smartphone hardware telemetry
56
+ const battery = await getBatteryStatus.func();
57
+
58
+ // 2. Build LCEL Chain connected to local llama-server (port 8080)
59
+ const prompt = PromptTemplate.fromTemplate('Phone Telemetry: {status}. Diagnose in 1 sentence:');
60
+ const llm = new OpenAICompatibleChat({ baseUrl: 'http://127.0.0.1:8080/v1', model: 'llama3', temperature: 0.3 });
61
+ const chain = prompt.pipe(llm).pipe(new StringOutputParser());
62
+
63
+ // 3. Execute with 0 npm dependencies
64
+ const report = await chain.invoke({ status: JSON.stringify(battery) });
65
+ console.log('AI Diagnostic:', report);
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Official Documentation & Benchmarks
71
+ - [Official Architecture & API Reference](https://uno-km.vercel.app/lib/aichain/)
72
+ - [Ecosystem Metrics & Registry Stats](https://uno-km.vercel.app/foundation/metrics)
73
+ - [AMEVA Open-Source Foundation Portal](https://uno-km.vercel.app/foundation/index.html)
74
+
75
+ ---
76
+
77
+ ## License
78
+ Licensed under the Apache-2.0 License. Copyright (c) 2026 Eunho Kim ([@uno-km](https://github.com/uno-km)).
@@ -0,0 +1,112 @@
1
+ Metadata-Version: 2.4
2
+ Name: amv-aichain
3
+ Version: 1.3.0
4
+ Summary: Zero-dependency AI chaining and autonomous agent framework utilizing device resources for Android Termux & Edge
5
+ Home-page: https://github.com/uno-km/termux-aichain
6
+ Author: UnoKim
7
+ Author-email: UnoKim <uno-km@users.noreply.github.com>
8
+ License: Apache-2.0
9
+ Project-URL: Homepage, https://github.com/uno-km/amv-aichain
10
+ Project-URL: Repository, https://github.com/uno-km/amv-aichain.git
11
+ Project-URL: Issues, https://github.com/uno-km/amv-aichain/issues
12
+ Keywords: termux,android,edge-ai,langchain,llama-cpp,bitnet,agent,zero-dependency
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Operating System :: POSIX :: Linux
22
+ Classifier: Operating System :: Android
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: ameva-runtime>=2.0.0
29
+ Requires-Dist: ameva-component-sdk<2.0,>=0.1.0
30
+ Dynamic: author
31
+ Dynamic: home-page
32
+ Dynamic: license-file
33
+ Dynamic: requires-python
34
+
35
+ # AMV-AIChain
36
+
37
+ > **마이그레이션 안내**: 이 패키지는 `termux-aichain`에서 `amv-aichain`로 이름이 바뀌었습니다. 기존 `termux-aichain` 배포본(PyPI/npm)은 호환을 위해 당분간 유지되나 deprecated 상태이며 더 이상 갱신되지 않습니다. `pip install amv-aichain` / `npm install amv-aichain`로 전환하십시오.
38
+ >
39
+ > Android **Termux 환경** 또는 **안드로이드 Linux 커널(루팅 없이 Linux 환경이 구동되는 모든 디바이스)** 에서 동작합니다 — Termux 전용이 아닙니다.
40
+
41
+ [![PyPI](https://img.shields.io/pypi/v/amv-aichain.svg?style=flat-square&color=0369a1)](https://pypi.org/project/amv-aichain/)
42
+ [![Python](https://img.shields.io/pypi/pyversions/amv-aichain.svg?style=flat-square)](https://pypi.org/project/amv-aichain/)
43
+ [![npm](https://img.shields.io/npm/v/amv-aichain.svg?style=flat-square&color=b91c1c)](https://www.npmjs.com/package/amv-aichain)
44
+ [![npm downloads](https://img.shields.io/npm/dm/amv-aichain.svg?style=flat-square&color=b91c1c)](https://www.npmjs.com/package/amv-aichain)
45
+ [![License](https://img.shields.io/badge/License-Apache_2.0-004499.svg?style=flat-square)](https://github.com/uno-km/amv-aichain)
46
+
47
+ > **왜 터먹스에선 랭체인 대신 AIChain인가? 수백MB 의존성 폭탄 vs 94KB 제로-의존성 LCEL 및 하드웨어 액추에이션**
48
+ > *Why LangChain on Termux? Bloat & Crash vs 94KB Zero-Dep LCEL & Hardware Native Agents*
49
+
50
+ ---
51
+
52
+ ## Architecture & Overview
53
+
54
+ 외부 의존성 0개(Zero-Dependency)의 순수 표준 라이브러리 기반으로 LangChain 호환 LCEL 파이프 체이닝(prompt | llm | parser), StateGraph 자율 에이전트, 온디바이스 SQLite 코사인 벡터 검색, 스마트폰 하드웨어 직접 제어(배터리, 온도, 진동, GPS)를 94KB 초경량 코어로 완벽히 제공합니다.
55
+
56
+ Termux-AIChain provides 100% pure standard-library LCEL pipe chaining (prompt | llm | parser), autonomous StateGraph agents, on-device SQLite vector RAG, and first-class Android smartphone hardware actuation (battery, temperature, haptics, GPS) in a tiny 94KB footprint.
57
+
58
+ ---
59
+
60
+ ## Installation & Quickstart
61
+
62
+ ### Python (PyPI)
63
+ ```bash
64
+ pip install amv-aichain
65
+ ```
66
+ ```python
67
+ from termux_aichain import PromptTemplate, OpenAICompatibleChat, StringOutputParser, get_battery_status
68
+
69
+ # 1. Read physical smartphone hardware telemetry
70
+ battery = get_battery_status()
71
+
72
+ # 2. Build LCEL Chain connected to local llama-server (port 8080)
73
+ prompt = PromptTemplate.from_template("Phone Telemetry: {status}. Diagnose in 1 sentence:")
74
+ llm = OpenAICompatibleChat(base_url="http://127.0.0.1:8080/v1", model="llama3", temperature=0.3)
75
+ chain = prompt | llm | StringOutputParser()
76
+
77
+ # 3. Execute with 0 external dependencies
78
+ report = chain.invoke({"status": battery})
79
+ print("AI Diagnostic:", report)
80
+ ```
81
+
82
+ ### Node.js / TypeScript (npm)
83
+ ```bash
84
+ npm install amv-aichain
85
+ ```
86
+ ```typescript
87
+ import { PromptTemplate, OpenAICompatibleChat, StringOutputParser, getBatteryStatus } from 'amv-aichain';
88
+
89
+ // 1. Read physical smartphone hardware telemetry
90
+ const battery = await getBatteryStatus.func();
91
+
92
+ // 2. Build LCEL Chain connected to local llama-server (port 8080)
93
+ const prompt = PromptTemplate.fromTemplate('Phone Telemetry: {status}. Diagnose in 1 sentence:');
94
+ const llm = new OpenAICompatibleChat({ baseUrl: 'http://127.0.0.1:8080/v1', model: 'llama3', temperature: 0.3 });
95
+ const chain = prompt.pipe(llm).pipe(new StringOutputParser());
96
+
97
+ // 3. Execute with 0 npm dependencies
98
+ const report = await chain.invoke({ status: JSON.stringify(battery) });
99
+ console.log('AI Diagnostic:', report);
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Official Documentation & Benchmarks
105
+ - [Official Architecture & API Reference](https://uno-km.vercel.app/lib/aichain/)
106
+ - [Ecosystem Metrics & Registry Stats](https://uno-km.vercel.app/foundation/metrics)
107
+ - [AMEVA Open-Source Foundation Portal](https://uno-km.vercel.app/foundation/index.html)
108
+
109
+ ---
110
+
111
+ ## License
112
+ Licensed under the Apache-2.0 License. Copyright (c) 2026 Eunho Kim ([@uno-km](https://github.com/uno-km)).
@@ -0,0 +1,70 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ amv_aichain.egg-info/PKG-INFO
6
+ amv_aichain.egg-info/SOURCES.txt
7
+ amv_aichain.egg-info/dependency_links.txt
8
+ amv_aichain.egg-info/entry_points.txt
9
+ amv_aichain.egg-info/requires.txt
10
+ amv_aichain.egg-info/top_level.txt
11
+ termux_aichain/__init__.py
12
+ termux_aichain/adapter.py
13
+ termux_aichain/cli.py
14
+ termux_aichain/core/__init__.py
15
+ termux_aichain/core/agent_types.py
16
+ termux_aichain/core/base.py
17
+ termux_aichain/core/local_agent.py
18
+ termux_aichain/core/parsers.py
19
+ termux_aichain/core/process_identity.py
20
+ termux_aichain/core/prompt.py
21
+ termux_aichain/core/schema.py
22
+ termux_aichain/core/splitters.py
23
+ termux_aichain/core/providers/__init__.py
24
+ termux_aichain/core/providers/bitnet.py
25
+ termux_aichain/core/providers/local_server.py
26
+ termux_aichain/core/providers/openai_compatible.py
27
+ termux_aichain/device/__init__.py
28
+ termux_aichain/device/ecosystem.py
29
+ termux_aichain/device/tools.py
30
+ termux_aichain/graph/__init__.py
31
+ termux_aichain/graph/agent.py
32
+ termux_aichain/graph/state.py
33
+ termux_aichain/memory/__init__.py
34
+ termux_aichain/memory/buffer.py
35
+ termux_aichain/memory/embeddings.py
36
+ termux_aichain/memory/extractor.py
37
+ termux_aichain/memory/simd.py
38
+ termux_aichain/memory/sqlite.py
39
+ termux_aichain/output/normalizer.py
40
+ termux_aichain/output/scanner.py
41
+ termux_aichain/serve/__init__.py
42
+ termux_aichain/serve/dashboard.py
43
+ termux_aichain/serve/server.py
44
+ termux_aichain/trace/__init__.py
45
+ termux_aichain/trace/tracer.py
46
+ tests/test_audit_script.py
47
+ tests/test_cli.py
48
+ tests/test_core_bitnet.py
49
+ tests/test_core_chain.py
50
+ tests/test_core_parser.py
51
+ tests/test_core_prompt.py
52
+ tests/test_core_provider.py
53
+ tests/test_core_splitter.py
54
+ tests/test_dashboard.py
55
+ tests/test_device.py
56
+ tests/test_ecosystem.py
57
+ tests/test_facade_ux.py
58
+ tests/test_graph_agent.py
59
+ tests/test_graph_parallel_fanout.py
60
+ tests/test_graph_state.py
61
+ tests/test_local_agent_modes.py
62
+ tests/test_local_server.py
63
+ tests/test_memory.py
64
+ tests/test_microscopic_edge_cases.py
65
+ tests/test_output_normalizer.py
66
+ tests/test_p0_release_blockers.py
67
+ tests/test_rag_pipeline.py
68
+ tests/test_serve.py
69
+ tests/test_simd_vector.py
70
+ tests/test_trace.py
@@ -0,0 +1,5 @@
1
+ [ameva.components]
2
+ amv-aichain = termux_aichain.adapter:create_adapter
3
+
4
+ [console_scripts]
5
+ amv-aichain = termux_aichain.cli:main
@@ -0,0 +1,2 @@
1
+ ameva-runtime>=2.0.0
2
+ ameva-component-sdk<2.0,>=0.1.0
@@ -0,0 +1 @@
1
+ termux_aichain
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "amv-aichain"
7
+ version = "1.3.0"
8
+ description = "Zero-dependency AI chaining and autonomous agent framework utilizing device resources for Android Termux & Edge"
9
+ readme = "README.md"
10
+ authors = [{ name = "UnoKim", email = "uno-km@users.noreply.github.com" }]
11
+ license = { text = "Apache-2.0" }
12
+ classifiers = [
13
+ "Development Status :: 4 - Beta",
14
+ "Intended Audience :: Developers",
15
+ "License :: OSI Approved :: Apache Software License",
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: 3.14",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Operating System :: Android",
23
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
24
+ "Topic :: Software Development :: Libraries :: Application Frameworks",
25
+ ]
26
+ keywords = ["termux", "android", "edge-ai", "langchain", "llama-cpp", "bitnet", "agent", "zero-dependency"]
27
+ requires-python = ">=3.10"
28
+ dependencies = [
29
+ "ameva-runtime>=2.0.0",
30
+ "ameva-component-sdk>=0.1.0,<2.0",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/uno-km/amv-aichain"
35
+ Repository = "https://github.com/uno-km/amv-aichain.git"
36
+ Issues = "https://github.com/uno-km/amv-aichain/issues"
37
+
38
+ [tool.setuptools.packages.find]
39
+ where = ["."]
40
+ include = ["termux_aichain*"]
41
+
42
+ [tool.pytest.ini_options]
43
+ pythonpath = ["."]
44
+ testpaths = ["tests"]
45
+ [project.scripts]
46
+ amv-aichain = "termux_aichain.cli:main"
47
+
48
+ [project.entry-points."ameva.components"]
49
+ amv-aichain = "termux_aichain.adapter:create_adapter"
50
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,28 @@
1
+ # Copyright (c) 2026 Uno Kim / AMEVA Foundation. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0 OR Commercial-License
3
+ from setuptools import setup, find_packages
4
+
5
+ setup(
6
+ name="termux-aichain",
7
+ version="1.1.4",
8
+ description="Ultra-lightweight Zero-Dependency AI chaining & agent framework for Termux, Android and Edge computing.",
9
+ long_description=open("README.md", encoding="utf-8").read() if open("README.md", encoding="utf-8") else "",
10
+ long_description_content_type="text/markdown",
11
+ author="UnoKim",
12
+ author_email="uno-km@users.noreply.github.com",
13
+ url="https://github.com/uno-km/termux-aichain",
14
+ packages=find_packages(),
15
+ python_requires=">=3.10",
16
+ install_requires=[
17
+ "ameva-runtime>=2.0.0",
18
+ ],
19
+ classifiers=[
20
+ "License :: OSI Approved :: Apache Software License",
21
+ "Operating System :: Android",
22
+ "Operating System :: POSIX :: Linux",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.10",
25
+ "Programming Language :: Python :: 3.11",
26
+ "Programming Language :: Python :: 3.12",
27
+ ],
28
+ )
@@ -0,0 +1,151 @@
1
+ # Copyright (c) 2026 Uno Kim / AMEVA Foundation. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0 OR Commercial-License
3
+ """
4
+ ==============================================================================
5
+ termux-aichain: Sovereign Zero-Dependency Edge AI Framework for Termux & Android
6
+ ==============================================================================
7
+ Copyright (c) 2026 AMEVA Open-Source Foundation & UnoKim.
8
+ Licensed under the Apache License, Version 2.0.
9
+ """
10
+
11
+ from __future__ import annotations
12
+ import importlib
13
+ from typing import Any
14
+
15
+ __version__ = "1.3.0"
16
+ __author__ = "UnoKim <uno-km@users.noreply.github.com>"
17
+
18
+ _LAZY_IMPORTS = {
19
+ # Schema
20
+ "Message": ("termux_aichain.core.schema", "Message"),
21
+ "HumanMessage": ("termux_aichain.core.schema", "HumanMessage"),
22
+ "AIMessage": ("termux_aichain.core.schema", "AIMessage"),
23
+ "SystemMessage": ("termux_aichain.core.schema", "SystemMessage"),
24
+ "ToolMessage": ("termux_aichain.core.schema", "ToolMessage"),
25
+ "UsageInfo": ("termux_aichain.core.schema", "UsageInfo"),
26
+ "GenerationResult": ("termux_aichain.core.schema", "GenerationResult"),
27
+ "StreamChunk": ("termux_aichain.core.schema", "StreamChunk"),
28
+ # Prompt
29
+ "PromptTemplate": ("termux_aichain.core.prompt", "PromptTemplate"),
30
+ "ChatPromptTemplate": ("termux_aichain.core.prompt", "ChatPromptTemplate"),
31
+ # Base
32
+ "Runnable": ("termux_aichain.core.base", "Runnable"),
33
+ "RunnableLambda": ("termux_aichain.core.base", "RunnableLambda"),
34
+ "RunnableSequence": ("termux_aichain.core.base", "RunnableSequence"),
35
+ "RunnablePassthrough": ("termux_aichain.core.base", "RunnablePassthrough"),
36
+ "RunnableParallel": ("termux_aichain.core.base", "RunnableParallel"),
37
+ "BaseChatModel": ("termux_aichain.core.base", "BaseChatModel"),
38
+ # Providers
39
+ "OpenAICompatibleChat": ("termux_aichain.core.providers.openai_compatible", "OpenAICompatibleChat"),
40
+ "BitNetChat": ("termux_aichain.core.providers.bitnet", "BitNetChat"),
41
+ "LocalServerConfig": ("termux_aichain.core.providers.local_server", "LocalServerConfig"),
42
+ "LocalServerManager": ("termux_aichain.core.providers.local_server", "LocalServerManager"),
43
+ "LlamaCppServer": ("termux_aichain.core.providers.local_server", "LlamaCppServer"),
44
+ "BitNetServer": ("termux_aichain.core.providers.local_server", "BitNetServer"),
45
+ # Enterprise LocalAgent & 4 Execution Modes
46
+ "LocalAgent": ("termux_aichain.core.local_agent", "LocalAgent"),
47
+ "AgentState": ("termux_aichain.core.agent_types", "AgentState"),
48
+ "ConnectConfig": ("termux_aichain.core.agent_types", "ConnectConfig"),
49
+ "ManagedConfig": ("termux_aichain.core.agent_types", "ManagedConfig"),
50
+ "EmbeddedConfig": ("termux_aichain.core.agent_types", "EmbeddedConfig"),
51
+ "RemoteConfig": ("termux_aichain.core.agent_types", "RemoteConfig"),
52
+ "ToolPolicy": ("termux_aichain.core.agent_types", "ToolPolicy"),
53
+ "ToolRule": ("termux_aichain.core.agent_types", "ToolRule"),
54
+ "ToolCallCandidate": ("termux_aichain.core.agent_types", "ToolCallCandidate"),
55
+ "TransportSecurityConfig": ("termux_aichain.core.agent_types", "TransportSecurityConfig"),
56
+ # Output Normalization
57
+ "OutputNormalizer": ("termux_aichain.output.normalizer", "OutputNormalizer"),
58
+ "RawModelResponse": ("termux_aichain.output.normalizer", "RawModelResponse"),
59
+ "NormalizedModelResponse": ("termux_aichain.output.normalizer", "NormalizedModelResponse"),
60
+ # Standard Errors
61
+ "LocalAgentError": ("termux_aichain.core.agent_types", "LocalAgentError"),
62
+ "ServerConnectionRefusedError": ("termux_aichain.core.agent_types", "ServerConnectionRefusedError"),
63
+ "ServerProtocolMismatchError": ("termux_aichain.core.agent_types", "ServerProtocolMismatchError"),
64
+ "ModelIdentityMismatchError": ("termux_aichain.core.agent_types", "ModelIdentityMismatchError"),
65
+ "ManagedSpawnNotSupportedError": ("termux_aichain.core.agent_types", "ManagedSpawnNotSupportedError"),
66
+ "ServerStartupTimeoutError": ("termux_aichain.core.agent_types", "ServerStartupTimeoutError"),
67
+ "DuplicateServerOwnershipError": ("termux_aichain.core.agent_types", "DuplicateServerOwnershipError"),
68
+ "RemoteFallbackNotAuthorizedError": ("termux_aichain.core.agent_types", "RemoteFallbackNotAuthorizedError"),
69
+ "ToolApprovalRequiredError": ("termux_aichain.core.agent_types", "ToolApprovalRequiredError"),
70
+ "ToolArgumentValidationError": ("termux_aichain.core.agent_types", "ToolArgumentValidationError"),
71
+ "ToolRateLimitExceededError": ("termux_aichain.core.agent_types", "ToolRateLimitExceededError"),
72
+ "ToolPolicyDeniedError": ("termux_aichain.core.agent_types", "ToolPolicyDeniedError"),
73
+ "ToolCallRepairNotAllowedError": ("termux_aichain.core.agent_types", "ToolCallRepairNotAllowedError"),
74
+ "DuplicateToolAliasError": ("termux_aichain.core.agent_types", "DuplicateToolAliasError"),
75
+ "NativeBackendUnavailableError": ("termux_aichain.core.agent_types", "NativeBackendUnavailableError"),
76
+ # Parsers
77
+ "StringOutputParser": ("termux_aichain.core.parsers", "StringOutputParser"),
78
+ "JsonOutputParser": ("termux_aichain.core.parsers", "JsonOutputParser"),
79
+ "RegexOutputParser": ("termux_aichain.core.parsers", "RegexOutputParser"),
80
+ # Splitters
81
+ "Document": ("termux_aichain.core.splitters", "Document"),
82
+ "CharacterTextSplitter": ("termux_aichain.core.splitters", "CharacterTextSplitter"),
83
+ "RecursiveCharacterTextSplitter": ("termux_aichain.core.splitters", "RecursiveCharacterTextSplitter"),
84
+ "TextLoader": ("termux_aichain.core.splitters", "TextLoader"),
85
+ "MarkdownLoader": ("termux_aichain.core.splitters", "MarkdownLoader"),
86
+ "JSONLoader": ("termux_aichain.core.splitters", "JSONLoader"),
87
+ "DirectoryLoader": ("termux_aichain.core.splitters", "DirectoryLoader"),
88
+ "format_docs": ("termux_aichain.core.splitters", "format_docs"),
89
+ # Graph
90
+ "StateGraph": ("termux_aichain.graph.state", "StateGraph"),
91
+ "CompiledGraph": ("termux_aichain.graph.state", "CompiledGraph"),
92
+ "START": ("termux_aichain.graph.state", "START"),
93
+ "END": ("termux_aichain.graph.state", "END"),
94
+ "Tool": ("termux_aichain.graph.agent", "Tool"),
95
+ "tool": ("termux_aichain.graph.agent", "tool"),
96
+ "create_react_agent": ("termux_aichain.graph.agent", "create_react_agent"),
97
+ # Memory
98
+ "ConversationBufferMemory": ("termux_aichain.memory.buffer", "ConversationBufferMemory"),
99
+ "SQLiteEntityMemory": ("termux_aichain.memory.sqlite", "SQLiteEntityMemory"),
100
+ "SQLiteVectorStore": ("termux_aichain.memory.sqlite", "SQLiteVectorStore"),
101
+ "VectorStoreRetriever": ("termux_aichain.memory.sqlite", "VectorStoreRetriever"),
102
+ "NativeVectorEngine": ("termux_aichain.memory.simd", "NativeVectorEngine"),
103
+ "get_simd_engine": ("termux_aichain.memory.simd", "get_simd_engine"),
104
+ "FactExtractor": ("termux_aichain.memory.extractor", "FactExtractor"),
105
+ "BaseEmbeddings": ("termux_aichain.memory.embeddings", "BaseEmbeddings"),
106
+ "LocalEmbeddings": ("termux_aichain.memory.embeddings", "LocalEmbeddings"),
107
+ "SparseBM25Embeddings": ("termux_aichain.memory.embeddings", "SparseBM25Embeddings"),
108
+ # Serve
109
+ "AgentServer": ("termux_aichain.serve.server", "AgentServer"),
110
+ "serve": ("termux_aichain.serve.server", "serve"),
111
+ "DASHBOARD_HTML": ("termux_aichain.serve.dashboard", "DASHBOARD_HTML"),
112
+ # Trace
113
+ "TraceSpan": ("termux_aichain.trace.tracer", "TraceSpan"),
114
+ "Tracer": ("termux_aichain.trace.tracer", "Tracer"),
115
+ "traceable": ("termux_aichain.trace.tracer", "traceable"),
116
+ # Device Tools
117
+ "get_battery_status": ("termux_aichain.device.tools", "get_battery_status"),
118
+ "get_sensor_data": ("termux_aichain.device.tools", "get_sensor_data"),
119
+ "get_device_location": ("termux_aichain.device.tools", "get_device_location"),
120
+ "record_speech_to_text": ("termux_aichain.device.tools", "record_speech_to_text"),
121
+ "vibrate_device": ("termux_aichain.device.tools", "vibrate_device"),
122
+ "send_notification": ("termux_aichain.device.tools", "send_notification"),
123
+ "speak_tts": ("termux_aichain.device.tools", "speak_tts"),
124
+ "execute_shell": ("termux_aichain.device.tools", "execute_shell"),
125
+ "get_default_device_tools": ("termux_aichain.device.tools", "get_default_device_tools"),
126
+ # Ecosystem Tools
127
+ "infer_bitnet_llm": ("termux_aichain.device.ecosystem", "infer_bitnet_llm"),
128
+ "transcribe_speech": ("termux_aichain.device.ecosystem", "transcribe_speech"),
129
+ "generate_diffusion_image": ("termux_aichain.device.ecosystem", "generate_diffusion_image"),
130
+ "browse_web_headless": ("termux_aichain.device.ecosystem", "browse_web_headless"),
131
+ "synthesize_speech": ("termux_aichain.device.ecosystem", "synthesize_speech"),
132
+ "speak_text": ("termux_aichain.device.ecosystem", "speak_text"),
133
+ "analyze_image_vlm": ("termux_aichain.device.ecosystem", "analyze_image_vlm"),
134
+ "detect_faces": ("termux_aichain.device.ecosystem", "detect_faces"),
135
+ "detect_edges_canny": ("termux_aichain.device.ecosystem", "detect_edges_canny"),
136
+ "get_ecosystem_tools": ("termux_aichain.device.ecosystem", "get_ecosystem_tools"),
137
+ }
138
+
139
+ __all__ = ["__version__"] + list(_LAZY_IMPORTS.keys())
140
+
141
+ def __getattr__(name: str) -> Any:
142
+ if name in _LAZY_IMPORTS:
143
+ module_path, attr_name = _LAZY_IMPORTS[name]
144
+ mod = importlib.import_module(module_path)
145
+ val = getattr(mod, attr_name)
146
+ globals()[name] = val
147
+ return val
148
+ raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
149
+
150
+ def __dir__() -> list[str]:
151
+ return sorted(list(globals().keys()) + list(_LAZY_IMPORTS.keys()))