@geminilight/mindos 0.5.30 → 0.5.33
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/lib/api.ts +21 -4
- package/package.json +1 -1
- package/scripts/release.sh +15 -8
- package/scripts/setup.js +10 -6
package/app/lib/api.ts
CHANGED
|
@@ -29,14 +29,30 @@ export async function apiFetch<T>(url: string, opts: ApiFetchOptions = {}): Prom
|
|
|
29
29
|
|
|
30
30
|
let controller: AbortController | undefined;
|
|
31
31
|
let timeoutId: ReturnType<typeof setTimeout> | undefined;
|
|
32
|
+
let removeExternalAbortListener: (() => void) | undefined;
|
|
32
33
|
|
|
33
|
-
if (timeout > 0) {
|
|
34
|
+
if (timeout > 0 || externalSignal) {
|
|
34
35
|
controller = new AbortController();
|
|
35
|
-
timeoutId = setTimeout(() => controller!.abort(), timeout);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
if (timeout > 0 && controller) {
|
|
39
|
+
timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Bridge caller-provided AbortSignal so both timeout and external cancel work.
|
|
43
|
+
if (externalSignal && controller) {
|
|
44
|
+
if (externalSignal.aborted) {
|
|
45
|
+
controller.abort();
|
|
46
|
+
} else {
|
|
47
|
+
const onAbort = () => controller?.abort();
|
|
48
|
+
externalSignal.addEventListener('abort', onAbort, { once: true });
|
|
49
|
+
removeExternalAbortListener = () => {
|
|
50
|
+
externalSignal.removeEventListener('abort', onAbort);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const signal = controller?.signal ?? externalSignal;
|
|
40
56
|
|
|
41
57
|
try {
|
|
42
58
|
const res = await fetch(url, { ...fetchOpts, signal });
|
|
@@ -60,5 +76,6 @@ export async function apiFetch<T>(url: string, opts: ApiFetchOptions = {}): Prom
|
|
|
60
76
|
return (await res.json()) as T;
|
|
61
77
|
} finally {
|
|
62
78
|
if (timeoutId) clearTimeout(timeoutId);
|
|
79
|
+
if (removeExternalAbortListener) removeExternalAbortListener();
|
|
63
80
|
}
|
|
64
81
|
}
|
package/package.json
CHANGED
package/scripts/release.sh
CHANGED
|
@@ -92,26 +92,33 @@ git push origin main
|
|
|
92
92
|
git push origin "$VERSION"
|
|
93
93
|
echo ""
|
|
94
94
|
|
|
95
|
-
# 5. Wait for CI
|
|
95
|
+
# 5. Wait for CI
|
|
96
|
+
# Flow: tag push → sync-to-mindos (syncs code + tag to public repo) → public repo publish-npm
|
|
96
97
|
if command -v gh &>/dev/null; then
|
|
97
|
-
echo "⏳ Waiting for
|
|
98
|
+
echo "⏳ Waiting for sync → publish pipeline..."
|
|
99
|
+
echo " mindos-dev tag push → sync-to-mindos → GeminiLight/MindOS tag → npm publish"
|
|
98
100
|
TIMEOUT=120
|
|
99
101
|
ELAPSED=0
|
|
100
102
|
RUN_ID=""
|
|
101
103
|
|
|
102
|
-
#
|
|
104
|
+
# Watch the sync workflow on mindos-dev
|
|
103
105
|
while [ -z "$RUN_ID" ] && [ "$ELAPSED" -lt 30 ]; do
|
|
104
106
|
sleep 3
|
|
105
107
|
ELAPSED=$((ELAPSED + 3))
|
|
106
|
-
RUN_ID=$(gh run list --workflow=
|
|
108
|
+
RUN_ID=$(gh run list --workflow=sync-to-mindos.yml --limit=1 --json databaseId,headBranch --jq ".[0].databaseId" 2>/dev/null || true)
|
|
107
109
|
done
|
|
108
110
|
|
|
109
111
|
if [ -n "$RUN_ID" ]; then
|
|
110
|
-
gh run watch "$RUN_ID" --exit-status && echo "✅
|
|
112
|
+
gh run watch "$RUN_ID" --exit-status && echo "✅ Synced $VERSION to GeminiLight/MindOS" || echo "❌ Sync failed — check: gh run view $RUN_ID --log"
|
|
113
|
+
echo " npm publish will be triggered on GeminiLight/MindOS."
|
|
114
|
+
echo " Check: https://github.com/GeminiLight/MindOS/actions"
|
|
111
115
|
else
|
|
112
|
-
echo "⚠️ Could not find CI run. Check manually:
|
|
116
|
+
echo "⚠️ Could not find CI run. Check manually:"
|
|
117
|
+
echo " Sync: https://github.com/GeminiLight/mindos-dev/actions"
|
|
118
|
+
echo " Publish: https://github.com/GeminiLight/MindOS/actions"
|
|
113
119
|
fi
|
|
114
120
|
else
|
|
115
|
-
echo "💡
|
|
116
|
-
echo " Check
|
|
121
|
+
echo "💡 Release pipeline: mindos-dev → sync → GeminiLight/MindOS → npm publish"
|
|
122
|
+
echo " Check sync: https://github.com/GeminiLight/mindos-dev/actions"
|
|
123
|
+
echo " Check publish: https://github.com/GeminiLight/MindOS/actions"
|
|
117
124
|
fi
|
package/scripts/setup.js
CHANGED
|
@@ -186,14 +186,18 @@ function write(s) { process.stdout.write(s); }
|
|
|
186
186
|
// ── State ─────────────────────────────────────────────────────────────────────
|
|
187
187
|
|
|
188
188
|
function detectSystemLang() {
|
|
189
|
-
// Check env vars
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
// Check env vars by precedence (LC_ALL > LC_MESSAGES > LANG > LANGUAGE)
|
|
190
|
+
// For LANGUAGE, only use the first entry before ':' (it's a priority list)
|
|
191
|
+
const candidates = [
|
|
192
192
|
process.env.LC_ALL,
|
|
193
193
|
process.env.LC_MESSAGES,
|
|
194
|
-
process.env.
|
|
195
|
-
|
|
196
|
-
|
|
194
|
+
process.env.LANG,
|
|
195
|
+
...(process.env.LANGUAGE ? [process.env.LANGUAGE.split(':')[0]] : []),
|
|
196
|
+
];
|
|
197
|
+
const first = candidates.find(Boolean);
|
|
198
|
+
if (first) {
|
|
199
|
+
return first.toLowerCase().startsWith('zh') ? 'zh' : 'en';
|
|
200
|
+
}
|
|
197
201
|
|
|
198
202
|
// Fallback: Intl API (works on Windows where LANG is often unset)
|
|
199
203
|
try {
|