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
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.modelConfig = modelConfig;
4
+ const llm_1 = require("../llm");
5
+ const pricing_1 = require("../llm/pricing");
6
+ /**
7
+ * Configuration des modèles pour Chat Completions (legacy) et Responses API
8
+ *
9
+ * Gère la configuration des modèles avec migration automatique des paramètres
10
+ * entre les deux APIs.
11
+ *
12
+ * @param model - Alias du modèle (ex: "LOW", "MEDIUM", "HIGH", "EMBEDDING-small", "VISION")
13
+ * @param custom - Options personnalisées (provider, thinking, temperature, etc.)
14
+ * @param custom.provider - Provider à utiliser ('openai' | 'xai'), default: LLM_PROVIDER env
15
+ * @param custom.thinking - Active le mode raisonnement (reasoning_effort: high)
16
+ * @param forResponses - Si true, adapte pour l'API Responses (sinon Chat Completions)
17
+ *
18
+ * @example
19
+ * // Modèle par défaut
20
+ * const config = modelConfig("MEDIUM");
21
+ *
22
+ * // Forcer OpenAI pour embeddings
23
+ * const config = modelConfig("EMBEDDING-small", { provider: 'openai' });
24
+ *
25
+ * // Vision avec xAI
26
+ * const config = modelConfig("VISION", { provider: 'xai' });
27
+ */
28
+ function modelConfig(model, custom, forResponses = false) {
29
+ //
30
+ // Extraire et supprimer les paramètres spéciaux
31
+ const provider = custom?.provider || (0, llm_1.getDefaultProvider)();
32
+ const thinking = custom?.thinking || false;
33
+ delete custom?.provider;
34
+ delete custom?.thinking;
35
+ const defaultOptions = Object.assign({
36
+ stream_options: { "include_usage": true },
37
+ }, custom || {});
38
+ //
39
+ // Get mapping based on provider (OpenAI vs xAI)
40
+ // LLM() applique automatiquement reasoning_effort si thinking=true
41
+ const mapping = (0, pricing_1.LLM)(provider, thinking);
42
+ //
43
+ // Vérifier que le modèle existe pour ce provider
44
+ if (!mapping[model]) {
45
+ const availableModels = Object.keys(mapping).join(', ');
46
+ throw new Error(`Model "${model}" not available for provider "${provider}". ` +
47
+ `Available models: ${availableModels}`);
48
+ }
49
+ const options = Object.assign({}, mapping[model], defaultOptions);
50
+ //
51
+ // Pour Responses API : mapper vers la nouvelle structure et filtrer les paramètres incompatibles
52
+ // Chat Completions utilise reasoning_effort (string) et verbosity (string)
53
+ // Responses API utilise reasoning: { effort: string } et text.verbosity (string)
54
+ if (forResponses) {
55
+ // Mapper reasoning_effort → reasoning: { effort }
56
+ if (options.reasoning_effort) {
57
+ options.reasoning = { effort: options.reasoning_effort };
58
+ delete options.reasoning_effort;
59
+ }
60
+ // Mapper verbosity → text.verbosity
61
+ if (options.verbosity) {
62
+ options.text = { verbosity: options.verbosity };
63
+ delete options.verbosity;
64
+ }
65
+ // Supprimer les paramètres non supportés par Responses API
66
+ const unsupportedParams = ['frequency_penalty', 'presence_penalty', 'stream_options', 'web_search_options'];
67
+ unsupportedParams.forEach(param => {
68
+ delete options[param];
69
+ });
70
+ }
71
+ return options;
72
+ }
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Responses API Implementation
3
+ *
4
+ * Migration de Chat Completions vers Responses API pour:
5
+ * - Meilleur support des modèles reasoning (o-series, gpt-5)
6
+ * - Tool calls préservés pendant le raisonnement via reasoning: { effort }
7
+ * - Events SSE typés (response.output_text.delta, response.function_call.*)
8
+ * - Plus de boucle moreThinkin (obsolète) : reasoning géré nativement
9
+ *
10
+ * Différences clés vs legacy:
11
+ * - `input` remplace `messages` (même format array, juste renommage du paramètre)
12
+ * - `reasoning: { effort: 'low' | 'medium' | 'high' }` remplace `reasoning_effort`
13
+ * - Events SSE structurés vs delta progressifs
14
+ * - `response.usage` vs `final.usage`
15
+ * - Tools/function calling: format identique, `parallel_tool_calls` supporté
16
+ *
17
+ * Optimisations appliquées (vs code original):
18
+ * - OPTIM: Helpers centralisés (accumulateUsageTokens, stepsToActions)
19
+ * - BUG FIX: executionResultMerge fusionne actions correctement (corrigé dans types.ts)
20
+ * - BUG FIX: moreThinkin supprimé (obsolète)
21
+ * - BUG FIX: reasoning_effort géré par modelConfig uniquement
22
+ *
23
+ * TODO [Phase 2]: Migration vers openai-agents-js
24
+ * https://openai.github.io/openai-agents-js/
25
+ * - Remplacer handleTransferCall par handoff natif du SDK
26
+ * - Utiliser swarm.run() pour orchestration multi-agents
27
+ * - Mapper downstreamAgents vers router policies
28
+ * - Intégration optionnelle avec Vercel AI SDK (multi-providers)
29
+ * - stateGraph restera compatible (AgentMessage générique, agnostic de l'API)
30
+ */
31
+ import { AgentConfig, AgenticContext, ExecuteAgentResult, ExecutionResult } from "../types";
32
+ import { ReadCompletionsStreamOptions, ExecuteAgentSetParams } from "./shared";
33
+ /**
34
+ * RESPONSES API: Traite le stream de responses avec tool calls
35
+ *
36
+ * Utilise les events SSE typés de Responses API:
37
+ * - response.output_text.delta → texte
38
+ * - response.function_call.* → tool calls
39
+ * - response.completed → finalisation
40
+ */
41
+ export declare function readCompletionsStream(params: ReadCompletionsStreamOptions): Promise<ExecutionResult>;
42
+ /**
43
+ * Executes a set of agents to process a user query
44
+ *
45
+ * RESPONSES API VERSION
46
+ */
47
+ export declare function executeAgentSet(agentSet: AgentConfig[], context: AgenticContext, params: ExecuteAgentSetParams): Promise<ExecutionResult>;
48
+ /**
49
+ * Execute agent - Responses API version
50
+ */
51
+ export declare function executeAgent(agentSet: AgentConfig[], params: ExecuteAgentSetParams): Promise<ExecuteAgentResult>;
52
+ /**
53
+ * Execute query - Responses API version
54
+ */
55
+ export declare function executeQuery(params: ExecuteAgentSetParams): Promise<ExecuteAgentResult>;