@simonyea/holysheep-cli 2.1.4 → 2.1.6
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonyea/holysheep-cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.6",
|
|
4
4
|
"description": "Claude Code/Cursor/Cline API relay for China — ¥1=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "node tests/droid.test.js && node tests/workspace-store.test.js",
|
|
@@ -759,6 +759,73 @@ function buildModelsResponse(config) {
|
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
761
|
|
|
762
|
+
// ── Live HolySheep model list for OpenClaw ───────────────────────────────────
|
|
763
|
+
// OpenClaw / AcpModelSelector hits `/v1/models` to populate its model dropdown.
|
|
764
|
+
// Historically this returned only the static `config.models` from
|
|
765
|
+
// `~/.openclaw/holysheep-bridge.json`, so users saw a stale hand-curated list.
|
|
766
|
+
// We now fetch the full live catalog from the HolySheep API once per bridge
|
|
767
|
+
// process (60s TTL) and merge it with the user's preferred models. The
|
|
768
|
+
// config.models always wins on ordering — new entries from upstream are
|
|
769
|
+
// appended afterwards so existing users don't see their default model jump.
|
|
770
|
+
//
|
|
771
|
+
// Env opt-out: HOLYSHEEP_BRIDGE_NO_LIVE_MODELS=1 keeps the old static behavior.
|
|
772
|
+
let _liveModelsCache = { at: 0, ids: null }
|
|
773
|
+
const LIVE_MODELS_TTL_MS = 60_000
|
|
774
|
+
|
|
775
|
+
async function fetchLiveHolySheepModels(config) {
|
|
776
|
+
if (process.env.HOLYSHEEP_BRIDGE_NO_LIVE_MODELS === '1') return null
|
|
777
|
+
const now = Date.now()
|
|
778
|
+
if (_liveModelsCache.ids && now - _liveModelsCache.at < LIVE_MODELS_TTL_MS) {
|
|
779
|
+
return _liveModelsCache.ids
|
|
780
|
+
}
|
|
781
|
+
const base = (config.baseUrlOpenAI || 'https://api.holysheep.ai/v1').replace(/\/+$/, '')
|
|
782
|
+
const url = `${base}/models`
|
|
783
|
+
const apiKey = config.apiKey
|
|
784
|
+
if (!apiKey) return null
|
|
785
|
+
try {
|
|
786
|
+
const resp = await upstreamFetch(url, {
|
|
787
|
+
method: 'GET',
|
|
788
|
+
headers: { authorization: `Bearer ${apiKey}` },
|
|
789
|
+
})
|
|
790
|
+
if (!resp.ok) return null
|
|
791
|
+
const body = await resp.json()
|
|
792
|
+
const ids = Array.isArray(body?.data)
|
|
793
|
+
? body.data.map((m) => (m && typeof m.id === 'string' ? m.id : null)).filter(Boolean)
|
|
794
|
+
: null
|
|
795
|
+
if (ids && ids.length) {
|
|
796
|
+
_liveModelsCache = { at: now, ids }
|
|
797
|
+
return ids
|
|
798
|
+
}
|
|
799
|
+
} catch {
|
|
800
|
+
// Network error / upstream 5xx — fall back to static config.models.
|
|
801
|
+
}
|
|
802
|
+
return null
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
async function buildLiveModelsResponse(config) {
|
|
806
|
+
const live = await fetchLiveHolySheepModels(config)
|
|
807
|
+
const configured = config.models || []
|
|
808
|
+
if (!live) return buildModelsResponse(config)
|
|
809
|
+
// Merge: preserve user's preferred ordering from config.models (typically
|
|
810
|
+
// the models they actively use for OpenClaw), then append new live entries.
|
|
811
|
+
const seen = new Set(configured)
|
|
812
|
+
const merged = [...configured]
|
|
813
|
+
for (const id of live) {
|
|
814
|
+
if (!seen.has(id)) {
|
|
815
|
+
merged.push(id)
|
|
816
|
+
seen.add(id)
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
return {
|
|
820
|
+
object: 'list',
|
|
821
|
+
data: merged.map((model) => ({
|
|
822
|
+
id: model,
|
|
823
|
+
object: 'model',
|
|
824
|
+
owned_by: 'holysheep',
|
|
825
|
+
})),
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
762
829
|
function isProcessAlive(pid) {
|
|
763
830
|
if (!Number.isInteger(pid) || pid <= 0) return null
|
|
764
831
|
try {
|
|
@@ -29,11 +29,14 @@ const VENDOR_DIR = path.join(__dirname, 'vendor', 'aionui')
|
|
|
29
29
|
|
|
30
30
|
// Baked-in defaults — updated with every 2.x.0 release that bumps the bundle.
|
|
31
31
|
// Override via HOLYSHEEP_AIONUI_RUNTIME_URL / HOLYSHEEP_AIONUI_RUNTIME_SHA256.
|
|
32
|
+
// hs3 = fix user-visible iOfficeAI/AionUi links → holysheep.ai (2.1.6, 2026-04-22).
|
|
33
|
+
// Previous revisions still live on the CDN for forensics, but all new installs of
|
|
34
|
+
// @simonyea/holysheep-cli >= 2.1.6 pull this tarball.
|
|
32
35
|
const DEFAULT_RUNTIME_URL =
|
|
33
|
-
'https://mail.holysheep.ai/app/cli/aionui-runtime-v1.9.18-holysheep.tar.gz'
|
|
36
|
+
'https://mail.holysheep.ai/app/cli/aionui-runtime-v1.9.18-holysheep-hs3.tar.gz'
|
|
34
37
|
const DEFAULT_RUNTIME_SHA256 =
|
|
35
|
-
'
|
|
36
|
-
const DEFAULT_RUNTIME_VERSION = '1.9.18-holysheep'
|
|
38
|
+
'ee3c0983fc44423a027d6d286a1e38411786323b080b71389bd52c6e36f5ff6b'
|
|
39
|
+
const DEFAULT_RUNTIME_VERSION = '1.9.18-holysheep-hs3'
|
|
37
40
|
|
|
38
41
|
function isValidRuntimeDir(dir) {
|
|
39
42
|
if (!dir) return false
|