@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 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
- // Merge external signal if provided
39
- const signal = externalSignal ?? controller?.signal;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geminilight/mindos",
3
- "version": "0.5.30",
3
+ "version": "0.5.33",
4
4
  "description": "MindOS — Human-Agent Collaborative Mind System. Local-first knowledge base that syncs your mind to all AI Agents via MCP.",
5
5
  "keywords": [
6
6
  "mindos",
@@ -92,26 +92,33 @@ git push origin main
92
92
  git push origin "$VERSION"
93
93
  echo ""
94
94
 
95
- # 5. Wait for CI (if gh is available)
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 CI publish workflow..."
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
- # Wait for the workflow run to appear
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=publish-npm.yml --limit=1 --json databaseId,headBranch --jq ".[0].databaseId" 2>/dev/null || true)
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 "✅ Published $VERSION to npm" || echo "❌ CI failed — check: gh run view $RUN_ID --log"
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: https://github.com/GeminiLight/mindos-dev/actions"
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 "💡 Install 'gh' CLI to auto-watch CI status."
116
- echo " Check publish status: https://github.com/GeminiLight/mindos-dev/actions"
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 first (Linux / macOS / WSL)
190
- const vars = [
191
- process.env.LANG,
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.LANGUAGE,
195
- ].filter(Boolean).join(' ').toLowerCase();
196
- if (vars.includes('zh')) return 'zh';
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 {