openclacky 1.2.8 → 1.2.9

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.
@@ -133,12 +133,15 @@ DEFAULT_NPM_REGISTRY="https://registry.npmjs.org"
133
133
  DEFAULT_MISE_INSTALL_URL="https://mise.run"
134
134
 
135
135
  CN_CDN_BASE_URL="https://oss.1024code.com"
136
+ CN_CDN_FALLBACK_URL="https://clackyai-1258723534.cos.ap-guangzhou.myqcloud.com"
136
137
  CN_ALIYUN_MIRROR="https://mirrors.aliyun.com"
137
- CN_MISE_INSTALL_URL="${CN_CDN_BASE_URL}/mise.sh"
138
- CN_RUBY_PRECOMPILED_URL="${CN_CDN_BASE_URL}/ruby/ruby-{version}.{platform}.tar.gz"
139
138
  CN_RUBYGEMS_URL="${CN_ALIYUN_MIRROR}/rubygems/"
140
139
  CN_NPM_REGISTRY="https://registry.npmmirror.com"
141
140
  CN_NODE_MIRROR_URL="https://cdn.npmmirror.com/binaries/node/"
141
+
142
+ # Derived from CN_CDN_BASE_URL — always set via _apply_cdn_base_url()
143
+ CN_MISE_INSTALL_URL="${CN_CDN_BASE_URL}/mise.sh"
144
+ CN_RUBY_PRECOMPILED_URL="${CN_CDN_BASE_URL}/ruby/ruby-{version}.{platform}.tar.gz"
142
145
  CN_GEM_BASE_URL="${CN_CDN_BASE_URL}/openclacky"
143
146
  CN_GEM_LATEST_URL="${CN_GEM_BASE_URL}/latest.txt"
144
147
 
@@ -201,6 +204,37 @@ _probe_url_with_retry() {
201
204
  echo "$result"
202
205
  }
203
206
 
207
+ # --------------------------------------------------------------------------
208
+ # CN CDN resolution helpers
209
+ # --------------------------------------------------------------------------
210
+
211
+ # Probe primary CDN then fallback; echoes the reachable base URL or exits 1
212
+ _resolve_cdn_base_url() {
213
+ local result
214
+ result=$(_probe_url_with_retry "$CN_CDN_BASE_URL")
215
+ _print_probe_result "CN CDN (oss.1024code.com)" "$result"
216
+ ! _is_slow_or_unreachable "$result" && return 0
217
+
218
+ print_warning "CN CDN unreachable — trying fallback..."
219
+ result=$(_probe_url_with_retry "$CN_CDN_FALLBACK_URL")
220
+ _print_probe_result "CN CDN fallback" "$result"
221
+ if _is_slow_or_unreachable "$result"; then
222
+ print_error "CN CDN and fallback both unreachable — cannot install."
223
+ exit 1
224
+ fi
225
+ CN_CDN_BASE_URL="$CN_CDN_FALLBACK_URL"
226
+ }
227
+
228
+ # Apply a resolved base URL to all CDN-derived variables
229
+ _apply_cdn_base_url() {
230
+ local base="$1"
231
+ CN_CDN_BASE_URL="$base"
232
+ CN_MISE_INSTALL_URL="${base}/mise.sh"
233
+ CN_RUBY_PRECOMPILED_URL="${base}/ruby/ruby-{version}.{platform}.tar.gz"
234
+ CN_GEM_BASE_URL="${base}/openclacky"
235
+ CN_GEM_LATEST_URL="${CN_GEM_BASE_URL}/latest.txt"
236
+ }
237
+
204
238
  # --------------------------------------------------------------------------
205
239
  # detect_network_region — sets USE_CN_MIRRORS and active mirror variables
206
240
  # --------------------------------------------------------------------------
@@ -208,42 +242,48 @@ detect_network_region() {
208
242
  print_step "Network pre-flight check..."
209
243
  echo ""
210
244
 
211
- local google_result baidu_result
212
- google_result=$(_probe_url "https://www.google.com")
213
- baidu_result=$(_probe_url "https://www.baidu.com")
245
+ local probe_google="https://www.google.com"
246
+ local probe_github="https://raw.githubusercontent.com"
247
+ local probe_baidu="https://www.baidu.com"
214
248
 
215
- _print_probe_result "google.com" "$google_result"
216
- _print_probe_result "baidu.com" "$baidu_result"
249
+ local google_result github_result baidu_result
250
+ google_result=$(_probe_url "$probe_google")
251
+ github_result=$(_probe_url "$probe_github")
252
+ baidu_result=$(_probe_url "$probe_baidu")
217
253
 
218
- local google_ok=false baidu_ok=false
254
+ _print_probe_result "google.com" "$google_result"
255
+ _print_probe_result "raw.githubusercontent.com" "$github_result"
256
+ _print_probe_result "baidu.com" "$baidu_result"
257
+
258
+ local google_ok=false github_ok=false baidu_ok=false
219
259
  ! _is_slow_or_unreachable "$google_result" && google_ok=true
260
+ ! _is_slow_or_unreachable "$github_result" && github_ok=true
220
261
  ! _is_slow_or_unreachable "$baidu_result" && baidu_ok=true
221
262
 
222
- if [ "$google_ok" = true ]; then
263
+ if [ "$google_ok" = true ] && [ "$github_ok" = true ]; then
223
264
  NETWORK_REGION="global"
224
265
  print_success "Region: global"
225
266
  elif [ "$baidu_ok" = true ]; then
226
267
  NETWORK_REGION="china"
227
268
  print_success "Region: china"
228
269
  else
229
- NETWORK_REGION="unknown"
230
- print_warning "Region: unknown (both unreachable)"
270
+ print_error "Region: unknown (all unreachable) — cannot install."
271
+ exit 1
231
272
  fi
232
273
  echo ""
233
274
 
234
275
  if [ "$NETWORK_REGION" = "china" ]; then
235
- local cdn_result mirror_result
236
- cdn_result=$(_probe_url_with_retry "$CN_MISE_INSTALL_URL")
237
- mirror_result=$(_probe_url_with_retry "$CN_RUBYGEMS_URL")
276
+ _resolve_cdn_base_url
277
+ _apply_cdn_base_url "$CN_CDN_BASE_URL"
238
278
 
239
- _print_probe_result "CN CDN (mise/Ruby)" "$cdn_result"
240
- _print_probe_result "Aliyun (gem)" "$mirror_result"
279
+ local mirror_result
280
+ mirror_result=$(_probe_url_with_retry "$CN_ALIYUN_MIRROR")
281
+ _print_probe_result "Aliyun mirror" "$mirror_result"
241
282
 
242
- local cdn_ok=false mirror_ok=false
243
- ! _is_slow_or_unreachable "$cdn_result" && cdn_ok=true
283
+ local mirror_ok=false
244
284
  ! _is_slow_or_unreachable "$mirror_result" && mirror_ok=true
245
285
 
246
- if [ "$cdn_ok" = true ] || [ "$mirror_ok" = true ]; then
286
+ if [ "$mirror_ok" = true ]; then
247
287
  USE_CN_MIRRORS=true
248
288
  MISE_INSTALL_URL="$CN_MISE_INSTALL_URL"
249
289
  RUBYGEMS_INSTALL_URL="$CN_RUBYGEMS_URL"
@@ -252,19 +292,10 @@ detect_network_region() {
252
292
  RUBY_VERSION_SPEC="ruby@3.4.8"
253
293
  print_info "CN mirrors applied"
254
294
  else
255
- print_warning "CN mirrors unreachable — falling back to global sources"
295
+ print_error "CN mirrors unreachable — cannot install."
296
+ exit 1
256
297
  fi
257
298
  else
258
- local rubygems_result mise_result
259
- rubygems_result=$(_probe_url_with_retry "$DEFAULT_RUBYGEMS_URL")
260
- mise_result=$(_probe_url_with_retry "$DEFAULT_MISE_INSTALL_URL")
261
-
262
- _print_probe_result "RubyGems" "$rubygems_result"
263
- _print_probe_result "mise.run" "$mise_result"
264
-
265
- _is_slow_or_unreachable "$rubygems_result" && print_warning "RubyGems is slow/unreachable."
266
- _is_slow_or_unreachable "$mise_result" && print_warning "mise.run is slow/unreachable."
267
-
268
299
  USE_CN_MIRRORS=false
269
300
  RUBY_VERSION_SPEC="ruby@3"
270
301
  fi
@@ -128,12 +128,15 @@ DEFAULT_NPM_REGISTRY="https://registry.npmjs.org"
128
128
  DEFAULT_MISE_INSTALL_URL="https://mise.run"
129
129
 
130
130
  CN_CDN_BASE_URL="https://oss.1024code.com"
131
+ CN_CDN_FALLBACK_URL="https://clackyai-1258723534.cos.ap-guangzhou.myqcloud.com"
131
132
  CN_ALIYUN_MIRROR="https://mirrors.aliyun.com"
132
- CN_MISE_INSTALL_URL="${CN_CDN_BASE_URL}/mise.sh"
133
- CN_RUBY_PRECOMPILED_URL="${CN_CDN_BASE_URL}/ruby/ruby-{version}.{platform}.tar.gz"
134
133
  CN_RUBYGEMS_URL="${CN_ALIYUN_MIRROR}/rubygems/"
135
134
  CN_NPM_REGISTRY="https://registry.npmmirror.com"
136
135
  CN_NODE_MIRROR_URL="https://cdn.npmmirror.com/binaries/node/"
136
+
137
+ # Derived from CN_CDN_BASE_URL — always set via _apply_cdn_base_url()
138
+ CN_MISE_INSTALL_URL="${CN_CDN_BASE_URL}/mise.sh"
139
+ CN_RUBY_PRECOMPILED_URL="${CN_CDN_BASE_URL}/ruby/ruby-{version}.{platform}.tar.gz"
137
140
  CN_GEM_BASE_URL="${CN_CDN_BASE_URL}/openclacky"
138
141
  CN_GEM_LATEST_URL="${CN_GEM_BASE_URL}/latest.txt"
139
142
 
@@ -196,6 +199,37 @@ _probe_url_with_retry() {
196
199
  echo "$result"
197
200
  }
198
201
 
202
+ # --------------------------------------------------------------------------
203
+ # CN CDN resolution helpers
204
+ # --------------------------------------------------------------------------
205
+
206
+ # Probe primary CDN then fallback; echoes the reachable base URL or exits 1
207
+ _resolve_cdn_base_url() {
208
+ local result
209
+ result=$(_probe_url_with_retry "$CN_CDN_BASE_URL")
210
+ _print_probe_result "CN CDN (oss.1024code.com)" "$result"
211
+ ! _is_slow_or_unreachable "$result" && return 0
212
+
213
+ print_warning "CN CDN unreachable — trying fallback..."
214
+ result=$(_probe_url_with_retry "$CN_CDN_FALLBACK_URL")
215
+ _print_probe_result "CN CDN fallback" "$result"
216
+ if _is_slow_or_unreachable "$result"; then
217
+ print_error "CN CDN and fallback both unreachable — cannot install."
218
+ exit 1
219
+ fi
220
+ CN_CDN_BASE_URL="$CN_CDN_FALLBACK_URL"
221
+ }
222
+
223
+ # Apply a resolved base URL to all CDN-derived variables
224
+ _apply_cdn_base_url() {
225
+ local base="$1"
226
+ CN_CDN_BASE_URL="$base"
227
+ CN_MISE_INSTALL_URL="${base}/mise.sh"
228
+ CN_RUBY_PRECOMPILED_URL="${base}/ruby/ruby-{version}.{platform}.tar.gz"
229
+ CN_GEM_BASE_URL="${base}/openclacky"
230
+ CN_GEM_LATEST_URL="${CN_GEM_BASE_URL}/latest.txt"
231
+ }
232
+
199
233
  # --------------------------------------------------------------------------
200
234
  # detect_network_region — sets USE_CN_MIRRORS and active mirror variables
201
235
  # --------------------------------------------------------------------------
@@ -203,42 +237,48 @@ detect_network_region() {
203
237
  print_step "Network pre-flight check..."
204
238
  echo ""
205
239
 
206
- local google_result baidu_result
207
- google_result=$(_probe_url "https://www.google.com")
208
- baidu_result=$(_probe_url "https://www.baidu.com")
240
+ local probe_google="https://www.google.com"
241
+ local probe_github="https://raw.githubusercontent.com"
242
+ local probe_baidu="https://www.baidu.com"
243
+
244
+ local google_result github_result baidu_result
245
+ google_result=$(_probe_url "$probe_google")
246
+ github_result=$(_probe_url "$probe_github")
247
+ baidu_result=$(_probe_url "$probe_baidu")
209
248
 
210
- _print_probe_result "google.com" "$google_result"
211
- _print_probe_result "baidu.com" "$baidu_result"
249
+ _print_probe_result "google.com" "$google_result"
250
+ _print_probe_result "raw.githubusercontent.com" "$github_result"
251
+ _print_probe_result "baidu.com" "$baidu_result"
212
252
 
213
- local google_ok=false baidu_ok=false
253
+ local google_ok=false github_ok=false baidu_ok=false
214
254
  ! _is_slow_or_unreachable "$google_result" && google_ok=true
255
+ ! _is_slow_or_unreachable "$github_result" && github_ok=true
215
256
  ! _is_slow_or_unreachable "$baidu_result" && baidu_ok=true
216
257
 
217
- if [ "$google_ok" = true ]; then
258
+ if [ "$google_ok" = true ] && [ "$github_ok" = true ]; then
218
259
  NETWORK_REGION="global"
219
260
  print_success "Region: global"
220
261
  elif [ "$baidu_ok" = true ]; then
221
262
  NETWORK_REGION="china"
222
263
  print_success "Region: china"
223
264
  else
224
- NETWORK_REGION="unknown"
225
- print_warning "Region: unknown (both unreachable)"
265
+ print_error "Region: unknown (all unreachable) — cannot install."
266
+ exit 1
226
267
  fi
227
268
  echo ""
228
269
 
229
270
  if [ "$NETWORK_REGION" = "china" ]; then
230
- local cdn_result mirror_result
231
- cdn_result=$(_probe_url_with_retry "$CN_MISE_INSTALL_URL")
232
- mirror_result=$(_probe_url_with_retry "$CN_RUBYGEMS_URL")
271
+ _resolve_cdn_base_url
272
+ _apply_cdn_base_url "$CN_CDN_BASE_URL"
233
273
 
234
- _print_probe_result "CN CDN (mise/Ruby)" "$cdn_result"
235
- _print_probe_result "Aliyun (gem)" "$mirror_result"
274
+ local mirror_result
275
+ mirror_result=$(_probe_url_with_retry "$CN_ALIYUN_MIRROR")
276
+ _print_probe_result "Aliyun mirror" "$mirror_result"
236
277
 
237
- local cdn_ok=false mirror_ok=false
238
- ! _is_slow_or_unreachable "$cdn_result" && cdn_ok=true
278
+ local mirror_ok=false
239
279
  ! _is_slow_or_unreachable "$mirror_result" && mirror_ok=true
240
280
 
241
- if [ "$cdn_ok" = true ] || [ "$mirror_ok" = true ]; then
281
+ if [ "$mirror_ok" = true ]; then
242
282
  USE_CN_MIRRORS=true
243
283
  MISE_INSTALL_URL="$CN_MISE_INSTALL_URL"
244
284
  RUBYGEMS_INSTALL_URL="$CN_RUBYGEMS_URL"
@@ -247,19 +287,10 @@ detect_network_region() {
247
287
  RUBY_VERSION_SPEC="ruby@3.4.8"
248
288
  print_info "CN mirrors applied"
249
289
  else
250
- print_warning "CN mirrors unreachable — falling back to global sources"
290
+ print_error "CN mirrors unreachable — cannot install."
291
+ exit 1
251
292
  fi
252
293
  else
253
- local rubygems_result mise_result
254
- rubygems_result=$(_probe_url_with_retry "$DEFAULT_RUBYGEMS_URL")
255
- mise_result=$(_probe_url_with_retry "$DEFAULT_MISE_INSTALL_URL")
256
-
257
- _print_probe_result "RubyGems" "$rubygems_result"
258
- _print_probe_result "mise.run" "$mise_result"
259
-
260
- _is_slow_or_unreachable "$rubygems_result" && print_warning "RubyGems is slow/unreachable."
261
- _is_slow_or_unreachable "$mise_result" && print_warning "mise.run is slow/unreachable."
262
-
263
294
  USE_CN_MIRRORS=false
264
295
  RUBY_VERSION_SPEC="ruby@3"
265
296
  fi
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openclacky
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - windy
@@ -366,7 +366,6 @@ files:
366
366
  - lib/clacky/default_skills/channel-manager/SKILL.md
367
367
  - lib/clacky/default_skills/channel-manager/dingtalk_setup.rb
368
368
  - lib/clacky/default_skills/channel-manager/discord_setup.rb
369
- - lib/clacky/default_skills/channel-manager/feishu_setup.rb
370
369
  - lib/clacky/default_skills/channel-manager/import_lark_skills.rb
371
370
  - lib/clacky/default_skills/channel-manager/install_feishu_skills.rb
372
371
  - lib/clacky/default_skills/channel-manager/weixin_setup.rb
@@ -376,6 +375,7 @@ files:
376
375
  - lib/clacky/default_skills/deploy/SKILL.md
377
376
  - lib/clacky/default_skills/extend-openclacky/SKILL.md
378
377
  - lib/clacky/default_skills/mcp-manager/SKILL.md
378
+ - lib/clacky/default_skills/media-gen/SKILL.md
379
379
  - lib/clacky/default_skills/new/SKILL.md
380
380
  - lib/clacky/default_skills/new/scripts/create_rails_project.sh
381
381
  - lib/clacky/default_skills/onboard/SKILL.md
@@ -413,6 +413,10 @@ files:
413
413
  - lib/clacky/mcp/stdio_transport.rb
414
414
  - lib/clacky/mcp/transport.rb
415
415
  - lib/clacky/mcp/virtual_skill.rb
416
+ - lib/clacky/media/base.rb
417
+ - lib/clacky/media/gemini.rb
418
+ - lib/clacky/media/generator.rb
419
+ - lib/clacky/media/openai_compat.rb
416
420
  - lib/clacky/message_format/anthropic.rb
417
421
  - lib/clacky/message_format/bedrock.rb
418
422
  - lib/clacky/message_format/open_ai.rb
@@ -538,6 +542,7 @@ files:
538
542
  - lib/clacky/web/index.html
539
543
  - lib/clacky/web/marked.min.js
540
544
  - lib/clacky/web/mcp.js
545
+ - lib/clacky/web/model-tester.js
541
546
  - lib/clacky/web/onboard.js
542
547
  - lib/clacky/web/profile.js
543
548
  - lib/clacky/web/sessions.js