agentic-api 2.0.314 → 2.0.585

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 (76) hide show
  1. package/README.md +37 -34
  2. package/dist/src/agents/prompts.d.ts +1 -1
  3. package/dist/src/agents/prompts.js +9 -7
  4. package/dist/src/agents/reducer.core.js +2 -2
  5. package/dist/src/agents/simulator.d.ts +33 -4
  6. package/dist/src/agents/simulator.dashboard.d.ts +140 -0
  7. package/dist/src/agents/simulator.dashboard.js +344 -0
  8. package/dist/src/agents/simulator.executor.d.ts +9 -3
  9. package/dist/src/agents/simulator.executor.js +43 -17
  10. package/dist/src/agents/simulator.js +103 -19
  11. package/dist/src/agents/simulator.prompts.d.ts +9 -8
  12. package/dist/src/agents/simulator.prompts.js +68 -62
  13. package/dist/src/agents/simulator.types.d.ts +39 -4
  14. package/dist/src/agents/simulator.utils.d.ts +22 -1
  15. package/dist/src/agents/simulator.utils.js +27 -2
  16. package/dist/src/execute/helpers.d.ts +75 -0
  17. package/dist/src/execute/helpers.js +139 -0
  18. package/dist/src/execute/index.d.ts +11 -0
  19. package/dist/src/execute/index.js +44 -0
  20. package/dist/src/execute/legacy.d.ts +46 -0
  21. package/dist/src/{execute.js → execute/legacy.js} +130 -232
  22. package/dist/src/execute/modelconfig.d.ts +29 -0
  23. package/dist/src/execute/modelconfig.js +72 -0
  24. package/dist/src/execute/responses.d.ts +55 -0
  25. package/dist/src/execute/responses.js +595 -0
  26. package/dist/src/execute/shared.d.ts +83 -0
  27. package/dist/src/execute/shared.js +188 -0
  28. package/dist/src/index.d.ts +5 -1
  29. package/dist/src/index.js +21 -2
  30. package/dist/src/llm/config.d.ts +25 -0
  31. package/dist/src/llm/config.js +38 -0
  32. package/dist/src/llm/index.d.ts +48 -0
  33. package/dist/src/llm/index.js +115 -0
  34. package/dist/src/llm/openai.d.ts +6 -0
  35. package/dist/src/llm/openai.js +154 -0
  36. package/dist/src/llm/pricing.d.ts +26 -0
  37. package/dist/src/llm/pricing.js +129 -0
  38. package/dist/src/llm/xai.d.ts +17 -0
  39. package/dist/src/llm/xai.js +90 -0
  40. package/dist/src/pricing.llm.d.ts +3 -15
  41. package/dist/src/pricing.llm.js +10 -230
  42. package/dist/src/prompts.d.ts +0 -1
  43. package/dist/src/prompts.js +51 -118
  44. package/dist/src/rag/embeddings.d.ts +5 -1
  45. package/dist/src/rag/embeddings.js +23 -7
  46. package/dist/src/rag/parser.js +1 -1
  47. package/dist/src/rag/rag.manager.d.ts +33 -2
  48. package/dist/src/rag/rag.manager.js +159 -61
  49. package/dist/src/rag/types.d.ts +2 -0
  50. package/dist/src/rag/usecase.js +8 -11
  51. package/dist/src/rules/git/git.e2e.helper.js +21 -2
  52. package/dist/src/rules/git/git.health.d.ts +4 -2
  53. package/dist/src/rules/git/git.health.js +113 -16
  54. package/dist/src/rules/git/index.d.ts +1 -1
  55. package/dist/src/rules/git/index.js +3 -2
  56. package/dist/src/rules/git/repo.d.ts +57 -7
  57. package/dist/src/rules/git/repo.js +326 -39
  58. package/dist/src/rules/git/repo.pr.d.ts +8 -0
  59. package/dist/src/rules/git/repo.pr.js +161 -13
  60. package/dist/src/rules/git/repo.tools.d.ts +5 -1
  61. package/dist/src/rules/git/repo.tools.js +54 -7
  62. package/dist/src/rules/types.d.ts +25 -0
  63. package/dist/src/rules/utils.matter.d.ts +0 -20
  64. package/dist/src/rules/utils.matter.js +58 -81
  65. package/dist/src/scrapper.js +3 -2
  66. package/dist/src/stategraph/stategraph.d.ts +26 -1
  67. package/dist/src/stategraph/stategraph.js +43 -2
  68. package/dist/src/stategraph/stategraph.storage.js +4 -0
  69. package/dist/src/stategraph/types.d.ts +5 -0
  70. package/dist/src/types.d.ts +42 -7
  71. package/dist/src/types.js +8 -7
  72. package/dist/src/usecase.js +1 -1
  73. package/dist/src/utils.d.ts +0 -8
  74. package/dist/src/utils.js +26 -29
  75. package/package.json +9 -7
  76. package/dist/src/execute.d.ts +0 -63
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.gitNewValidationRequest = exports.gitGetNextPRNumber = exports.gitClosePRRobust = exports.gitClosePR = exports.gitPRUpdateComments = exports.gitLoadPR = exports.gitGetClosedPRs = exports.gitGetAllPR = exports.gitGetPRMetadata = exports.gitIsPRClosedRobust = exports.gitIsPRClosed = exports.gitSyncPR = exports.gitIDRegistryRename = exports.gitIDRegistryExists = exports.gitFileStrictMatter = exports.gitEnsureMatterID = exports.gitRegisterExistingID = exports.gitReloadIDRegistry = exports.gitGenerateNextID = exports.gitDeleteFile = exports.gitRenameFile = exports.gitEditFile = exports.gitCreateOrEditFile = exports.gitGetBranchHealth = exports.gitCheckConfiguration = exports.gitShowConfiguration = exports.gitSetupRepository = exports.gitEnsureRemoteConfiguration = exports.gitEnsureRepositoryConfiguration = exports.gitInit = exports.gitDeleteNote = exports.gitWriteNote = exports.gitReadNote = exports.gitGetDiffFiles = exports.gitGetAllBranches = exports.gitGetUnmergedBranchesForFile = exports.gitReadFileOutsideRepo = exports.gitGetFileHistory = exports.gitGetFilePreview = exports.gitGetFileContent = exports.gitGetFilesSummary = exports.gitFileExistsInBranch = exports.gitListFilesOutsideRepo = exports.gitListFilesInBranch = exports.gitLastCommit = exports.gitIsFileMerged = exports.isValidInt = exports.gitLoad = exports.unlock = exports.lock = void 0;
18
- exports.gitNewPR = void 0;
17
+ exports.gitGetNextPRNumber = exports.gitClosePRRobust = exports.gitClosePR = exports.gitPRUpdateComments = exports.gitLoadPR = exports.gitGetClosedPRs = exports.gitGetAllPR = exports.gitGetPRMetadata = exports.gitIsPRClosedRobust = exports.gitIsPRClosed = exports.gitSyncPR = exports.gitIDRegistryRename = exports.gitIDRegistryExists = exports.gitFileStrictMatter = exports.gitEnsureMatterID = exports.gitRegisterExistingID = exports.gitReloadIDRegistry = exports.gitGenerateNextID = exports.gitDeleteFile = exports.gitRenameFile = exports.gitEditFile = exports.gitCreateOrEditFile = exports.gitGetValidationBranchHealth = exports.gitGetBranchHealth = exports.gitCheckConfiguration = exports.gitShowConfiguration = exports.gitSetupRepository = exports.gitEnsureRemoteConfiguration = exports.gitEnsureRepositoryConfiguration = exports.gitInit = exports.gitDeleteNote = exports.gitWriteNote = exports.gitReadNote = exports.gitGetDiffFiles = exports.gitGetAllBranches = exports.gitGetUnmergedBranchesForFile = exports.gitReadFileOutsideRepo = exports.gitGetFileHistory = exports.gitGetFilePreview = exports.gitGetFileContent = exports.gitGetFilesSummary = exports.gitFileExistsInBranch = exports.gitListFilesOutsideRepo = exports.gitListFilesInBranch = exports.gitLastCommit = exports.gitIsFileMerged = exports.isValidInt = exports.gitLoad = exports.unlock = exports.lock = void 0;
18
+ exports.gitNewPR = exports.gitNewValidationRequest = void 0;
19
19
  // === OPÉRATIONS GIT BAS NIVEAU ===
20
20
  // Fonctions atomiques pour manipuler Git directement
21
21
  var repo_tools_1 = require("./repo.tools");
@@ -53,6 +53,7 @@ Object.defineProperty(exports, "gitSetupRepository", { enumerable: true, get: fu
53
53
  Object.defineProperty(exports, "gitShowConfiguration", { enumerable: true, get: function () { return repo_1.gitShowConfiguration; } });
54
54
  Object.defineProperty(exports, "gitCheckConfiguration", { enumerable: true, get: function () { return repo_1.gitCheckConfiguration; } });
55
55
  Object.defineProperty(exports, "gitGetBranchHealth", { enumerable: true, get: function () { return repo_1.gitGetBranchHealth; } });
56
+ Object.defineProperty(exports, "gitGetValidationBranchHealth", { enumerable: true, get: function () { return repo_1.gitGetValidationBranchHealth; } });
56
57
  Object.defineProperty(exports, "gitCreateOrEditFile", { enumerable: true, get: function () { return repo_1.gitCreateOrEditFile; } });
57
58
  Object.defineProperty(exports, "gitEditFile", { enumerable: true, get: function () { return repo_1.gitEditFile; } });
58
59
  Object.defineProperty(exports, "gitRenameFile", { enumerable: true, get: function () { return repo_1.gitRenameFile; } });
@@ -1,5 +1,14 @@
1
1
  import { SimpleGit } from 'simple-git';
2
2
  import { RulesGitConfig, GitCommitHistory, RuleUser, GitHealthStatus } from '../types';
3
+ /**
4
+ * Structure du cache matter pour un fichier
5
+ */
6
+ interface MatterStrict {
7
+ id?: number;
8
+ title?: string;
9
+ service?: string;
10
+ oldfile?: string;
11
+ }
3
12
  /**
4
13
  * Vérifie si le fichier de registre d'IDs existe dans le repository Git
5
14
  *
@@ -52,7 +61,7 @@ export declare function gitReloadIDRegistry(config?: RulesGitConfig): void;
52
61
  /**
53
62
  * Enregistre un ID existant dans le registre
54
63
  *
55
- * @param id L'ID à enregistrer
64
+ * @param matter Le matter contenant l'ID à enregistrer
56
65
  * @param branch Branche du fichier (optionnel, pour vérification de propriété)
57
66
  * @param file Nom du fichier (optionnel, pour vérification de propriété)
58
67
  * @param config Configuration Git optionnelle
@@ -60,8 +69,11 @@ export declare function gitReloadIDRegistry(config?: RulesGitConfig): void;
60
69
  *
61
70
  * **Note:** Si `branch` et `file` sont fournis, la fonction vérifie si l'ID appartient
62
71
  * déjà au même fichier. Si oui, aucune erreur n'est levée (cas de re-scan).
72
+ *
73
+ * **Note:** `setMatterCache()` est appelé automatiquement avant l'enregistrement
74
+ * pour garantir la cohérence du cache.
63
75
  */
64
- export declare function gitRegisterExistingID(id: number, branch?: string, file?: string, config?: RulesGitConfig): void;
76
+ export declare function gitRegisterExistingID(matter: MatterStrict, branch?: string, file?: string, config?: RulesGitConfig): void;
65
77
  /**
66
78
  * Renomme un fichier dans le cache du registre d'IDs
67
79
  *
@@ -84,11 +96,18 @@ export declare function gitRegisterExistingID(id: number, branch?: string, file?
84
96
  export declare function gitIDRegistryRename(oldFile: string, newFile: string, branch: string, config?: RulesGitConfig): void;
85
97
  /**
86
98
  * Valide et assure qu'un matter a un ID valide
99
+ *
100
+ * **Principe d'identité stable**: Un fichier conserve son ID à travers les branches.
101
+ * Cette fonction cherche d'abord si le fichier a déjà un ID dans le registre
102
+ * (peu importe la branche), et le réutilise pour garantir la cohérence.
103
+ *
87
104
  * @param matter Le matter à valider/compléter
88
105
  * @param config Configuration Git optionnelle
106
+ * @param branch Branche du fichier (optionnel, peut être undefined lors de createPullRequest)
107
+ * @param file Nom du fichier (requis pour chercher l'ID existant)
89
108
  * @returns Le matter mis à jour avec un ID valide
90
109
  */
91
- export declare function gitEnsureMatterID(matter: any, config?: RulesGitConfig): any;
110
+ export declare function gitEnsureMatterID(matter: MatterStrict, config?: RulesGitConfig, branch?: string, file?: string): any;
92
111
  /**
93
112
  * Lecture rapide et stricte du matter d'un fichier (id + title uniquement)
94
113
  *
@@ -176,13 +195,20 @@ export declare function gitShowConfiguration(git: SimpleGit): Promise<any>;
176
195
  */
177
196
  export declare function gitCheckConfiguration(git?: SimpleGit): Promise<any>;
178
197
  /**
179
- * Crée un fichier dans la branche draft (opération bas niveau)
180
- * @param git Instance Git
198
+ * Crée ou modifie un fichier dans une branche Git et fait un commit automatique
199
+ *
200
+ * @param git Instance SimpleGit
181
201
  * @param filePath Chemin du fichier
182
202
  * @param PR Nom de la branche de Pull Request
183
203
  * @param content Contenu du fichier
184
- * @param user Utilisateur qui effectue l'opération
185
- * @param config Configuration Git (optionnel, utilise la config globale)
204
+ * @param user Utilisateur qui fait le commit
205
+ * @param config Configuration Git optionnelle
206
+ * @returns Historique du commit créé
207
+ *
208
+ * @fixme Ajouter un paramètre optionnel `commitMessage?: string` pour permettre de personnaliser
209
+ * le message de commit au lieu d'utiliser toujours `commit: ${filePath}` par défaut.
210
+ * Cela permettrait aux callers de spécifier des messages plus descriptifs.
211
+ *
186
212
  * @throws GitOperationError si la création échoue
187
213
  */
188
214
  export declare function gitCreateOrEditFile(git: SimpleGit, filePath: string, PR: string, content: string, user: RuleUser, config?: RulesGitConfig): Promise<GitCommitHistory>;
@@ -243,3 +269,27 @@ export declare function gitDeleteFile(git: SimpleGit, filePath: string, branch:
243
269
  * @returns Promise<GitHealthStatus> Diagnostic complet avec liste des problèmes et recommandations de réparation
244
270
  */
245
271
  export declare function gitGetBranchHealth(git: SimpleGit, branch?: string): Promise<GitHealthStatus>;
272
+ /**
273
+ * Version optimisée de gitGetBranchHealth pour les branches de validation
274
+ *
275
+ * Cette fonction utilise une approche en cascade pour diagnostiquer rapidement
276
+ * l'état d'une branche de validation sans effectuer de checkout coûteux.
277
+ *
278
+ * Tests effectués dans l'ordre (arrêt au premier échec) :
279
+ * 1. Branche existe ? (git rev-parse --verify)
280
+ * 2. Note Git présente sur HEAD ? (gitReadNote avec maxCommit=1)
281
+ * 3. Note correspond au bon PR ? (note.id === prNumber)
282
+ *
283
+ * Avantages :
284
+ * - ✅ Pas de checkout (gain 80-90% performance)
285
+ * - ✅ Lecture directe du HEAD sans changer de branche
286
+ * - ✅ Tests cascade (arrêt dès qu'un problème est détecté)
287
+ * - ✅ Optimisé pour branches temporaires (validations)
288
+ *
289
+ * @param git Instance SimpleGit
290
+ * @param branch Nom de la branche de validation à diagnostiquer
291
+ * @param config Configuration Git optionnelle
292
+ * @returns GitHealthStatus avec diagnostic optimisé
293
+ */
294
+ export declare function gitGetValidationBranchHealth(git: SimpleGit, branch: string, config?: RulesGitConfig): Promise<GitHealthStatus>;
295
+ export {};