tpcp-core 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 (79) hide show
  1. tpcp_core-0.4.1/.gitignore +29 -0
  2. tpcp_core-0.4.1/COMMERCIAL_LICENSE.md +22 -0
  3. tpcp_core-0.4.1/Dockerfile +29 -0
  4. tpcp_core-0.4.1/LICENSE +57 -0
  5. tpcp_core-0.4.1/PKG-INFO +141 -0
  6. tpcp_core-0.4.1/README.md +88 -0
  7. tpcp_core-0.4.1/add_headers.py +32 -0
  8. tpcp_core-0.4.1/docs/RFC-001-Core-Protocol.md +515 -0
  9. tpcp_core-0.4.1/docs/api_reference.md +430 -0
  10. tpcp_core-0.4.1/docs/architecture.md +144 -0
  11. tpcp_core-0.4.1/docs/universal_edge.md +72 -0
  12. tpcp_core-0.4.1/examples/01_handshake_demo.py +127 -0
  13. tpcp_core-0.4.1/examples/02_shared_memory_demo.py +104 -0
  14. tpcp_core-0.4.1/examples/03_telepathy_demo.py +90 -0
  15. tpcp_core-0.4.1/proto/tpcp.proto +141 -0
  16. tpcp_core-0.4.1/proto/tpcp.schema.json +487 -0
  17. tpcp_core-0.4.1/pyproject.toml +88 -0
  18. tpcp_core-0.4.1/tests/__init__.py +0 -0
  19. tpcp_core-0.4.1/tests/test_adapters.py +29 -0
  20. tpcp_core-0.4.1/tests/test_canbus_adapter.py +99 -0
  21. tpcp_core-0.4.1/tests/test_crypto_canonical.py +25 -0
  22. tpcp_core-0.4.1/tests/test_homeassistant_adapter.py +481 -0
  23. tpcp_core-0.4.1/tests/test_integration.py +96 -0
  24. tpcp_core-0.4.1/tests/test_mock_node.py +43 -0
  25. tpcp_core-0.4.1/tests/test_modbus_adapter.py +127 -0
  26. tpcp_core-0.4.1/tests/test_node.py +322 -0
  27. tpcp_core-0.4.1/tests/test_opcua_adapter.py +119 -0
  28. tpcp_core-0.4.1/tests/test_queue.py +84 -0
  29. tpcp_core-0.4.1/tests/test_relay_server.py +649 -0
  30. tpcp_core-0.4.1/tests/test_schemas.py +156 -0
  31. tpcp_core-0.4.1/tests/test_security.py +67 -0
  32. tpcp_core-0.4.1/tests/test_vector.py +93 -0
  33. tpcp_core-0.4.1/tpcp/__init__.py +61 -0
  34. tpcp_core-0.4.1/tpcp/adapters/__init__.py +104 -0
  35. tpcp_core-0.4.1/tpcp/adapters/autogen_adapter.py +116 -0
  36. tpcp_core-0.4.1/tpcp/adapters/base.py +71 -0
  37. tpcp_core-0.4.1/tpcp/adapters/canbus_adapter.py +285 -0
  38. tpcp_core-0.4.1/tpcp/adapters/crewai_adapter.py +69 -0
  39. tpcp_core-0.4.1/tpcp/adapters/haystack_adapter.py +136 -0
  40. tpcp_core-0.4.1/tpcp/adapters/homeassistant_adapter.py +205 -0
  41. tpcp_core-0.4.1/tpcp/adapters/langgraph_adapter.py +71 -0
  42. tpcp_core-0.4.1/tpcp/adapters/llamaindex_adapter.py +118 -0
  43. tpcp_core-0.4.1/tpcp/adapters/modbus_adapter.py +369 -0
  44. tpcp_core-0.4.1/tpcp/adapters/mqtt_adapter.py +199 -0
  45. tpcp_core-0.4.1/tpcp/adapters/opcua_adapter.py +314 -0
  46. tpcp_core-0.4.1/tpcp/adapters/openai_agents_adapter.py +139 -0
  47. tpcp_core-0.4.1/tpcp/adapters/pydantic_ai_adapter.py +121 -0
  48. tpcp_core-0.4.1/tpcp/adapters/ros2_adapter.py +220 -0
  49. tpcp_core-0.4.1/tpcp/adapters/semantic_kernel_adapter.py +118 -0
  50. tpcp_core-0.4.1/tpcp/adapters/smolagents_adapter.py +116 -0
  51. tpcp_core-0.4.1/tpcp/cli/__init__.py +0 -0
  52. tpcp_core-0.4.1/tpcp/cli/commands/__init__.py +0 -0
  53. tpcp_core-0.4.1/tpcp/cli/commands/inspect.py +24 -0
  54. tpcp_core-0.4.1/tpcp/cli/commands/keygen.py +29 -0
  55. tpcp_core-0.4.1/tpcp/cli/commands/listen.py +37 -0
  56. tpcp_core-0.4.1/tpcp/cli/commands/ping.py +43 -0
  57. tpcp_core-0.4.1/tpcp/cli/commands/send.py +61 -0
  58. tpcp_core-0.4.1/tpcp/cli/main.py +20 -0
  59. tpcp_core-0.4.1/tpcp/core/__init__.py +24 -0
  60. tpcp_core-0.4.1/tpcp/core/chunker.py +102 -0
  61. tpcp_core-0.4.1/tpcp/core/node.py +715 -0
  62. tpcp_core-0.4.1/tpcp/core/queue.py +91 -0
  63. tpcp_core-0.4.1/tpcp/core/reassembler.py +152 -0
  64. tpcp_core-0.4.1/tpcp/core/relay_client.py +90 -0
  65. tpcp_core-0.4.1/tpcp/memory/__init__.py +22 -0
  66. tpcp_core-0.4.1/tpcp/memory/crdt.py +167 -0
  67. tpcp_core-0.4.1/tpcp/memory/vector.py +126 -0
  68. tpcp_core-0.4.1/tpcp/py.typed +0 -0
  69. tpcp_core-0.4.1/tpcp/relay/__init__.py +17 -0
  70. tpcp_core-0.4.1/tpcp/relay/server.py +365 -0
  71. tpcp_core-0.4.1/tpcp/relay/webhook.py +170 -0
  72. tpcp_core-0.4.1/tpcp/schemas/__init__.py +55 -0
  73. tpcp_core-0.4.1/tpcp/schemas/envelope.py +343 -0
  74. tpcp_core-0.4.1/tpcp/security/__init__.py +22 -0
  75. tpcp_core-0.4.1/tpcp/security/acl.py +73 -0
  76. tpcp_core-0.4.1/tpcp/security/crypto.py +217 -0
  77. tpcp_core-0.4.1/tpcp/testing/__init__.py +2 -0
  78. tpcp_core-0.4.1/tpcp/testing/mock_node.py +108 -0
  79. tpcp_core-0.4.1/tpcp/transport/__init__.py +18 -0
@@ -0,0 +1,29 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *$py.class
4
+ *.so
5
+ .Python
6
+ env/
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ .pytest_cache/
23
+ .coverage
24
+ htmlcov/
25
+ .mypy_cache/
26
+ .ruff_cache/
27
+ .env
28
+ .venv
29
+ venv/
@@ -0,0 +1,22 @@
1
+ # Commercial License Agreement
2
+
3
+ **TPCP Dual-License Strategy: Enterprise Protection**
4
+
5
+ The Telepathy Communication Protocol (TPCP) is open-source software, but it is distributed under the strict terms of the **GNU Affero General Public License v3.0 (AGPLv3)**.
6
+
7
+ ### What does the AGPLv3 mean for your business?
8
+ The AGPLv3 requires that any software interacting with or modifying TPCP—including integrating it into network backends, SaaS architectures, or API-driven applications—must also be released under the AGPLv3. **This means exposing your proprietary source code to the public.**
9
+
10
+ ### The Commercial Use Alternative
11
+ If your organization intends to use TPCP in a **closed-source, proprietary, or commercial environment**, integrating the SDKs (`tpcp-core` or `tpcp-ts`) without open-sourcing your own intellectual property directly violates the AGPLv3.
12
+
13
+ To legally bypass this requirement and protect your trade secrets, you **must purchase a Commercial Use License**.
14
+
15
+ ### Terms of the Commercial License
16
+ A Commercial License grants your organization the right to:
17
+ 1. Integrate TPCP core routing and CRDT topologies into proprietary, closed-source SaaS enterprise backends.
18
+ 2. Distribute binaries, apps, or compiled web interfaces wrapping the `tpcp-ts` client without opening the source.
19
+ 3. Remove the GNU AGPL copyright headers from modified internal forks of the repository.
20
+
21
+ ### Acquiring a License
22
+ For enterprise pricing, custom integration support, and commercial license purchases, please contact the Principal Systems Architect (Repository Maintainer) directly. Using the software commercially without explicit, written agreement constitutes severe copyright infringement.
@@ -0,0 +1,29 @@
1
+ # TPCP A-DNS Relay Server
2
+ # Usage: docker build -t tpcp-relay . && docker run -p 8765:8765 tpcp-relay
3
+
4
+ FROM python:3.11-slim
5
+
6
+ WORKDIR /app
7
+
8
+ # Pull latest security patches from upstream Debian
9
+ RUN apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Copy and install package (core only, no dev/edge extras needed for relay)
12
+ COPY pyproject.toml README.md ./
13
+ COPY tpcp/ ./tpcp/
14
+
15
+ RUN pip install --no-cache-dir --upgrade pip wheel jaraco.context && \
16
+ pip install --no-cache-dir -e . && \
17
+ useradd -r -u 1001 -g root tpcp
18
+
19
+ USER tpcp
20
+
21
+ EXPOSE 8765
22
+
23
+ ENV TPCP_PORT=8765
24
+
25
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
26
+ CMD python -c "import socket; s=socket.socket(); s.connect(('127.0.0.1',8765)); s.close()" || exit 1
27
+
28
+ # Run the A-DNS relay server
29
+ CMD ["python", "-m", "tpcp.relay.server"]
@@ -0,0 +1,57 @@
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU Affero General Public License is a free, copyleft license for
11
+ software and other kinds of works, specifically designed to ensure
12
+ cooperation with the community in the case of network server software.
13
+
14
+ The licenses for most software and other practical works are designed
15
+ to take away your freedom to share and change the works. By contrast,
16
+ our General Public Licenses are intended to guarantee your freedom to
17
+ share and change all versions of a program--to make sure it remains free
18
+ software for all its users.
19
+
20
+ When we speak of free software, we are referring to freedom, not
21
+ price. Our General Public Licenses are designed to make sure that you
22
+ have the freedom to distribute copies of free software (and charge for
23
+ them if you wish), that you receive source code or can get it if you
24
+ want it, that you can change the software or use pieces of it in new
25
+ free programs, and that you know you can do these things.
26
+
27
+ Developers that use our General Public Licenses protect your rights
28
+ with two steps: (1) assert copyright on the software, and (2) offer
29
+ you this License which gives you legal permission to copy, distribute
30
+ and/or modify the software.
31
+
32
+ A secondary benefit of defending all users' freedom is that
33
+ improvements made in alternate versions of the program, if they
34
+ receive widespread use, become available for other developers to
35
+ incorporate. Many developers of free software are heartened and
36
+ encouraged by the resulting cooperation. However, in the case of
37
+ software used on network servers, this result may fail to come about.
38
+ The GNU General Public License permits making a modified version and
39
+ letting the public access it on a server without ever releasing its
40
+ source code to the public.
41
+
42
+ The GNU Affero General Public License is designed specifically to
43
+ ensure that, in such cases, the modified source code becomes available
44
+ to the community. It requires the operator of a network server to
45
+ provide the source code of the modified version running there to the
46
+ users of that server. Therefore, public use of a modified version, on
47
+ a publicly accessible server, gives the public access to the source
48
+ code of the modified version.
49
+
50
+ An older license, called the Affero General Public License and
51
+ published by Affero, was designed to accomplish similar goals. This is
52
+ a different license, not a version of the Affero GPL, but Affero has
53
+ released a new version of the Affero GPL which permits relicensing under
54
+ this license.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
@@ -0,0 +1,141 @@
1
+ Metadata-Version: 2.4
2
+ Name: tpcp-core
3
+ Version: 0.4.1
4
+ Summary: Telepathy Communication Protocol - A framework-agnostic communication protocol for autonomous agents.
5
+ Project-URL: Homepage, https://github.com/Etriti00/agent-telepathy
6
+ Project-URL: Repository, https://github.com/Etriti00/agent-telepathy
7
+ Project-URL: Documentation, https://github.com/Etriti00/agent-telepathy/blob/main/tpcp/docs/api_reference.md
8
+ Project-URL: Bug Tracker, https://github.com/Etriti00/agent-telepathy/issues
9
+ Author-email: TPCP Contributors <tpcp@protonmail.com>
10
+ License: AGPL-3.0-or-later
11
+ License-File: LICENSE
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: AsyncIO
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Communications
21
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
22
+ Requires-Python: >=3.11
23
+ Requires-Dist: aiosqlite>=0.20.0
24
+ Requires-Dist: click>=8.0.0
25
+ Requires-Dist: cryptography>=42.0.0
26
+ Requires-Dist: pydantic>=2.5.0
27
+ Requires-Dist: websockets>=12.0
28
+ Provides-Extra: ai-frameworks
29
+ Requires-Dist: autogen-agentchat>=0.4.0; extra == 'ai-frameworks'
30
+ Requires-Dist: haystack-ai>=2.0.0; extra == 'ai-frameworks'
31
+ Requires-Dist: llama-index>=0.10.0; extra == 'ai-frameworks'
32
+ Requires-Dist: openai>=1.0.0; extra == 'ai-frameworks'
33
+ Requires-Dist: pydantic-ai>=0.0.14; extra == 'ai-frameworks'
34
+ Requires-Dist: semantic-kernel>=1.0.0; extra == 'ai-frameworks'
35
+ Requires-Dist: smolagents>=1.0.0; extra == 'ai-frameworks'
36
+ Provides-Extra: dev
37
+ Requires-Dist: black>=24.2.0; extra == 'dev'
38
+ Requires-Dist: mypy>=1.8.0; extra == 'dev'
39
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
40
+ Requires-Dist: pytest-timeout>=0.5.0; extra == 'dev'
41
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
42
+ Requires-Dist: ruff>=0.3.0; extra == 'dev'
43
+ Provides-Extra: edge
44
+ Requires-Dist: aiohttp>=3.9.3; extra == 'edge'
45
+ Requires-Dist: fastapi>=0.110.0; extra == 'edge'
46
+ Requires-Dist: paho-mqtt>=2.0.0; extra == 'edge'
47
+ Requires-Dist: uvicorn>=0.29.0; extra == 'edge'
48
+ Provides-Extra: industrial
49
+ Requires-Dist: asyncua>=1.1.0; extra == 'industrial'
50
+ Requires-Dist: pymodbus>=3.6.0; extra == 'industrial'
51
+ Requires-Dist: python-can>=4.3.0; extra == 'industrial'
52
+ Description-Content-Type: text/markdown
53
+
54
+ # TPCP: Telepathy Communication Protocol
55
+
56
+ **Framework-agnostic, mathematically merged, cryptographically secure state synchronization for autonomous AI agents.**
57
+
58
+ [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
59
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/release/python-3110/)
60
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)](https://www.typescriptlang.org/)
61
+
62
+ TPCP natively connects disparate AI agents (e.g., CrewAI, LangGraph, React Dashboards) into a unified, decentralized swarm. It moves beyond simple text-based chat strings, enabling agents to natively share semantic brain states, merge conflict-free memory, and guarantee network security using cryptographic mathematics.
63
+
64
+ ---
65
+
66
+ ## ⚡ Core Features
67
+
68
+ * **🧠 Semantic Vector Sync (Telepathy):** Bypass the text bottleneck. Agents transmit compressed 1536-dimensional conceptual representations directly to peers using `VectorEmbeddingPayload`s.
69
+ * **🔗 Conflict-Free Shared Memory:** No external database locks required. The internal `LWWMap` (Last-Writer-Wins) CRDT utilizes Lamport logical clocks to deterministically merge distributed state across the network.
70
+ * **🛡️ Ed25519 Cryptographic Trust:** Every agent spawns a mathematical identity. All payloads are signed and strictly verified by the `TPCPNode` middleware to prevent spoofing or tampering.
71
+ * **🌍 A-DNS Global Discovery:** Dynamic Agent Domain Name System (A-DNS) relays allow local nodes to discover and route payloads to autonomous peers globally across decoupled subnets.
72
+ * **📦 Cross-Language Architecture:** Fully featured SDKs available in both Python (`tpcp-core`) and TypeScript (`tpcp-ts`) for full-stack swarm intelligence.
73
+
74
+ ---
75
+
76
+ ## 🚀 Quick Start
77
+
78
+ Initialize a node, register a peer, and synchronize semantic memory in three lines of code.
79
+
80
+ ### Python (Backend Node)
81
+ ```python
82
+ import asyncio
83
+ from tpcp import TPCPNode, AgentIdentity, Intent, CRDTSyncPayload
84
+
85
+ async def main():
86
+ # 1. Initialize cryptographic identity
87
+ identity = AgentIdentity(framework="LangGraph")
88
+ node = TPCPNode(identity=identity, host="127.0.0.1", port=8000)
89
+
90
+ # 2. Update local state
91
+ node.shared_memory.set("system_status", "DEFCON 1")
92
+
93
+ # 3. Synchronize mathematically with a peer
94
+ payload = CRDTSyncPayload(
95
+ crdt_type="LWW-Map",
96
+ state=node.shared_memory.serialize_state(),
97
+ vector_clock={}
98
+ )
99
+ # The payload is auto-signed and encrypted on dispatch
100
+ await node.send_message(peer_uuid, Intent.STATE_SYNC, payload)
101
+
102
+ asyncio.run(main())
103
+ ```
104
+
105
+ ### TypeScript (Frontend Client)
106
+ ```typescript
107
+ import { TPCPNode, AgentIdentity } from 'tpcp-ts';
108
+
109
+ // 1. Initialize the UI Node
110
+ const identity: AgentIdentity = {
111
+ agent_id: crypto.randomUUID(),
112
+ framework: "React-Dashboard",
113
+ capabilities: ["visualization"],
114
+ public_key: "" // Auto-generated Ed25519
115
+ };
116
+
117
+ const node = new TPCPNode(identity, "127.0.0.1", 9000);
118
+
119
+ // 2. Wrap the node in reactive state hooks
120
+ node.on("onStateSync", (mergedState) => {
121
+ // The LWWMap has safely resolved any merge conflicts!
122
+ console.log("Global Swarm State Updated:", mergedState);
123
+ });
124
+
125
+ await node.startListening();
126
+ ```
127
+
128
+ ---
129
+
130
+ ## ⚖️ Licensing & Commercial Use
131
+
132
+ TPCP is dual-licensed to support both the open-source community and enterprise integrations.
133
+
134
+ ### Open-Source License (AGPLv3)
135
+ This project is open-sourced under the **GNU Affero General Public License v3.0 (AGPLv3)**.
136
+ If you integrate TPCP into your project, **your entire project must also be open-sourced under the AGPLv3.** This includes any backend SaaS server actively routing TPCP network traffic.
137
+
138
+ ### Commercial License
139
+ If you wish to integrate TPCP into **proprietary, closed-source enterprise applications** or utilize the network architecture within a commercial backend without being forced to open-source your intellectual property, you **MUST purchase a Commercial Use License**.
140
+
141
+ Please review the [COMMERCIAL_LICENSE.md](./COMMERCIAL_LICENSE.md) file for more information on terms and obtaining a license.
@@ -0,0 +1,88 @@
1
+ # TPCP: Telepathy Communication Protocol
2
+
3
+ **Framework-agnostic, mathematically merged, cryptographically secure state synchronization for autonomous AI agents.**
4
+
5
+ [![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
6
+ [![Python 3.11+](https://img.shields.io/badge/python-3.11+-blue.svg)](https://www.python.org/downloads/release/python-3110/)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)](https://www.typescriptlang.org/)
8
+
9
+ TPCP natively connects disparate AI agents (e.g., CrewAI, LangGraph, React Dashboards) into a unified, decentralized swarm. It moves beyond simple text-based chat strings, enabling agents to natively share semantic brain states, merge conflict-free memory, and guarantee network security using cryptographic mathematics.
10
+
11
+ ---
12
+
13
+ ## ⚡ Core Features
14
+
15
+ * **🧠 Semantic Vector Sync (Telepathy):** Bypass the text bottleneck. Agents transmit compressed 1536-dimensional conceptual representations directly to peers using `VectorEmbeddingPayload`s.
16
+ * **🔗 Conflict-Free Shared Memory:** No external database locks required. The internal `LWWMap` (Last-Writer-Wins) CRDT utilizes Lamport logical clocks to deterministically merge distributed state across the network.
17
+ * **🛡️ Ed25519 Cryptographic Trust:** Every agent spawns a mathematical identity. All payloads are signed and strictly verified by the `TPCPNode` middleware to prevent spoofing or tampering.
18
+ * **🌍 A-DNS Global Discovery:** Dynamic Agent Domain Name System (A-DNS) relays allow local nodes to discover and route payloads to autonomous peers globally across decoupled subnets.
19
+ * **📦 Cross-Language Architecture:** Fully featured SDKs available in both Python (`tpcp-core`) and TypeScript (`tpcp-ts`) for full-stack swarm intelligence.
20
+
21
+ ---
22
+
23
+ ## 🚀 Quick Start
24
+
25
+ Initialize a node, register a peer, and synchronize semantic memory in three lines of code.
26
+
27
+ ### Python (Backend Node)
28
+ ```python
29
+ import asyncio
30
+ from tpcp import TPCPNode, AgentIdentity, Intent, CRDTSyncPayload
31
+
32
+ async def main():
33
+ # 1. Initialize cryptographic identity
34
+ identity = AgentIdentity(framework="LangGraph")
35
+ node = TPCPNode(identity=identity, host="127.0.0.1", port=8000)
36
+
37
+ # 2. Update local state
38
+ node.shared_memory.set("system_status", "DEFCON 1")
39
+
40
+ # 3. Synchronize mathematically with a peer
41
+ payload = CRDTSyncPayload(
42
+ crdt_type="LWW-Map",
43
+ state=node.shared_memory.serialize_state(),
44
+ vector_clock={}
45
+ )
46
+ # The payload is auto-signed and encrypted on dispatch
47
+ await node.send_message(peer_uuid, Intent.STATE_SYNC, payload)
48
+
49
+ asyncio.run(main())
50
+ ```
51
+
52
+ ### TypeScript (Frontend Client)
53
+ ```typescript
54
+ import { TPCPNode, AgentIdentity } from 'tpcp-ts';
55
+
56
+ // 1. Initialize the UI Node
57
+ const identity: AgentIdentity = {
58
+ agent_id: crypto.randomUUID(),
59
+ framework: "React-Dashboard",
60
+ capabilities: ["visualization"],
61
+ public_key: "" // Auto-generated Ed25519
62
+ };
63
+
64
+ const node = new TPCPNode(identity, "127.0.0.1", 9000);
65
+
66
+ // 2. Wrap the node in reactive state hooks
67
+ node.on("onStateSync", (mergedState) => {
68
+ // The LWWMap has safely resolved any merge conflicts!
69
+ console.log("Global Swarm State Updated:", mergedState);
70
+ });
71
+
72
+ await node.startListening();
73
+ ```
74
+
75
+ ---
76
+
77
+ ## ⚖️ Licensing & Commercial Use
78
+
79
+ TPCP is dual-licensed to support both the open-source community and enterprise integrations.
80
+
81
+ ### Open-Source License (AGPLv3)
82
+ This project is open-sourced under the **GNU Affero General Public License v3.0 (AGPLv3)**.
83
+ If you integrate TPCP into your project, **your entire project must also be open-sourced under the AGPLv3.** This includes any backend SaaS server actively routing TPCP network traffic.
84
+
85
+ ### Commercial License
86
+ If you wish to integrate TPCP into **proprietary, closed-source enterprise applications** or utilize the network architecture within a commercial backend without being forced to open-source your intellectual property, you **MUST purchase a Commercial Use License**.
87
+
88
+ Please review the [COMMERCIAL_LICENSE.md](./COMMERCIAL_LICENSE.md) file for more information on terms and obtaining a license.
@@ -0,0 +1,32 @@
1
+ import os
2
+
3
+ header = """# Copyright (c) 2026 Principal Systems Architect
4
+ # This file is part of TPCP.
5
+ #
6
+ # TPCP is free software: you can redistribute it and/or modify
7
+ # it under the terms of the GNU Affero General Public License as published by
8
+ # the Free Software Foundation, either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # TPCP is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Affero General Public License for more details.
15
+ #
16
+ # You should have received a copy of the GNU Affero General Public License
17
+ # along with TPCP. If not, see <https://www.gnu.org/licenses/>.
18
+ #
19
+ # For commercial licensing inquiries, see COMMERCIAL_LICENSE.md
20
+
21
+ """
22
+
23
+ for root, _, files in os.walk("tpcp"):
24
+ for file in files:
25
+ if file.endswith(".py"):
26
+ path = os.path.join(root, file)
27
+ with open(path, "r", encoding="utf-8") as f:
28
+ content = f.read()
29
+ if not content.startswith("# Copyright"):
30
+ with open(path, "w", encoding="utf-8") as f:
31
+ f.write(header + content)
32
+ print("Finished appending headers to all python files.")