@cleocode/core 2026.9.13 → 2026.9.14

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.
@@ -613,6 +613,13 @@ var init_cli_category = __esm({
613
613
  }
614
614
  });
615
615
 
616
+ // packages/contracts/src/code-symbol.ts
617
+ var init_code_symbol = __esm({
618
+ "packages/contracts/src/code-symbol.ts"() {
619
+ "use strict";
620
+ }
621
+ });
622
+
616
623
  // packages/contracts/src/config/manifest.ts
617
624
  import { z as z4 } from "zod";
618
625
  var PROJECT_INFO_MANIFEST, PROJECT_CONTEXT_MANIFEST, CLEO_CONFIG_MANIFEST, GLOBAL_CLEO_CONFIG_MANIFEST, CONFIG_MANIFEST_ENTRIES, configManifestEntrySchema;
@@ -16813,6 +16820,7 @@ var init_src = __esm({
16813
16820
  init_branch_lock();
16814
16821
  init_changesets();
16815
16822
  init_cli_category();
16823
+ init_code_symbol();
16816
16824
  init_manifest();
16817
16825
  init_credentials();
16818
16826
  init_daemon();
@@ -34914,13 +34922,33 @@ var init_config = __esm({
34914
34922
  var embedding_local_exports = {};
34915
34923
  __export(embedding_local_exports, {
34916
34924
  LocalEmbeddingProvider: () => LocalEmbeddingProvider,
34917
- getLocalEmbeddingProvider: () => getLocalEmbeddingProvider
34925
+ __resetLocalEmbeddingStateForTests: () => __resetLocalEmbeddingStateForTests,
34926
+ getLocalEmbeddingProvider: () => getLocalEmbeddingProvider,
34927
+ isEmbeddingPipelineLoaded: () => isEmbeddingPipelineLoaded
34918
34928
  });
34919
34929
  async function loadPipeline() {
34920
34930
  if (_ready) return;
34921
- const { pipeline } = await import("@huggingface/transformers");
34922
- _pipeline = await pipeline("feature-extraction", MODEL_NAME);
34923
- _ready = true;
34931
+ if (_loadFailed) {
34932
+ throw new Error(`Local embedding pipeline is unavailable in this process: ${_loadError}`);
34933
+ }
34934
+ try {
34935
+ const { pipeline } = await import("@huggingface/transformers");
34936
+ _pipeline = await pipeline("feature-extraction", MODEL_NAME);
34937
+ _ready = true;
34938
+ } catch (err) {
34939
+ _loadFailed = true;
34940
+ _loadError = err instanceof Error ? err.message : String(err);
34941
+ throw err;
34942
+ }
34943
+ }
34944
+ function isEmbeddingPipelineLoaded() {
34945
+ return _ready;
34946
+ }
34947
+ function __resetLocalEmbeddingStateForTests() {
34948
+ _pipeline = null;
34949
+ _ready = false;
34950
+ _loadFailed = false;
34951
+ _loadError = null;
34924
34952
  }
34925
34953
  function getLocalEmbeddingProvider() {
34926
34954
  if (!_instance) {
@@ -34928,7 +34956,7 @@ function getLocalEmbeddingProvider() {
34928
34956
  }
34929
34957
  return _instance;
34930
34958
  }
34931
- var MODEL_NAME, _pipeline, _ready, LocalEmbeddingProvider, _instance;
34959
+ var MODEL_NAME, _pipeline, _ready, _loadFailed, _loadError, LocalEmbeddingProvider, _instance;
34932
34960
  var init_embedding_local = __esm({
34933
34961
  "packages/core/src/memory/embedding-local.ts"() {
34934
34962
  "use strict";
@@ -34936,14 +34964,41 @@ var init_embedding_local = __esm({
34936
34964
  MODEL_NAME = "Xenova/all-MiniLM-L6-v2";
34937
34965
  _pipeline = null;
34938
34966
  _ready = false;
34967
+ _loadFailed = false;
34968
+ _loadError = null;
34939
34969
  LocalEmbeddingProvider = class {
34940
34970
  /** Number of dimensions produced — must match brain_embeddings vec0 table. */
34941
34971
  dimensions = EMBEDDING_DIMENSIONS;
34942
34972
  /**
34943
- * Whether the pipeline has been successfully initialized and is ready to produce embeddings.
34973
+ * Whether this provider CAN produce embeddings — not whether it already has.
34974
+ *
34975
+ * ## The deadlock this fixes (gh#1217)
34976
+ *
34977
+ * This previously returned `_ready`, the "pipeline has loaded" flag. But
34978
+ * `_ready` is set only by `loadPipeline()`, which runs only inside
34979
+ * {@link embed} — and every caller of `embed` first checks `isAvailable()`.
34980
+ * In any fresh CLI process `_ready` is false, so nothing ever called
34981
+ * `embed`, so `_ready` never became true. **The readiness check could only
34982
+ * be satisfied by the call it guarded.**
34983
+ *
34984
+ * The observable result was total, silent inertness: `cleo brain
34985
+ * maintenance` reported `{processed: 0, skipped: 0, errors: 0}` forever,
34986
+ * `brain_embeddings` stayed empty after dozens of observations, new writes
34987
+ * were never embedded, and every hybrid search quietly degraded to FTS5 —
34988
+ * while `brain.embedding.enabled` was true and the provider itself was
34989
+ * perfectly healthy when called directly.
34990
+ *
34991
+ * Availability is therefore capability: this provider can load its pipeline
34992
+ * on demand, and says so until a load actually fails. The ~22 MB first-call
34993
+ * download is the expected cost of the lazy design, not a reason to refuse
34994
+ * to begin.
34995
+ *
34996
+ * @returns `true` unless loading the pipeline has already failed here.
34997
+ *
34998
+ * @task T12129 (gh#1217)
34944
34999
  */
34945
35000
  isAvailable() {
34946
- return _ready;
35001
+ return !_loadFailed;
34947
35002
  }
34948
35003
  /**
34949
35004
  * Convert a single text string into a 384-dimension float vector.
@@ -35004,7 +35059,11 @@ function clearEmbeddingProvider() {
35004
35059
  }
35005
35060
  async function embedText(text2) {
35006
35061
  if (!currentProvider?.isAvailable()) return null;
35007
- return currentProvider.embed(text2);
35062
+ try {
35063
+ return await currentProvider.embed(text2);
35064
+ } catch {
35065
+ return null;
35066
+ }
35008
35067
  }
35009
35068
  function isEmbeddingAvailable() {
35010
35069
  return currentProvider?.isAvailable() ?? false;