Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

test(e2e): complete the embedding.ts mock export surface for the cycle-sync import path

test447f81956d48
diff --git a/test/e2e/dream-cycle-phase-order-pglite.test.ts b/test/e2e/dream-cycle-phase-order-pglite.test.ts
index c9356d752f..7588d14e84 100644
--- a/test/e2e/dream-cycle-phase-order-pglite.test.ts
+++ b/test/e2e/dream-cycle-phase-order-pglite.test.ts
@@ -48,6 +48,16 @@ mock.module('../../src/core/embedding.ts', () => ({
estimateEmbeddingCostUsd: (tokens: number) => (tokens / 1000) * 0.00013,
// v0.41.31: embed phase reads the current signature to stamp provenance.
currentEmbeddingSignature: () => 'text-embedding-3-large:1536',
+ // The cycle sync phase reaches commands/sync.ts, whose static embedding.ts
+ // imports must all resolve against this mock (missing names are a load-time
+ // SyntaxError, not a runtime undefined).
+ currentEmbeddingPricePerMTok: () => 0.13,
+ willEmbedSynchronously: (opts: { v2Enabled: boolean; serialFlag: boolean; noEmbed: boolean }) => {
+ const effectiveNoEmbed = opts.v2Enabled && !opts.serialFlag && !opts.noEmbed ? true : opts.noEmbed;
+ return effectiveNoEmbed ? 'deferred' : 'inline';
+ },
+ shouldBlockSync: (costUsd: number, floorUsd: number, mode: string, posture: 'gated' | 'tokenmax' = 'gated') =>
+ posture === 'tokenmax' ? false : mode === 'inline' && costUsd > floorUsd,
}));
const { runCycle, ALL_PHASES } = await import('../../src/core/cycle.ts');