scios-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.
@@ -0,0 +1,191 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ Copyright 2024 Google LLC
180
+
181
+ Licensed under the Apache License, Version 2.0 (the "License");
182
+ you may not use this file except in compliance with the License.
183
+ You may obtain a copy of the License at
184
+
185
+ http://www.apache.org/licenses/LICENSE-2.0
186
+
187
+ Unless required by applicable law or agreed to in writing, software
188
+ distributed under the License is distributed on an "AS IS" BASIS,
189
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
190
+ See the License for the specific language governing permissions and
191
+ limitations under the License.
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: scios-cli
3
+ Version: 0.1.0
4
+ Summary: Scios Local Agent Workspace Sync CLI — bridge your terminal to the Scios Cloud backend
5
+ Author: Scios Team
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/google-octo/science-studio
8
+ Project-URL: Repository, https://github.com/google-octo/science-studio
9
+ Project-URL: Documentation, https://github.com/google-octo/science-studio/tree/main/packages/cli
10
+ Keywords: scios,cli,agent,sync,science,workflow
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: requests>=2.31.0
28
+ Requires-Dist: watchdog>=3.0.0
29
+ Dynamic: license-file
30
+
31
+ # Scios CLI 🚀
32
+
33
+ The local workspace engine bridging your terminal natively to the Scios Cloud backend.
34
+
35
+ Instead of hunting for logs scattered across web panels or modifying long agent prompts in narrow browser textboxes, you can now push a button on the Web UI to magically download the entire codebase to your machine and hot-reload changes as you type!
36
+
37
+ ## Overview
38
+ By installing this lightweight Python package, whenever you click the **"Open in Antigravity"** button in Scios Web:
39
+ 1. Your browser will spawn an interactive Terminal securely connected to your session.
40
+ 2. The entire project is downloaded and formatted into a structured local directory (`sync_<idea_id>/agents/`).
41
+ 3. You can use native VS Code, your own linter, and formatting extensions to iterate on the Agent architecture.
42
+ 4. When you press `CMD+S` locally, the `scios-cli` instantly pushes the diff back to the live Cloud instances seamlessly!
43
+
44
+ ---
45
+
46
+ ## 💻 Installation
47
+
48
+ Scios CLI requires **Python 3.9+** and can be quickly installed alongside your standard developer tools:
49
+
50
+ ```bash
51
+ # 1. Clone or step into the Scios project (if building from source)
52
+ cd packages/cli
53
+
54
+ # 2. Install the `scios-cli` pip package globally
55
+ pip install -e .
56
+ ```
57
+
58
+ ### Install Deep Link Handler (Critical) 🔗
59
+ Web Browsers strictly sandbox their environment for security. To enable true one-click magical execution without copying and pasting terminal commands, you must register the native OS Protocol handler (`scios://`).
60
+
61
+ Run this command **once** anywhere in your terminal after installation:
62
+
63
+ ```bash
64
+ scios-init
65
+ ```
66
+ This is fully cross-platform and will instantly register exactly what your OS needs:
67
+ - 🍎 **macOS**: An AppleScript wrapper app is loaded to Launch Services.
68
+ - 🐧 **Linux**: An `.desktop` MimeType handler explicitly set.
69
+ - 🪟 **Windows**: The protocol hooks injected correctly into `HKEY_CURRENT_USER`.
70
+
71
+ ---
72
+
73
+ ## 🏃 Usage & Workflow
74
+
75
+ ### 1. Activating the Live Sync
76
+ 1. In the Scios Web App, navigate to any specific **Idea** or Workflow node.
77
+ 2. Next to the "Run Pipeline" button in the header, click **Open in Antigravity**.
78
+ 3. A popup will ask you *"Allow this site to open SciosSync?"* — Click **Open**.
79
+
80
+ Your system Terminal will spawn, authenticate with your specific user session automatically behind the scenes, and print:
81
+ ```text
82
+ 🔗 Received Deep Link: scios://sync?id=...
83
+ ✨ Successfully pulled Scios project down over API.
84
+ 👀 Watching /sync_1234abcd/agents for live agent code changes... (Press Ctrl+C to exit)
85
+ ```
86
+
87
+ ### 2. Modifying Code Locally
88
+ Your OS will now have a `/sync_<idea_id>` directory precisely at the root of where your terminal spawned.
89
+ Simply drag that folder right into VS Code:
90
+ - Tweak the pandas logic, alter an LLM system prompt, or build an entire new reasoning strategy in `agents/MyAgent.py`.
91
+ - **Hit Save:** Your terminal will blink immediately: `✅ Successfully updated agent code over API!`
92
+
93
+ ### 3. Remote Triggering (`--local`)
94
+ If you don't want to use the web application to trigger an execution loop and you just want to launch your new logic:
95
+ ```bash
96
+ scios-sync 1234-5678-your-idea-id --endpoint "https://api.scios.ai/v1" --token "eyJh..." --local
97
+ ```
98
+ Passing `--local` directly triggers the Cloud APIs to launch that pipeline on the heavy GPUs immediately without ever having to touch a web button.
99
+
100
+ ---
101
+
102
+ ### Manual Fallback Commands
103
+ If for some reason your organization blocks Deep Links, the "Open in Antigravity" button also copies a fail-safe execution string to your OS Clipboard:
104
+ ```bash
105
+ scios-sync <idea_id> --endpoint "..." --token "..."
106
+ ```
107
+ You can simply paste this string straight into your terminal after installing the pip package to achieve exact feature parity!
@@ -0,0 +1,77 @@
1
+ # Scios CLI 🚀
2
+
3
+ The local workspace engine bridging your terminal natively to the Scios Cloud backend.
4
+
5
+ Instead of hunting for logs scattered across web panels or modifying long agent prompts in narrow browser textboxes, you can now push a button on the Web UI to magically download the entire codebase to your machine and hot-reload changes as you type!
6
+
7
+ ## Overview
8
+ By installing this lightweight Python package, whenever you click the **"Open in Antigravity"** button in Scios Web:
9
+ 1. Your browser will spawn an interactive Terminal securely connected to your session.
10
+ 2. The entire project is downloaded and formatted into a structured local directory (`sync_<idea_id>/agents/`).
11
+ 3. You can use native VS Code, your own linter, and formatting extensions to iterate on the Agent architecture.
12
+ 4. When you press `CMD+S` locally, the `scios-cli` instantly pushes the diff back to the live Cloud instances seamlessly!
13
+
14
+ ---
15
+
16
+ ## 💻 Installation
17
+
18
+ Scios CLI requires **Python 3.9+** and can be quickly installed alongside your standard developer tools:
19
+
20
+ ```bash
21
+ # 1. Clone or step into the Scios project (if building from source)
22
+ cd packages/cli
23
+
24
+ # 2. Install the `scios-cli` pip package globally
25
+ pip install -e .
26
+ ```
27
+
28
+ ### Install Deep Link Handler (Critical) 🔗
29
+ Web Browsers strictly sandbox their environment for security. To enable true one-click magical execution without copying and pasting terminal commands, you must register the native OS Protocol handler (`scios://`).
30
+
31
+ Run this command **once** anywhere in your terminal after installation:
32
+
33
+ ```bash
34
+ scios-init
35
+ ```
36
+ This is fully cross-platform and will instantly register exactly what your OS needs:
37
+ - 🍎 **macOS**: An AppleScript wrapper app is loaded to Launch Services.
38
+ - 🐧 **Linux**: An `.desktop` MimeType handler explicitly set.
39
+ - 🪟 **Windows**: The protocol hooks injected correctly into `HKEY_CURRENT_USER`.
40
+
41
+ ---
42
+
43
+ ## 🏃 Usage & Workflow
44
+
45
+ ### 1. Activating the Live Sync
46
+ 1. In the Scios Web App, navigate to any specific **Idea** or Workflow node.
47
+ 2. Next to the "Run Pipeline" button in the header, click **Open in Antigravity**.
48
+ 3. A popup will ask you *"Allow this site to open SciosSync?"* — Click **Open**.
49
+
50
+ Your system Terminal will spawn, authenticate with your specific user session automatically behind the scenes, and print:
51
+ ```text
52
+ 🔗 Received Deep Link: scios://sync?id=...
53
+ ✨ Successfully pulled Scios project down over API.
54
+ 👀 Watching /sync_1234abcd/agents for live agent code changes... (Press Ctrl+C to exit)
55
+ ```
56
+
57
+ ### 2. Modifying Code Locally
58
+ Your OS will now have a `/sync_<idea_id>` directory precisely at the root of where your terminal spawned.
59
+ Simply drag that folder right into VS Code:
60
+ - Tweak the pandas logic, alter an LLM system prompt, or build an entire new reasoning strategy in `agents/MyAgent.py`.
61
+ - **Hit Save:** Your terminal will blink immediately: `✅ Successfully updated agent code over API!`
62
+
63
+ ### 3. Remote Triggering (`--local`)
64
+ If you don't want to use the web application to trigger an execution loop and you just want to launch your new logic:
65
+ ```bash
66
+ scios-sync 1234-5678-your-idea-id --endpoint "https://api.scios.ai/v1" --token "eyJh..." --local
67
+ ```
68
+ Passing `--local` directly triggers the Cloud APIs to launch that pipeline on the heavy GPUs immediately without ever having to touch a web button.
69
+
70
+ ---
71
+
72
+ ### Manual Fallback Commands
73
+ If for some reason your organization blocks Deep Links, the "Open in Antigravity" button also copies a fail-safe execution string to your OS Clipboard:
74
+ ```bash
75
+ scios-sync <idea_id> --endpoint "..." --token "..."
76
+ ```
77
+ You can simply paste this string straight into your terminal after installing the pip package to achieve exact feature parity!
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "scios-cli"
7
+ version = "0.1.0"
8
+ description = "Scios Local Agent Workspace Sync CLI — bridge your terminal to the Scios Cloud backend"
9
+ readme = "README.md"
10
+ license = {text = "Apache-2.0"}
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ {name = "Scios Team"},
14
+ ]
15
+ keywords = ["scios", "cli", "agent", "sync", "science", "workflow"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: Science/Research",
20
+ "License :: OSI Approved :: Apache Software License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Programming Language :: Python :: 3.13",
27
+ "Topic :: Scientific/Engineering",
28
+ "Topic :: Software Development :: Libraries",
29
+ "Operating System :: OS Independent",
30
+ ]
31
+ dependencies = [
32
+ "requests>=2.31.0",
33
+ "watchdog>=3.0.0",
34
+ ]
35
+
36
+ [project.urls]
37
+ Homepage = "https://github.com/google-octo/science-studio"
38
+ Repository = "https://github.com/google-octo/science-studio"
39
+ Documentation = "https://github.com/google-octo/science-studio/tree/main/packages/cli"
40
+
41
+ [project.scripts]
42
+ scios-sync = "scios_cli.main:cli_entry"
43
+ scios-init = "scios_cli.install:cli_install_protocol"
44
+
45
+ [tool.setuptools.packages.find]
46
+ include = ["scios_cli*"]
File without changes
@@ -0,0 +1,126 @@
1
+ import os
2
+ import sys
3
+ import subprocess
4
+ from pathlib import Path
5
+ import stat
6
+
7
+ def install_mac():
8
+ print("🚀 Installing Scios Custom URI Handler (scios://) for macOS...")
9
+ app_dir = Path.home() / "Applications"
10
+ app_dir.mkdir(exist_ok=True)
11
+ scios_app = app_dir / "SciosSync.app"
12
+
13
+ applescript_code = """
14
+ on open location this_url
15
+ tell application "Terminal"
16
+ activate
17
+ do script "scios-sync '" & this_url & "'"
18
+ end tell
19
+ end open location
20
+ """
21
+ print(f"🏗️ Compiling AppleScript to {scios_app}...")
22
+ subprocess.run(["osacompile", "-o", str(scios_app)], input=applescript_code.encode("utf-8"), check=True)
23
+
24
+ info_plist_path = scios_app / "Contents" / "Info.plist"
25
+ try:
26
+ subprocess.run(["plutil", "-convert", "xml1", str(info_plist_path)], check=True)
27
+ with open(info_plist_path, "r") as f:
28
+ plist_data = f.read()
29
+
30
+ url_type_xml = """ <key>CFBundleURLTypes</key>
31
+ <array>
32
+ <dict>
33
+ <key>CFBundleURLName</key>
34
+ <string>com.scios.sync</string>
35
+ <key>CFBundleURLSchemes</key>
36
+ <array>
37
+ <string>scios</string>
38
+ </array>
39
+ </dict>
40
+ </array>
41
+ """
42
+ if "<key>CFBundleURLTypes</key>" not in plist_data:
43
+ plist_data = plist_data.replace("</dict>\n</plist>", url_type_xml + "</dict>\n</plist>")
44
+ with open(info_plist_path, "w") as f:
45
+ f.write(plist_data)
46
+ except Exception as e:
47
+ print(f"❌ Failed to patch Info.plist: {e}")
48
+ sys.exit(1)
49
+
50
+ print(f"🔄 Registering app with macOS Launch Services...")
51
+ lsregister = "/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister"
52
+ if os.path.exists(lsregister):
53
+ subprocess.run([lsregister, "-f", str(scios_app)], check=True)
54
+ else:
55
+ subprocess.run(["open", "-R", str(scios_app)], check=True)
56
+ print(f"✅ Successfully installed Scios Protocol handler at {scios_app}")
57
+
58
+
59
+ def install_linux():
60
+ print("🚀 Installing Scios Custom URI Handler (scios://) for Linux...")
61
+ apps_dir = Path.home() / ".local" / "share" / "applications"
62
+ apps_dir.mkdir(exist_ok=True, parents=True)
63
+
64
+ desktop_file = apps_dir / "scios-sync.desktop"
65
+
66
+ desktop_content = """[Desktop Entry]
67
+ Name=Scios Sync Local Handler
68
+ Exec=scios-sync %u
69
+ Type=Application
70
+ Terminal=true
71
+ MimeType=x-scheme-handler/scios;
72
+ """
73
+ with open(desktop_file, "w") as f:
74
+ f.write(desktop_content)
75
+
76
+ os.chmod(desktop_file, os.stat(desktop_file).st_mode | stat.S_IEXEC)
77
+
78
+ print("🔄 Registering x-scheme-handler with xdg-mime...")
79
+ try:
80
+ subprocess.run(["xdg-mime", "default", "scios-sync.desktop", "x-scheme-handler/scios"], check=True)
81
+ subprocess.run(["update-desktop-database", str(apps_dir)], check=False)
82
+ print(f"✅ Successfully installed Scios Protocol handler at {desktop_file}")
83
+ except FileNotFoundError:
84
+ print("⚠️ xdg-mime or update-desktop-database not found. Is this a GUI Linux environment?")
85
+ print(f"✅ Desktop file created manually at {desktop_file}")
86
+
87
+
88
+ def install_windows():
89
+ print("🚀 Installing Scios Custom URI Handler (scios://) for Windows...")
90
+ import winreg
91
+
92
+ try:
93
+ # Create HKEY_CURRENT_USER\Software\Classes\scios
94
+ key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, r"Software\Classes\scios")
95
+ winreg.SetValue(key, "", winreg.REG_SZ, "URL:Scios Custom Protocol")
96
+ winreg.SetValueEx(key, "URL Protocol", 0, winreg.REG_SZ, "")
97
+
98
+ # Create shell\open\command
99
+ cmd_key = winreg.CreateKey(key, r"shell\open\command")
100
+ # Use cmd.exe /k to keep the window open after execution
101
+ winreg.SetValue(cmd_key, "", winreg.REG_SZ, f'cmd.exe /k scios-sync "%1"')
102
+
103
+ winreg.CloseKey(cmd_key)
104
+ winreg.CloseKey(key)
105
+ print("✅ Successfully installed Scios Protocol handler in Windows Registry!")
106
+ except Exception as e:
107
+ print(f"❌ Failed to modify registry: {e}")
108
+ print("You may need to run this command as Administrator.")
109
+ sys.exit(1)
110
+
111
+
112
+ def cli_install_protocol():
113
+ if sys.platform == "darwin":
114
+ install_mac()
115
+ elif sys.platform.startswith("linux"):
116
+ install_linux()
117
+ elif sys.platform == "win32":
118
+ install_windows()
119
+ else:
120
+ print(f"❌ Unsupported platform: {sys.platform}")
121
+ sys.exit(1)
122
+
123
+ print("\n🎉 You can now click 'Open in Antigravity' buttons securely on the Web UI.")
124
+
125
+ if __name__ == "__main__":
126
+ cli_install_protocol()
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env python3
2
+ import time
3
+ import argparse
4
+ import sys
5
+ import json
6
+ import base64
7
+ from pathlib import Path
8
+
9
+ try:
10
+ import requests
11
+ from watchdog.observers import Observer
12
+ from watchdog.events import FileSystemEventHandler
13
+ except ImportError:
14
+ print("Dependencies missing! Run: pip install requests watchdog")
15
+ sys.exit(1)
16
+
17
+ def setup_vscode_workspace(workspace_dir: Path):
18
+ vscode_dir = workspace_dir / ".vscode"
19
+ vscode_dir.mkdir(exist_ok=True, parents=True)
20
+ settings = {
21
+ "python.analysis.extraPaths": ["./agents"],
22
+ "editor.formatOnSave": True
23
+ }
24
+ with open(vscode_dir / "settings.json", "w") as f:
25
+ json.dump(settings, f, indent=4)
26
+
27
+ def generate_trace_summary(trace_data: dict, output_path: Path):
28
+ if not trace_data or "node_executions" not in trace_data:
29
+ return
30
+ try:
31
+ nodes = trace_data.get("node_executions", [])
32
+ with open(output_path, "w") as f:
33
+ f.write("# Execution Trace Summary\n\n| Node | Agent Name | Status | Duration (s) | Error |\n|------|------------|--------|--------------|-------|\n")
34
+ for node in nodes:
35
+ node_id = node.get("node_id", "Unknown")
36
+ agent_name = node.get("agent_name", "N/A")
37
+ status = node.get("status", "unknown")
38
+ duration = round(node.get("duration", 0), 2)
39
+ error_str = str(node.get("error", "")).replace("\n", " ")[:100]
40
+ f.write(f"| `{node_id}` | **{agent_name}** | {status} | {duration} | {error_str} |\n")
41
+ except Exception as e:
42
+ print(f"Failed to generate trace summary: {e}")
43
+
44
+ class AgentSyncHandler(FileSystemEventHandler):
45
+ def __init__(self, endpoint: str, headers: dict):
46
+ self.endpoint = endpoint
47
+ self.headers = headers
48
+ self.last_syncs = {}
49
+
50
+ def on_modified(self, event):
51
+ if event.is_directory or not event.src_path.endswith('.py'):
52
+ return
53
+
54
+ current_time = time.time()
55
+ if current_time - self.last_syncs.get(event.src_path, 0) < 1.0:
56
+ return # Debounce updates
57
+
58
+ self.last_syncs[event.src_path] = current_time
59
+ self.sync_file(Path(event.src_path))
60
+
61
+ def sync_file(self, file_path: Path):
62
+ try:
63
+ with open(file_path, "r") as f:
64
+ content = f.read()
65
+
66
+ first_line = content.split('\n')[0]
67
+ if not first_line.startswith("# AGENT_ID:"):
68
+ return
69
+
70
+ agent_id = first_line.replace("# AGENT_ID:", "").strip()
71
+ print(f"\n📝 Change detected in {file_path.name}! Syncing to Scios cloud...")
72
+
73
+ res = requests.patch(
74
+ f"{self.endpoint}/agents/{agent_id}/code",
75
+ headers=self.headers,
76
+ json={"code_content": content}
77
+ )
78
+
79
+ if res.status_code in (200, 204):
80
+ print(f"✅ Successfully updated agent code over API!")
81
+ else:
82
+ print(f"❌ Error syncing {file_path.name}: {res.status_code} - {res.text}")
83
+
84
+ except Exception as e:
85
+ print(f"❌ Error reading {file_path.name}: {e}")
86
+
87
+ def cli_entry():
88
+ # Detect Deep Link Intercept from our MacOS Handler App
89
+ import urllib.parse
90
+ if len(sys.argv) == 2 and sys.argv[1].startswith("scios://sync"):
91
+ url = sys.argv[1]
92
+ print(f"🔗 Received Deep Link: {url[:30]}...")
93
+ parsed = urllib.parse.urlparse(url)
94
+ qs = urllib.parse.parse_qs(parsed.query)
95
+ sys.argv = [
96
+ sys.argv[0],
97
+ qs.get('id', [''])[0],
98
+ '--endpoint', qs.get('endpoint', [''])[0],
99
+ '--token', qs.get('token', [''])[0]
100
+ ]
101
+ if 'local' in qs and qs['local'][0].lower() == 'true':
102
+ sys.argv.append('--local')
103
+
104
+ parser = argparse.ArgumentParser(description="Scios Public CLI - Local Agent Sync")
105
+ parser.add_argument("idea_id", help="UUID of the Idea to mount")
106
+ parser.add_argument("--endpoint", required=True, help="Base API endpoint (e.g., https://api.scios.ai/api/v1)")
107
+ parser.add_argument("--token", required=True, help="Authentication Bearer token")
108
+ parser.add_argument("--local", action="store_true", help="Trigger execution via API instead of syncing")
109
+ args = parser.parse_args()
110
+
111
+ headers = {
112
+ "Authorization": f"Bearer {args.token}",
113
+ "Content-Type": "application/json"
114
+ }
115
+
116
+ if args.local:
117
+ print(f"\n🚀 Launching Workflow Execution remotely via API...")
118
+ # To run execution we need active_workflow_id, let's fetch manifest first
119
+ res = requests.get(f"{args.endpoint}/ideas/{args.idea_id}/sync-manifest", headers=headers)
120
+ if res.status_code != 200:
121
+ print(f"❌ Failed to fetch workflow: {res.text}")
122
+ sys.exit(1)
123
+
124
+ manifest = res.json()
125
+ workflow_id = manifest["active_workflow_id"]
126
+
127
+ exec_res = requests.post(f"{args.endpoint}/workflows/{workflow_id}/execute", headers=headers, json={"input_data": {}})
128
+ if exec_res.status_code in (200, 201):
129
+ ex_id = exec_res.json().get("execution_id")
130
+ print(f"✅ Remote Execution Triggered: {ex_id}")
131
+ print("To view real-time logs, look at the Web UI 'Idea Details' panel.")
132
+ else:
133
+ print(f"❌ Failed to trigger execution: {exec_res.text}")
134
+ return
135
+
136
+ # Handle standard Sync
137
+ print(f"🔗 Connecting to Scios API ({args.endpoint}) for Idea {args.idea_id}...")
138
+ res = requests.get(f"{args.endpoint}/ideas/{args.idea_id}/sync-manifest", headers=headers)
139
+
140
+ if res.status_code != 200:
141
+ print(f"❌ Failed to retrieve sync manifest! Status: {res.status_code}")
142
+ print(res.text)
143
+ sys.exit(1)
144
+
145
+ data = res.json()
146
+ workspace_dir = Path.cwd() / f"sync_{args.idea_id}"
147
+ agents_dir = workspace_dir / "agents"
148
+ exec_dir = workspace_dir / "execution"
149
+ wf_dir = workspace_dir / "workflows"
150
+ data_dir = workspace_dir / "datasets"
151
+
152
+ for d in [workspace_dir, agents_dir, exec_dir, wf_dir, data_dir]:
153
+ d.mkdir(parents=True, exist_ok=True)
154
+ setup_vscode_workspace(workspace_dir)
155
+
156
+ if data.get("workflow_definition"):
157
+ with open(wf_dir / "definition.json", "w") as f:
158
+ json.dump(data["workflow_definition"], f, indent=2)
159
+
160
+ for agent in data.get("agents", []):
161
+ code = agent.get("vibe_code", {}).get("code")
162
+ if not code: continue
163
+ safe_name = "".join(c if c.isalnum() else "_" for c in agent["name"])
164
+ with open(agents_dir / f"{safe_name}.py", "w") as f:
165
+ f.write(f"# AGENT_ID: {agent['id']}\n{code}")
166
+ print(f"✓ Loaded {len(data.get('agents', []))} native agents into {agents_dir.name}/")
167
+
168
+ if data.get("execution"):
169
+ ex = data["execution"]
170
+ with open(exec_dir / "metrics.json", "w") as f:
171
+ json.dump(ex.get("metrics"), f, indent=2)
172
+ if ex.get("trace"):
173
+ with open(exec_dir / "trace.json", "w") as f:
174
+ json.dump(ex["trace"], f, indent=2)
175
+ generate_trace_summary(ex["trace"], exec_dir / "trace_summary.md")
176
+ if ex.get("logs"):
177
+ with open(exec_dir / "logs.json", "w") as f:
178
+ json.dump(ex["logs"], f, indent=2)
179
+
180
+ if data.get("datasets"):
181
+ for ds in data["datasets"]:
182
+ name = "".join(c if c.isalnum() or c in ".-_" else "_" for c in ds["name"])
183
+ if ds["type"] == "inline":
184
+ header, b64_data = ds["content"].split(",", 1)
185
+ raw = base64.b64decode(b64_data)
186
+ mode = "w" if "text" in ds["mime_type"] or ds["data_type"] in ["csv", "json"] else "wb"
187
+ with open(data_dir / name, mode) as f:
188
+ f.write(raw.decode('utf-8') if mode == "w" else raw)
189
+ elif ds["type"] == "gcs":
190
+ with open(data_dir / f"{name}.url", "w") as f:
191
+ f.write(f"[InternetShortcut]\nURL={ds['content']}\n# ID: {ds['id']}")
192
+ else:
193
+ with open(data_dir / f"{name}.metadata.json", "w") as f:
194
+ json.dump(ds, f, indent=2)
195
+
196
+ print(f"✨ Successfully pulled Scios project down over API.")
197
+ print(f"\n👀 Watching {agents_dir} for live agent code changes... (Press Ctrl+C to exit)")
198
+
199
+ observer = Observer()
200
+ observer.schedule(AgentSyncHandler(args.endpoint, headers), str(agents_dir), recursive=False)
201
+ observer.start()
202
+
203
+ try:
204
+ while True:
205
+ time.sleep(1)
206
+ except KeyboardInterrupt:
207
+ observer.stop()
208
+ print("\nStopping watcher...")
209
+ observer.join()
210
+
211
+ if __name__ == "__main__":
212
+ cli_entry()
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: scios-cli
3
+ Version: 0.1.0
4
+ Summary: Scios Local Agent Workspace Sync CLI — bridge your terminal to the Scios Cloud backend
5
+ Author: Scios Team
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/google-octo/science-studio
8
+ Project-URL: Repository, https://github.com/google-octo/science-studio
9
+ Project-URL: Documentation, https://github.com/google-octo/science-studio/tree/main/packages/cli
10
+ Keywords: scios,cli,agent,sync,science,workflow
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Software Development :: Libraries
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: requests>=2.31.0
28
+ Requires-Dist: watchdog>=3.0.0
29
+ Dynamic: license-file
30
+
31
+ # Scios CLI 🚀
32
+
33
+ The local workspace engine bridging your terminal natively to the Scios Cloud backend.
34
+
35
+ Instead of hunting for logs scattered across web panels or modifying long agent prompts in narrow browser textboxes, you can now push a button on the Web UI to magically download the entire codebase to your machine and hot-reload changes as you type!
36
+
37
+ ## Overview
38
+ By installing this lightweight Python package, whenever you click the **"Open in Antigravity"** button in Scios Web:
39
+ 1. Your browser will spawn an interactive Terminal securely connected to your session.
40
+ 2. The entire project is downloaded and formatted into a structured local directory (`sync_<idea_id>/agents/`).
41
+ 3. You can use native VS Code, your own linter, and formatting extensions to iterate on the Agent architecture.
42
+ 4. When you press `CMD+S` locally, the `scios-cli` instantly pushes the diff back to the live Cloud instances seamlessly!
43
+
44
+ ---
45
+
46
+ ## 💻 Installation
47
+
48
+ Scios CLI requires **Python 3.9+** and can be quickly installed alongside your standard developer tools:
49
+
50
+ ```bash
51
+ # 1. Clone or step into the Scios project (if building from source)
52
+ cd packages/cli
53
+
54
+ # 2. Install the `scios-cli` pip package globally
55
+ pip install -e .
56
+ ```
57
+
58
+ ### Install Deep Link Handler (Critical) 🔗
59
+ Web Browsers strictly sandbox their environment for security. To enable true one-click magical execution without copying and pasting terminal commands, you must register the native OS Protocol handler (`scios://`).
60
+
61
+ Run this command **once** anywhere in your terminal after installation:
62
+
63
+ ```bash
64
+ scios-init
65
+ ```
66
+ This is fully cross-platform and will instantly register exactly what your OS needs:
67
+ - 🍎 **macOS**: An AppleScript wrapper app is loaded to Launch Services.
68
+ - 🐧 **Linux**: An `.desktop` MimeType handler explicitly set.
69
+ - 🪟 **Windows**: The protocol hooks injected correctly into `HKEY_CURRENT_USER`.
70
+
71
+ ---
72
+
73
+ ## 🏃 Usage & Workflow
74
+
75
+ ### 1. Activating the Live Sync
76
+ 1. In the Scios Web App, navigate to any specific **Idea** or Workflow node.
77
+ 2. Next to the "Run Pipeline" button in the header, click **Open in Antigravity**.
78
+ 3. A popup will ask you *"Allow this site to open SciosSync?"* — Click **Open**.
79
+
80
+ Your system Terminal will spawn, authenticate with your specific user session automatically behind the scenes, and print:
81
+ ```text
82
+ 🔗 Received Deep Link: scios://sync?id=...
83
+ ✨ Successfully pulled Scios project down over API.
84
+ 👀 Watching /sync_1234abcd/agents for live agent code changes... (Press Ctrl+C to exit)
85
+ ```
86
+
87
+ ### 2. Modifying Code Locally
88
+ Your OS will now have a `/sync_<idea_id>` directory precisely at the root of where your terminal spawned.
89
+ Simply drag that folder right into VS Code:
90
+ - Tweak the pandas logic, alter an LLM system prompt, or build an entire new reasoning strategy in `agents/MyAgent.py`.
91
+ - **Hit Save:** Your terminal will blink immediately: `✅ Successfully updated agent code over API!`
92
+
93
+ ### 3. Remote Triggering (`--local`)
94
+ If you don't want to use the web application to trigger an execution loop and you just want to launch your new logic:
95
+ ```bash
96
+ scios-sync 1234-5678-your-idea-id --endpoint "https://api.scios.ai/v1" --token "eyJh..." --local
97
+ ```
98
+ Passing `--local` directly triggers the Cloud APIs to launch that pipeline on the heavy GPUs immediately without ever having to touch a web button.
99
+
100
+ ---
101
+
102
+ ### Manual Fallback Commands
103
+ If for some reason your organization blocks Deep Links, the "Open in Antigravity" button also copies a fail-safe execution string to your OS Clipboard:
104
+ ```bash
105
+ scios-sync <idea_id> --endpoint "..." --token "..."
106
+ ```
107
+ You can simply paste this string straight into your terminal after installing the pip package to achieve exact feature parity!
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ scios_cli/__init__.py
6
+ scios_cli/install.py
7
+ scios_cli/main.py
8
+ scios_cli.egg-info/PKG-INFO
9
+ scios_cli.egg-info/SOURCES.txt
10
+ scios_cli.egg-info/dependency_links.txt
11
+ scios_cli.egg-info/entry_points.txt
12
+ scios_cli.egg-info/requires.txt
13
+ scios_cli.egg-info/top_level.txt
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ scios-init = scios_cli.install:cli_install_protocol
3
+ scios-sync = scios_cli.main:cli_entry
@@ -0,0 +1,2 @@
1
+ requests>=2.31.0
2
+ watchdog>=3.0.0
@@ -0,0 +1 @@
1
+ scios_cli
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,19 @@
1
+ from setuptools import setup, find_packages
2
+
3
+ setup(
4
+ name="scios-cli",
5
+ version="0.1.0",
6
+ description="Scios Local Agent Workspace Sync CLI",
7
+ author="Scios",
8
+ packages=find_packages(),
9
+ install_requires=[
10
+ "requests>=2.31.0",
11
+ "watchdog>=3.0.0"
12
+ ],
13
+ entry_points={
14
+ "console_scripts": [
15
+ "scios-sync=scios_cli.main:cli_entry",
16
+ "scios-init=scios_cli.install:cli_install_protocol",
17
+ ],
18
+ },
19
+ )