mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-12 17:57:37 +02:00
Trois défauts sans rapport entre eux, tous visibles à l'écran. Jauge de contexte bloquée à « 0 / N (0 %) » : le comptage exact vient de usage.prompt_tokens (include_usage), qu'un llama-server récent a cessé de renvoyer. On note désormais si l'usage est arrivé ; sinon la fin de tour publie l'estimation qui pilote déjà la compaction — approximative, mais jamais absente. Et la souscription envoie la valeur courante juste après le rattrapage : une page rechargée affichait zéro sur une discussion pourtant pleine, faute d'événement ctx_used dans la fenêtre rejouée. Espace disque : « il ne reste que 11,9 Go » sur un partage Unraid qui en a des centaines. /mnt/user est servi par shfs, un FUSE qui agrège plusieurs disques — statfs y renvoie l'espace d'un seul, et ce chiffre REFUSAIT l'installation du modèle. Les systèmes de fichiers qui approximent (FUSE, overlay, NFS, CIFS, Ceph, Gluster) sont reconnus par leur magie : leur chiffre reste affiché, précédé d'un « ~ », mais ne bloque plus rien. Panneau Fichiers : le panneau entier défilait, emportant vers le haut l'en-tête, le fil d'Ariane et le pied (occupation disque, bouton .zip) dès qu'il y avait quelques fichiers. Seule la liste défile maintenant ; le pied reste en bas et l'état vide se centre. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
157 lines
5.1 KiB
TypeScript
157 lines
5.1 KiB
TypeScript
//#region src/composable-filters.d.ts
|
|
type StringOrRegExp = string | RegExp;
|
|
type PluginModuleType = "js" | "jsx" | "ts" | "tsx" | "json" | "text" | "base64" | "dataurl" | "binary" | "empty" | (string & {});
|
|
type FilterExpressionKind = FilterExpression["kind"];
|
|
type FilterExpression = And | Or | Not | Id | ModuleType | Code | Query;
|
|
type TopLevelFilterExpression = Include | Exclude;
|
|
declare class And {
|
|
kind: "and";
|
|
args: FilterExpression[];
|
|
constructor(...args: FilterExpression[]);
|
|
}
|
|
declare class Or {
|
|
kind: "or";
|
|
args: FilterExpression[];
|
|
constructor(...args: FilterExpression[]);
|
|
}
|
|
declare class Not {
|
|
kind: "not";
|
|
expr: FilterExpression;
|
|
constructor(expr: FilterExpression);
|
|
}
|
|
interface QueryFilterObject {
|
|
[key: string]: StringOrRegExp | boolean;
|
|
}
|
|
interface IdParams {
|
|
cleanUrl?: boolean;
|
|
}
|
|
declare class Id {
|
|
kind: "id";
|
|
pattern: StringOrRegExp;
|
|
params: IdParams;
|
|
constructor(pattern: StringOrRegExp, params?: IdParams);
|
|
}
|
|
declare class ModuleType {
|
|
kind: "moduleType";
|
|
pattern: PluginModuleType;
|
|
constructor(pattern: PluginModuleType);
|
|
}
|
|
declare class Code {
|
|
kind: "code";
|
|
pattern: StringOrRegExp;
|
|
constructor(expr: StringOrRegExp);
|
|
}
|
|
declare class Query {
|
|
kind: "query";
|
|
key: string;
|
|
pattern: StringOrRegExp | boolean;
|
|
constructor(key: string, pattern: StringOrRegExp | boolean);
|
|
}
|
|
declare class Include {
|
|
kind: "include";
|
|
expr: FilterExpression;
|
|
constructor(expr: FilterExpression);
|
|
}
|
|
declare class Exclude {
|
|
kind: "exclude";
|
|
expr: FilterExpression;
|
|
constructor(expr: FilterExpression);
|
|
}
|
|
declare function and(...args: FilterExpression[]): And;
|
|
declare function or(...args: FilterExpression[]): Or;
|
|
declare function not(expr: FilterExpression): Not;
|
|
declare function id(pattern: StringOrRegExp, params?: IdParams): Id;
|
|
declare function moduleType(pattern: PluginModuleType): ModuleType;
|
|
declare function code(pattern: StringOrRegExp): Code;
|
|
declare function query(key: string, pattern: StringOrRegExp | boolean): Query;
|
|
declare function include(expr: FilterExpression): Include;
|
|
declare function exclude(expr: FilterExpression): Exclude;
|
|
/**
|
|
* convert a queryObject to FilterExpression like
|
|
* ```js
|
|
* and(query(k1, v1), query(k2, v2))
|
|
* ```
|
|
* @param queryFilterObject The query filter object needs to be matched.
|
|
* @returns a `And` FilterExpression
|
|
*/
|
|
declare function queries(queryFilter: QueryFilterObject): And;
|
|
declare function interpreter(exprs: TopLevelFilterExpression | TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType): boolean;
|
|
interface InterpreterCtx {
|
|
urlSearchParamsCache?: URLSearchParams;
|
|
}
|
|
declare function interpreterImpl(expr: TopLevelFilterExpression[], code?: string, id?: string, moduleType?: PluginModuleType, ctx?: InterpreterCtx): boolean;
|
|
declare function exprInterpreter(expr: FilterExpression, code?: string, id?: string, moduleType?: PluginModuleType, ctx?: InterpreterCtx): boolean;
|
|
//#endregion
|
|
//#region src/simple-filters.d.ts
|
|
/**
|
|
* Constructs a RegExp that matches the exact string specified.
|
|
*
|
|
* This is useful for plugin hook filters.
|
|
*
|
|
* @param str the string to match.
|
|
* @param flags flags for the RegExp.
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* import { exactRegex } from '@rolldown/pluginutils';
|
|
* const plugin = {
|
|
* name: 'plugin',
|
|
* resolveId: {
|
|
* filter: { id: exactRegex('foo') },
|
|
* handler(id) {} // will only be called for `foo`
|
|
* }
|
|
* }
|
|
* ```
|
|
*/
|
|
declare function exactRegex(str: string, flags?: string): RegExp;
|
|
/**
|
|
* Constructs a RegExp that matches a value that has the specified prefix.
|
|
*
|
|
* This is useful for plugin hook filters.
|
|
*
|
|
* @param str the string to match.
|
|
* @param flags flags for the RegExp.
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* import { prefixRegex } from '@rolldown/pluginutils';
|
|
* const plugin = {
|
|
* name: 'plugin',
|
|
* resolveId: {
|
|
* filter: { id: prefixRegex('foo') },
|
|
* handler(id) {} // will only be called for IDs starting with `foo`
|
|
* }
|
|
* }
|
|
* ```
|
|
*/
|
|
declare function prefixRegex(str: string, flags?: string): RegExp;
|
|
type WidenString<T> = T extends string ? string : T;
|
|
/**
|
|
* Converts a id filter to match with an id with a query.
|
|
*
|
|
* @param input the id filters to convert.
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* import { makeIdFiltersToMatchWithQuery } from '@rolldown/pluginutils';
|
|
* const plugin = {
|
|
* name: 'plugin',
|
|
* transform: {
|
|
* filter: { id: makeIdFiltersToMatchWithQuery(['**' + '/*.js', /\.ts$/]) },
|
|
* // The handler will be called for IDs like:
|
|
* // - foo.js
|
|
* // - foo.js?foo
|
|
* // - foo.txt?foo.js
|
|
* // - foo.ts
|
|
* // - foo.ts?foo
|
|
* // - foo.txt?foo.ts
|
|
* handler(code, id) {}
|
|
* }
|
|
* }
|
|
* ```
|
|
*/
|
|
declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: T): WidenString<T>;
|
|
declare function makeIdFiltersToMatchWithQuery<T extends string | RegExp>(input: readonly T[]): WidenString<T>[];
|
|
declare function makeIdFiltersToMatchWithQuery(input: string | RegExp | readonly (string | RegExp)[]): string | RegExp | (string | RegExp)[];
|
|
//#endregion
|
|
export { FilterExpression, FilterExpressionKind, QueryFilterObject, TopLevelFilterExpression, and, code, exactRegex, exclude, exprInterpreter, id, include, interpreter, interpreterImpl, makeIdFiltersToMatchWithQuery, moduleType, not, or, prefixRegex, queries, query }; |