@x12i/ai-gateway 10.4.4 → 11.0.1

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 (32) hide show
  1. package/README.md +5 -5
  2. package/dist/activity-manager.js +3 -19
  3. package/dist/gateway-memory.js +0 -7
  4. package/dist/gateway-messages.d.ts +2 -5
  5. package/dist/gateway-messages.js +2 -6
  6. package/dist/gateway-utils.js +1 -1
  7. package/dist/gateway-validation.js +13 -0
  8. package/dist/gateway.d.ts +0 -4
  9. package/dist/gateway.js +49 -36
  10. package/dist/message-builder.d.ts +4 -0
  11. package/dist/message-builder.js +147 -256
  12. package/dist/openrouter-runtime-adapter/create-openrouter-runtime-provider.js +54 -0
  13. package/dist/openrouter-runtime-adapter/map-gateway-request.js +20 -4
  14. package/dist/openrouter-runtime-adapter/validate-server-tools.js +4 -14
  15. package/dist/troubleshooting-helper.js +7 -4
  16. package/dist/types.d.ts +3 -7
  17. package/dist-cjs/activity-manager.cjs +3 -19
  18. package/dist-cjs/gateway-memory.cjs +0 -7
  19. package/dist-cjs/gateway-messages.cjs +2 -6
  20. package/dist-cjs/gateway-messages.d.ts +2 -5
  21. package/dist-cjs/gateway-utils.cjs +1 -1
  22. package/dist-cjs/gateway-validation.cjs +13 -0
  23. package/dist-cjs/gateway.cjs +49 -36
  24. package/dist-cjs/gateway.d.ts +0 -4
  25. package/dist-cjs/message-builder.cjs +147 -256
  26. package/dist-cjs/message-builder.d.ts +4 -0
  27. package/dist-cjs/openrouter-runtime-adapter/create-openrouter-runtime-provider.cjs +54 -0
  28. package/dist-cjs/openrouter-runtime-adapter/map-gateway-request.cjs +20 -4
  29. package/dist-cjs/openrouter-runtime-adapter/validate-server-tools.cjs +4 -14
  30. package/dist-cjs/troubleshooting-helper.cjs +7 -4
  31. package/dist-cjs/types.d.ts +3 -7
  32. package/package.json +2 -2
@@ -195,7 +195,10 @@ export function validateAIRequest(request) {
195
195
  errors.push('instructions is required');
196
196
  }
197
197
  if (!request.prompt) {
198
- errors.push('Prompt is required (input field has been removed - use workingMemory.input instead)');
198
+ const wmInput = request.workingMemory?.input;
199
+ if (wmInput === undefined || wmInput === null) {
200
+ errors.push('prompt or workingMemory.input is required for the user turn');
201
+ }
199
202
  }
200
203
  // Validate config
201
204
  if (!request.config) {
@@ -581,7 +584,7 @@ export function createValidationTestCases() {
581
584
  expectedErrors: ['instructions is required']
582
585
  },
583
586
  {
584
- name: 'Missing prompt',
587
+ name: 'Missing prompt and workingMemory.input',
585
588
  request: {
586
589
  aiRequestId: 'ai-no-prompt',
587
590
  agentId: 'agent-1',
@@ -589,11 +592,11 @@ export function createValidationTestCases() {
589
592
  actionRef: 'validation/x',
590
593
  identity: sampleIdentity('test', 'agent-1'),
591
594
  instructions: 'Test',
592
- workingMemory: { input: 'Test' },
595
+ workingMemory: {},
593
596
  config: { model: 'gpt-4o', provider: 'openai' }
594
597
  },
595
598
  shouldFail: true,
596
- expectedErrors: ['Prompt is required (input field has been removed - use workingMemory.input instead)']
599
+ expectedErrors: ['prompt or workingMemory.input is required for the user turn']
597
600
  },
598
601
  {
599
602
  name: 'Missing actionRef',
@@ -933,15 +933,11 @@ interface BaseLLMRequest extends Omit<LLMRequest, 'messages' | 'input' | 'reques
933
933
  */
934
934
  coreSkillId?: string;
935
935
  /**
936
- * Prompt template text (optional) — parsed with workingMemory and tier memories.
936
+ * Prompt template text (optional) — parsed with workingMemory and sent as the user turn.
937
+ * When omitted, workingMemory.input is serialized as the user message.
937
938
  * Use variables such as {{input}} resolved from workingMemory.input.
938
939
  */
939
940
  prompt?: string;
940
- /**
941
- * Context text (optional) - Template that can use workingMemory
942
- * Added as system message between instructions and prompt
943
- */
944
- context?: string;
945
941
  /**
946
942
  * Working memory (optional) - Affects all template parsing
947
943
  * Passed to Rendrix (v4+) for template variable substitution.
@@ -1042,7 +1038,7 @@ interface BaseLLMRequest extends Omit<LLMRequest, 'messages' | 'input' | 'reques
1042
1038
  * - agentId: Required to identify the agent
1043
1039
  * - instructions: Required (template text)
1044
1040
  *
1045
- * Minimum: instructions + prompt (prompt is required for user message)
1041
+ * Minimum: instructions + (prompt or workingMemory.input)
1046
1042
  *
1047
1043
  * Note: objectTypes is NOT supported in ChatRequest.
1048
1044
  * Use {@link AIInvokeRequest} with invoke() for structured output requests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@x12i/ai-gateway",
3
- "version": "10.4.4",
3
+ "version": "11.0.1",
4
4
  "description": "AI Gateway - Unified interface for LLM provider routing and management",
5
5
  "type": "module",
6
6
  "exports": {
@@ -44,7 +44,7 @@
44
44
  "dependencies": {
45
45
  "@x12i/activix": "^9.0.2",
46
46
  "@x12i/ai-profiles": "^3.4.1",
47
- "@x12i/ai-providers-router": "^4.10.0",
47
+ "@x12i/ai-providers-router": "^4.11.0",
48
48
  "@x12i/ai-tools": "^3.3.5",
49
49
  "@x12i/flex-md": "^4.8.0",
50
50
  "@x12i/logxer": "^5.1.0",