agentic-api 2.0.31 → 2.0.314

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 (89) hide show
  1. package/dist/src/agents/agents.example.js +21 -22
  2. package/dist/src/agents/authentication.js +1 -2
  3. package/dist/src/agents/prompts.d.ts +5 -4
  4. package/dist/src/agents/prompts.js +42 -87
  5. package/dist/src/agents/reducer.core.d.ts +24 -2
  6. package/dist/src/agents/reducer.core.js +125 -35
  7. package/dist/src/agents/reducer.loaders.d.ts +55 -1
  8. package/dist/src/agents/reducer.loaders.js +114 -1
  9. package/dist/src/agents/reducer.types.d.ts +45 -2
  10. package/dist/src/agents/semantic.js +1 -2
  11. package/dist/src/agents/simulator.d.ts +4 -0
  12. package/dist/src/agents/simulator.executor.d.ts +5 -1
  13. package/dist/src/agents/simulator.executor.js +41 -9
  14. package/dist/src/agents/simulator.js +86 -28
  15. package/dist/src/agents/simulator.prompts.d.ts +3 -2
  16. package/dist/src/agents/simulator.prompts.js +52 -78
  17. package/dist/src/agents/simulator.types.d.ts +20 -5
  18. package/dist/src/agents/simulator.utils.d.ts +7 -2
  19. package/dist/src/agents/simulator.utils.js +33 -11
  20. package/dist/src/agents/system.js +1 -2
  21. package/dist/src/execute.d.ts +17 -3
  22. package/dist/src/execute.js +156 -158
  23. package/dist/src/index.d.ts +1 -1
  24. package/dist/src/index.js +1 -1
  25. package/dist/src/{princing.openai.d.ts → pricing.llm.d.ts} +6 -0
  26. package/dist/src/pricing.llm.js +234 -0
  27. package/dist/src/prompts.d.ts +13 -4
  28. package/dist/src/prompts.js +221 -114
  29. package/dist/src/rag/embeddings.d.ts +36 -18
  30. package/dist/src/rag/embeddings.js +125 -128
  31. package/dist/src/rag/index.d.ts +5 -5
  32. package/dist/src/rag/index.js +14 -17
  33. package/dist/src/rag/parser.d.ts +2 -1
  34. package/dist/src/rag/parser.js +11 -14
  35. package/dist/src/rag/rag.examples.d.ts +27 -0
  36. package/dist/src/rag/rag.examples.js +151 -0
  37. package/dist/src/rag/rag.manager.d.ts +383 -0
  38. package/dist/src/rag/rag.manager.js +1378 -0
  39. package/dist/src/rag/types.d.ts +128 -12
  40. package/dist/src/rag/types.js +100 -1
  41. package/dist/src/rag/usecase.d.ts +37 -0
  42. package/dist/src/rag/usecase.js +96 -7
  43. package/dist/src/rules/git/git.e2e.helper.js +1 -0
  44. package/dist/src/rules/git/git.health.d.ts +57 -0
  45. package/dist/src/rules/git/git.health.js +281 -1
  46. package/dist/src/rules/git/index.d.ts +2 -2
  47. package/dist/src/rules/git/index.js +12 -1
  48. package/dist/src/rules/git/repo.d.ts +117 -0
  49. package/dist/src/rules/git/repo.js +536 -0
  50. package/dist/src/rules/git/repo.tools.d.ts +22 -1
  51. package/dist/src/rules/git/repo.tools.js +50 -1
  52. package/dist/src/rules/types.d.ts +16 -14
  53. package/dist/src/rules/utils.matter.d.ts +0 -4
  54. package/dist/src/rules/utils.matter.js +26 -7
  55. package/dist/src/scrapper.d.ts +15 -22
  56. package/dist/src/scrapper.js +57 -110
  57. package/dist/src/stategraph/index.d.ts +1 -1
  58. package/dist/src/stategraph/stategraph.d.ts +31 -2
  59. package/dist/src/stategraph/stategraph.js +93 -6
  60. package/dist/src/stategraph/stategraph.storage.js +4 -0
  61. package/dist/src/stategraph/types.d.ts +22 -0
  62. package/dist/src/types.d.ts +4 -2
  63. package/dist/src/types.js +1 -1
  64. package/dist/src/usecase.d.ts +11 -2
  65. package/dist/src/usecase.js +27 -35
  66. package/dist/src/utils.d.ts +32 -18
  67. package/dist/src/utils.js +60 -126
  68. package/package.json +7 -2
  69. package/dist/src/agents/digestor.test.d.ts +0 -1
  70. package/dist/src/agents/digestor.test.js +0 -45
  71. package/dist/src/agents/reducer.example.d.ts +0 -28
  72. package/dist/src/agents/reducer.example.js +0 -118
  73. package/dist/src/agents/reducer.process.d.ts +0 -16
  74. package/dist/src/agents/reducer.process.js +0 -143
  75. package/dist/src/agents/reducer.tools.d.ts +0 -29
  76. package/dist/src/agents/reducer.tools.js +0 -157
  77. package/dist/src/agents/simpleExample.d.ts +0 -3
  78. package/dist/src/agents/simpleExample.js +0 -38
  79. package/dist/src/agents/system-review.d.ts +0 -5
  80. package/dist/src/agents/system-review.js +0 -181
  81. package/dist/src/agents/systemReview.d.ts +0 -4
  82. package/dist/src/agents/systemReview.js +0 -22
  83. package/dist/src/princing.openai.js +0 -54
  84. package/dist/src/rag/tools.d.ts +0 -76
  85. package/dist/src/rag/tools.js +0 -196
  86. package/dist/src/rules/user.mapper.d.ts +0 -61
  87. package/dist/src/rules/user.mapper.js +0 -160
  88. package/dist/src/rules/utils/slug.d.ts +0 -22
  89. package/dist/src/rules/utils/slug.js +0 -35
@@ -1,160 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserRoleMapper = exports.ROLE_PERMISSIONS = exports.RuleRole = void 0;
4
- /**
5
- * Rôles disponibles pour les règles
6
- */
7
- var RuleRole;
8
- (function (RuleRole) {
9
- RuleRole["READER"] = "reader";
10
- RuleRole["EDITOR"] = "editor";
11
- RuleRole["VALIDATOR"] = "validator";
12
- RuleRole["PUBLISHER"] = "publisher";
13
- })(RuleRole || (exports.RuleRole = RuleRole = {}));
14
- /**
15
- * Permissions par rôle
16
- */
17
- exports.ROLE_PERMISSIONS = {
18
- [RuleRole.READER]: {
19
- canRead: true,
20
- canDelete: false,
21
- canEdit: false,
22
- canValidate: false,
23
- canPublish: false
24
- },
25
- [RuleRole.EDITOR]: {
26
- canRead: true,
27
- canDelete: true,
28
- canEdit: true,
29
- canValidate: false,
30
- canPublish: false
31
- },
32
- [RuleRole.VALIDATOR]: {
33
- canRead: true,
34
- canDelete: true,
35
- canEdit: true,
36
- canValidate: true,
37
- canPublish: false
38
- },
39
- [RuleRole.PUBLISHER]: {
40
- canRead: true,
41
- canDelete: true,
42
- canEdit: true,
43
- canValidate: true,
44
- canPublish: true
45
- }
46
- };
47
- /**
48
- * Mapper pour convertir UserMSAL en RuleUser
49
- */
50
- class UserRoleMapper {
51
- /**
52
- * Convertit un UserMSAL en RuleUser
53
- * @param userMSAL L'utilisateur MSAL
54
- * @param overrideRole Rôle à forcer (optionnel)
55
- */
56
- static toRuleUser(userMSAL, overrideRole) {
57
- // Déterminer le rôle
58
- let role = overrideRole;
59
- if (!role) {
60
- // Déterminer le rôle basé sur les propriétés de l'utilisateur MSAL
61
- role = this.determineRoleFromMSAL(userMSAL);
62
- }
63
- return {
64
- name: userMSAL.displayName || userMSAL.id,
65
- email: userMSAL.mail || `${userMSAL.id}@placeholder.local`,
66
- role: role
67
- };
68
- }
69
- /**
70
- * Détermine le rôle d'un utilisateur basé sur ses propriétés MSAL
71
- * @param userMSAL L'utilisateur MSAL
72
- */
73
- static determineRoleFromMSAL(userMSAL) {
74
- // Logique de détermination du rôle basée sur les propriétés MSAL
75
- // Cette logique peut être personnalisée selon les besoins de l'organisation
76
- // Par défaut, utiliser hasRole() si disponible
77
- const userRole = userMSAL.role;
78
- // Mapper les rôles MSAL vers les rôles de règles
79
- switch (userRole?.toLowerCase()) {
80
- case 'admin':
81
- case 'administrator':
82
- case 'director':
83
- case 'publisher':
84
- return RuleRole.PUBLISHER;
85
- case 'manager':
86
- case 'chef':
87
- case 'validator':
88
- case 'reviewer':
89
- return RuleRole.VALIDATOR;
90
- case 'editor':
91
- case 'contributor':
92
- case 'writer':
93
- return RuleRole.EDITOR;
94
- case 'reader':
95
- case 'viewer':
96
- case 'anonymous':
97
- default:
98
- return RuleRole.READER;
99
- }
100
- }
101
- /**
102
- * Vérifie si un utilisateur a une permission spécifique
103
- * @param userMSAL L'utilisateur MSAL
104
- * @param permission La permission à vérifier
105
- * @param overrideRole Rôle à forcer (optionnel)
106
- */
107
- static hasPermission(userMSAL, permission, overrideRole) {
108
- const ruleUser = this.toRuleUser(userMSAL, overrideRole);
109
- const role = ruleUser.role || RuleRole.READER;
110
- return exports.ROLE_PERMISSIONS[role][permission];
111
- }
112
- /**
113
- * Obtient toutes les permissions d'un utilisateur
114
- * @param userMSAL L'utilisateur MSAL
115
- * @param overrideRole Rôle à forcer (optionnel)
116
- */
117
- static getPermissions(userMSAL, overrideRole) {
118
- const ruleUser = this.toRuleUser(userMSAL, overrideRole);
119
- const role = ruleUser.role || RuleRole.READER;
120
- return exports.ROLE_PERMISSIONS[role];
121
- }
122
- /**
123
- * Vérifie si un utilisateur peut effectuer une action sur une branche donnée
124
- * @param userMSAL L'utilisateur MSAL
125
- * @param action L'action à effectuer
126
- * @param branch La branche concernée
127
- */
128
- static canPerformAction(userMSAL, action, branch) {
129
- // Déterminer le rôle requis selon l'action et la branche
130
- const isValidationBranch = branch.startsWith('rule-validation-');
131
- const isMainBranch = branch === 'main';
132
- switch (action) {
133
- case 'delete':
134
- return this.hasPermission(userMSAL, 'canDelete');
135
- case 'read':
136
- return this.hasPermission(userMSAL, 'canRead');
137
- case 'edit':
138
- // L'édition n'est autorisée que sur la branche d'édition
139
- if (branch !== 'rule-editor' && !isValidationBranch) {
140
- return false;
141
- }
142
- return this.hasPermission(userMSAL, 'canEdit');
143
- case 'validate':
144
- // La validation n'est autorisée que sur les branches de validation
145
- if (!isValidationBranch) {
146
- return false;
147
- }
148
- return this.hasPermission(userMSAL, 'canValidate');
149
- case 'publish':
150
- // La publication n'est autorisée que depuis les branches de validation vers main
151
- if (!isValidationBranch) {
152
- return false;
153
- }
154
- return this.hasPermission(userMSAL, 'canPublish');
155
- default:
156
- return false;
157
- }
158
- }
159
- }
160
- exports.UserRoleMapper = UserRoleMapper;
@@ -1,22 +0,0 @@
1
- /**
2
- * Utility functions for handling slugs in the rules system
3
- */
4
- /**
5
- * Extracts a slug from a file path
6
- * @param filePath The file path to extract the slug from
7
- * @returns The slug extracted from the file path
8
- */
9
- export declare const slugFromFile: (filePath: string, ext?: string) => string;
10
- /**
11
- * Converts a slug back to a file path
12
- * @param slug The slug to convert to a file path
13
- * @param ext The file extension to append (default: '.md')
14
- * @returns The file path created from the slug
15
- */
16
- export declare const fileFromSlug: (slug: string, ext?: string) => string;
17
- /**
18
- * Validates if a string is a valid slug
19
- * @param slug The slug to validate
20
- * @returns True if the slug is valid, false otherwise
21
- */
22
- export declare const isValidSlug: (slug: string) => boolean;
@@ -1,35 +0,0 @@
1
- "use strict";
2
- /**
3
- * Utility functions for handling slugs in the rules system
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isValidSlug = exports.fileFromSlug = exports.slugFromFile = void 0;
7
- const utils_1 = require("../../utils");
8
- /**
9
- * Extracts a slug from a file path
10
- * @param filePath The file path to extract the slug from
11
- * @returns The slug extracted from the file path
12
- */
13
- const slugFromFile = (filePath, ext = '.md') => {
14
- return (0, utils_1.toSlug)(filePath.replace(ext, ''));
15
- };
16
- exports.slugFromFile = slugFromFile;
17
- /**
18
- * Converts a slug back to a file path
19
- * @param slug The slug to convert to a file path
20
- * @param ext The file extension to append (default: '.md')
21
- * @returns The file path created from the slug
22
- */
23
- const fileFromSlug = (slug, ext = '.md') => {
24
- return `${slug}${ext}`;
25
- };
26
- exports.fileFromSlug = fileFromSlug;
27
- /**
28
- * Validates if a string is a valid slug
29
- * @param slug The slug to validate
30
- * @returns True if the slug is valid, false otherwise
31
- */
32
- const isValidSlug = (slug) => {
33
- return /^[a-z0-9-]+$/.test(slug);
34
- };
35
- exports.isValidSlug = isValidSlug;