Skip to content

Commit 8aad0b9

Browse files
committed
refactor: rename core/service to core/domain
1 parent def1632 commit 8aad0b9

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

backend/src/internal/core/service/weights/MomentumWeightsService.ts renamed to backend/src/internal/core/domain/weights/MomentumWeightsStrategy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function mergeMomentumWeightsOptions(
6969
};
7070
}
7171

72-
export class MomentumWeightsService implements WeightsPort {
72+
export class MomentumWeightsStrategy implements WeightsPort {
7373
private readonly opts: MomentumWeightsOptions;
7474

7575
constructor(opts: Partial<MomentumWeightsOptions> = {}) {
@@ -87,7 +87,7 @@ export class MomentumWeightsService implements WeightsPort {
8787
const capResult = capByPercentile(momentumItems, cap);
8888
const cappedItems = capResult.cappedItems;
8989
const capMeta = capResult.meta;
90-
console.info('[MomentumWeightsService] cap', {
90+
console.info('[MomentumWeightsStrategy] cap', {
9191
reason: capMeta.reason,
9292
capped: capMeta.capped,
9393
capValue: capMeta.capValue,

backend/src/internal/core/service/weights/capByPercentile.ts renamed to backend/src/internal/core/domain/weights/capByPercentile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { WeightedItem } from '../../entity/Item.ts';
2-
import type { CapOptions } from './MomentumWeightsService.ts';
2+
import type { CapOptions } from './MomentumWeightsStrategy.ts';
33

44
export type WeightsCapReason =
55
| 'no_excess'

backend/src/internal/core/service/weights/computeMomentum.ts renamed to backend/src/internal/core/domain/weights/computeMomentum.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { RelevantItem, WeightedItem } from '../../entity/Item.ts';
2-
import type { MomentumOptions } from './MomentumWeightsService.ts';
2+
import type { MomentumOptions } from './MomentumWeightsStrategy.ts';
33

44
function isNew(prevRaw: number | undefined): boolean {
55
return prevRaw === undefined;

backend/src/internal/core/service/weights/normalizeByMean.ts renamed to backend/src/internal/core/domain/weights/normalizeByMean.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { WeightedItem } from '../../entity/Item.ts';
2-
import type { NormalizeOptions } from './MomentumWeightsService.ts';
2+
import type { NormalizeOptions } from './MomentumWeightsStrategy.ts';
33

44
/**
55
* Normalize weights so that their mean equals `target`. Input is not mutated.

backend/src/internal/core/service/weights/sanitizeScores.ts renamed to backend/src/internal/core/domain/weights/sanitizeScores.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function sanitizeScores(
1919
.map((i) => `${i.source}=${String(i.score)}`)
2020
.join(', ');
2121
console.warn(
22-
`[MomentumWeightsService] ${nonFinite.length} non-finite ${fieldName}(s) found — sanitized to 0. Samples: ${sample}`,
22+
`[MomentumWeightsStrategy] ${nonFinite.length} non-finite ${fieldName}(s) found — sanitized to 0. Samples: ${sample}`,
2323
);
2424
}
2525
return arr.map((i) => (Number.isFinite(i.score) ? i : { ...i, score: 0 }));
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
import {
2+
DEFAULT_WEIGHTS_OPTIONS,
3+
MomentumWeightsStrategy,
4+
} from '../../core/domain/weights/MomentumWeightsStrategy.ts';
15
import type { ItemsProviderPort } from '../../core/port/ItemsProviderPort.ts';
26
import type { LlmPort } from '../../core/port/LlmPort.ts';
37
import type { PersistencePort } from '../../core/port/PersistencePort.ts';
4-
import {
5-
DEFAULT_WEIGHTS_OPTIONS,
6-
MomentumWeightsService,
7-
} from '../../core/service/weights/MomentumWeightsService.ts';
88
import { Agent } from './Agent.ts';
99

1010
export function makeAgent(
1111
items: ItemsProviderPort,
1212
llm: LlmPort,
1313
persistence: PersistencePort,
1414
): Agent {
15-
const weights = new MomentumWeightsService(DEFAULT_WEIGHTS_OPTIONS);
15+
const weights = new MomentumWeightsStrategy(DEFAULT_WEIGHTS_OPTIONS);
1616
return new Agent(items, llm, persistence, weights);
1717
}

0 commit comments

Comments
 (0)