newbro-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. newbro_cli-0.1.0/PKG-INFO +333 -0
  2. newbro_cli-0.1.0/README.md +303 -0
  3. newbro_cli-0.1.0/pyproject.toml +54 -0
  4. newbro_cli-0.1.0/setup.cfg +4 -0
  5. newbro_cli-0.1.0/src/newbro_cli.egg-info/PKG-INFO +333 -0
  6. newbro_cli-0.1.0/src/newbro_cli.egg-info/SOURCES.txt +189 -0
  7. newbro_cli-0.1.0/src/newbro_cli.egg-info/dependency_links.txt +1 -0
  8. newbro_cli-0.1.0/src/newbro_cli.egg-info/entry_points.txt +2 -0
  9. newbro_cli-0.1.0/src/newbro_cli.egg-info/requires.txt +22 -0
  10. newbro_cli-0.1.0/src/newbro_cli.egg-info/top_level.txt +1 -0
  11. newbro_cli-0.1.0/src/synapse/__init__.py +3 -0
  12. newbro_cli-0.1.0/src/synapse/__main__.py +9 -0
  13. newbro_cli-0.1.0/src/synapse/api/__init__.py +1 -0
  14. newbro_cli-0.1.0/src/synapse/api/app.py +54 -0
  15. newbro_cli-0.1.0/src/synapse/api/logging.py +42 -0
  16. newbro_cli-0.1.0/src/synapse/api/models.py +135 -0
  17. newbro_cli-0.1.0/src/synapse/api/paths.py +26 -0
  18. newbro_cli-0.1.0/src/synapse/api/routes/__init__.py +1 -0
  19. newbro_cli-0.1.0/src/synapse/api/routes/commands.py +66 -0
  20. newbro_cli-0.1.0/src/synapse/api/routes/executor_nodes.py +125 -0
  21. newbro_cli-0.1.0/src/synapse/api/routes/health.py +8 -0
  22. newbro_cli-0.1.0/src/synapse/api/routes/interaction_requests.py +59 -0
  23. newbro_cli-0.1.0/src/synapse/api/routes/messages.py +46 -0
  24. newbro_cli-0.1.0/src/synapse/api/routes/personas.py +124 -0
  25. newbro_cli-0.1.0/src/synapse/api/routes/session_config.py +64 -0
  26. newbro_cli-0.1.0/src/synapse/api/routes/sessions.py +129 -0
  27. newbro_cli-0.1.0/src/synapse/api/ws/__init__.py +1 -0
  28. newbro_cli-0.1.0/src/synapse/api/ws/executors.py +69 -0
  29. newbro_cli-0.1.0/src/synapse/api/ws/stream.py +363 -0
  30. newbro_cli-0.1.0/src/synapse/blackboard/__init__.py +14 -0
  31. newbro_cli-0.1.0/src/synapse/blackboard/backends/__init__.py +5 -0
  32. newbro_cli-0.1.0/src/synapse/blackboard/backends/memory.py +491 -0
  33. newbro_cli-0.1.0/src/synapse/blackboard/interfaces.py +167 -0
  34. newbro_cli-0.1.0/src/synapse/blackboard/queries.py +31 -0
  35. newbro_cli-0.1.0/src/synapse/blackboard/revisions.py +30 -0
  36. newbro_cli-0.1.0/src/synapse/blackboard/store.py +31 -0
  37. newbro_cli-0.1.0/src/synapse/blackboard/subscriptions.py +23 -0
  38. newbro_cli-0.1.0/src/synapse/cli/__init__.py +5 -0
  39. newbro_cli-0.1.0/src/synapse/cli/main.py +1958 -0
  40. newbro_cli-0.1.0/src/synapse/communication/__init__.py +6 -0
  41. newbro_cli-0.1.0/src/synapse/communication/brain.py +1274 -0
  42. newbro_cli-0.1.0/src/synapse/communication/context.py +219 -0
  43. newbro_cli-0.1.0/src/synapse/communication/history.py +80 -0
  44. newbro_cli-0.1.0/src/synapse/communication/model.py +107 -0
  45. newbro_cli-0.1.0/src/synapse/communication/models/__init__.py +4 -0
  46. newbro_cli-0.1.0/src/synapse/communication/models/openai.py +331 -0
  47. newbro_cli-0.1.0/src/synapse/communication/models/scripted.py +167 -0
  48. newbro_cli-0.1.0/src/synapse/communication/persona_pool.py +200 -0
  49. newbro_cli-0.1.0/src/synapse/communication/policies/__init__.py +4 -0
  50. newbro_cli-0.1.0/src/synapse/communication/policies/reply_style.py +59 -0
  51. newbro_cli-0.1.0/src/synapse/communication/policies/tool_usage_policy.py +10 -0
  52. newbro_cli-0.1.0/src/synapse/communication/prompts/__init__.py +3 -0
  53. newbro_cli-0.1.0/src/synapse/communication/prompts/base/__init__.py +1 -0
  54. newbro_cli-0.1.0/src/synapse/communication/prompts/base/guardrails.py +6 -0
  55. newbro_cli-0.1.0/src/synapse/communication/prompts/base/identity.py +7 -0
  56. newbro_cli-0.1.0/src/synapse/communication/prompts/base/persona_identity.py +21 -0
  57. newbro_cli-0.1.0/src/synapse/communication/prompts/base/reply_style.py +6 -0
  58. newbro_cli-0.1.0/src/synapse/communication/prompts/base/tool_policy.py +57 -0
  59. newbro_cli-0.1.0/src/synapse/communication/prompts/builders.py +168 -0
  60. newbro_cli-0.1.0/src/synapse/communication/prompts/examples/__init__.py +1 -0
  61. newbro_cli-0.1.0/src/synapse/communication/prompts/examples/notification_style.py +11 -0
  62. newbro_cli-0.1.0/src/synapse/communication/prompts/examples/tool_usage.py +60 -0
  63. newbro_cli-0.1.0/src/synapse/communication/prompts/runtime_context.py +199 -0
  64. newbro_cli-0.1.0/src/synapse/communication/prompts/tasks/__init__.py +1 -0
  65. newbro_cli-0.1.0/src/synapse/communication/prompts/tasks/normal_reply.py +40 -0
  66. newbro_cli-0.1.0/src/synapse/communication/prompts/tasks/proactive_notification.py +14 -0
  67. newbro_cli-0.1.0/src/synapse/communication/resolver.py +156 -0
  68. newbro_cli-0.1.0/src/synapse/communication/tools/__init__.py +256 -0
  69. newbro_cli-0.1.0/src/synapse/communication/tools/add_constraint.py +63 -0
  70. newbro_cli-0.1.0/src/synapse/communication/tools/add_task_note.py +59 -0
  71. newbro_cli-0.1.0/src/synapse/communication/tools/base.py +22 -0
  72. newbro_cli-0.1.0/src/synapse/communication/tools/control_task.py +82 -0
  73. newbro_cli-0.1.0/src/synapse/communication/tools/create_task.py +127 -0
  74. newbro_cli-0.1.0/src/synapse/communication/tools/list_tasks.py +53 -0
  75. newbro_cli-0.1.0/src/synapse/communication/tools/query_task_detail.py +57 -0
  76. newbro_cli-0.1.0/src/synapse/communication/tools/query_task_summary.py +34 -0
  77. newbro_cli-0.1.0/src/synapse/communication/tools/resolve_interaction_request.py +67 -0
  78. newbro_cli-0.1.0/src/synapse/communication/tools/update_task.py +109 -0
  79. newbro_cli-0.1.0/src/synapse/communication/types.py +22 -0
  80. newbro_cli-0.1.0/src/synapse/config_home.py +72 -0
  81. newbro_cli-0.1.0/src/synapse/connectors/__init__.py +1 -0
  82. newbro_cli-0.1.0/src/synapse/connectors/base/__init__.py +20 -0
  83. newbro_cli-0.1.0/src/synapse/connectors/base/bindings.py +145 -0
  84. newbro_cli-0.1.0/src/synapse/connectors/base/module.py +48 -0
  85. newbro_cli-0.1.0/src/synapse/connectors/base/transport.py +202 -0
  86. newbro_cli-0.1.0/src/synapse/connectors/host/__init__.py +17 -0
  87. newbro_cli-0.1.0/src/synapse/connectors/host/app.py +60 -0
  88. newbro_cli-0.1.0/src/synapse/connectors/host/catalog.py +29 -0
  89. newbro_cli-0.1.0/src/synapse/connectors/host/config.py +164 -0
  90. newbro_cli-0.1.0/src/synapse/connectors/host/registry.py +21 -0
  91. newbro_cli-0.1.0/src/synapse/connectors/voice/__init__.py +1 -0
  92. newbro_cli-0.1.0/src/synapse/connectors/voice/agora_convoai/__init__.py +20 -0
  93. newbro_cli-0.1.0/src/synapse/connectors/voice/agora_convoai/app.py +4 -0
  94. newbro_cli-0.1.0/src/synapse/connectors/voice/agora_convoai/models.py +116 -0
  95. newbro_cli-0.1.0/src/synapse/connectors/voice/agora_convoai/module.py +391 -0
  96. newbro_cli-0.1.0/src/synapse/connectors/voice/agora_convoai/service.py +513 -0
  97. newbro_cli-0.1.0/src/synapse/connectors/voice/agora_convoai/session_service.py +286 -0
  98. newbro_cli-0.1.0/src/synapse/connectors/voice/agora_convoai/settings.py +223 -0
  99. newbro_cli-0.1.0/src/synapse/connectors/voice/agora_convoai/token_utils.py +153 -0
  100. newbro_cli-0.1.0/src/synapse/envfile.py +25 -0
  101. newbro_cli-0.1.0/src/synapse/execution/__init__.py +21 -0
  102. newbro_cli-0.1.0/src/synapse/execution/assignment.py +53 -0
  103. newbro_cli-0.1.0/src/synapse/execution/brain.py +45 -0
  104. newbro_cli-0.1.0/src/synapse/execution/mode_manager.py +105 -0
  105. newbro_cli-0.1.0/src/synapse/execution/reconcile.py +178 -0
  106. newbro_cli-0.1.0/src/synapse/execution/run_manager.py +184 -0
  107. newbro_cli-0.1.0/src/synapse/execution/scheduler.py +13 -0
  108. newbro_cli-0.1.0/src/synapse/execution/session_manager.py +122 -0
  109. newbro_cli-0.1.0/src/synapse/execution/summary_manager.py +84 -0
  110. newbro_cli-0.1.0/src/synapse/executors/__init__.py +1 -0
  111. newbro_cli-0.1.0/src/synapse/executors/adapters/__init__.py +17 -0
  112. newbro_cli-0.1.0/src/synapse/executors/adapters/acpx/__init__.py +4 -0
  113. newbro_cli-0.1.0/src/synapse/executors/adapters/acpx/executor.py +610 -0
  114. newbro_cli-0.1.0/src/synapse/executors/adapters/acpx/session.py +117 -0
  115. newbro_cli-0.1.0/src/synapse/executors/adapters/codex/__init__.py +4 -0
  116. newbro_cli-0.1.0/src/synapse/executors/adapters/codex/client.py +182 -0
  117. newbro_cli-0.1.0/src/synapse/executors/adapters/codex/executor.py +455 -0
  118. newbro_cli-0.1.0/src/synapse/executors/adapters/codex/jsonrpc.py +108 -0
  119. newbro_cli-0.1.0/src/synapse/executors/adapters/codex/session.py +124 -0
  120. newbro_cli-0.1.0/src/synapse/executors/adapters/hosted/__init__.py +3 -0
  121. newbro_cli-0.1.0/src/synapse/executors/adapters/hosted/executor.py +95 -0
  122. newbro_cli-0.1.0/src/synapse/executors/adapters/mock/__init__.py +5 -0
  123. newbro_cli-0.1.0/src/synapse/executors/adapters/mock/config.py +7 -0
  124. newbro_cli-0.1.0/src/synapse/executors/adapters/mock/executor.py +91 -0
  125. newbro_cli-0.1.0/src/synapse/executors/adapters/mock/session.py +7 -0
  126. newbro_cli-0.1.0/src/synapse/executors/core/__init__.py +19 -0
  127. newbro_cli-0.1.0/src/synapse/executors/core/capabilities.py +12 -0
  128. newbro_cli-0.1.0/src/synapse/executors/core/events.py +22 -0
  129. newbro_cli-0.1.0/src/synapse/executors/core/executor.py +32 -0
  130. newbro_cli-0.1.0/src/synapse/executors/core/registry.py +28 -0
  131. newbro_cli-0.1.0/src/synapse/executors/core/results.py +12 -0
  132. newbro_cli-0.1.0/src/synapse/executors/core/session.py +12 -0
  133. newbro_cli-0.1.0/src/synapse/executors/node/__init__.py +15 -0
  134. newbro_cli-0.1.0/src/synapse/executors/node/__main__.py +43 -0
  135. newbro_cli-0.1.0/src/synapse/executors/node/config.py +130 -0
  136. newbro_cli-0.1.0/src/synapse/executors/node/registry.py +310 -0
  137. newbro_cli-0.1.0/src/synapse/executors/node/service.py +397 -0
  138. newbro_cli-0.1.0/src/synapse/infrastructure/__init__.py +1 -0
  139. newbro_cli-0.1.0/src/synapse/infrastructure/llm/__init__.py +3 -0
  140. newbro_cli-0.1.0/src/synapse/infrastructure/llm/openai_provider.py +454 -0
  141. newbro_cli-0.1.0/src/synapse/interaction/__init__.py +3 -0
  142. newbro_cli-0.1.0/src/synapse/interaction/manager.py +353 -0
  143. newbro_cli-0.1.0/src/synapse/interaction/sanitization.py +76 -0
  144. newbro_cli-0.1.0/src/synapse/notification/__init__.py +14 -0
  145. newbro_cli-0.1.0/src/synapse/notification/candidate_builder.py +136 -0
  146. newbro_cli-0.1.0/src/synapse/notification/manager.py +179 -0
  147. newbro_cli-0.1.0/src/synapse/notification/policy.py +91 -0
  148. newbro_cli-0.1.0/src/synapse/observability/__init__.py +25 -0
  149. newbro_cli-0.1.0/src/synapse/observability/bootstrap.py +146 -0
  150. newbro_cli-0.1.0/src/synapse/observability/context.py +47 -0
  151. newbro_cli-0.1.0/src/synapse/observability/emitters/__init__.py +29 -0
  152. newbro_cli-0.1.0/src/synapse/observability/emitters/api.py +87 -0
  153. newbro_cli-0.1.0/src/synapse/observability/emitters/blackboard.py +76 -0
  154. newbro_cli-0.1.0/src/synapse/observability/emitters/communication.py +178 -0
  155. newbro_cli-0.1.0/src/synapse/observability/emitters/execution.py +154 -0
  156. newbro_cli-0.1.0/src/synapse/observability/emitters/notification.py +111 -0
  157. newbro_cli-0.1.0/src/synapse/observability/logger.py +73 -0
  158. newbro_cli-0.1.0/src/synapse/observability/reason_codes.py +14 -0
  159. newbro_cli-0.1.0/src/synapse/observability/redaction.py +117 -0
  160. newbro_cli-0.1.0/src/synapse/observability/schema.py +57 -0
  161. newbro_cli-0.1.0/src/synapse/observability/sinks/__init__.py +4 -0
  162. newbro_cli-0.1.0/src/synapse/observability/sinks/pretty.py +216 -0
  163. newbro_cli-0.1.0/src/synapse/observability/sinks/stdout.py +16 -0
  164. newbro_cli-0.1.0/src/synapse/observability/sinks/types.py +10 -0
  165. newbro_cli-0.1.0/src/synapse/observability/store.py +85 -0
  166. newbro_cli-0.1.0/src/synapse/protocol/__init__.py +97 -0
  167. newbro_cli-0.1.0/src/synapse/protocol/assignment.py +9 -0
  168. newbro_cli-0.1.0/src/synapse/protocol/command.py +14 -0
  169. newbro_cli-0.1.0/src/synapse/protocol/enums.py +138 -0
  170. newbro_cli-0.1.0/src/synapse/protocol/execution_mode.py +12 -0
  171. newbro_cli-0.1.0/src/synapse/protocol/executor_node.py +120 -0
  172. newbro_cli-0.1.0/src/synapse/protocol/interaction.py +47 -0
  173. newbro_cli-0.1.0/src/synapse/protocol/interruption.py +13 -0
  174. newbro_cli-0.1.0/src/synapse/protocol/mutation.py +16 -0
  175. newbro_cli-0.1.0/src/synapse/protocol/notification.py +22 -0
  176. newbro_cli-0.1.0/src/synapse/protocol/persona.py +19 -0
  177. newbro_cli-0.1.0/src/synapse/protocol/run.py +20 -0
  178. newbro_cli-0.1.0/src/synapse/protocol/session.py +43 -0
  179. newbro_cli-0.1.0/src/synapse/protocol/summary.py +11 -0
  180. newbro_cli-0.1.0/src/synapse/protocol/task.py +22 -0
  181. newbro_cli-0.1.0/src/synapse/protocol/task_execution_detail.py +14 -0
  182. newbro_cli-0.1.0/src/synapse/runtime/__init__.py +28 -0
  183. newbro_cli-0.1.0/src/synapse/runtime/bootstrap.py +29 -0
  184. newbro_cli-0.1.0/src/synapse/runtime/config.py +209 -0
  185. newbro_cli-0.1.0/src/synapse/runtime/container.py +102 -0
  186. newbro_cli-0.1.0/src/synapse/runtime/executor_node_manager.py +477 -0
  187. newbro_cli-0.1.0/src/synapse/runtime/models.py +112 -0
  188. newbro_cli-0.1.0/src/synapse/runtime/session.py +1212 -0
  189. newbro_cli-0.1.0/src/synapse/service/__init__.py +3 -0
  190. newbro_cli-0.1.0/src/synapse/service/app.py +96 -0
  191. newbro_cli-0.1.0/src/synapse/yaml_support.py +136 -0
@@ -0,0 +1,333 @@
1
+ Metadata-Version: 2.4
2
+ Name: newbro-cli
3
+ Version: 0.1.0
4
+ Summary: Newbro CLI for the Synapse communication-brain / execution-brain runtime prototype
5
+ Project-URL: Repository, https://github.com/AgoraIO/Synapse
6
+ Project-URL: Documentation, https://github.com/AgoraIO/Synapse#readme
7
+ Keywords: newbro,synapse,cli,agent-runtime,communication-brain,execution-brain
8
+ Requires-Python: >=3.12
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: agora-agent-server-sdk>=1.1.1
11
+ Requires-Dist: agora-token-builder>=1.0.0
12
+ Requires-Dist: anyio<5,>=4.4
13
+ Requires-Dist: fastapi<1.0,>=0.115
14
+ Requires-Dist: httpx<1.0,>=0.27
15
+ Requires-Dist: openai<2.0,>=1.51
16
+ Requires-Dist: pydantic<3.0,>=2.8
17
+ Requires-Dist: PyYAML<7.0,>=6.0
18
+ Requires-Dist: python-dotenv<2.0,>=1.0
19
+ Requires-Dist: typing-extensions<5,>=4.12
20
+ Requires-Dist: uvicorn<1.0,>=0.30
21
+ Requires-Dist: websockets<16,>=13
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest<9.0,>=8.0; extra == "dev"
24
+ Requires-Dist: pytest-cov<6,>=5; extra == "dev"
25
+ Requires-Dist: pyright<2,>=1.1.380; extra == "dev"
26
+ Requires-Dist: ruff<1,>=0.6; extra == "dev"
27
+ Provides-Extra: release
28
+ Requires-Dist: build<2.0,>=1.2; extra == "release"
29
+ Requires-Dist: twine<7,>=5; extra == "release"
30
+
31
+ # Synapse
32
+
33
+ Backend-first prototype for a communication-brain / execution-brain runtime.
34
+
35
+ ## Concept
36
+
37
+ - `Communication Brain`: handles acknowledgement, clarification, and user-facing status.
38
+ - `Execution Brain`: owns task lifecycle and executor orchestration.
39
+ - `Shared Blackboard`: the session-level state synchronization layer.
40
+ - `Protocols`: explicit schemas for messages, tasks, execution events, and stream events.
41
+
42
+ ## CLI
43
+
44
+ Synapse requires Python 3.12 or newer.
45
+
46
+ For a fresh clone, use the repo bootstrap launcher:
47
+
48
+ ```bash
49
+ ./install.sh
50
+ ./newbro setup
51
+ ./newbro connector setup
52
+ ./newbro doctor
53
+ ./newbro dev
54
+ ```
55
+
56
+ `./install.sh` installs supported local development dependencies, creates `.venv`,
57
+ installs the project in editable mode, installs frontend dependencies, and writes
58
+ starter `~/.newbro/.env` plus `~/.newbro/config.yaml` files when they do not
59
+ already exist.
60
+
61
+ `./newbro setup` fills in `~/.newbro/.env` plus the shared
62
+ `~/.newbro/config.yaml` runtime/api/connectors config. By default it prompts for
63
+ required runtime values such as `OPENAI_API_KEY`, and it can also enter the
64
+ connector-host setup flow. For connector-only reconfiguration, use:
65
+
66
+ ```bash
67
+ ./newbro connector setup
68
+ ```
69
+
70
+ For automation, use:
71
+
72
+ ```bash
73
+ OPENAI_API_KEY=... ./newbro setup --non-interactive
74
+ ```
75
+
76
+ If you already have legacy Synapse config under `~/.synapse` and `~/.newbro`
77
+ does not exist yet, the CLI migrates that home directory to `~/.newbro` on the
78
+ first run.
79
+
80
+ ## Install From PyPI
81
+
82
+ Install the public package with:
83
+
84
+ ```bash
85
+ python3 -m pip install newbro-cli
86
+ newbro --help
87
+ newbro executor setup
88
+ newbro executor run --base-url https://synapse.example.com --node-id node-1234 --token secret
89
+ ```
90
+
91
+ The published package name is `newbro-cli` and the installed console script is
92
+ `newbro`, but the Python module namespace is still `synapse` in this release.
93
+ Use `import synapse` for Python imports; `import newbro` is not supported.
94
+
95
+ `~/.newbro/.env` is auto-loaded by the backend at startup. You do not need to export
96
+ variables manually. OpenAI is required for normal development and demo runtime,
97
+ so set `OPENAI_API_KEY` in `~/.newbro/.env` before starting the app.
98
+
99
+ ## Optional ACPX Executor
100
+
101
+ If you want Synapse to delegate execution through `acpx` instead of the direct
102
+ Codex executor, install ACPX first:
103
+
104
+ ```bash
105
+ npm install -g acpx@latest
106
+ ```
107
+
108
+ Quick verification:
109
+
110
+ ```bash
111
+ acpx --version
112
+ codex --version
113
+ ```
114
+
115
+ Then add at least this to `~/.newbro/.env`:
116
+
117
+ ```env
118
+ SYNAPSE_ACPX_EXECUTOR_ENABLED=true
119
+ ```
120
+
121
+ Optional overrides:
122
+
123
+ ```env
124
+ # SYNAPSE_ACPX_COMMAND=acpx
125
+ # SYNAPSE_ACPX_AGENT=codex
126
+ # SYNAPSE_ACPX_PERMISSION_MODE=approve-all
127
+ # SYNAPSE_ACPX_NON_INTERACTIVE_PERMISSIONS=deny
128
+ # SYNAPSE_ACPX_TIMEOUT_SECONDS=300
129
+ ```
130
+
131
+ If both ACPX and the direct Codex executor are enabled, Synapse prefers ACPX.
132
+
133
+ ## Common Commands
134
+
135
+ ```bash
136
+ ./install.sh
137
+ ./newbro setup
138
+ ./newbro connector setup
139
+ ./newbro doctor
140
+ ./newbro dev
141
+ ./newbro backend
142
+ ./newbro frontend
143
+ ./newbro start
144
+ ./newbro connector run
145
+ ./newbro service install
146
+ ./newbro service start
147
+ ./newbro service stop
148
+ ./newbro service restart
149
+ ```
150
+
151
+ The installed console script is named `newbro`, so after setup you can run
152
+ `.venv/bin/newbro dev` or activate the virtual environment and use `newbro dev`.
153
+
154
+ ## Run Backend
155
+
156
+ ```bash
157
+ ./newbro backend
158
+ ```
159
+
160
+ FastAPI docs will be available at:
161
+
162
+ ```text
163
+ http://127.0.0.1:8000/docs
164
+ ```
165
+
166
+ If the frontend shows `error` and messages do not progress, first confirm the
167
+ backend is running from the same virtual environment where dependencies were
168
+ installed.
169
+
170
+ To run only the frontend:
171
+
172
+ ```bash
173
+ ./newbro frontend
174
+ ```
175
+
176
+ To run only the headless connector host:
177
+
178
+ ```bash
179
+ ./newbro connector run
180
+ ```
181
+
182
+ ## Ubuntu Systemd
183
+
184
+ For an Ubuntu server deployment from a repo checkout, install the combined
185
+ system service with:
186
+
187
+ ```bash
188
+ ./newbro service install
189
+ ```
190
+
191
+ `./newbro service install` now installs or updates the unit, reloads systemd,
192
+ enables the unit, and restarts the service so the latest code is live
193
+ immediately.
194
+
195
+ The installed `newbro.service` unit runs `newbro start`, so it serves one
196
+ main Synapse service on the public port.
197
+
198
+ This path stays inside the repo checkout. The main service serves
199
+ `src/synapse/ui/dist` at `/`, keeps the normal API and websocket routes on the
200
+ same origin, and mounts `/api/connectors/...` routes directly when connectors are
201
+ enabled.
202
+
203
+ The systemd unit runs as the user who invoked `./newbro service install` and
204
+ reads shared runtime-plus-connector config from that user’s home directory:
205
+
206
+ ```text
207
+ ~/.newbro/.env
208
+ ~/.newbro/config.yaml
209
+ ```
210
+
211
+ If you install the service as `root`, it will run as `root` and use:
212
+
213
+ ```text
214
+ /root/.newbro/.env
215
+ /root/.newbro/config.yaml
216
+ ```
217
+
218
+ If the Codex executor is enabled, set an absolute
219
+ `runtime.codex_command` in `~/.newbro/config.yaml` so the service does not
220
+ depend on an interactive shell PATH.
221
+
222
+ `./newbro dev` and `./newbro start` do not auto-start the standalone connector
223
+ host. Run `./newbro connector run` separately when you want the detached connector
224
+ process for direct connector testing or separate deployment.
225
+
226
+ `./newbro dev` is the reload-capable local iteration path. `./newbro start`
227
+ does not reload Python code changes, so restart it after editing backend,
228
+ connector modules, or other Python service code.
229
+
230
+ The connector host talks to the Synapse backend directly using the configured
231
+ `SYNAPSE_CONNECTOR_SYNAPSE_BASE_URL` and does not use proxy environment variables
232
+ for its internal upstream traffic.
233
+
234
+ ## Test
235
+
236
+ ```bash
237
+ .venv/bin/python -m pytest
238
+ ```
239
+
240
+ Frontend build check:
241
+
242
+ ```bash
243
+ cd src/synapse/ui
244
+ npm run build
245
+ ```
246
+
247
+ Release build and publish:
248
+
249
+ ```bash
250
+ python3 -m pip install '.[release]'
251
+ python3 -m build
252
+ python3 -m twine check dist/*
253
+ python3 -m twine upload dist/*
254
+ ```
255
+
256
+ Or use the helper script:
257
+
258
+ ```bash
259
+ PYPI_TOKEN='pypi-...' ./scripts/publish_pypi.sh
260
+ PYPI_TOKEN='pypi-...' ./scripts/publish_pypi.sh --testpypi
261
+ ./scripts/publish_pypi.sh --dry-run
262
+ ```
263
+
264
+ ## Deploy UI to Vercel
265
+
266
+ The main UI lives under `src/synapse/ui/`.
267
+
268
+ Before deploying the frontend separately, make sure the backend is reachable on
269
+ its own public HTTPS origin, that the public backend origin preserves secure
270
+ websocket upgrades for `WS /api/sessions/{session_id}/stream`, and that the backend
271
+ allows the Vercel frontend origin through CORS:
272
+
273
+ ```env
274
+ SYNAPSE_CORS_ALLOWED_ORIGINS=https://app.example.com,https://your-project.vercel.app
275
+ ```
276
+
277
+ Then deploy from the UI workspace:
278
+
279
+ ```bash
280
+ cd src/synapse/ui
281
+ npx vercel env add VITE_API_BASE_URL production
282
+ npx vercel env add VITE_CONNECTOR_BASE_URL production
283
+ npx vercel --prod
284
+ ```
285
+
286
+ Set the production frontend base URLs to your public server origin, for
287
+ example:
288
+
289
+ ```text
290
+ VITE_API_BASE_URL=https://newbro.plutoless.com
291
+ VITE_CONNECTOR_BASE_URL=https://newbro.plutoless.com
292
+ ```
293
+
294
+ If you also use Vercel preview deployments, add the same variable for the
295
+ `preview` environment and include that preview origin in
296
+ `SYNAPSE_CORS_ALLOWED_ORIGINS`.
297
+
298
+ If the deployed UI enables voice mode, the connector host must also allow the
299
+ frontend origin. Configure that in `~/.newbro/config.yaml` under:
300
+
301
+ ```yaml
302
+ connector_host:
303
+ cors_allowed_origins:
304
+ - https://newbro.agora-io.czhen.work
305
+ ```
306
+
307
+ If the backend is served behind Nginx on your server, proxy the public session
308
+ routes to the main Synapse API on port `8000`, proxy `/api/connectors/...` to the
309
+ connector host on `8010`, and keep websocket upgrade headers intact for
310
+ `/api/sessions/{session_id}/stream`. See
311
+ [`docs/guides/vercel-ui-deployment.md`](./docs/guides/vercel-ui-deployment.md)
312
+ for the full deployment contract and an example reverse-proxy shape.
313
+
314
+ This repo also includes a GitHub Actions workflow at
315
+ `.github/workflows/deploy-ui-vercel.yml`:
316
+
317
+ - pull requests deploy a Vercel preview for `src/synapse/ui`
318
+ - pushes to `main` deploy production
319
+ - `workflow_dispatch` can trigger a manual production deploy
320
+
321
+ Before enabling that workflow, configure these GitHub repository settings:
322
+
323
+ - Actions secret: `VERCEL_TOKEN`
324
+ - Actions variable or secret: `VERCEL_ORG_ID`
325
+ - Actions variable or secret: `VERCEL_PROJECT_ID`
326
+
327
+ The production GitHub Actions deploy now injects
328
+ `VITE_API_BASE_URL=https://newbro.plutoless.com` and
329
+ `VITE_CONNECTOR_BASE_URL=https://newbro.plutoless.com` directly into the build so
330
+ the merge-to-`main` path does not depend on separate Vercel production env
331
+ entries.
332
+ If you also use manual Vercel CLI deploys outside GitHub Actions, keep the
333
+ Vercel project env aligned with those same values.
@@ -0,0 +1,303 @@
1
+ # Synapse
2
+
3
+ Backend-first prototype for a communication-brain / execution-brain runtime.
4
+
5
+ ## Concept
6
+
7
+ - `Communication Brain`: handles acknowledgement, clarification, and user-facing status.
8
+ - `Execution Brain`: owns task lifecycle and executor orchestration.
9
+ - `Shared Blackboard`: the session-level state synchronization layer.
10
+ - `Protocols`: explicit schemas for messages, tasks, execution events, and stream events.
11
+
12
+ ## CLI
13
+
14
+ Synapse requires Python 3.12 or newer.
15
+
16
+ For a fresh clone, use the repo bootstrap launcher:
17
+
18
+ ```bash
19
+ ./install.sh
20
+ ./newbro setup
21
+ ./newbro connector setup
22
+ ./newbro doctor
23
+ ./newbro dev
24
+ ```
25
+
26
+ `./install.sh` installs supported local development dependencies, creates `.venv`,
27
+ installs the project in editable mode, installs frontend dependencies, and writes
28
+ starter `~/.newbro/.env` plus `~/.newbro/config.yaml` files when they do not
29
+ already exist.
30
+
31
+ `./newbro setup` fills in `~/.newbro/.env` plus the shared
32
+ `~/.newbro/config.yaml` runtime/api/connectors config. By default it prompts for
33
+ required runtime values such as `OPENAI_API_KEY`, and it can also enter the
34
+ connector-host setup flow. For connector-only reconfiguration, use:
35
+
36
+ ```bash
37
+ ./newbro connector setup
38
+ ```
39
+
40
+ For automation, use:
41
+
42
+ ```bash
43
+ OPENAI_API_KEY=... ./newbro setup --non-interactive
44
+ ```
45
+
46
+ If you already have legacy Synapse config under `~/.synapse` and `~/.newbro`
47
+ does not exist yet, the CLI migrates that home directory to `~/.newbro` on the
48
+ first run.
49
+
50
+ ## Install From PyPI
51
+
52
+ Install the public package with:
53
+
54
+ ```bash
55
+ python3 -m pip install newbro-cli
56
+ newbro --help
57
+ newbro executor setup
58
+ newbro executor run --base-url https://synapse.example.com --node-id node-1234 --token secret
59
+ ```
60
+
61
+ The published package name is `newbro-cli` and the installed console script is
62
+ `newbro`, but the Python module namespace is still `synapse` in this release.
63
+ Use `import synapse` for Python imports; `import newbro` is not supported.
64
+
65
+ `~/.newbro/.env` is auto-loaded by the backend at startup. You do not need to export
66
+ variables manually. OpenAI is required for normal development and demo runtime,
67
+ so set `OPENAI_API_KEY` in `~/.newbro/.env` before starting the app.
68
+
69
+ ## Optional ACPX Executor
70
+
71
+ If you want Synapse to delegate execution through `acpx` instead of the direct
72
+ Codex executor, install ACPX first:
73
+
74
+ ```bash
75
+ npm install -g acpx@latest
76
+ ```
77
+
78
+ Quick verification:
79
+
80
+ ```bash
81
+ acpx --version
82
+ codex --version
83
+ ```
84
+
85
+ Then add at least this to `~/.newbro/.env`:
86
+
87
+ ```env
88
+ SYNAPSE_ACPX_EXECUTOR_ENABLED=true
89
+ ```
90
+
91
+ Optional overrides:
92
+
93
+ ```env
94
+ # SYNAPSE_ACPX_COMMAND=acpx
95
+ # SYNAPSE_ACPX_AGENT=codex
96
+ # SYNAPSE_ACPX_PERMISSION_MODE=approve-all
97
+ # SYNAPSE_ACPX_NON_INTERACTIVE_PERMISSIONS=deny
98
+ # SYNAPSE_ACPX_TIMEOUT_SECONDS=300
99
+ ```
100
+
101
+ If both ACPX and the direct Codex executor are enabled, Synapse prefers ACPX.
102
+
103
+ ## Common Commands
104
+
105
+ ```bash
106
+ ./install.sh
107
+ ./newbro setup
108
+ ./newbro connector setup
109
+ ./newbro doctor
110
+ ./newbro dev
111
+ ./newbro backend
112
+ ./newbro frontend
113
+ ./newbro start
114
+ ./newbro connector run
115
+ ./newbro service install
116
+ ./newbro service start
117
+ ./newbro service stop
118
+ ./newbro service restart
119
+ ```
120
+
121
+ The installed console script is named `newbro`, so after setup you can run
122
+ `.venv/bin/newbro dev` or activate the virtual environment and use `newbro dev`.
123
+
124
+ ## Run Backend
125
+
126
+ ```bash
127
+ ./newbro backend
128
+ ```
129
+
130
+ FastAPI docs will be available at:
131
+
132
+ ```text
133
+ http://127.0.0.1:8000/docs
134
+ ```
135
+
136
+ If the frontend shows `error` and messages do not progress, first confirm the
137
+ backend is running from the same virtual environment where dependencies were
138
+ installed.
139
+
140
+ To run only the frontend:
141
+
142
+ ```bash
143
+ ./newbro frontend
144
+ ```
145
+
146
+ To run only the headless connector host:
147
+
148
+ ```bash
149
+ ./newbro connector run
150
+ ```
151
+
152
+ ## Ubuntu Systemd
153
+
154
+ For an Ubuntu server deployment from a repo checkout, install the combined
155
+ system service with:
156
+
157
+ ```bash
158
+ ./newbro service install
159
+ ```
160
+
161
+ `./newbro service install` now installs or updates the unit, reloads systemd,
162
+ enables the unit, and restarts the service so the latest code is live
163
+ immediately.
164
+
165
+ The installed `newbro.service` unit runs `newbro start`, so it serves one
166
+ main Synapse service on the public port.
167
+
168
+ This path stays inside the repo checkout. The main service serves
169
+ `src/synapse/ui/dist` at `/`, keeps the normal API and websocket routes on the
170
+ same origin, and mounts `/api/connectors/...` routes directly when connectors are
171
+ enabled.
172
+
173
+ The systemd unit runs as the user who invoked `./newbro service install` and
174
+ reads shared runtime-plus-connector config from that user’s home directory:
175
+
176
+ ```text
177
+ ~/.newbro/.env
178
+ ~/.newbro/config.yaml
179
+ ```
180
+
181
+ If you install the service as `root`, it will run as `root` and use:
182
+
183
+ ```text
184
+ /root/.newbro/.env
185
+ /root/.newbro/config.yaml
186
+ ```
187
+
188
+ If the Codex executor is enabled, set an absolute
189
+ `runtime.codex_command` in `~/.newbro/config.yaml` so the service does not
190
+ depend on an interactive shell PATH.
191
+
192
+ `./newbro dev` and `./newbro start` do not auto-start the standalone connector
193
+ host. Run `./newbro connector run` separately when you want the detached connector
194
+ process for direct connector testing or separate deployment.
195
+
196
+ `./newbro dev` is the reload-capable local iteration path. `./newbro start`
197
+ does not reload Python code changes, so restart it after editing backend,
198
+ connector modules, or other Python service code.
199
+
200
+ The connector host talks to the Synapse backend directly using the configured
201
+ `SYNAPSE_CONNECTOR_SYNAPSE_BASE_URL` and does not use proxy environment variables
202
+ for its internal upstream traffic.
203
+
204
+ ## Test
205
+
206
+ ```bash
207
+ .venv/bin/python -m pytest
208
+ ```
209
+
210
+ Frontend build check:
211
+
212
+ ```bash
213
+ cd src/synapse/ui
214
+ npm run build
215
+ ```
216
+
217
+ Release build and publish:
218
+
219
+ ```bash
220
+ python3 -m pip install '.[release]'
221
+ python3 -m build
222
+ python3 -m twine check dist/*
223
+ python3 -m twine upload dist/*
224
+ ```
225
+
226
+ Or use the helper script:
227
+
228
+ ```bash
229
+ PYPI_TOKEN='pypi-...' ./scripts/publish_pypi.sh
230
+ PYPI_TOKEN='pypi-...' ./scripts/publish_pypi.sh --testpypi
231
+ ./scripts/publish_pypi.sh --dry-run
232
+ ```
233
+
234
+ ## Deploy UI to Vercel
235
+
236
+ The main UI lives under `src/synapse/ui/`.
237
+
238
+ Before deploying the frontend separately, make sure the backend is reachable on
239
+ its own public HTTPS origin, that the public backend origin preserves secure
240
+ websocket upgrades for `WS /api/sessions/{session_id}/stream`, and that the backend
241
+ allows the Vercel frontend origin through CORS:
242
+
243
+ ```env
244
+ SYNAPSE_CORS_ALLOWED_ORIGINS=https://app.example.com,https://your-project.vercel.app
245
+ ```
246
+
247
+ Then deploy from the UI workspace:
248
+
249
+ ```bash
250
+ cd src/synapse/ui
251
+ npx vercel env add VITE_API_BASE_URL production
252
+ npx vercel env add VITE_CONNECTOR_BASE_URL production
253
+ npx vercel --prod
254
+ ```
255
+
256
+ Set the production frontend base URLs to your public server origin, for
257
+ example:
258
+
259
+ ```text
260
+ VITE_API_BASE_URL=https://newbro.plutoless.com
261
+ VITE_CONNECTOR_BASE_URL=https://newbro.plutoless.com
262
+ ```
263
+
264
+ If you also use Vercel preview deployments, add the same variable for the
265
+ `preview` environment and include that preview origin in
266
+ `SYNAPSE_CORS_ALLOWED_ORIGINS`.
267
+
268
+ If the deployed UI enables voice mode, the connector host must also allow the
269
+ frontend origin. Configure that in `~/.newbro/config.yaml` under:
270
+
271
+ ```yaml
272
+ connector_host:
273
+ cors_allowed_origins:
274
+ - https://newbro.agora-io.czhen.work
275
+ ```
276
+
277
+ If the backend is served behind Nginx on your server, proxy the public session
278
+ routes to the main Synapse API on port `8000`, proxy `/api/connectors/...` to the
279
+ connector host on `8010`, and keep websocket upgrade headers intact for
280
+ `/api/sessions/{session_id}/stream`. See
281
+ [`docs/guides/vercel-ui-deployment.md`](./docs/guides/vercel-ui-deployment.md)
282
+ for the full deployment contract and an example reverse-proxy shape.
283
+
284
+ This repo also includes a GitHub Actions workflow at
285
+ `.github/workflows/deploy-ui-vercel.yml`:
286
+
287
+ - pull requests deploy a Vercel preview for `src/synapse/ui`
288
+ - pushes to `main` deploy production
289
+ - `workflow_dispatch` can trigger a manual production deploy
290
+
291
+ Before enabling that workflow, configure these GitHub repository settings:
292
+
293
+ - Actions secret: `VERCEL_TOKEN`
294
+ - Actions variable or secret: `VERCEL_ORG_ID`
295
+ - Actions variable or secret: `VERCEL_PROJECT_ID`
296
+
297
+ The production GitHub Actions deploy now injects
298
+ `VITE_API_BASE_URL=https://newbro.plutoless.com` and
299
+ `VITE_CONNECTOR_BASE_URL=https://newbro.plutoless.com` directly into the build so
300
+ the merge-to-`main` path does not depend on separate Vercel production env
301
+ entries.
302
+ If you also use manual Vercel CLI deploys outside GitHub Actions, keep the
303
+ Vercel project env aligned with those same values.
@@ -0,0 +1,54 @@
1
+ [project]
2
+ name = "newbro-cli"
3
+ version = "0.1.0"
4
+ description = "Newbro CLI for the Synapse communication-brain / execution-brain runtime prototype"
5
+ readme = "README.md"
6
+ requires-python = ">=3.12"
7
+ keywords = ["newbro", "synapse", "cli", "agent-runtime", "communication-brain", "execution-brain"]
8
+ dependencies = [
9
+ "agora-agent-server-sdk>=1.1.1",
10
+ "agora-token-builder>=1.0.0",
11
+ "anyio>=4.4,<5",
12
+ "fastapi>=0.115,<1.0",
13
+ "httpx>=0.27,<1.0",
14
+ "openai>=1.51,<2.0",
15
+ "pydantic>=2.8,<3.0",
16
+ "PyYAML>=6.0,<7.0",
17
+ "python-dotenv>=1.0,<2.0",
18
+ "typing-extensions>=4.12,<5",
19
+ "uvicorn>=0.30,<1.0",
20
+ "websockets>=13,<16",
21
+ ]
22
+
23
+ [project.optional-dependencies]
24
+ dev = [
25
+ "pytest>=8.0,<9.0",
26
+ "pytest-cov>=5,<6",
27
+ "pyright>=1.1.380,<2",
28
+ "ruff>=0.6,<1",
29
+ ]
30
+ release = [
31
+ "build>=1.2,<2.0",
32
+ "twine>=5,<7",
33
+ ]
34
+
35
+ [project.scripts]
36
+ newbro = "synapse.cli.main:main"
37
+
38
+ [project.urls]
39
+ Repository = "https://github.com/AgoraIO/Synapse"
40
+ Documentation = "https://github.com/AgoraIO/Synapse#readme"
41
+
42
+ [build-system]
43
+ requires = ["setuptools>=68"]
44
+ build-backend = "setuptools.build_meta"
45
+
46
+ [tool.setuptools]
47
+ package-dir = {"" = "src"}
48
+
49
+ [tool.setuptools.packages.find]
50
+ where = ["src"]
51
+ include = ["synapse*"]
52
+
53
+ [tool.pytest.ini_options]
54
+ testpaths = ["tests"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+