@tianshu-ai/local-bridge 0.6.1 → 0.6.2
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.
- package/app/TianshuBridge.swift +14 -2
- package/package.json +1 -1
package/app/TianshuBridge.swift
CHANGED
|
@@ -18,6 +18,7 @@ struct Config: Codable {
|
|
|
18
18
|
var token: String = ""
|
|
19
19
|
var engine: String = "own" // "own" | "stealth"
|
|
20
20
|
var headless: Bool = false
|
|
21
|
+
var shell: Bool = false // expose exec + file sync (opt-in)
|
|
21
22
|
var device: String = "" // empty → hostname
|
|
22
23
|
|
|
23
24
|
static var path: URL {
|
|
@@ -92,6 +93,7 @@ final class Bridge {
|
|
|
92
93
|
if !cfg.token.isEmpty { args += ["--token", cfg.token] }
|
|
93
94
|
if cfg.engine == "stealth" { args += ["--browser-engine", "stealth"] }
|
|
94
95
|
if cfg.headless { args += ["--headless"] }
|
|
96
|
+
if cfg.shell { args += ["--shell"] }
|
|
95
97
|
if !cfg.device.isEmpty { args += ["--device", cfg.device] }
|
|
96
98
|
|
|
97
99
|
let p = Process()
|
|
@@ -174,6 +176,7 @@ final class AppController: NSObject, NSApplicationDelegate {
|
|
|
174
176
|
menu.addItem(statusMI)
|
|
175
177
|
menu.addItem(NSMenuItem(title: "Server: \(cfg.server)", action: nil, keyEquivalent: ""))
|
|
176
178
|
let eng = cfg.engine == "stealth" ? "stealth" : "own"
|
|
179
|
+
menu.addItem(NSMenuItem(title: "Shell: \(cfg.shell ? "on" : "off")", action: nil, keyEquivalent: ""))
|
|
177
180
|
menu.addItem(NSMenuItem(title: "Browser: \(eng)\(cfg.headless ? " (headless)" : "")",
|
|
178
181
|
action: nil, keyEquivalent: ""))
|
|
179
182
|
menu.addItem(.separator())
|
|
@@ -217,6 +220,7 @@ final class AppController: NSObject, NSApplicationDelegate {
|
|
|
217
220
|
private var tokenField: NSTextField!
|
|
218
221
|
private var enginePopup: NSPopUpButton!
|
|
219
222
|
private var headlessCheck: NSButton!
|
|
223
|
+
private var shellCheck: NSButton!
|
|
220
224
|
|
|
221
225
|
private func makeSettingsView() -> NSView {
|
|
222
226
|
let v = NSView(frame: NSRect(x: 0, y: 0, width: 380, height: 300))
|
|
@@ -229,7 +233,7 @@ final class AppController: NSObject, NSApplicationDelegate {
|
|
|
229
233
|
paste.frame = NSRect(x: 16, y: 258, width: 200, height: 28)
|
|
230
234
|
paste.bezelStyle = .rounded
|
|
231
235
|
v.addSubview(paste)
|
|
232
|
-
let hint = NSTextField(labelWithString: "(copies server + token + browser settings)")
|
|
236
|
+
let hint = NSTextField(labelWithString: "(copies server + token + browser + shell settings)")
|
|
233
237
|
hint.frame = NSRect(x: 16, y: 238, width: 348, height: 16)
|
|
234
238
|
hint.font = NSFont.systemFont(ofSize: 10)
|
|
235
239
|
hint.textColor = .secondaryLabelColor
|
|
@@ -254,8 +258,14 @@ final class AppController: NSObject, NSApplicationDelegate {
|
|
|
254
258
|
headlessCheck.state = cfg.headless ? .on : .off
|
|
255
259
|
v.addSubview(headlessCheck)
|
|
256
260
|
|
|
261
|
+
shellCheck = NSButton(checkboxWithTitle: "Shell (run commands + sync files)", target: nil, action: nil)
|
|
262
|
+
shellCheck.frame = NSRect(x: 110, y: 70, width: 260, height: 20)
|
|
263
|
+
shellCheck.state = cfg.shell ? .on : .off
|
|
264
|
+
shellCheck.toolTip = "Exposes exec + file sync on your machine, jailed to ~/.tianshu_shell. Off by default; enable only for a server you trust."
|
|
265
|
+
v.addSubview(shellCheck)
|
|
266
|
+
|
|
257
267
|
let save = NSButton(title: "Save & Restart", target: self, action: #selector(saveSettings))
|
|
258
|
-
save.frame = NSRect(x: 200, y:
|
|
268
|
+
save.frame = NSRect(x: 200, y: 18, width: 160, height: 32)
|
|
259
269
|
save.bezelStyle = .rounded
|
|
260
270
|
v.addSubview(save)
|
|
261
271
|
return v
|
|
@@ -266,6 +276,7 @@ final class AppController: NSObject, NSApplicationDelegate {
|
|
|
266
276
|
cfg.token = tokenField.stringValue.trimmingCharacters(in: .whitespaces)
|
|
267
277
|
cfg.engine = enginePopup.indexOfSelectedItem == 1 ? "stealth" : "own"
|
|
268
278
|
cfg.headless = headlessCheck.state == .on
|
|
279
|
+
cfg.shell = shellCheck.state == .on
|
|
269
280
|
cfg.save()
|
|
270
281
|
configWindow?.close()
|
|
271
282
|
rebuildMenu()
|
|
@@ -295,6 +306,7 @@ final class AppController: NSObject, NSApplicationDelegate {
|
|
|
295
306
|
if let t = params["token"] { tokenField.stringValue = t }
|
|
296
307
|
if let e = params["engine"] { enginePopup.selectItem(at: e == "stealth" ? 1 : 0) }
|
|
297
308
|
if let h = params["headless"] { headlessCheck.state = (h == "1" || h == "true") ? .on : .off }
|
|
309
|
+
if let s = params["shell"] { shellCheck.state = (s == "1" || s == "true") ? .on : .off }
|
|
298
310
|
}
|
|
299
311
|
|
|
300
312
|
private func alert(_ title: String, _ body: String) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tianshu-ai/local-bridge",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "Local bridge for tianshu — dial into a tianshu server over WebSocket and expose your machine's tools (browser, files, shell) to the agent via reverse-MCP.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|