avantgate 1.1.2 → 1.2.0

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.
Files changed (93) hide show
  1. package/dist/agent/adapters/custom-adapter.d.ts +50 -0
  2. package/dist/agent/adapters/custom-adapter.d.ts.map +1 -0
  3. package/dist/agent/adapters/index.d.ts +6 -0
  4. package/dist/agent/adapters/index.d.ts.map +1 -0
  5. package/dist/agent/adapters/memory-adapter.d.ts +34 -0
  6. package/dist/agent/adapters/memory-adapter.d.ts.map +1 -0
  7. package/dist/agent/adapters/platform-adapter.d.ts +32 -0
  8. package/dist/agent/adapters/platform-adapter.d.ts.map +1 -0
  9. package/dist/agent/adapters/prisma-adapter.d.ts +55 -0
  10. package/dist/agent/adapters/prisma-adapter.d.ts.map +1 -0
  11. package/dist/agent/adapters/sqlite-adapter.d.ts +31 -0
  12. package/dist/agent/adapters/sqlite-adapter.d.ts.map +1 -0
  13. package/dist/agent/dto.d.ts +32 -0
  14. package/dist/agent/dto.d.ts.map +1 -0
  15. package/dist/agent/errors.d.ts +50 -0
  16. package/dist/agent/errors.d.ts.map +1 -0
  17. package/dist/agent/factory.d.ts +21 -0
  18. package/dist/agent/factory.d.ts.map +1 -0
  19. package/dist/agent/guardrails.d.ts +14 -0
  20. package/dist/agent/guardrails.d.ts.map +1 -0
  21. package/dist/agent/index.d.ts +17 -742
  22. package/dist/agent/index.d.ts.map +1 -0
  23. package/dist/agent/index.js +203 -18
  24. package/dist/agent/index.mjs +202 -18
  25. package/dist/agent/isolated-tool.d.ts +9 -0
  26. package/dist/agent/isolated-tool.d.ts.map +1 -0
  27. package/dist/agent/registry.d.ts +71 -0
  28. package/dist/agent/registry.d.ts.map +1 -0
  29. package/dist/agent/step-runner.d.ts +12 -0
  30. package/dist/agent/step-runner.d.ts.map +1 -0
  31. package/dist/agent/strategy.d.ts +37 -0
  32. package/dist/agent/strategy.d.ts.map +1 -0
  33. package/dist/agent/telemetry/http-exporter.d.ts +24 -0
  34. package/dist/agent/telemetry/http-exporter.d.ts.map +1 -0
  35. package/dist/agent/telemetry/index.d.ts +3 -0
  36. package/dist/agent/telemetry/index.d.ts.map +1 -0
  37. package/dist/agent/telemetry/types.d.ts +92 -0
  38. package/dist/agent/telemetry/types.d.ts.map +1 -0
  39. package/dist/agent/tool-invoker.d.ts +17 -0
  40. package/dist/agent/tool-invoker.d.ts.map +1 -0
  41. package/dist/agent/tool-state.d.ts +7 -0
  42. package/dist/agent/tool-state.d.ts.map +1 -0
  43. package/dist/agent/types.d.ts +243 -0
  44. package/dist/agent/types.d.ts.map +1 -0
  45. package/dist/control-layer.d.ts +49 -0
  46. package/dist/control-layer.d.ts.map +1 -0
  47. package/dist/finance/factory.d.ts +11 -0
  48. package/dist/finance/factory.d.ts.map +1 -0
  49. package/dist/finance/index.d.ts +9 -76
  50. package/dist/finance/index.d.ts.map +1 -0
  51. package/dist/finance/normalizer.d.ts +19 -0
  52. package/dist/finance/normalizer.d.ts.map +1 -0
  53. package/dist/finance/strategies/french-pcg.strategy.d.ts +10 -0
  54. package/dist/finance/strategies/french-pcg.strategy.d.ts.map +1 -0
  55. package/dist/finance/strategies/international.strategy.d.ts +10 -0
  56. package/dist/finance/strategies/international.strategy.d.ts.map +1 -0
  57. package/dist/finance/strategies/swiss-co.strategy.d.ts +10 -0
  58. package/dist/finance/strategies/swiss-co.strategy.d.ts.map +1 -0
  59. package/dist/finance/strategies/uk-ifrs.strategy.d.ts +10 -0
  60. package/dist/finance/strategies/uk-ifrs.strategy.d.ts.map +1 -0
  61. package/dist/finance/strategies/us-gaap.strategy.d.ts +10 -0
  62. package/dist/finance/strategies/us-gaap.strategy.d.ts.map +1 -0
  63. package/dist/{strategy.interface-CB4_ZAuk.d.ts → finance/strategy.interface.d.ts} +5 -6
  64. package/dist/finance/strategy.interface.d.ts.map +1 -0
  65. package/dist/index.d.ts +9 -390
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/input-guard.d.ts +13 -0
  68. package/dist/input-guard.d.ts.map +1 -0
  69. package/dist/pricing.d.ts +49 -0
  70. package/dist/pricing.d.ts.map +1 -0
  71. package/dist/prompts/index.d.ts +5 -0
  72. package/dist/prompts/index.d.ts.map +1 -0
  73. package/dist/prompts/prompt-builder.d.ts +31 -0
  74. package/dist/prompts/prompt-builder.d.ts.map +1 -0
  75. package/dist/prompts/prompt-registry.d.ts +13 -0
  76. package/dist/prompts/prompt-registry.d.ts.map +1 -0
  77. package/dist/prompts/prompt-template.d.ts +17 -0
  78. package/dist/prompts/prompt-template.d.ts.map +1 -0
  79. package/dist/prompts/types.d.ts +39 -0
  80. package/dist/prompts/types.d.ts.map +1 -0
  81. package/dist/providers/http-client.d.ts +18 -0
  82. package/dist/providers/http-client.d.ts.map +1 -0
  83. package/dist/response-validator.d.ts +18 -0
  84. package/dist/response-validator.d.ts.map +1 -0
  85. package/dist/sanitizer.d.ts +11 -0
  86. package/dist/sanitizer.d.ts.map +1 -0
  87. package/dist/types.d.ts +146 -0
  88. package/dist/types.d.ts.map +1 -0
  89. package/package.json +3 -3
  90. package/dist/agent/index.d.mts +0 -743
  91. package/dist/finance/index.d.mts +0 -76
  92. package/dist/index.d.mts +0 -390
  93. package/dist/strategy.interface-CB4_ZAuk.d.mts +0 -16
@@ -1,76 +1,9 @@
1
- import { I as IAccountingStrategy, F as FinancialJurisdictionCode, A as AccountingStandard, a as FinancialCurrency } from '../strategy.interface-CB4_ZAuk.js';
2
-
3
- declare class AccountingFactory {
4
- private static strategies;
5
- private static detectionOrder;
6
- private static initDefaults;
7
- static registerStrategy(strategy: IAccountingStrategy): void;
8
- static getStrategy(code?: FinancialJurisdictionCode): IAccountingStrategy;
9
- static detectStrategy(documentText: string): IAccountingStrategy;
10
- static resetDefaults(): void;
11
- }
12
-
13
- interface FinancialNormalizerOptions {
14
- jurisdiction?: FinancialJurisdictionCode;
15
- autoDetect?: boolean;
16
- }
17
- /**
18
- * Assainit et répare une chaîne JSON contenant des données financières :
19
- * - Notation comptable négative entre parenthèses : (150 000) -> -150000
20
- * - Espaces et virgules décimales : "1 850 000,50 €" -> 1850000.50
21
- * - Abréviations de grandeurs : "1 850 k€" -> 1850000, "2.4 M€" -> 2400000
22
- * - Suppression des symboles de devises dans les positions numériques
23
- * - Préservation stricte des chaînes descriptives normales contenant des parenthèses
24
- */
25
- declare function cleanFinancialJSON(rawText: string, options?: FinancialNormalizerOptions): string;
26
- /**
27
- * Crée une fonction de transformation financière réutilisable.
28
- */
29
- declare function withFinancialNormalizer(options?: FinancialNormalizerOptions): (rawText: string) => string;
30
-
31
- declare class FrenchPCGStrategy implements IAccountingStrategy {
32
- readonly jurisdictionCode: FinancialJurisdictionCode;
33
- readonly standard: AccountingStandard;
34
- readonly defaultCurrency: FinancialCurrency;
35
- cleanNumber(value: string | number): number;
36
- cleanJSON(rawText: string): string;
37
- detect(text: string): boolean;
38
- }
39
-
40
- declare class UsGAAPStrategy implements IAccountingStrategy {
41
- readonly jurisdictionCode: FinancialJurisdictionCode;
42
- readonly standard: AccountingStandard;
43
- readonly defaultCurrency: FinancialCurrency;
44
- cleanNumber(value: string | number): number;
45
- cleanJSON(rawText: string): string;
46
- detect(text: string): boolean;
47
- }
48
-
49
- declare class UkIFRSStrategy implements IAccountingStrategy {
50
- readonly jurisdictionCode: FinancialJurisdictionCode;
51
- readonly standard: AccountingStandard;
52
- readonly defaultCurrency: FinancialCurrency;
53
- cleanNumber(value: string | number): number;
54
- cleanJSON(rawText: string): string;
55
- detect(text: string): boolean;
56
- }
57
-
58
- declare class SwissCOStrategy implements IAccountingStrategy {
59
- readonly jurisdictionCode: FinancialJurisdictionCode;
60
- readonly standard: AccountingStandard;
61
- readonly defaultCurrency: FinancialCurrency;
62
- cleanNumber(value: string | number): number;
63
- cleanJSON(rawText: string): string;
64
- detect(text: string): boolean;
65
- }
66
-
67
- declare class InternationalAccountingStrategy implements IAccountingStrategy {
68
- readonly jurisdictionCode: FinancialJurisdictionCode;
69
- readonly standard: AccountingStandard;
70
- readonly defaultCurrency: FinancialCurrency;
71
- cleanNumber(value: string | number): number;
72
- cleanJSON(rawText: string): string;
73
- detect(_text: string): boolean;
74
- }
75
-
76
- export { AccountingFactory, AccountingStandard, FinancialCurrency, FinancialJurisdictionCode, type FinancialNormalizerOptions, FrenchPCGStrategy, IAccountingStrategy, InternationalAccountingStrategy, SwissCOStrategy, UkIFRSStrategy, UsGAAPStrategy, cleanFinancialJSON, withFinancialNormalizer };
1
+ export * from "./strategy.interface";
2
+ export * from "./factory";
3
+ export * from "./normalizer";
4
+ export * from "./strategies/french-pcg.strategy";
5
+ export * from "./strategies/us-gaap.strategy";
6
+ export * from "./strategies/uk-ifrs.strategy";
7
+ export * from "./strategies/swiss-co.strategy";
8
+ export * from "./strategies/international.strategy";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/finance/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,kCAAkC,CAAC;AACjD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qCAAqC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { FinancialJurisdictionCode } from "./strategy.interface";
2
+ export interface FinancialNormalizerOptions {
3
+ jurisdiction?: FinancialJurisdictionCode;
4
+ autoDetect?: boolean;
5
+ }
6
+ /**
7
+ * Assainit et répare une chaîne JSON contenant des données financières :
8
+ * - Notation comptable négative entre parenthèses : (150 000) -> -150000
9
+ * - Espaces et virgules décimales : "1 850 000,50 €" -> 1850000.50
10
+ * - Abréviations de grandeurs : "1 850 k€" -> 1850000, "2.4 M€" -> 2400000
11
+ * - Suppression des symboles de devises dans les positions numériques
12
+ * - Préservation stricte des chaînes descriptives normales contenant des parenthèses
13
+ */
14
+ export declare function cleanFinancialJSON(rawText: string, options?: FinancialNormalizerOptions): string;
15
+ /**
16
+ * Crée une fonction de transformation financière réutilisable.
17
+ */
18
+ export declare function withFinancialNormalizer(options?: FinancialNormalizerOptions): (rawText: string) => string;
19
+ //# sourceMappingURL=normalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizer.d.ts","sourceRoot":"","sources":["../../src/finance/normalizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAItE,MAAM,WAAW,0BAA0B;IACzC,YAAY,CAAC,EAAE,yBAAyB,CAAC;IACzC,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,0BAA0B,GACnC,MAAM,CAiBR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,CAAC,EAAE,0BAA0B,GACnC,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAE7B"}
@@ -0,0 +1,10 @@
1
+ import type { IAccountingStrategy, FinancialJurisdictionCode, AccountingStandard, FinancialCurrency } from "../strategy.interface";
2
+ export declare class FrenchPCGStrategy implements IAccountingStrategy {
3
+ readonly jurisdictionCode: FinancialJurisdictionCode;
4
+ readonly standard: AccountingStandard;
5
+ readonly defaultCurrency: FinancialCurrency;
6
+ cleanNumber(value: string | number): number;
7
+ cleanJSON(rawText: string): string;
8
+ detect(text: string): boolean;
9
+ }
10
+ //# sourceMappingURL=french-pcg.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"french-pcg.strategy.d.ts","sourceRoot":"","sources":["../../../src/finance/strategies/french-pcg.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,iBAAkB,YAAW,mBAAmB;IAC3D,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAQ;IAC5D,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAS;IAC9C,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAS;IAE7C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IA8C3C,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAkDlC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAkBrC"}
@@ -0,0 +1,10 @@
1
+ import type { IAccountingStrategy, FinancialJurisdictionCode, AccountingStandard, FinancialCurrency } from "../strategy.interface";
2
+ export declare class InternationalAccountingStrategy implements IAccountingStrategy {
3
+ readonly jurisdictionCode: FinancialJurisdictionCode;
4
+ readonly standard: AccountingStandard;
5
+ readonly defaultCurrency: FinancialCurrency;
6
+ cleanNumber(value: string | number): number;
7
+ cleanJSON(rawText: string): string;
8
+ detect(_text: string): boolean;
9
+ }
10
+ //# sourceMappingURL=international.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"international.strategy.d.ts","sourceRoot":"","sources":["../../../src/finance/strategies/international.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,+BAAgC,YAAW,mBAAmB;IACzE,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAmB;IACvE,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAW;IAChD,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAS;IAE7C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IA4D3C,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAsBlC,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;CAGtC"}
@@ -0,0 +1,10 @@
1
+ import type { IAccountingStrategy, FinancialJurisdictionCode, AccountingStandard, FinancialCurrency } from "../strategy.interface";
2
+ export declare class SwissCOStrategy implements IAccountingStrategy {
3
+ readonly jurisdictionCode: FinancialJurisdictionCode;
4
+ readonly standard: AccountingStandard;
5
+ readonly defaultCurrency: FinancialCurrency;
6
+ cleanNumber(value: string | number): number;
7
+ cleanJSON(rawText: string): string;
8
+ detect(text: string): boolean;
9
+ }
10
+ //# sourceMappingURL=swiss-co.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swiss-co.strategy.d.ts","sourceRoot":"","sources":["../../../src/finance/strategies/swiss-co.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,eAAgB,YAAW,mBAAmB;IACzD,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAQ;IAC5D,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAc;IACnD,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAS;IAE7C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IA2C3C,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAiClC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAYrC"}
@@ -0,0 +1,10 @@
1
+ import type { IAccountingStrategy, FinancialJurisdictionCode, AccountingStandard, FinancialCurrency } from "../strategy.interface";
2
+ export declare class UkIFRSStrategy implements IAccountingStrategy {
3
+ readonly jurisdictionCode: FinancialJurisdictionCode;
4
+ readonly standard: AccountingStandard;
5
+ readonly defaultCurrency: FinancialCurrency;
6
+ cleanNumber(value: string | number): number;
7
+ cleanJSON(rawText: string): string;
8
+ detect(text: string): boolean;
9
+ }
10
+ //# sourceMappingURL=uk-ifrs.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uk-ifrs.strategy.d.ts","sourceRoot":"","sources":["../../../src/finance/strategies/uk-ifrs.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,cAAe,YAAW,mBAAmB;IACxD,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAQ;IAC5D,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAU;IAC/C,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAS;IAE7C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAwC3C,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAiClC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAYrC"}
@@ -0,0 +1,10 @@
1
+ import type { IAccountingStrategy, FinancialJurisdictionCode, AccountingStandard, FinancialCurrency } from "../strategy.interface";
2
+ export declare class UsGAAPStrategy implements IAccountingStrategy {
3
+ readonly jurisdictionCode: FinancialJurisdictionCode;
4
+ readonly standard: AccountingStandard;
5
+ readonly defaultCurrency: FinancialCurrency;
6
+ cleanNumber(value: string | number): number;
7
+ cleanJSON(rawText: string): string;
8
+ detect(text: string): boolean;
9
+ }
10
+ //# sourceMappingURL=us-gaap.strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"us-gaap.strategy.d.ts","sourceRoot":"","sources":["../../../src/finance/strategies/us-gaap.strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EACzB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,uBAAuB,CAAC;AAE/B,qBAAa,cAAe,YAAW,mBAAmB;IACxD,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAQ;IAC5D,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAa;IAClD,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAS;IAE7C,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IA8C3C,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAqClC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAcrC"}
@@ -1,7 +1,7 @@
1
- type FinancialJurisdictionCode = "FR" | "US" | "UK" | "CH" | "INTERNATIONAL";
2
- type AccountingStandard = "PCG" | "US_GAAP" | "IFRS" | "SWISS_CO" | "OTHER";
3
- type FinancialCurrency = "EUR" | "USD" | "GBP" | "CHF";
4
- interface IAccountingStrategy {
1
+ export type FinancialJurisdictionCode = "FR" | "US" | "UK" | "CH" | "INTERNATIONAL";
2
+ export type AccountingStandard = "PCG" | "US_GAAP" | "IFRS" | "SWISS_CO" | "OTHER";
3
+ export type FinancialCurrency = "EUR" | "USD" | "GBP" | "CHF";
4
+ export interface IAccountingStrategy {
5
5
  readonly jurisdictionCode: FinancialJurisdictionCode;
6
6
  readonly standard: AccountingStandard;
7
7
  readonly defaultCurrency: FinancialCurrency;
@@ -12,5 +12,4 @@ interface IAccountingStrategy {
12
12
  /** Heuristique de détection automatique à partir du texte brut */
13
13
  detect(text: string): boolean;
14
14
  }
15
-
16
- export type { AccountingStandard as A, FinancialJurisdictionCode as F, IAccountingStrategy as I, FinancialCurrency as a };
15
+ //# sourceMappingURL=strategy.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.interface.d.ts","sourceRoot":"","sources":["../../src/finance/strategy.interface.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,eAAe,CAAC;AACpF,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC;AACnF,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE9D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,gBAAgB,EAAE,yBAAyB,CAAC;IACrD,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CAAC;IAE5C,mEAAmE;IACnE,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAE5C,wEAAwE;IACxE,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IAEnC,kEAAkE;IAClE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CAC/B"}
package/dist/index.d.ts CHANGED
@@ -1,390 +1,9 @@
1
- import { z } from 'zod';
2
- import { F as FinancialJurisdictionCode } from './strategy.interface-CB4_ZAuk.js';
3
-
4
- interface ChatMessage {
5
- role: "system" | "user" | "assistant" | "tool";
6
- content: string;
7
- }
8
- interface LLMUsage {
9
- promptTokens?: number;
10
- completionTokens?: number;
11
- totalTokens?: number;
12
- promptCacheHitTokens?: number;
13
- promptCacheMissTokens?: number;
14
- }
15
- interface LLMCompletionOptions {
16
- model?: string;
17
- messages: ChatMessage[];
18
- temperature?: number;
19
- responseFormat?: Record<string, unknown>;
20
- }
21
- interface LLMStructuredOutputOptions<T> {
22
- model?: string;
23
- messages: ChatMessage[];
24
- schema: z.ZodType<T>;
25
- schemaName: string;
26
- temperature?: number;
27
- }
28
- interface LLMProviderPort {
29
- readonly name: string;
30
- complete(options: LLMCompletionOptions): Promise<{
31
- text: string;
32
- usage?: LLMUsage;
33
- }>;
34
- stream?(options: LLMCompletionOptions): AsyncGenerator<string, LLMUsage | undefined>;
35
- generateStructuredOutput?<T>(options: LLMStructuredOutputOptions<T>): Promise<T>;
36
- }
37
- interface ModelPrice {
38
- promptUSDPerMillion: number;
39
- completionUSDPerMillion: number;
40
- cacheHitUSDPerMillion?: number;
41
- }
42
- interface PricingAdapter {
43
- fetchPrice(model: string, provider?: string): Promise<ModelPrice | undefined> | ModelPrice | undefined;
44
- }
45
- declare class ConfigurationError extends Error {
46
- constructor(message: string);
47
- }
48
- declare class BudgetExceededError extends Error {
49
- constructor(message: string);
50
- }
51
-
52
- interface ProviderConfig {
53
- provider: "deepseek" | "mistral" | "openai" | "ollama" | "openrouter" | "custom";
54
- model: string;
55
- apiKey?: string;
56
- baseUrl?: string;
57
- client?: LLMProviderPort;
58
- pricing?: ModelPrice;
59
- }
60
- interface SecurityConfig {
61
- detectPromptInjection?: boolean;
62
- maskPII?: boolean;
63
- maxInputLength?: number;
64
- }
65
- interface RetryConfig {
66
- maxRetries?: number;
67
- initialDelayMs?: number;
68
- backoffFactor?: number;
69
- }
70
- interface AuditRecord {
71
- timestamp: Date;
72
- model: string;
73
- tokens: {
74
- prompt: number;
75
- completion: number;
76
- total: number;
77
- };
78
- costUSD: number;
79
- failoverOccurred: boolean;
80
- attempts: number;
81
- durationMs?: number;
82
- }
83
- interface AuditSinkPort {
84
- readonly name: string;
85
- log(record: AuditRecord): Promise<void> | void;
86
- }
87
- interface FinanceFeaturesConfig {
88
- enableFrenchAccounting?: boolean;
89
- stripCurrencySymbols?: boolean;
90
- jurisdiction?: "FR" | "US" | "UK" | "CH" | "INTERNATIONAL";
91
- autoDetect?: boolean;
92
- }
93
- interface FeaturesConfig {
94
- finance?: FinanceFeaturesConfig;
95
- }
96
- interface ControlLayerConfig {
97
- primary: ProviderConfig;
98
- fallback?: ProviderConfig;
99
- emergencyFallback?: ProviderConfig;
100
- retryOptions?: RetryConfig;
101
- auditSink?: AuditSinkPort;
102
- maxTokenBudget?: number;
103
- maxCostUSD?: number;
104
- security?: SecurityConfig;
105
- hourlyTokenLimit?: number;
106
- dailyTokenLimit?: number;
107
- features?: FeaturesConfig;
108
- pricingAdapter?: PricingAdapter;
109
- pricingCacheTtlMs?: number;
110
- customPricing?: Record<string, ModelPrice>;
111
- mockSimulation?: boolean;
112
- }
113
- interface ExecutionResult {
114
- text: string;
115
- tokens: {
116
- prompt: number;
117
- completion: number;
118
- total: number;
119
- };
120
- costUSD: number;
121
- modelUsed: string;
122
- failoverOccurred: boolean;
123
- attempts: number;
124
- }
125
- interface StructuredExecutionResult<T> {
126
- data: T;
127
- rawText: string;
128
- tokens: {
129
- prompt: number;
130
- completion: number;
131
- total: number;
132
- };
133
- costUSD: number;
134
- modelUsed: string;
135
- failoverOccurred: boolean;
136
- }
137
- interface GenerateStructuredOutputOptions<T> {
138
- model?: string;
139
- messages: ChatMessage[];
140
- schema: z.ZodType<T>;
141
- schemaName?: string;
142
- maxRetries?: number;
143
- temperature?: number;
144
- providerOverride?: LLMProviderPort;
145
- financialNormalizer?: boolean;
146
- }
147
-
148
- interface CalculateCostOptions {
149
- provider?: string;
150
- providerPricing?: ModelPrice;
151
- customPricing?: Record<string, ModelPrice>;
152
- adapter?: PricingAdapter;
153
- }
154
- /**
155
- * Catalogue indicatif non injecté par défaut dans le moteur.
156
- * Les utilisateurs peuvent s'en servir comme jeu de données initial (ex: seed Prisma)
157
- * ou pour peupler le PricingRegistry s'ils souhaitent des valeurs de départ.
158
- */
159
- declare const SEED_MODEL_PRICES: Record<string, ModelPrice>;
160
- declare class CachedPricingAdapter implements PricingAdapter {
161
- private cache;
162
- private ttlMs;
163
- private delegate;
164
- constructor(delegate: PricingAdapter, ttlMs?: number);
165
- fetchPrice(model: string, provider?: string): Promise<ModelPrice | undefined>;
166
- peek(model: string, provider?: string): ModelPrice | undefined;
167
- clearCache(): void;
168
- invalidate(model?: string, provider?: string): void;
169
- }
170
- /**
171
- * Registre de tarification dynamique.
172
- * Démarre 100% vide : aucune valeur codée en dur n'est imposée par défaut (Option A : Strict & Truthful).
173
- */
174
- declare class PricingRegistry {
175
- private static prices;
176
- private static adapter?;
177
- static registerPrice(identifier: string, price: ModelPrice): void;
178
- static registerDistributorPrices(distributor: string, priceMap: Record<string, ModelPrice>): void;
179
- static registerPrices(prices: Record<string, ModelPrice>): void;
180
- static getPrice(model: string, provider?: string): ModelPrice | undefined;
181
- static setAdapter(adapter: PricingAdapter): void;
182
- static getAdapter(): PricingAdapter | undefined;
183
- static clear(): void;
184
- /**
185
- * Réinitialise le registre en chargeant le catalogue d'exemple SEED_MODEL_PRICES.
186
- */
187
- static loadSeedPrices(): void;
188
- static getAllPrices(): Record<string, ModelPrice>;
189
- }
190
- declare const DEFAULT_MODEL_PRICES: Record<string, ModelPrice>;
191
- declare function resolveModelPrice(model: string, options?: CalculateCostOptions | string): ModelPrice | undefined;
192
- declare function resolveModelPriceAsync(model: string, options?: CalculateCostOptions | string): Promise<ModelPrice | undefined>;
193
- declare function calculateCostUSD(model: string, promptTokens: number, completionTokens: number, cacheHitTokens?: number, options?: CalculateCostOptions | string): number;
194
-
195
- /**
196
- * In-Flight PII Sanitizer for AvantGate.
197
- * Masque les données sensibles (email, téléphone, NIR/sécurité sociale, IBAN/BIC, numéro fiscal SPI)
198
- * avant l'envoi vers des API cloud.
199
- */
200
- interface SanitizeResult {
201
- text: string;
202
- maskedCount: number;
203
- }
204
- declare function sanitizePII(input: string): SanitizeResult;
205
-
206
- /**
207
- * Active Input & Security Guard for AvantGate.
208
- * Bloque les tentatives de jailbreak, fuite de prompt système et attaques d'injection.
209
- */
210
- interface InputGuardResult {
211
- valid: boolean;
212
- blockedReason?: string;
213
- }
214
- declare function validateUserInput(input: string, options?: {
215
- detectInjection?: boolean;
216
- maxLength?: number;
217
- }): InputGuardResult;
218
-
219
- interface ValidateOptions {
220
- normalizer?: (rawText: string) => string;
221
- financialNormalizer?: boolean;
222
- jurisdiction?: FinancialJurisdictionCode;
223
- }
224
- /**
225
- * Nettoie et extrait un bloc JSON valide depuis une réponse de LLM
226
- * (gère les blocs markdown ```json ... ```, les balises de réflexion, etc.)
227
- */
228
- declare function extractAndCleanJSON(rawText: string): string;
229
- /**
230
- * Valide et auto-répare une sortie JSON contre un schéma Zod.
231
- * Supporte l'option de normalisation financière (parenthèses négatives, formats comptables).
232
- */
233
- declare function validateWithZod<T>(rawText: string, schema: z.ZodType<T>, options?: ValidateOptions): T;
234
-
235
- declare class AvantGateControlLayer {
236
- private config;
237
- private cachedPricingAdapter?;
238
- constructor(config: ControlLayerConfig);
239
- private resolveProviderConfig;
240
- private findProviderConfig;
241
- private calculateCost;
242
- private applySecurityGuards;
243
- private checkPreflightBudget;
244
- private checkPostExecutionBudget;
245
- private buildMessages;
246
- private resolveTokens;
247
- private getProviderChain;
248
- private executeSimulation;
249
- private executeOverrideProvider;
250
- private executeProviderPipeline;
251
- private assembleResult;
252
- private notifyAuditSink;
253
- /**
254
- * Exécute une requête avec garde d'entrée, masquage PII, garde pré-vol et calcul des coûts.
255
- */
256
- execute(options: {
257
- userQuery: string;
258
- systemPrompt?: string;
259
- temperature?: number;
260
- providerOverride?: LLMProviderPort;
261
- }): Promise<ExecutionResult>;
262
- /**
263
- * Exécute une requête et valide/répare le résultat selon un schéma Zod.
264
- */
265
- executeStructured<T>(options: {
266
- userQuery: string;
267
- systemPrompt?: string;
268
- schema: z.ZodType<T>;
269
- temperature?: number;
270
- providerOverride?: LLMProviderPort;
271
- }): Promise<StructuredExecutionResult<T>>;
272
- /**
273
- * Méthode unifiée de premier niveau pour l'extraction structurée sans code boilerplate.
274
- * Gère le failover multi-fournisseurs, les retries, la validation Zod et la normalisation financière.
275
- */
276
- generateStructuredOutput<T>(options: GenerateStructuredOutputOptions<T>): Promise<StructuredExecutionResult<T>>;
277
- }
278
- declare function createLLMControlLayer(config: ControlLayerConfig): AvantGateControlLayer;
279
- declare const createAvantGate: typeof createLLMControlLayer;
280
-
281
- interface PromptMessage {
282
- role: "system" | "user" | "assistant";
283
- content: string;
284
- }
285
- type PromptLabel = "production" | "staging" | "experimental";
286
- interface PromptTemplateOptions<TVariables extends Record<string, unknown> = Record<string, unknown>> {
287
- id: string;
288
- version: number;
289
- label?: PromptLabel;
290
- description?: string;
291
- template: string;
292
- inputSchema?: z.ZodType<TVariables>;
293
- antiInjection?: {
294
- enabled?: boolean;
295
- blockPatterns?: RegExp[];
296
- sanitizer?: (value: string) => string;
297
- };
298
- }
299
- interface PromptValidationResult {
300
- isValid: boolean;
301
- threats: string[];
302
- }
303
- interface ITokenBudget {
304
- count(text: string): number;
305
- remaining(): number;
306
- reserve(slot: string, text: string): void;
307
- forceReserve(slot: string, text: string): void;
308
- getAllocated(): number;
309
- reset(): void;
310
- }
311
- interface BuildResult {
312
- messages: PromptMessage[];
313
- promptText: string;
314
- allocatedTokens?: number;
315
- isTruncated: boolean;
316
- truncatedSlot?: "context" | "pinnedFacts" | "user";
317
- }
318
-
319
- declare class PromptTemplate<TVariables extends Record<string, unknown> = Record<string, unknown>> {
320
- readonly id: string;
321
- readonly version: number;
322
- readonly label: PromptLabel;
323
- readonly description?: string;
324
- readonly template: string;
325
- readonly inputSchema?: z.ZodType<TVariables>;
326
- private blockPatterns;
327
- private antiInjectionEnabled;
328
- private customSanitizer?;
329
- constructor(options: PromptTemplateOptions<TVariables>);
330
- validateUserInput(variables: TVariables): PromptValidationResult;
331
- format(variables: TVariables): string;
332
- }
333
-
334
- declare class PromptBuilder {
335
- private personaSlot;
336
- private rulesSlot;
337
- private retryHintSlot;
338
- private fewShotSlot;
339
- private pinnedFactsSlot;
340
- private contextSlot;
341
- private userPayloadSlot;
342
- private schemaContractText;
343
- constructor(templateOrId?: string | PromptTemplate);
344
- withPersona(persona: string): this;
345
- withRules(rules: string | string[]): this;
346
- withRetryHint(hint: string): this;
347
- withFewShot(examples: Array<{
348
- question: string;
349
- answer: string;
350
- }>): this;
351
- withPinnedFacts(facts: string | Record<string, unknown>): this;
352
- withContext(context: string): this;
353
- withUserPayload(payload: string): this;
354
- schemaContract<T>(schema: z.ZodType<T>, options?: {
355
- schemaName?: string;
356
- }): this;
357
- private assembleMessages;
358
- toMessages(): PromptMessage[];
359
- build(budget?: ITokenBudget): BuildResult;
360
- }
361
-
362
- declare class PromptRegistry {
363
- private static registry;
364
- static register<T extends Record<string, unknown>>(templateOrOptions: PromptTemplate<T> | PromptTemplateOptions<T>): void;
365
- static get<T extends Record<string, unknown> = Record<string, unknown>>(id: string, options?: {
366
- version?: number;
367
- label?: PromptLabel;
368
- }): PromptTemplate<T>;
369
- static has(id: string): boolean;
370
- static clear(): void;
371
- }
372
-
373
- declare class HttpProviderClient implements LLMProviderPort {
374
- readonly name: string;
375
- private readonly baseUrl;
376
- private readonly apiKey?;
377
- private readonly providerType;
378
- constructor(config: ProviderConfig);
379
- private resolveEndpoint;
380
- private buildHeaders;
381
- private buildPayload;
382
- private extractUsage;
383
- complete(options: LLMCompletionOptions): Promise<{
384
- text: string;
385
- usage?: LLMUsage;
386
- }>;
387
- }
388
- declare function createHttpProviderClient(config: ProviderConfig): HttpProviderClient;
389
-
390
- export { type AuditRecord, type AuditSinkPort, BudgetExceededError as AvantGateBudgetExceededError, ConfigurationError as AvantGateConfigurationError, AvantGateControlLayer, BudgetExceededError, type BuildResult, CachedPricingAdapter, type CalculateCostOptions, type ChatMessage, ConfigurationError, type ControlLayerConfig, DEFAULT_MODEL_PRICES, type ExecutionResult, type FeaturesConfig, type FinanceFeaturesConfig, type GenerateStructuredOutputOptions, HttpProviderClient, type ITokenBudget, type InputGuardResult, type LLMCompletionOptions, type LLMProviderPort, type LLMStructuredOutputOptions, type LLMUsage, type ModelPrice, type PricingAdapter, PricingRegistry, PromptBuilder, type PromptLabel, type PromptMessage, PromptRegistry, PromptTemplate, type PromptTemplateOptions, type PromptValidationResult, type ProviderConfig, type RetryConfig, SEED_MODEL_PRICES, type SanitizeResult, type SecurityConfig, type StructuredExecutionResult, type ValidateOptions, AvantGateControlLayer as ZenLLMControlLayer, calculateCostUSD, createAvantGate, createHttpProviderClient, createLLMControlLayer, extractAndCleanJSON, resolveModelPrice, resolveModelPriceAsync, sanitizePII, validateUserInput, validateWithZod };
1
+ export * from "./types";
2
+ export * from "./pricing";
3
+ export * from "./sanitizer";
4
+ export * from "./input-guard";
5
+ export * from "./response-validator";
6
+ export * from "./control-layer";
7
+ export * from "./prompts";
8
+ export * from "./providers/http-client";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Active Input & Security Guard for AvantGate.
3
+ * Bloque les tentatives de jailbreak, fuite de prompt système et attaques d'injection.
4
+ */
5
+ export interface InputGuardResult {
6
+ valid: boolean;
7
+ blockedReason?: string;
8
+ }
9
+ export declare function validateUserInput(input: string, options?: {
10
+ detectInjection?: boolean;
11
+ maxLength?: number;
12
+ }): InputGuardResult;
13
+ //# sourceMappingURL=input-guard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-guard.d.ts","sourceRoot":"","sources":["../src/input-guard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1D,gBAAgB,CAqBlB"}