dosync 0.4.1__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 (111) hide show
  1. dosync-0.4.1/LICENSE +201 -0
  2. dosync-0.4.1/PKG-INFO +372 -0
  3. dosync-0.4.1/README.md +315 -0
  4. dosync-0.4.1/dosync/__init__.py +17 -0
  5. dosync-0.4.1/dosync/adapters/__init__.py +258 -0
  6. dosync-0.4.1/dosync/adapters/ble.py +199 -0
  7. dosync-0.4.1/dosync/adapters/homeassistant.py +655 -0
  8. dosync-0.4.1/dosync/adapters/matter.py +320 -0
  9. dosync-0.4.1/dosync/adapters/mavlink.py +1205 -0
  10. dosync-0.4.1/dosync/adapters/mqtt.py +409 -0
  11. dosync-0.4.1/dosync/adapters/notifications.py +153 -0
  12. dosync-0.4.1/dosync/adapters/shelly.py +348 -0
  13. dosync-0.4.1/dosync/adapters/wiz.py +357 -0
  14. dosync-0.4.1/dosync/audit_backup.py +184 -0
  15. dosync-0.4.1/dosync/auth.py +194 -0
  16. dosync-0.4.1/dosync/auth_fastapi.py +87 -0
  17. dosync-0.4.1/dosync/cert_signing.py +117 -0
  18. dosync-0.4.1/dosync/certify.py +1091 -0
  19. dosync-0.4.1/dosync/cli.py +61 -0
  20. dosync-0.4.1/dosync/composite_operations.py +306 -0
  21. dosync-0.4.1/dosync/db.py +826 -0
  22. dosync-0.4.1/dosync/device_arbiter.py +270 -0
  23. dosync-0.4.1/dosync/discovery.py +208 -0
  24. dosync-0.4.1/dosync/ed25519_pure.py +204 -0
  25. dosync-0.4.1/dosync/executor.py +97 -0
  26. dosync-0.4.1/dosync/geo.py +63 -0
  27. dosync-0.4.1/dosync/hub.py +2923 -0
  28. dosync-0.4.1/dosync/hub_monitor.py +144 -0
  29. dosync-0.4.1/dosync/manage.py +913 -0
  30. dosync-0.4.1/dosync/mcp_server.py +746 -0
  31. dosync-0.4.1/dosync/metrics.py +244 -0
  32. dosync-0.4.1/dosync/models.py +562 -0
  33. dosync-0.4.1/dosync/operation_guards.py +228 -0
  34. dosync-0.4.1/dosync/operation_supervisor.py +216 -0
  35. dosync-0.4.1/dosync/operations.py +331 -0
  36. dosync-0.4.1/dosync/policies.py +1210 -0
  37. dosync-0.4.1/dosync/policy_config.py +252 -0
  38. dosync-0.4.1/dosync/py.typed +0 -0
  39. dosync-0.4.1/dosync/reconciler.py +177 -0
  40. dosync-0.4.1/dosync/route_composer.py +189 -0
  41. dosync-0.4.1/dosync/security.py +680 -0
  42. dosync-0.4.1/dosync/server.py +1911 -0
  43. dosync-0.4.1/dosync/validation.py +98 -0
  44. dosync-0.4.1/dosync.egg-info/PKG-INFO +372 -0
  45. dosync-0.4.1/dosync.egg-info/SOURCES.txt +109 -0
  46. dosync-0.4.1/dosync.egg-info/dependency_links.txt +1 -0
  47. dosync-0.4.1/dosync.egg-info/entry_points.txt +4 -0
  48. dosync-0.4.1/dosync.egg-info/requires.txt +39 -0
  49. dosync-0.4.1/dosync.egg-info/top_level.txt +1 -0
  50. dosync-0.4.1/pyproject.toml +79 -0
  51. dosync-0.4.1/setup.cfg +4 -0
  52. dosync-0.4.1/tests/test_adapters.py +168 -0
  53. dosync-0.4.1/tests/test_audit_archive.py +167 -0
  54. dosync-0.4.1/tests/test_audit_backup.py +125 -0
  55. dosync-0.4.1/tests/test_audit_provenance.py +218 -0
  56. dosync-0.4.1/tests/test_auth.py +259 -0
  57. dosync-0.4.1/tests/test_ble_adapter.py +158 -0
  58. dosync-0.4.1/tests/test_claim_state_machine.py +92 -0
  59. dosync-0.4.1/tests/test_composite_operations.py +215 -0
  60. dosync-0.4.1/tests/test_composite_orchestration.py +217 -0
  61. dosync-0.4.1/tests/test_composition_kind_db.py +158 -0
  62. dosync-0.4.1/tests/test_composition_kind_endpoint.py +121 -0
  63. dosync-0.4.1/tests/test_composition_routing.py +175 -0
  64. dosync-0.4.1/tests/test_db.py +252 -0
  65. dosync-0.4.1/tests/test_deployment_env_contract.py +115 -0
  66. dosync-0.4.1/tests/test_device_health.py +80 -0
  67. dosync-0.4.1/tests/test_device_heartbeat.py +98 -0
  68. dosync-0.4.1/tests/test_drone_policies.py +239 -0
  69. dosync-0.4.1/tests/test_ed25519_pure.py +120 -0
  70. dosync-0.4.1/tests/test_emergency_preemption.py +337 -0
  71. dosync-0.4.1/tests/test_event_loop_migration.py +137 -0
  72. dosync-0.4.1/tests/test_explain_consistency.py +77 -0
  73. dosync-0.4.1/tests/test_geo.py +103 -0
  74. dosync-0.4.1/tests/test_ha_bridge_hygiene.py +76 -0
  75. dosync-0.4.1/tests/test_hub_monitor.py +186 -0
  76. dosync-0.4.1/tests/test_idempotency.py +131 -0
  77. dosync-0.4.1/tests/test_independent_observation.py +234 -0
  78. dosync-0.4.1/tests/test_integration_suite.py +138 -0
  79. dosync-0.4.1/tests/test_mavlink_adapter.py +218 -0
  80. dosync-0.4.1/tests/test_mavlink_channels.py +85 -0
  81. dosync-0.4.1/tests/test_mavlink_listener.py +492 -0
  82. dosync-0.4.1/tests/test_mavlink_return_home.py +154 -0
  83. dosync-0.4.1/tests/test_mavlink_single_reader.py +201 -0
  84. dosync-0.4.1/tests/test_mavlink_telemetry_closure.py +161 -0
  85. dosync-0.4.1/tests/test_mcp_dynamic_intents.py +131 -0
  86. dosync-0.4.1/tests/test_mcp_partial_progress.py +117 -0
  87. dosync-0.4.1/tests/test_metrics.py +113 -0
  88. dosync-0.4.1/tests/test_models.py +207 -0
  89. dosync-0.4.1/tests/test_multihub_endpoints.py +66 -0
  90. dosync-0.4.1/tests/test_operation_guards.py +210 -0
  91. dosync-0.4.1/tests/test_operation_supervisor.py +253 -0
  92. dosync-0.4.1/tests/test_operations.py +285 -0
  93. dosync-0.4.1/tests/test_operations_endpoints.py +119 -0
  94. dosync-0.4.1/tests/test_operations_persistence.py +216 -0
  95. dosync-0.4.1/tests/test_operations_wiring.py +213 -0
  96. dosync-0.4.1/tests/test_panel_polish_2026_07_21.py +89 -0
  97. dosync-0.4.1/tests/test_policies.py +597 -0
  98. dosync-0.4.1/tests/test_policy_config.py +298 -0
  99. dosync-0.4.1/tests/test_reachability_cause.py +88 -0
  100. dosync-0.4.1/tests/test_recall_benchmark_postpolicy.py +123 -0
  101. dosync-0.4.1/tests/test_reconciler.py +252 -0
  102. dosync-0.4.1/tests/test_resolution_wiring.py +79 -0
  103. dosync-0.4.1/tests/test_resolver_scoring.py +157 -0
  104. dosync-0.4.1/tests/test_resolver_semantics.py +102 -0
  105. dosync-0.4.1/tests/test_route_composer.py +194 -0
  106. dosync-0.4.1/tests/test_sensor_kind.py +231 -0
  107. dosync-0.4.1/tests/test_server.py +159 -0
  108. dosync-0.4.1/tests/test_telemetry_bridge.py +280 -0
  109. dosync-0.4.1/tests/test_validation.py +165 -0
  110. dosync-0.4.1/tests/test_validation_integration.py +320 -0
  111. dosync-0.4.1/tests/test_wiring_audit.py +192 -0
dosync-0.4.1/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Rodrigo Giuliani
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
dosync-0.4.1/PKG-INFO ADDED
@@ -0,0 +1,372 @@
1
+ Metadata-Version: 2.4
2
+ Name: dosync
3
+ Version: 0.4.1
4
+ Summary: The semantic layer between AI agents and physical devices
5
+ Author-email: Rodrigo Giuliani <rgiuliani@dosync.dev>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://dosync.dev
8
+ Project-URL: Repository, https://github.com/giulianireg-spec/dosync-protocol
9
+ Project-URL: Specification, https://github.com/giulianireg-spec/dosync-protocol/blob/main/spec/DoSync-SPEC-v0.1.md
10
+ Project-URL: Issues, https://github.com/giulianireg-spec/dosync-protocol/issues
11
+ Keywords: iot,ai-agents,protocol,semantic,orchestration,audit,governance,mcp,home-automation,robotics
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: System Administrators
15
+ Classifier: Operating System :: OS Independent
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: Topic :: Home Automation
21
+ Classifier: Topic :: System :: Distributed Computing
22
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
23
+ Requires-Python: >=3.10
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: fastapi<1.0,>=0.115.0
27
+ Requires-Dist: uvicorn<1.0,>=0.23.0
28
+ Requires-Dist: pydantic<3.0,>=2.7.0
29
+ Requires-Dist: jsonschema<5.0,>=4.18
30
+ Provides-Extra: wiz
31
+ Requires-Dist: pywizlight>=0.5.0; extra == "wiz"
32
+ Provides-Extra: mqtt
33
+ Requires-Dist: paho-mqtt>=2.0.0; extra == "mqtt"
34
+ Provides-Extra: ha
35
+ Requires-Dist: aiohttp>=3.8.0; extra == "ha"
36
+ Provides-Extra: ble
37
+ Requires-Dist: bleak>=0.21; extra == "ble"
38
+ Provides-Extra: sms
39
+ Requires-Dist: twilio>=8.0.0; extra == "sms"
40
+ Provides-Extra: mavlink
41
+ Requires-Dist: pymavlink>=2.4.0; extra == "mavlink"
42
+ Provides-Extra: mcp
43
+ Requires-Dist: mcp>=1.0.0; extra == "mcp"
44
+ Provides-Extra: all
45
+ Requires-Dist: pywizlight>=0.5.0; extra == "all"
46
+ Requires-Dist: paho-mqtt>=2.0.0; extra == "all"
47
+ Requires-Dist: aiohttp>=3.8.0; extra == "all"
48
+ Requires-Dist: bleak>=0.21; extra == "all"
49
+ Requires-Dist: twilio>=8.0.0; extra == "all"
50
+ Requires-Dist: pymavlink>=2.4.0; extra == "all"
51
+ Requires-Dist: mcp>=1.0.0; extra == "all"
52
+ Provides-Extra: dev
53
+ Requires-Dist: pytest>=7.4; extra == "dev"
54
+ Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
55
+ Requires-Dist: httpx>=0.27; extra == "dev"
56
+ Dynamic: license-file
57
+
58
+ # DoSync Protocol
59
+
60
+ > The semantic layer between AI agents and physical devices.
61
+
62
+ [![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
63
+ [![Protocol](https://img.shields.io/badge/protocol-v0.4-green.svg)](spec/DoSync-SPEC-v0.1.md)
64
+ [![PyPI](https://img.shields.io/pypi/v/dosync.svg)](https://pypi.org/project/dosync/)
65
+ [![Python](https://img.shields.io/pypi/pyversions/dosync.svg)](https://pypi.org/project/dosync/)
66
+ [![CI](https://github.com/giulianireg-spec/dosync-protocol/actions/workflows/ci.yml/badge.svg)](https://github.com/giulianireg-spec/dosync-protocol/actions/workflows/ci.yml)
67
+ [![Certification](https://img.shields.io/badge/certification-Conformance%2052%2F52-orange.svg)](dosync/certify.py)
68
+ [![MCP](https://img.shields.io/badge/MCP-compatible-purple.svg)](dosync/mcp_server.py)
69
+
70
+ ---
71
+
72
+ ## The problem
73
+
74
+ Today's IoT protocols speak the language of commands. AI speaks the language of goals.
75
+
76
+ ```python
77
+ # Existing protocols
78
+ lock.unlock()
79
+ light.set_brightness(100)
80
+ thermostat.set_temperature(21)
81
+
82
+ # What an AI actually expresses
83
+ "there is an emergency at home"
84
+ "nobody is home — save energy"
85
+ "good morning"
86
+ ```
87
+
88
+ Someone has to translate. Today, that translation is custom code written per-device, per-platform, per-scenario. It breaks when you add a new device. It completely fails in emergencies where milliseconds matter.
89
+
90
+ **DoSync is the bridge.**
91
+
92
+ ---
93
+
94
+ ## What it does
95
+
96
+ DoSync is an open protocol (Apache 2.0) that lets AI systems interact with physical devices using **semantic intent** — expressing *what they want to achieve*, not *how to achieve it*.
97
+
98
+ When the hub receives `"ensure_safety / emergency"`, every registered device figures out its own role automatically based on its declared capabilities — no hardcoded rules, no manual configuration.
99
+
100
+ ---
101
+
102
+ ## Scope and safety boundaries
103
+
104
+ DoSync coordinates **non-safety-critical systems** — lighting, access, climate, notifications, logging — and produces a tamper-evident record of every action. It is infrastructure for coordination and auditability, not a certified safety system.
105
+
106
+ DoSync is **not** certified to IEC 61508 / IEC 62304 / ISO 13849 and must not be the sole or primary mechanism for:
107
+
108
+ - Primary control of medical devices or life-support systems
109
+ - Fire suppression, gas detection, or emergency shutdown of SIL-rated machinery
110
+ - Any function where a failure could cause injury or loss of life
111
+
112
+ In regulated or industrial environments, DoSync **complements** the certified safety systems already in place — coordinating the peripherals around them and recording what happened — but never replaces them. The certified safety system remains in charge of safety.
113
+
114
+ See [Protocol Specification §12.3](spec/DoSync-SPEC-v0.1.md) for the full operational boundaries.
115
+
116
+ ---
117
+
118
+ ## Is DoSync for you?
119
+
120
+ DoSync earns its place in specific situations — and honestly gets in the way in others. A quick filter:
121
+
122
+ **It probably fits if you:**
123
+ - Are building an **AI agent that acts on physical devices** and need an auditable record of what it did, when, and why.
124
+ - Coordinate **heterogeneous devices** (different brands / transports) and want one semantic layer — express a goal, devices resolve it — with a tamper-evident audit trail.
125
+ - Work in **robotics or physical automation** and want a policy + safety layer (emergency preemption, confirmation policies) *between* the AI and the actuators.
126
+ - Keep hand-writing per-device command sequences and wish you could just say *"secure the space."*
127
+
128
+ **It's probably not for you if you:**
129
+ - Want home automation (schedules, motion → light). [Home Assistant](https://www.home-assistant.io/) and its automations — and its MCP server — already do that better; DoSync would be overhead.
130
+ - Have a single device or one brand's ecosystem — you don't need a coordination layer.
131
+ - Don't need auditability or a policy layer.
132
+
133
+ **If the first list is you:** the fastest way in is the **[20-minute device tutorial](TUTORIAL.md)** — build a device that senses, expresses a goal, and acts, with the full audit trail. Or open an [issue](https://github.com/giulianireg-spec/dosync-protocol/issues) describing what you're trying to coordinate and we'll tell you honestly whether DoSync fits.
134
+
135
+ ---
136
+
137
+ ## Demo
138
+
139
+ [![DoSync Demo](https://img.shields.io/badge/▶_Watch_Demo-YouTube-red?style=for-the-badge)](https://youtu.be/2czAqoIrd08)
140
+
141
+ **What you'll see:** Claude AI triggers a physical emergency protocol in real time — 10 Philips WiZ bulbs at full brightness, SMS notification sent, audit log updated. No commands. No rules. No cloud.
142
+
143
+ ---
144
+
145
+ ## How it works
146
+
147
+ ```
148
+ User / AI says: "there is an emergency at home"
149
+
150
+ DoSync Hub v0.3.0
151
+
152
+ ┌───────────────┼───────────────┐
153
+ ▼ ▼ ▼
154
+ 💡 All lights 📱 SMS sent 🚨 Alarm
155
+ at maximum to family activated
156
+ (10 WiZ bulbs) immediately
157
+ │ │ │
158
+ └───────────────┴───────────────┘
159
+
160
+ Audit log updated
161
+ (SHA-256 tamper-evident)
162
+ ```
163
+
164
+ The **Capability-based Resolver** matches the intent against every device's **Capability Manifest** — what it can sense, what it can do, whether it's emergency-capable. No rules to write. Add a new device and it participates automatically.
165
+
166
+ Benchmark (Raspberry Pi 5, Python 3.11.2):
167
+
168
+ | Devices | Mean | p99 | Within 500ms limit |
169
+ |---|---|---|---|
170
+ | 38 (production) | 0.076ms | 0.097ms | ✓ |
171
+ | 1000 | 1.336ms | 5.690ms | ✓ |
172
+ | 5000 | 9.163ms | 24.541ms | ✓ (20× margin) |
173
+
174
+ ---
175
+
176
+ ## Protocol architecture
177
+
178
+ | Layer | Name | Role |
179
+ |---|---|---|
180
+ | 5 | **Intent** | AI expresses semantic goals |
181
+ | 4 | **Semantic** | Resolver maps intent → device actions |
182
+ | 3 | **Registry** | Devices self-declare capabilities on join |
183
+ | 2 | **Secure channel** | mTLS, local PKI — no internet required |
184
+ | 1 | **Transport (HAL)** | Reference: WiFi/HTTP-WS · MQTT. Via bridge: Zigbee · Z-Wave · Thread · Matter (Home Assistant). Native BLE/radio bindings: roadmap |
185
+
186
+ ---
187
+
188
+ ## Quick start
189
+
190
+ ### Install and run — five minutes, no hardware
191
+
192
+ ```bash
193
+ pip install dosync
194
+ dosync-hub
195
+ ```
196
+
197
+ That is a working hub on `http://127.0.0.1:47200`. It starts with a simulated
198
+ executor, so you can drive the whole protocol — register devices, fire intents,
199
+ read the audit chain — before you own a single smart device.
200
+
201
+ Register something and give it a goal:
202
+
203
+ ```bash
204
+ # 1. A device declares what it CAN DO (not what commands it takes)
205
+ curl -X POST http://127.0.0.1:47200/v1/devices/register \
206
+ -H 'Content-Type: application/json' -d '{
207
+ "device_id": "siren-hall", "device_name": "Hall Siren",
208
+ "manufacturer": "acme", "model": "S1", "firmware": "1.0",
209
+ "category": "actuator", "tags": ["alarm", "emergency"],
210
+ "emergency_capable": true, "cert_tier": "basic",
211
+ "sensors": [], "actuators": [{"id": "alarm", "type": "alarm",
212
+ "description": "audible alarm"}]}'
213
+
214
+ # 2. An AI expresses a GOAL — not a command, and it names no device
215
+ curl -X POST http://127.0.0.1:47200/v1/intent/async \
216
+ -H 'Content-Type: application/json' \
217
+ -d '{"intent": "ensure_safety", "urgency": "emergency", "context": {}}'
218
+
219
+ # 3. Ask WHY those devices were chosen
220
+ curl http://127.0.0.1:47200/v1/intents/ensure_safety/explain
221
+
222
+ # 4. Read the tamper-evident record of what happened
223
+ curl http://127.0.0.1:47200/v1/audit?limit=10
224
+ ```
225
+
226
+ Step 3 is the one worth pausing on: the hub tells you which devices it
227
+ evaluated, which it included, and the score breakdown behind each decision.
228
+ Step 4 is the other: every action leaves a SHA-256-chained entry, so what the
229
+ system did is provable after the fact rather than merely logged.
230
+
231
+ Install only the adapters you need:
232
+
233
+ ```bash
234
+ pip install 'dosync[wiz]' # Philips WiZ bulbs
235
+ pip install 'dosync[ha]' # Home Assistant bridge
236
+ pip install 'dosync[mqtt]' # MQTT devices
237
+ pip install 'dosync[all]' # everything
238
+ ```
239
+
240
+ ### Docker
241
+
242
+ ```bash
243
+ docker run -p 47200:47200 dosync/hub # published image
244
+ # or, from a clone:
245
+ docker compose up
246
+ ```
247
+
248
+ ### From source (development)
249
+
250
+ ```bash
251
+ git clone https://github.com/giulianireg-spec/dosync-protocol
252
+ cd dosync-protocol
253
+ python3 -m venv venv && source venv/bin/activate
254
+ pip install -e '.[dev]'
255
+ pytest # 667 tests
256
+ dosync-hub --reload
257
+ ```
258
+
259
+ ---
260
+
261
+ ## What's built today
262
+
263
+ | Component | Status |
264
+ |---|---|
265
+ | REST API (12+ endpoints) | ✅ |
266
+ | WebSocket real-time events | ✅ |
267
+ | Web dashboard | ✅ |
268
+ | API key authentication + SHA-256 audit log | ✅ |
269
+ | Capability-based resolver | ✅ |
270
+ | Certification CLI — Standard 33/33 · Emergency 44/44 (signed reports) | ✅ |
271
+ | Philips WiZ adapter (UDP local) | ✅ |
272
+ | Home Assistant bridge (10 domains) | ✅ |
273
+ | Native MCP server (Claude, ChatGPT, any LLM) | ✅ |
274
+ | GPIO adapter — Raspberry Pi 5 (PIR + DHT22) | ✅ |
275
+ | SMS notifications via Twilio | ✅ code (requires an active Twilio plan) |
276
+ | MQTT transport adapter (Mosquitto) | ✅ |
277
+ | Shelly adapter (HTTP local, Gen1 + Gen2) | ✅ code, not hardware-tested |
278
+ | Matter adapter (via HA bridge / python-matter-server) | ✅ code, not hardware-tested |
279
+ | External Resolver Protocol (HTTP wire format) | ✅ |
280
+ | SQLite persistence (survives restarts) | ✅ |
281
+ | CI pipeline (GitHub Actions) | ✅ |
282
+ | Multi-hub assisted failover (Phase A — operator-in-the-loop) | ✅ |
283
+ | Long-running operations + telemetry reconciliation (state machine) | ✅ |
284
+ | Drone / MAVLink adapter — full AI→intent→mission loop in ArduPilot SITL | ✅ software (physical flight pending) |
285
+
286
+ ---
287
+
288
+ ## MQTT transport
289
+
290
+ DoSync supports MQTT as a Layer 1 transport for devices that can't use HTTP. Requires Mosquitto and proper authentication. See [config/mosquitto-secure.conf](config/mosquitto-secure.conf) for secure setup.
291
+
292
+ ```bash
293
+ # Enable MQTT in the hub service
294
+ Environment="DOSYNC_MQTT_BROKER=localhost"
295
+ Environment="DOSYNC_MQTT_USER=dosync-hub"
296
+ Environment="DOSYNC_MQTT_PASSWORD=<password>"
297
+ Environment="DOSYNC_MQTT_SECRET=<registration-secret>"
298
+ ```
299
+
300
+ ---
301
+
302
+ ## Certification
303
+
304
+ Self-certifiable with the CLI:
305
+
306
+ ```bash
307
+ python3 certify.py --host <hub-ip> --port 47200 --tier standard
308
+ # Output: dosync-cert-standard-*.json
309
+ ```
310
+
311
+ | Tier | Tests | What it validates |
312
+ |---|---|---|
313
+ | **Basic** | 10 | Connectivity, auth, device manifest |
314
+ | **Standard** | 33 | Protocol conformance, events, health, version headers |
315
+ | **Emergency** | 44 | Everything in Standard + emergency override, policy engine, audit log integrity |
316
+
317
+ ---
318
+
319
+ ## Implementations
320
+
321
+ | Language | Location | Author | Certification |
322
+ |---|---|---|---|
323
+ | Python (reference) | `server.py` | this project | Standard 33/33 · Emergency 44/44 ✅ |
324
+ | Node.js (companion) | [giulianireg-spec/dosync-node](https://github.com/giulianireg-spec/dosync-node) | this project | 33/33 Standard ✅ |
325
+
326
+ The Node.js implementation is a **companion** port that validates the protocol
327
+ is implementable in a second language against the same certification suite —
328
+ both share the same author. A genuinely **independent** implementation
329
+ (different author or organization) is a tracked milestone for v1.0: a protocol
330
+ needs multiple independent implementations to become a standard. See the
331
+ [roadmap](ROADMAP.md).
332
+
333
+ ---
334
+
335
+ ## Works with Home Assistant — a layer on top, not a replacement
336
+
337
+ Home Assistant already solved the hardest problem: talking to thousands of devices, and since 2025 it ships an MCP server so an AI can control them directly. DoSync doesn't reinvent that — it reads devices from HA through a bridge already in the repo and adds **one thing**: it turns a semantic goal (`ensure_safety`, `away_mode`) into a coordinated, **auditable** set of actions across *any* source (HA, WiZ, GPIO, MQTT, BLE).
338
+
339
+ The honest version: for everyday automation ("porch light when I get home") you **don't need DoSync** — HA's automations and its MCP cover that completely. DoSync earns its place only when **coordination and traceability matter at once** — e.g. a fall-response that unlocks the door, lights the house, and messages family, with a tamper-evident record of exactly what fired and when. Full reasoning: [Home Assistant Already Talks to Your Devices. So What Would DoSync Add?](https://dev.to/giulianiregspec/home-assistant-already-talks-to-your-devices-so-what-would-dosync-add-1iei)
340
+
341
+ ---
342
+
343
+ ## Beyond the home
344
+
345
+ Nothing in DoSync assumes a house — the same 5-layer stack coordinates physical systems anywhere an AI needs to act: retail cold-chain, hotels, factory peripherals (alongside certified safety systems, never replacing them).
346
+
347
+ The proof: we took it to the hardest device, an **autonomous drone**. From a single plain-language sentence, an AI model (Claude Haiku, via DoSync's MCP server) fired an `inspect_area` intent and the drone flew the full mission in ArduPilot SITL — every step confirmed by real telemetry. When the AI guessed coordinates 11,000 km away, the supervisor didn't fake success: it waited for a confirmed arrival, none came, and it aborted with a clear diagnosis. **The AI can be wrong; the protocol doesn't have to be.** [Full build log](https://dev.to/giulianiregspec/i-gave-an-ai-one-sentence-a-drone-flew-the-mission-and-when-the-ai-guessed-wrong-the-system-2h3m) · *(validated in SITL; physical-hardware flight is the next step, not a claim made today.)*
348
+
349
+ ---
350
+
351
+ ## Contributing
352
+
353
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development workflow, including the CI pipeline that runs on every push.
354
+
355
+ ---
356
+
357
+ ## Specification
358
+
359
+ - [spec/DoSync-SPEC-v0.1.md](spec/DoSync-SPEC-v0.1.md) — full protocol specification
360
+ - [spec/RESOLVER-SPEC-v0.3.md](spec/RESOLVER-SPEC-v0.3.md) — resolver interface + external resolver protocol
361
+ - [DESIGN-PRINCIPLES.md](DESIGN-PRINCIPLES.md) — architectural decisions and rationale
362
+ - [COMPATIBILITY.md](COMPATIBILITY.md) — backward compatibility guarantees
363
+
364
+ ---
365
+
366
+ ## License
367
+
368
+ Apache 2.0 — free to implement, free to extend, no royalties.
369
+
370
+ ---
371
+
372
+ *DoSync Protocol v0.3.0 · © 2026 Rodrigo Giuliani · rgiuliani@dosync.dev*