jishushell 0.4.24 → 0.4.30

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 (167) hide show
  1. package/INSTALL-NOTICE +11 -0
  2. package/apps/browserless-chromium-container.yaml +78 -0
  3. package/apps/hermes-container.yaml +36 -2
  4. package/apps/ollama-binary.yaml +91 -90
  5. package/apps/ollama-cpu-container.yaml +8 -1
  6. package/apps/ollama-with-hollama-binary.yaml +91 -90
  7. package/apps/openclaw-binary.yaml +30 -1
  8. package/apps/openclaw-container.yaml +37 -2
  9. package/apps/openclaw-with-ollama-container.yaml +11 -2
  10. package/apps/openclaw-with-searxng-container.yaml +22 -2
  11. package/apps/openwebui-container.yaml +45 -1
  12. package/apps/playwright-container.yaml +7 -1
  13. package/apps/searxng-container.yaml +54 -4
  14. package/dist/cli/app.js +79 -9
  15. package/dist/cli/app.js.map +1 -1
  16. package/dist/cli/doctor.d.ts +12 -12
  17. package/dist/cli/doctor.js +242 -55
  18. package/dist/cli/doctor.js.map +1 -1
  19. package/dist/cli/llm.d.ts +4 -3
  20. package/dist/cli/llm.js +4 -3
  21. package/dist/cli/llm.js.map +1 -1
  22. package/dist/cli/panel.d.ts +6 -5
  23. package/dist/cli/panel.js +10 -9
  24. package/dist/cli/panel.js.map +1 -1
  25. package/dist/control.d.ts +7 -6
  26. package/dist/control.js +7 -6
  27. package/dist/control.js.map +1 -1
  28. package/dist/routes/agent-apps.d.ts +1 -1
  29. package/dist/routes/agent-apps.js +1 -1
  30. package/dist/routes/apps.js +44 -11
  31. package/dist/routes/apps.js.map +1 -1
  32. package/dist/routes/auth.js +3 -0
  33. package/dist/routes/auth.js.map +1 -1
  34. package/dist/routes/instances.js +787 -16
  35. package/dist/routes/instances.js.map +1 -1
  36. package/dist/routes/llm.js +24 -35
  37. package/dist/routes/llm.js.map +1 -1
  38. package/dist/routes/setup.js +1 -1
  39. package/dist/routes/setup.js.map +1 -1
  40. package/dist/server.d.ts +9 -0
  41. package/dist/server.js +410 -17
  42. package/dist/server.js.map +1 -1
  43. package/dist/services/agent-apps/catalog.js +4 -3
  44. package/dist/services/agent-apps/catalog.js.map +1 -1
  45. package/dist/services/agent-apps/index.d.ts +1 -1
  46. package/dist/services/agent-apps/index.js +1 -1
  47. package/dist/services/agent-apps/installers/adapter.d.ts +1 -1
  48. package/dist/services/agent-apps/installers/adapter.js +1 -1
  49. package/dist/services/agent-apps/installers/shell-script.d.ts +1 -1
  50. package/dist/services/agent-apps/installers/shell-script.js +3 -3
  51. package/dist/services/agent-apps/installers/shell-script.js.map +1 -1
  52. package/dist/services/agent-apps/types.d.ts +2 -2
  53. package/dist/services/agent-apps/types.js +1 -1
  54. package/dist/services/app/app-manager.d.ts +24 -1
  55. package/dist/services/app/app-manager.js +664 -116
  56. package/dist/services/app/app-manager.js.map +1 -1
  57. package/dist/services/app/hermes-agent-manager.js +6 -4
  58. package/dist/services/app/hermes-agent-manager.js.map +1 -1
  59. package/dist/services/app/provide-resolver.d.ts +29 -0
  60. package/dist/services/app/provide-resolver.js +112 -0
  61. package/dist/services/app/provide-resolver.js.map +1 -0
  62. package/dist/services/capability-endpoint-validator.d.ts +41 -0
  63. package/dist/services/capability-endpoint-validator.js +104 -0
  64. package/dist/services/capability-endpoint-validator.js.map +1 -0
  65. package/dist/services/capability-health.d.ts +16 -0
  66. package/dist/services/capability-health.js +121 -0
  67. package/dist/services/capability-health.js.map +1 -0
  68. package/dist/services/capability-registry.d.ts +106 -0
  69. package/dist/services/capability-registry.js +313 -0
  70. package/dist/services/capability-registry.js.map +1 -0
  71. package/dist/services/connection-apply.d.ts +89 -0
  72. package/dist/services/connection-apply.js +421 -0
  73. package/dist/services/connection-apply.js.map +1 -0
  74. package/dist/services/connection-resolver.d.ts +65 -0
  75. package/dist/services/connection-resolver.js +281 -0
  76. package/dist/services/connection-resolver.js.map +1 -0
  77. package/dist/services/connection-transactor.d.ts +37 -0
  78. package/dist/services/connection-transactor.js +341 -0
  79. package/dist/services/connection-transactor.js.map +1 -0
  80. package/dist/services/instance-manager.d.ts +13 -0
  81. package/dist/services/instance-manager.js +137 -23
  82. package/dist/services/instance-manager.js.map +1 -1
  83. package/dist/services/llm-proxy/index.d.ts +16 -2
  84. package/dist/services/llm-proxy/index.js +48 -44
  85. package/dist/services/llm-proxy/index.js.map +1 -1
  86. package/dist/services/llm-proxy/probe.d.ts +6 -0
  87. package/dist/services/llm-proxy/probe.js +85 -0
  88. package/dist/services/llm-proxy/probe.js.map +1 -0
  89. package/dist/services/llm-proxy/ssrf.d.ts +1 -0
  90. package/dist/services/llm-proxy/ssrf.js +18 -7
  91. package/dist/services/llm-proxy/ssrf.js.map +1 -1
  92. package/dist/services/nomad-manager.js +375 -16
  93. package/dist/services/nomad-manager.js.map +1 -1
  94. package/dist/services/process-manager.js +1 -1
  95. package/dist/services/process-manager.js.map +1 -1
  96. package/dist/services/runtime/adapters/hermes.d.ts +30 -1
  97. package/dist/services/runtime/adapters/hermes.js +218 -5
  98. package/dist/services/runtime/adapters/hermes.js.map +1 -1
  99. package/dist/services/runtime/adapters/openclaw-mcporter.d.ts +45 -0
  100. package/dist/services/runtime/adapters/openclaw-mcporter.js +108 -0
  101. package/dist/services/runtime/adapters/openclaw-mcporter.js.map +1 -0
  102. package/dist/services/runtime/adapters/openclaw.d.ts +87 -0
  103. package/dist/services/runtime/adapters/openclaw.js +250 -2
  104. package/dist/services/runtime/adapters/openclaw.js.map +1 -1
  105. package/dist/services/runtime/mcp-shims/firewall.d.ts +26 -0
  106. package/dist/services/runtime/mcp-shims/firewall.js +129 -0
  107. package/dist/services/runtime/mcp-shims/firewall.js.map +1 -0
  108. package/dist/services/runtime/mcp-shims/searxng-shim.d.ts +27 -0
  109. package/dist/services/runtime/mcp-shims/searxng-shim.js +125 -0
  110. package/dist/services/runtime/mcp-shims/searxng-shim.js.map +1 -0
  111. package/dist/services/runtime/mcp-shims/write-mcp-entry.d.ts +83 -0
  112. package/dist/services/runtime/mcp-shims/write-mcp-entry.js +127 -0
  113. package/dist/services/runtime/mcp-shims/write-mcp-entry.js.map +1 -0
  114. package/dist/services/runtime/migrations.d.ts +8 -0
  115. package/dist/services/runtime/migrations.js +100 -0
  116. package/dist/services/runtime/migrations.js.map +1 -1
  117. package/dist/services/runtime/types.d.ts +15 -0
  118. package/dist/services/setup-manager.js +6 -6
  119. package/dist/services/setup-manager.js.map +1 -1
  120. package/dist/services/suggestions.d.ts +27 -0
  121. package/dist/services/suggestions.js +133 -0
  122. package/dist/services/suggestions.js.map +1 -0
  123. package/dist/services/task-registry.js +4 -2
  124. package/dist/services/task-registry.js.map +1 -1
  125. package/dist/services/telemetry/device-fingerprint.d.ts +1 -1
  126. package/dist/services/telemetry/device-fingerprint.js +1 -1
  127. package/dist/services/types-shim.d.ts +16 -0
  128. package/dist/services/types-shim.js +2 -0
  129. package/dist/services/types-shim.js.map +1 -0
  130. package/dist/types.d.ts +171 -1
  131. package/dist/utils/instance-lock.d.ts +22 -0
  132. package/dist/utils/instance-lock.js +48 -0
  133. package/dist/utils/instance-lock.js.map +1 -0
  134. package/dist/utils/safe-json.js +55 -22
  135. package/dist/utils/safe-json.js.map +1 -1
  136. package/install/jishu-install.sh +323 -27
  137. package/install/jishu-uninstall.sh +353 -20
  138. package/package.json +3 -1
  139. package/public/assets/Dashboard-rkWp-CXd.js +1 -0
  140. package/public/assets/{HermesChatPanel-mFSureyc.js → HermesChatPanel-_GHoklgo.js} +1 -1
  141. package/public/assets/HermesConfigForm-anDnwUp_.js +4 -0
  142. package/public/assets/{InitPassword-CVA8wQA6.js → InitPassword-ZU9_-hDr.js} +1 -1
  143. package/public/assets/InstanceDetail-CN0FH1aw.js +92 -0
  144. package/public/assets/{Login-BWsZH2mu.js → Login-BItXqYAJ.js} +1 -1
  145. package/public/assets/NewInstance-BousE6kY.js +1 -0
  146. package/public/assets/ProviderRecommendations-DFYj7Fb6.js +1 -0
  147. package/public/assets/Settings-Bttc6QmM.js +1 -0
  148. package/public/assets/Setup-Bsxx1zgj.js +1 -0
  149. package/public/assets/{WeixinLoginPanel-CnjR8xMu.js → WeixinLoginPanel-DPZpAKgO.js} +2 -2
  150. package/public/assets/index-8xZy1z5k.css +1 -0
  151. package/public/assets/index-Dw3HhUYE.js +19 -0
  152. package/public/assets/providers-DtNXh9JD.js +1 -0
  153. package/public/assets/registry-5s2UB6is.js +2 -0
  154. package/public/index.html +2 -2
  155. package/scripts/check-app-spec.mjs +443 -0
  156. package/scripts/check-i18n.mjs +154 -0
  157. package/scripts/run.sh +4 -4
  158. package/public/assets/Dashboard-B-JoOjBQ.js +0 -1
  159. package/public/assets/HermesConfigForm-DvR05LK1.js +0 -4
  160. package/public/assets/InstanceDetail-DcZW2QGO.js +0 -91
  161. package/public/assets/NewInstance-BCIrAd86.js +0 -1
  162. package/public/assets/Settings-xkDcduFz.js +0 -1
  163. package/public/assets/Setup-Cfuwj4gV.js +0 -1
  164. package/public/assets/index-CPhVFEsx.css +0 -1
  165. package/public/assets/index-DQsM6Joa.js +0 -19
  166. package/public/assets/providers-V-vwrExZ.js +0 -1
  167. package/public/assets/registry-B4UFJdpA.js +0 -2
package/INSTALL-NOTICE CHANGED
@@ -20,6 +20,17 @@ software bundled with or installed by this product.
20
20
  with its respective license terms, including any restrictions on
21
21
  commercial use, competitive offerings, or redistribution.
22
22
 
23
+ Xcode Command Line Tools (build tools for macOS)
24
+ URL : https://www.apple.com/legal/sla/docs/xcode.pdf
25
+ License : Apple Xcode and Apple SDKs Agreement
26
+ Author : Apple Inc.
27
+
28
+ Homebrew (package manager for macOS)
29
+ URL : https://github.com/Homebrew/brew
30
+ License : BSD 2-Clause License
31
+ https://github.com/Homebrew/brew/blob/HEAD/LICENSE.txt
32
+ Author : Homebrew contributors
33
+
23
34
  Docker Engine
24
35
  URL : https://github.com/moby/moby
25
36
  License : Apache License, Version 2.0
@@ -0,0 +1,78 @@
1
+ id: browserless-chromium-container
2
+ name: Browserless Chromium
3
+ version: "1.0.0"
4
+ jishushell:
5
+ min_version: "0.4.30"
6
+ description: "运行 browserless/chromium 服务,提供可嵌入实例页的浏览器调试画面与自动化连接端点"
7
+ singleInstance: true
8
+
9
+ tasks:
10
+ - name: browserless
11
+ role: service
12
+ runtime: container
13
+ image: "ghcr.io/browserless/chromium:latest"
14
+ env:
15
+ HOST: "0.0.0.0"
16
+ PORT: "3000"
17
+ TOKEN: ""
18
+ CONCURRENT: "5"
19
+ QUEUED: "10"
20
+ TIMEOUT: "120000"
21
+ # 防反爬虫配置
22
+ DEFAULT_USER_AGENT: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"
23
+ FUNCTION_ENABLE_INCOGNITO: "true"
24
+ NAVIGATION_TIMEOUT: "30000"
25
+ # 减少自动化检测特征
26
+ DEFAULT_LAUNCH_ARGS: "--disable-blink-features=AutomationControlled --disable-infobars --window-size=1920,1080 --start-maximized"
27
+ DEFAULT_HEADLESS: "new"
28
+ # 持久化用户数据(cookies/localStorage/session),登录后会话保持
29
+ DATA_DIR: "/tmp/browserless-data"
30
+ volumes:
31
+ - source: "~/.jishushell/apps/${app_id}/data"
32
+ target: "/tmp/browserless-data"
33
+ resources:
34
+ cpu: "1000m"
35
+ memory: "2048Mi"
36
+ ports:
37
+ - name: http
38
+ port: 3000
39
+ visibility: external
40
+ health:
41
+ http:
42
+ path: /docs
43
+ port: 3000
44
+ interval: "15s"
45
+ timeout: "5s"
46
+ retries: 6
47
+ start_period: "35s"
48
+
49
+ provides:
50
+ - capability: "browserless-debugger"
51
+ port: 3000
52
+ path: "/debugger/"
53
+ protocol: "http"
54
+ description: "Browserless Debug Viewer,可在实例页中嵌入浏览器画面"
55
+ - capability: "browserless-api"
56
+ port: 3000
57
+ path: "/"
58
+ protocol: "http"
59
+ description: "Browserless 根 API(供调试器页面连接 ws 与 sessions 接口)"
60
+ - capability: "browserless-docs"
61
+ port: 3000
62
+ path: "/docs/"
63
+ protocol: "http"
64
+ description: "Browserless API 文档页"
65
+ - capability: "browser-ws"
66
+ task: "browserless"
67
+ port: 3000
68
+ protocol: "ws"
69
+ description: "Browserless CDP/WebSocket 连接端点(ws://host:3000),用于 browser 类 require 自动绑定(命名遵循 <category>-<vendor> 约定)"
70
+
71
+ lifecycle:
72
+ install:
73
+ - downloadImage: "ghcr.io/browserless/chromium:latest"
74
+ - mkdir: "~/.jishushell/apps/${app_id}/data"
75
+ pre_start:
76
+ - mkdir: "~/.jishushell/apps/${app_id}/data"
77
+ uninstall:
78
+ - deleteImage: "ghcr.io/browserless/chromium:latest"
@@ -2,7 +2,7 @@ id: hermes-container
2
2
  name: Hermes Agent
3
3
  version: "1.0.0"
4
4
  jishushell:
5
- min_version: "0.4.24"
5
+ min_version: "0.4.30"
6
6
  agentType: hermes
7
7
  description: "Hermes Agent 容器运行时,使用 apps 目录作为统一安装根"
8
8
  singleInstance: false
@@ -32,4 +32,38 @@ tasks:
32
32
  interval: "15s"
33
33
  timeout: "5s"
34
34
  retries: 3
35
- start_period: "30s"
35
+ start_period: "30s"
36
+
37
+ provides:
38
+ - capability: "web-hermes"
39
+ task: "gateway"
40
+ port: 8642
41
+ protocol: "http"
42
+ description: "Hermes Agent Web UI"
43
+ - capability: "llm-agent"
44
+ task: "gateway"
45
+ port: 8642
46
+ protocol: "http"
47
+ path: "/v1"
48
+ auth:
49
+ kind: "bearer"
50
+ tokenSource: "instance.env.API_SERVER_KEY"
51
+ description: "OpenAI-compatible chat endpoint (verified on Pi: GET /v1/models returns hermes-agent model)"
52
+
53
+ requires:
54
+ - capability: "llm"
55
+ inject_as: "LLM_ENDPOINT"
56
+ required: false
57
+ cardinality: "one"
58
+ - capability: "search"
59
+ inject_as: "SEARCH_API_BASE_URL"
60
+ required: false
61
+ cardinality: "one"
62
+ - capability: "browser"
63
+ inject_as: "BROWSER_CDP_URL"
64
+ required: false
65
+ cardinality: "one"
66
+ - capability: "mcp"
67
+ inject_as: "MCP_SERVERS"
68
+ required: false
69
+ cardinality: "many"
@@ -2,7 +2,7 @@ id: ollama-binary
2
2
  name: Ollama
3
3
  version: "1.0.0"
4
4
  jishushell:
5
- min_version: "0.4.24"
5
+ min_version: "0.4.30"
6
6
  description: "通过官方脚本,安装并运行Ollama"
7
7
  singleInstance: true
8
8
 
@@ -62,8 +62,15 @@ provides:
62
62
  - cmd: "help"
63
63
  description: "Help about any command"
64
64
  - capability: "ollama-api"
65
+ task: "gateway"
65
66
  port: 11434
67
+ protocol: "http"
66
68
  description: "Ollama HTTP API,兼容 OpenAI /v1/chat/completions 端点"
69
+ - capability: "llm-ollama"
70
+ task: "gateway"
71
+ port: 11434
72
+ protocol: "http"
73
+ description: "Ollama OpenAI-compatible LLM endpoint (Connections 主推命名)"
67
74
 
68
75
  lifecycle:
69
76
  pre_install:
@@ -75,76 +82,74 @@ lifecycle:
75
82
  fi;
76
83
  install:
77
84
  - run: >-
78
- if ! command -v ollama >/dev/null 2>&1; then
79
- echo "未检测到 ollama,开始安装..." >&2;
80
- if [ "$(id -u)" -ne 0 ]; then
81
- if ! command -v sudo >/dev/null 2>&1; then
82
- echo "未检测到 sudo,当前环境无法自动安装 Ollama。请以 root 身份重试。" >&2;
83
- exit 1;
84
- fi;
85
- if [ -n "${JISHUSHELL_SUDO_ASKPASS:-}" ]; then
86
- sudo_probe_output="$(sudo -k -A true 2>&1)" || {
87
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
88
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法自动安装 Ollama。请在系统终端手动安装,或调整容器/服务配置后重试。" >&2;
89
- else
90
- echo "提供的 sudo 密码无效,无法安装 Ollama。" >&2;
91
- fi;
92
- exit 1;
93
- };
94
- run_as_root() { sudo -A "$@"; };
95
- else
96
- sudo_probe_output="$(sudo -n true 2>&1)" || {
97
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
98
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法自动安装 Ollama。请在系统终端手动安装,或调整容器/服务配置后重试。" >&2;
99
- else
100
- echo "安装 Ollama 需要 sudo 密码;请在页面弹窗中输入后重试。" >&2;
101
- fi;
102
- exit 1;
103
- };
104
- run_as_root() { sudo -n "$@"; };
105
- fi;
85
+ install_marker="$HOME/.jishushell/apps/${app_id}/.ollama-install-needed";
86
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
87
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
88
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
89
+ rm -f "$install_marker";
90
+ if command -v ollama >/dev/null 2>&1; then
91
+ if [ -f "$owner_marker" ] || [ -f "$legacy_owner_marker" ]; then
92
+ echo "检测到由 JishuShell 安装的 ollama,复用现有二进制。" >&2;
93
+ rm -f "$system_install_marker";
106
94
  else
107
- run_as_root() { "$@"; };
95
+ echo "检测到系统中已安装 ollama,跳过二进制安装。" >&2;
96
+ rm -f "$owner_marker" "$legacy_owner_marker";
97
+ : > "$system_install_marker";
108
98
  fi;
109
- for BINDIR in /usr/local/bin /usr/bin /bin; do
110
- echo "$PATH" | grep -q "$BINDIR" && break || continue;
111
- done;
112
- OLLAMA_INSTALL_DIR="$(dirname "${BINDIR:-/usr/local/bin}")";
113
- if [ -d "$OLLAMA_INSTALL_DIR/lib/ollama" ]; then
114
- old_dir="$OLLAMA_INSTALL_DIR/lib/ollama.jishushell-old-$(date +%s)";
115
- echo "检测到旧版 Ollama 目录,先移动到 $old_dir 以避免长时间卡在清理步骤..." >&2;
116
- run_as_root mv "$OLLAMA_INSTALL_DIR/lib/ollama" "$old_dir";
117
- ( run_as_root rm -rf "$old_dir" >/dev/null 2>&1 || true ) &
118
- fi;
119
- curl -fsSL https://ollama.com/install.sh | run_as_root sh;
120
99
  else
121
- echo "检测到系统中已安装 ollama,跳过二进制安装。" >&2;
100
+ echo "未检测到 ollama,开始安装..." >&2;
101
+ rm -f "$owner_marker" "$legacy_owner_marker" "$system_install_marker";
102
+ : > "$install_marker";
122
103
  fi
104
+ - run: >-
105
+ install_marker="$HOME/.jishushell/apps/${app_id}/.ollama-install-needed";
106
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
107
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
108
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
109
+ for BINDIR in /usr/local/bin /usr/bin /bin; do
110
+ echo "$PATH" | grep -q "$BINDIR" && break || continue;
111
+ done;
112
+ OLLAMA_INSTALL_DIR="$(dirname "${BINDIR:-/usr/local/bin}")";
113
+ if [ -d "$OLLAMA_INSTALL_DIR/lib/ollama" ]; then
114
+ old_dir="$OLLAMA_INSTALL_DIR/lib/ollama.jishushell-old-$(date +%s)";
115
+ echo "检测到旧版 Ollama 目录,先移动到 $old_dir 以避免长时间卡在清理步骤..." >&2;
116
+ mv "$OLLAMA_INSTALL_DIR/lib/ollama" "$old_dir";
117
+ ( rm -rf "$old_dir" >/dev/null 2>&1 || true ) &
118
+ fi;
119
+ curl -fsSL https://ollama.com/install.sh | sh;
120
+ rm -f "$install_marker";
121
+ rm -f "$legacy_owner_marker";
122
+ rm -f "$system_install_marker";
123
+ : > "$owner_marker"
124
+ sudo: true
125
+ ifFileExists: "~/.jishushell/apps/${app_id}/.ollama-install-needed"
123
126
  timeout_ms: 900000
124
127
  successIfCommandExists: "ollama"
125
128
  - run: >-
129
+ install_marker="$HOME/.jishushell/apps/${app_id}/.ollama-install-needed";
130
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
131
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
132
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
133
+ if [ -f "$install_marker" ] && command -v ollama >/dev/null 2>&1; then
134
+ echo "检测到 ollama 已可用,补记为由 JishuShell 安装。" >&2;
135
+ rm -f "$install_marker";
136
+ rm -f "$legacy_owner_marker";
137
+ rm -f "$system_install_marker";
138
+ : > "$owner_marker";
139
+ fi
140
+ ifFileExists: "~/.jishushell/apps/${app_id}/.ollama-install-needed"
141
+ - run: >-
142
+ service_active_marker="$HOME/.jishushell/apps/${app_id}/.ollama-service-active";
143
+ rm -f "$service_active_marker";
126
144
  case "$(uname -s)" in
127
145
  Linux)
128
146
  if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files ollama.service >/dev/null 2>&1; then
129
- echo "停止并禁用 ollama.service,后续交由 Nomad 管理..." >&2;
130
- if [ "$(id -u)" -eq 0 ]; then
131
- run_as_root() { "$@"; };
132
- elif [ -n "${JISHUSHELL_SUDO_ASKPASS:-}" ]; then
133
- sudo_probe_output="$(sudo -k -A true 2>&1)" || {
134
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
135
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法清理 ollama.service。请在系统终端手动执行后重试。" >&2;
136
- else
137
- echo "提供的 sudo 密码无效,无法清理 ollama.service。" >&2;
138
- fi;
139
- exit 1;
140
- };
141
- run_as_root() { sudo -A "$@"; };
142
- elif command -v sudo >/dev/null 2>&1; then
143
- run_as_root() { sudo -n "$@"; };
147
+ if systemctl is-active --quiet ollama.service 2>/dev/null; then
148
+ echo "检测到正在运行的 ollama.service,尝试停止并禁用,后续交由 Nomad 管理..." >&2;
149
+ : > "$service_active_marker";
144
150
  else
145
- run_as_root() { "$@"; };
151
+ echo "检测到未运行的 ollama.service,保留当前 systemd 配置不变。" >&2;
146
152
  fi;
147
- run_as_root systemctl disable --now ollama;
148
153
  else
149
154
  echo "Linux 环境未检测到 ollama.service,跳过 systemd 清理。" >&2;
150
155
  fi
@@ -163,38 +168,34 @@ lifecycle:
163
168
  echo "当前平台不支持自动清理 Ollama 自启,跳过。" >&2
164
169
  ;;
165
170
  esac
171
+ - run: >-
172
+ systemctl disable --now ollama;
173
+ rm -f "$HOME/.jishushell/apps/${app_id}/.ollama-service-active"
174
+ sudo: true
175
+ ifFileExists: "~/.jishushell/apps/${app_id}/.ollama-service-active"
166
176
 
167
177
  uninstall:
168
178
  - run: >-
169
- if [ "$(id -u)" -ne 0 ]; then
170
- if ! command -v sudo >/dev/null 2>&1; then
171
- echo "当前环境未检测到 sudo,无法卸载 Ollama。请以 root 身份重试。" >&2;
172
- exit 1;
173
- fi;
174
- if [ -n "${JISHUSHELL_SUDO_ASKPASS:-}" ]; then
175
- sudo_probe_output="$(sudo -k -A true 2>&1)" || {
176
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
177
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法卸载 Ollama。请在系统终端手动执行,或调整容器/服务配置后重试。" >&2;
178
- else
179
- echo "提供的 sudo 密码无效,无法卸载 Ollama。" >&2;
180
- fi;
181
- exit 1;
182
- };
183
- run_as_root() { sudo -A "$@"; };
184
- else
185
- sudo_probe_output="$(sudo -n true 2>&1)" || {
186
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
187
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法卸载 Ollama。请在系统终端手动执行,或调整容器/服务配置后重试。" >&2;
188
- else
189
- echo "卸载 Ollama 需要 sudo 密码;请在页面弹窗中输入后重试。" >&2;
190
- fi;
191
- exit 1;
192
- };
193
- run_as_root() { sudo -n "$@"; };
194
- fi;
195
- else
196
- run_as_root() { "$@"; };
197
- fi;
198
- run_as_root rm -f /usr/local/bin/ollama /usr/bin/ollama /bin/ollama;
199
- run_as_root rm -rf /usr/local/lib/ollama /usr/lib/ollama /usr/share/ollama 2>/dev/null || true
179
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
180
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
181
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
182
+ uninstall_marker="$HOME/.jishushell/.ollama-uninstall-needed-${app_id}";
183
+ rm -f "$uninstall_marker";
184
+ if [ -f "$system_install_marker" ]; then
185
+ echo "检测到复用的是系统已有 ollama,卸载时保留系统安装。" >&2;
186
+ rm -f "$system_install_marker";
187
+ elif [ -f "$owner_marker" ] || [ -f "$legacy_owner_marker" ]; then
188
+ : > "$uninstall_marker";
189
+ fi
190
+ - run: >-
191
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
192
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
193
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
194
+ uninstall_marker="$HOME/.jishushell/.ollama-uninstall-needed-${app_id}";
195
+ rm -f /usr/local/bin/ollama /usr/bin/ollama /bin/ollama;
196
+ rm -rf /usr/local/lib/ollama /usr/lib/ollama /usr/share/ollama 2>/dev/null || true;
197
+ rm -rf /Applications/Ollama.app "$HOME/Applications/Ollama.app" 2>/dev/null || true;
198
+ rm -f "$owner_marker" "$legacy_owner_marker" "$system_install_marker" "$uninstall_marker"
199
+ sudo: true
200
+ ifFileExists: "~/.jishushell/.ollama-uninstall-needed-${app_id}"
200
201
 
@@ -2,7 +2,7 @@ id: ollama-cpu-docker
2
2
  name: Ollama CPU(Docker)
3
3
  version: "1.0.0"
4
4
  jishushell:
5
- min_version: "0.4.24"
5
+ min_version: "0.4.30"
6
6
  description: "使用 alpine/ollama 镜像运行的纯 CPU 版 Ollama"
7
7
  singleInstance: true
8
8
 
@@ -33,5 +33,12 @@ tasks:
33
33
 
34
34
  provides:
35
35
  - capability: "ollama-api"
36
+ task: "gateway"
36
37
  port: 11434
38
+ protocol: "http"
37
39
  description: "Ollama HTTP API,兼容 OpenAI /v1/chat/completions 端点"
40
+ - capability: "llm-ollama"
41
+ task: "gateway"
42
+ port: 11434
43
+ protocol: "http"
44
+ description: "Ollama OpenAI-compatible LLM endpoint (Connections 主推命名)"
@@ -2,7 +2,7 @@ id: ollama-with-hollama-binary
2
2
  name: Ollama
3
3
  version: "1.0.0"
4
4
  jishushell:
5
- min_version: "0.4.24"
5
+ min_version: "0.4.30"
6
6
  description: "通过官方脚本安装并运行 Ollama,同时提供 Hollama Web UI。"
7
7
  singleInstance: true
8
8
 
@@ -52,13 +52,20 @@ tasks:
52
52
 
53
53
  provides:
54
54
  - capability: "hollama-web"
55
+ task: "hollama"
55
56
  port: 4173
56
57
  protocol: "http"
57
58
  description: "Hollama Web 界面"
58
59
  - capability: "ollama-api"
60
+ task: "gateway"
59
61
  port: 11434
60
62
  protocol: "http"
61
63
  description: "Ollama HTTP API,兼容 OpenAI /v1/chat/completions 端点"
64
+ - capability: "llm-ollama"
65
+ task: "gateway"
66
+ port: 11434
67
+ protocol: "http"
68
+ description: "Ollama OpenAI-compatible LLM endpoint (Connections 主推命名)"
62
69
 
63
70
  lifecycle:
64
71
  pre_install:
@@ -71,76 +78,74 @@ lifecycle:
71
78
  install:
72
79
  - downloadImage: "ghcr.io/fmaclen/hollama:latest"
73
80
  - run: >-
74
- if ! command -v ollama >/dev/null 2>&1; then
75
- echo "未检测到 ollama,开始安装..." >&2;
76
- if [ "$(id -u)" -ne 0 ]; then
77
- if ! command -v sudo >/dev/null 2>&1; then
78
- echo "未检测到 sudo,当前环境无法自动安装 Ollama。请以 root 身份重试。" >&2;
79
- exit 1;
80
- fi;
81
- if [ -n "${JISHUSHELL_SUDO_ASKPASS:-}" ]; then
82
- sudo_probe_output="$(sudo -A true 2>&1)" || {
83
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
84
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法自动安装 Ollama。请在系统终端手动安装,或调整容器/服务配置后重试。" >&2;
85
- else
86
- echo "提供的 sudo 密码无效,无法安装 Ollama。" >&2;
87
- fi;
88
- exit 1;
89
- };
90
- run_as_root() { sudo -A "$@"; };
91
- else
92
- sudo_probe_output="$(sudo -n true 2>&1)" || {
93
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
94
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法自动安装 Ollama。请在系统终端手动安装,或调整容器/服务配置后重试。" >&2;
95
- else
96
- echo "安装 Ollama 需要 sudo 密码;请在页面弹窗中输入后重试。" >&2;
97
- fi;
98
- exit 1;
99
- };
100
- run_as_root() { sudo -n "$@"; };
101
- fi;
81
+ install_marker="$HOME/.jishushell/apps/${app_id}/.ollama-install-needed";
82
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
83
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
84
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
85
+ rm -f "$install_marker";
86
+ if command -v ollama >/dev/null 2>&1; then
87
+ if [ -f "$owner_marker" ] || [ -f "$legacy_owner_marker" ]; then
88
+ echo "检测到由 JishuShell 安装的 ollama,复用现有二进制。" >&2;
89
+ rm -f "$system_install_marker";
102
90
  else
103
- run_as_root() { "$@"; };
91
+ echo "检测到系统中已安装 ollama,跳过二进制安装。" >&2;
92
+ rm -f "$owner_marker" "$legacy_owner_marker";
93
+ : > "$system_install_marker";
104
94
  fi;
105
- for BINDIR in /usr/local/bin /usr/bin /bin; do
106
- echo "$PATH" | grep -q "$BINDIR" && break || continue;
107
- done;
108
- OLLAMA_INSTALL_DIR="$(dirname "${BINDIR:-/usr/local/bin}")";
109
- if [ -d "$OLLAMA_INSTALL_DIR/lib/ollama" ]; then
110
- old_dir="$OLLAMA_INSTALL_DIR/lib/ollama.jishushell-old-$(date +%s)";
111
- echo "检测到旧版 Ollama 目录,先移动到 $old_dir 以避免长时间卡在清理步骤..." >&2;
112
- run_as_root mv "$OLLAMA_INSTALL_DIR/lib/ollama" "$old_dir";
113
- ( run_as_root rm -rf "$old_dir" >/dev/null 2>&1 || true ) &
114
- fi;
115
- curl -fsSL https://ollama.com/install.sh | run_as_root sh;
116
95
  else
117
- echo "检测到系统中已安装 ollama,跳过二进制安装。" >&2;
96
+ echo "未检测到 ollama,开始安装..." >&2;
97
+ rm -f "$owner_marker" "$legacy_owner_marker" "$system_install_marker";
98
+ : > "$install_marker";
118
99
  fi
100
+ - run: >-
101
+ install_marker="$HOME/.jishushell/apps/${app_id}/.ollama-install-needed";
102
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
103
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
104
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
105
+ for BINDIR in /usr/local/bin /usr/bin /bin; do
106
+ echo "$PATH" | grep -q "$BINDIR" && break || continue;
107
+ done;
108
+ OLLAMA_INSTALL_DIR="$(dirname "${BINDIR:-/usr/local/bin}")";
109
+ if [ -d "$OLLAMA_INSTALL_DIR/lib/ollama" ]; then
110
+ old_dir="$OLLAMA_INSTALL_DIR/lib/ollama.jishushell-old-$(date +%s)";
111
+ echo "检测到旧版 Ollama 目录,先移动到 $old_dir 以避免长时间卡在清理步骤..." >&2;
112
+ mv "$OLLAMA_INSTALL_DIR/lib/ollama" "$old_dir";
113
+ ( rm -rf "$old_dir" >/dev/null 2>&1 || true ) &
114
+ fi;
115
+ curl -fsSL https://ollama.com/install.sh | sh;
116
+ rm -f "$install_marker";
117
+ rm -f "$legacy_owner_marker";
118
+ rm -f "$system_install_marker";
119
+ : > "$owner_marker"
120
+ sudo: true
121
+ ifFileExists: "~/.jishushell/apps/${app_id}/.ollama-install-needed"
119
122
  timeout_ms: 900000
120
123
  successIfCommandExists: "ollama"
121
124
  - run: >-
125
+ install_marker="$HOME/.jishushell/apps/${app_id}/.ollama-install-needed";
126
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
127
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
128
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
129
+ if [ -f "$install_marker" ] && command -v ollama >/dev/null 2>&1; then
130
+ echo "检测到 ollama 已可用,补记为由 JishuShell 安装。" >&2;
131
+ rm -f "$install_marker";
132
+ rm -f "$legacy_owner_marker";
133
+ rm -f "$system_install_marker";
134
+ : > "$owner_marker";
135
+ fi
136
+ ifFileExists: "~/.jishushell/apps/${app_id}/.ollama-install-needed"
137
+ - run: >-
138
+ service_active_marker="$HOME/.jishushell/apps/${app_id}/.ollama-service-active";
139
+ rm -f "$service_active_marker";
122
140
  case "$(uname -s)" in
123
141
  Linux)
124
142
  if command -v systemctl >/dev/null 2>&1 && systemctl list-unit-files ollama.service >/dev/null 2>&1; then
125
- echo "停止并禁用 ollama.service,后续交由 Nomad 管理..." >&2;
126
- if [ "$(id -u)" -eq 0 ]; then
127
- run_as_root() { "$@"; };
128
- elif [ -n "${JISHUSHELL_SUDO_ASKPASS:-}" ]; then
129
- sudo_probe_output="$(sudo -A true 2>&1)" || {
130
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
131
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法清理 ollama.service。请在系统终端手动执行后重试。" >&2;
132
- else
133
- echo "提供的 sudo 密码无效,无法清理 ollama.service。" >&2;
134
- fi;
135
- exit 1;
136
- };
137
- run_as_root() { sudo -A "$@"; };
138
- elif command -v sudo >/dev/null 2>&1; then
139
- run_as_root() { sudo -n "$@"; };
143
+ if systemctl is-active --quiet ollama.service 2>/dev/null; then
144
+ echo "检测到正在运行的 ollama.service,尝试停止并禁用,后续交由 Nomad 管理..." >&2;
145
+ : > "$service_active_marker";
140
146
  else
141
- run_as_root() { "$@"; };
147
+ echo "检测到未运行的 ollama.service,保留当前 systemd 配置不变。" >&2;
142
148
  fi;
143
- run_as_root systemctl disable --now ollama;
144
149
  else
145
150
  echo "Linux 环境未检测到 ollama.service,跳过 systemd 清理。" >&2;
146
151
  fi
@@ -159,37 +164,33 @@ lifecycle:
159
164
  echo "当前平台不支持自动清理 Ollama 自启,跳过。" >&2
160
165
  ;;
161
166
  esac
167
+ - run: >-
168
+ systemctl disable --now ollama;
169
+ rm -f "$HOME/.jishushell/apps/${app_id}/.ollama-service-active"
170
+ sudo: true
171
+ ifFileExists: "~/.jishushell/apps/${app_id}/.ollama-service-active"
162
172
 
163
173
  uninstall:
164
174
  - run: >-
165
- if [ "$(id -u)" -ne 0 ]; then
166
- if ! command -v sudo >/dev/null 2>&1; then
167
- echo "当前环境未检测到 sudo,无法卸载 Ollama。请以 root 身份重试。" >&2;
168
- exit 1;
169
- fi;
170
- if [ -n "${JISHUSHELL_SUDO_ASKPASS:-}" ]; then
171
- sudo_probe_output="$(sudo -A true 2>&1)" || {
172
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
173
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法卸载 Ollama。请在系统终端手动执行,或调整容器/服务配置后重试。" >&2;
174
- else
175
- echo "提供的 sudo 密码无效,无法卸载 Ollama。" >&2;
176
- fi;
177
- exit 1;
178
- };
179
- run_as_root() { sudo -A "$@"; };
180
- else
181
- sudo_probe_output="$(sudo -n true 2>&1)" || {
182
- if printf '%s\n' "$sudo_probe_output" | grep -qi "no new privileges"; then
183
- echo "当前运行环境禁止 sudo 提权(no new privileges),无法卸载 Ollama。请在系统终端手动执行,或调整容器/服务配置后重试。" >&2;
184
- else
185
- echo "卸载 Ollama 需要 sudo 密码;请在页面弹窗中输入后重试。" >&2;
186
- fi;
187
- exit 1;
188
- };
189
- run_as_root() { sudo -n "$@"; };
190
- fi;
191
- else
192
- run_as_root() { "$@"; };
193
- fi;
194
- run_as_root rm -f /usr/local/bin/ollama /usr/bin/ollama /bin/ollama;
195
- run_as_root rm -rf /usr/local/lib/ollama /usr/lib/ollama /usr/share/ollama 2>/dev/null || true
175
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
176
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
177
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
178
+ uninstall_marker="$HOME/.jishushell/.ollama-uninstall-needed-${app_id}";
179
+ rm -f "$uninstall_marker";
180
+ if [ -f "$system_install_marker" ]; then
181
+ echo "检测到复用的是系统已有 ollama,卸载时保留系统安装。" >&2;
182
+ rm -f "$system_install_marker";
183
+ elif [ -f "$owner_marker" ] || [ -f "$legacy_owner_marker" ]; then
184
+ : > "$uninstall_marker";
185
+ fi
186
+ - run: >-
187
+ owner_marker="$HOME/.jishushell/.ollama-installed-by-jishushell-${app_id}";
188
+ legacy_owner_marker="$HOME/.jishushell/apps/${app_id}/.ollama-installed-by-jishushell";
189
+ system_install_marker="$HOME/.jishushell/.ollama-system-install-${app_id}";
190
+ uninstall_marker="$HOME/.jishushell/.ollama-uninstall-needed-${app_id}";
191
+ rm -f /usr/local/bin/ollama /usr/bin/ollama /bin/ollama;
192
+ rm -rf /usr/local/lib/ollama /usr/lib/ollama /usr/share/ollama 2>/dev/null || true;
193
+ rm -rf /Applications/Ollama.app "$HOME/Applications/Ollama.app" 2>/dev/null || true;
194
+ rm -f "$owner_marker" "$legacy_owner_marker" "$system_install_marker" "$uninstall_marker"
195
+ sudo: true
196
+ ifFileExists: "~/.jishushell/.ollama-uninstall-needed-${app_id}"