@23blocks/block-jarvis 5.1.0 → 5.3.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 (53) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/index.esm.js +524 -4
  3. package/dist/src/index.d.ts +4 -4
  4. package/dist/src/index.d.ts.map +1 -1
  5. package/dist/src/lib/jarvis.block.d.ts +7 -1
  6. package/dist/src/lib/jarvis.block.d.ts.map +1 -1
  7. package/dist/src/lib/mappers/agent-test.mapper.d.ts +5 -0
  8. package/dist/src/lib/mappers/agent-test.mapper.d.ts.map +1 -0
  9. package/dist/src/lib/mappers/company-key.mapper.d.ts +4 -0
  10. package/dist/src/lib/mappers/company-key.mapper.d.ts.map +1 -0
  11. package/dist/src/lib/mappers/index.d.ts +5 -0
  12. package/dist/src/lib/mappers/index.d.ts.map +1 -1
  13. package/dist/src/lib/mappers/llm-provider.mapper.d.ts +4 -0
  14. package/dist/src/lib/mappers/llm-provider.mapper.d.ts.map +1 -0
  15. package/dist/src/lib/mappers/prompt-template.mapper.d.ts +4 -0
  16. package/dist/src/lib/mappers/prompt-template.mapper.d.ts.map +1 -0
  17. package/dist/src/lib/mappers/prompt-test.mapper.d.ts +6 -0
  18. package/dist/src/lib/mappers/prompt-test.mapper.d.ts.map +1 -0
  19. package/dist/src/lib/services/agent-runtime.service.d.ts +1 -0
  20. package/dist/src/lib/services/agent-runtime.service.d.ts.map +1 -1
  21. package/dist/src/lib/services/agent-tests.service.d.ts +18 -0
  22. package/dist/src/lib/services/agent-tests.service.d.ts.map +1 -0
  23. package/dist/src/lib/services/ai-models.service.d.ts +5 -0
  24. package/dist/src/lib/services/ai-models.service.d.ts.map +1 -1
  25. package/dist/src/lib/services/company-keys.service.d.ts +14 -0
  26. package/dist/src/lib/services/company-keys.service.d.ts.map +1 -0
  27. package/dist/src/lib/services/executions.service.d.ts +2 -0
  28. package/dist/src/lib/services/executions.service.d.ts.map +1 -1
  29. package/dist/src/lib/services/index.d.ts +5 -0
  30. package/dist/src/lib/services/index.d.ts.map +1 -1
  31. package/dist/src/lib/services/llm-providers.service.d.ts +11 -0
  32. package/dist/src/lib/services/llm-providers.service.d.ts.map +1 -0
  33. package/dist/src/lib/services/prompt-templates.service.d.ts +10 -0
  34. package/dist/src/lib/services/prompt-templates.service.d.ts.map +1 -0
  35. package/dist/src/lib/services/prompt-tests.service.d.ts +32 -0
  36. package/dist/src/lib/services/prompt-tests.service.d.ts.map +1 -0
  37. package/dist/src/lib/services/prompts.service.d.ts +4 -1
  38. package/dist/src/lib/services/prompts.service.d.ts.map +1 -1
  39. package/dist/src/lib/types/agent-test.d.ts +56 -0
  40. package/dist/src/lib/types/agent-test.d.ts.map +1 -0
  41. package/dist/src/lib/types/company-key.d.ts +16 -0
  42. package/dist/src/lib/types/company-key.d.ts.map +1 -0
  43. package/dist/src/lib/types/execution.d.ts +1 -0
  44. package/dist/src/lib/types/execution.d.ts.map +1 -1
  45. package/dist/src/lib/types/index.d.ts +5 -0
  46. package/dist/src/lib/types/index.d.ts.map +1 -1
  47. package/dist/src/lib/types/llm-provider.d.ts +20 -0
  48. package/dist/src/lib/types/llm-provider.d.ts.map +1 -0
  49. package/dist/src/lib/types/prompt-template.d.ts +17 -0
  50. package/dist/src/lib/types/prompt-template.d.ts.map +1 -0
  51. package/dist/src/lib/types/prompt-test.d.ts +79 -0
  52. package/dist/src/lib/types/prompt-test.d.ts.map +1 -0
  53. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## 5.3.0 (2026-03-14)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **@23blocks/block-jarvis:** add prompt tests, agent tests, templates, company keys, LLM providers services ([c8c0cfd](https://github.com/23blocks-OS/frontend-sdk/commit/c8c0cfd))
6
+
7
+ ### ❤️ Thank You
8
+
9
+ - Claude Opus 4.6
10
+ - Juan Pelaez
11
+
12
+ ## 5.2.0 (2026-03-14)
13
+
14
+ ### 🚀 Features
15
+
16
+ - **@23blocks/block-jarvis:** export missing types, services, and mappers for tools, conditions, and transitions ([7733d1a](https://github.com/23blocks-OS/frontend-sdk/commit/7733d1a))
17
+
18
+ ### ❤️ Thank You
19
+
20
+ - Claude Opus 4.6
21
+ - Juan Pelaez
22
+
1
23
  ## 5.1.0 (2026-03-05)
2
24
 
3
25
  ### 🚀 Features
package/dist/index.esm.js CHANGED
@@ -298,7 +298,7 @@ function buildPromptBody(data) {
298
298
  if (data.templateData) body['template_data'] = data.templateData;
299
299
  return body;
300
300
  }
301
- function createPromptsService(transport, _config) {
301
+ function createPromptsService(transport, _config, sseUrl) {
302
302
  return {
303
303
  async list (params) {
304
304
  const queryParams = {};
@@ -345,6 +345,44 @@ function createPromptsService(transport, _config) {
345
345
  duration: response.duration
346
346
  };
347
347
  },
348
+ async publish (uniqueId, versionUniqueId) {
349
+ const response = await transport.post(`/prompts/${uniqueId}/versions/${versionUniqueId}/publish`, {});
350
+ return decodeOne(response, promptMapper);
351
+ },
352
+ async executeStream (uniqueId, data) {
353
+ const response = await transport.post(`/prompts/${uniqueId}/execute/stream`, {
354
+ agent_unique_id: data.agentUniqueId,
355
+ variables: data.variables
356
+ }, _({
357
+ responseType: 'stream',
358
+ headers: {
359
+ Accept: 'text/event-stream'
360
+ }
361
+ }, sseUrl ? {
362
+ baseUrl: sseUrl
363
+ } : {}));
364
+ if (response.body) {
365
+ return response.body.pipeThrough(new TextDecoderStream());
366
+ }
367
+ throw new Error('Streaming not supported');
368
+ },
369
+ async executeVersionStream (uniqueId, versionUniqueId, data) {
370
+ const response = await transport.post(`/prompts/${uniqueId}/versions/${versionUniqueId}/execute/stream`, {
371
+ agent_unique_id: data.agentUniqueId,
372
+ variables: data.variables
373
+ }, _({
374
+ responseType: 'stream',
375
+ headers: {
376
+ Accept: 'text/event-stream'
377
+ }
378
+ }, sseUrl ? {
379
+ baseUrl: sseUrl
380
+ } : {}));
381
+ if (response.body) {
382
+ return response.body.pipeThrough(new TextDecoderStream());
383
+ }
384
+ throw new Error('Streaming not supported');
385
+ },
348
386
  async render (uniqueId, data) {
349
387
  var _response_data, _response_data1, _response_data_meta, _response_data2, _response_meta, _response_data_meta1, _response_data3, _response_meta1, _response_data_meta2, _response_data4, _response_meta2, _response_data_meta3, _response_data5, _response_meta3;
350
388
  const response = await transport.post(`/prompts/${uniqueId}/render`, {
@@ -540,6 +578,7 @@ function createExecutionsService(transport, _config) {
540
578
  if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
541
579
  if (params == null ? void 0 : params.agentUniqueId) queryParams['agent_unique_id'] = params.agentUniqueId;
542
580
  if (params == null ? void 0 : params.promptUniqueId) queryParams['prompt_unique_id'] = params.promptUniqueId;
581
+ if (params == null ? void 0 : params.runUniqueId) queryParams['run_unique_id'] = params.runUniqueId;
543
582
  if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
544
583
  if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
545
584
  const response = await transport.get('/executions', {
@@ -566,6 +605,7 @@ function createExecutionsService(transport, _config) {
566
605
  const queryParams = {};
567
606
  if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
568
607
  if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
608
+ if (params == null ? void 0 : params.runUniqueId) queryParams['run_unique_id'] = params.runUniqueId;
569
609
  if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
570
610
  if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
571
611
  const response = await transport.get(`/prompts/${promptUniqueId}/executions`, {
@@ -576,6 +616,22 @@ function createExecutionsService(transport, _config) {
576
616
  async cancel (uniqueId) {
577
617
  const response = await transport.post(`/executions/${uniqueId}/cancel`, {});
578
618
  return decodeOne(response, executionMapper);
619
+ },
620
+ async listByPromptVersion (promptUniqueId, versionUniqueId, params) {
621
+ const queryParams = {};
622
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
623
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
624
+ if (params == null ? void 0 : params.runUniqueId) queryParams['run_unique_id'] = params.runUniqueId;
625
+ if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
626
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
627
+ const response = await transport.get(`/prompts/${promptUniqueId}/versions/${versionUniqueId}/executions`, {
628
+ params: queryParams
629
+ });
630
+ return decodePageResult(response, executionMapper);
631
+ },
632
+ async getByPrompt (promptUniqueId, executionUniqueId) {
633
+ const response = await transport.get(`/prompts/${promptUniqueId}/executions/${executionUniqueId}`);
634
+ return decodeOne(response, executionMapper);
579
635
  }
580
636
  };
581
637
  }
@@ -746,6 +802,17 @@ function createAIModelsService(transport, _config) {
746
802
  },
747
803
  async delete (uniqueId) {
748
804
  await transport.delete(`/ai_models/${uniqueId}`);
805
+ },
806
+ async openaiAvailable () {
807
+ const response = await transport.get('/vendors/openai/models');
808
+ const data = response.data || response;
809
+ if (Array.isArray(data)) {
810
+ return data.map((m)=>({
811
+ id: m.id || m.name,
812
+ name: m.name || m.id
813
+ }));
814
+ }
815
+ return [];
749
816
  }
750
817
  };
751
818
  }
@@ -1529,6 +1596,25 @@ function createAgentRuntimeService(transport, _config, sseUrl) {
1529
1596
  createdAt: new Date(response.created_at),
1530
1597
  updatedAt: new Date(response.updated_at)
1531
1598
  };
1599
+ },
1600
+ async getRunStatus (agentUniqueId, threadId, runId) {
1601
+ const response = await transport.get(`/agents/${agentUniqueId}/threads/${threadId}/runs/${runId}`);
1602
+ return {
1603
+ id: response.id,
1604
+ uniqueId: response.unique_id,
1605
+ agentUniqueId: response.agent_unique_id,
1606
+ runId: response.run_id || runId,
1607
+ threadId: response.thread_id || threadId,
1608
+ status: response.status,
1609
+ input: response.input,
1610
+ output: response.output,
1611
+ tokens: response.tokens,
1612
+ cost: response.cost,
1613
+ duration: response.duration,
1614
+ error: response.error,
1615
+ createdAt: new Date(response.created_at),
1616
+ updatedAt: new Date(response.updated_at)
1617
+ };
1532
1618
  }
1533
1619
  };
1534
1620
  }
@@ -2381,10 +2467,430 @@ function createAnalyticsService(transport, _config) {
2381
2467
  };
2382
2468
  }
2383
2469
 
2470
+ const promptTestMapper = {
2471
+ type: 'prompt_test',
2472
+ map: (resource)=>({
2473
+ id: resource.id,
2474
+ uniqueId: parseString(resource.attributes['unique_id']) || '',
2475
+ promptUniqueId: parseString(resource.attributes['prompt_unique_id']) || '',
2476
+ name: parseString(resource.attributes['name']) || '',
2477
+ description: parseString(resource.attributes['description']) || undefined,
2478
+ input: parseString(resource.attributes['input']) || undefined,
2479
+ expectedOutput: parseString(resource.attributes['expected_output']) || undefined,
2480
+ variables: resource.attributes['variables'],
2481
+ enabled: resource.attributes['enabled'] != null ? parseBoolean(resource.attributes['enabled']) : undefined,
2482
+ status: parseString(resource.attributes['status']) || 'active',
2483
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
2484
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date()
2485
+ })
2486
+ };
2487
+ const promptTestResultMapper = {
2488
+ type: 'prompt_test_result',
2489
+ map: (resource)=>({
2490
+ id: resource.id,
2491
+ uniqueId: parseString(resource.attributes['unique_id']) || '',
2492
+ testUniqueId: parseString(resource.attributes['test_unique_id']) || '',
2493
+ promptUniqueId: parseString(resource.attributes['prompt_unique_id']) || '',
2494
+ versionUniqueId: parseString(resource.attributes['version_unique_id']) || undefined,
2495
+ input: parseString(resource.attributes['input']) || undefined,
2496
+ expectedOutput: parseString(resource.attributes['expected_output']) || undefined,
2497
+ actualOutput: parseString(resource.attributes['actual_output']) || undefined,
2498
+ passed: resource.attributes['passed'] != null ? parseBoolean(resource.attributes['passed']) : undefined,
2499
+ score: parseOptionalNumber(resource.attributes['score']),
2500
+ tokens: parseOptionalNumber(resource.attributes['tokens']),
2501
+ cost: parseOptionalNumber(resource.attributes['cost']),
2502
+ duration: parseOptionalNumber(resource.attributes['duration']),
2503
+ error: parseString(resource.attributes['error']) || undefined,
2504
+ status: parseString(resource.attributes['status']) || 'pending',
2505
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
2506
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date()
2507
+ })
2508
+ };
2509
+ const promptTestEvaluationMapper = {
2510
+ type: 'prompt_test_evaluation',
2511
+ map: (resource)=>({
2512
+ id: resource.id,
2513
+ uniqueId: parseString(resource.attributes['unique_id']) || '',
2514
+ name: parseString(resource.attributes['name']) || undefined,
2515
+ description: parseString(resource.attributes['description']) || undefined,
2516
+ status: parseString(resource.attributes['status']) || 'active',
2517
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
2518
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date()
2519
+ })
2520
+ };
2521
+
2522
+ function buildPromptTestBody(data) {
2523
+ const body = {};
2524
+ if (data.name) body['name'] = data.name;
2525
+ if (data.description) body['description'] = data.description;
2526
+ if (data.input) body['input'] = data.input;
2527
+ if (data.expectedOutput) body['expected_output'] = data.expectedOutput;
2528
+ if (data.variables) body['variables'] = data.variables;
2529
+ if (data.enabled !== undefined) body['enabled'] = data.enabled;
2530
+ return body;
2531
+ }
2532
+ function createPromptTestsService(transport, _config) {
2533
+ return {
2534
+ async list (promptUniqueId, params) {
2535
+ const queryParams = {};
2536
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2537
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2538
+ if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
2539
+ if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
2540
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
2541
+ const response = await transport.get(`/prompts/${promptUniqueId}/tests`, {
2542
+ params: queryParams
2543
+ });
2544
+ return decodePageResult(response, promptTestMapper);
2545
+ },
2546
+ async get (promptUniqueId, testUniqueId) {
2547
+ const response = await transport.get(`/prompts/${promptUniqueId}/tests/${testUniqueId}`);
2548
+ return decodeOne(response, promptTestMapper);
2549
+ },
2550
+ async create (promptUniqueId, data) {
2551
+ const response = await transport.post(`/prompts/${promptUniqueId}/tests`, {
2552
+ prompt_test: buildPromptTestBody(data)
2553
+ });
2554
+ return decodeOne(response, promptTestMapper);
2555
+ },
2556
+ async update (promptUniqueId, testUniqueId, data) {
2557
+ const response = await transport.put(`/prompts/${promptUniqueId}/tests/${testUniqueId}`, {
2558
+ prompt_test: buildPromptTestBody(data)
2559
+ });
2560
+ return decodeOne(response, promptTestMapper);
2561
+ },
2562
+ async delete (promptUniqueId, testUniqueId) {
2563
+ await transport.delete(`/prompts/${promptUniqueId}/tests/${testUniqueId}`);
2564
+ },
2565
+ async run (promptUniqueId, testUniqueId) {
2566
+ const response = await transport.post(`/prompts/${promptUniqueId}/tests/${testUniqueId}/run`, {});
2567
+ return decodeOne(response, promptTestResultMapper);
2568
+ },
2569
+ async runAgainstVersion (promptUniqueId, versionUniqueId, testUniqueId) {
2570
+ const response = await transport.post(`/prompts/${promptUniqueId}/versions/${versionUniqueId}/tests/${testUniqueId}/run`, {});
2571
+ return decodeOne(response, promptTestResultMapper);
2572
+ },
2573
+ async runAll (promptUniqueId) {
2574
+ const response = await transport.post(`/prompts/${promptUniqueId}/tests/run-all`, {});
2575
+ const raw = response;
2576
+ const data = raw.data || raw;
2577
+ if (Array.isArray(data)) {
2578
+ return data.map((item)=>decodeOne({
2579
+ data: item
2580
+ }, promptTestResultMapper));
2581
+ }
2582
+ return [];
2583
+ },
2584
+ async listResults (promptUniqueId, testUniqueId, params) {
2585
+ const queryParams = {};
2586
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2587
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2588
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
2589
+ const response = await transport.get(`/prompts/${promptUniqueId}/tests/${testUniqueId}/results`, {
2590
+ params: queryParams
2591
+ });
2592
+ return decodePageResult(response, promptTestResultMapper);
2593
+ },
2594
+ async getResult (promptUniqueId, testUniqueId, resultUniqueId) {
2595
+ const response = await transport.get(`/prompts/${promptUniqueId}/tests/${testUniqueId}/results/${resultUniqueId}`);
2596
+ return decodeOne(response, promptTestResultMapper);
2597
+ },
2598
+ async listVersionResults (promptUniqueId, versionUniqueId, params) {
2599
+ const queryParams = {};
2600
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2601
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2602
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
2603
+ const response = await transport.get(`/prompts/${promptUniqueId}/versions/${versionUniqueId}/test-results`, {
2604
+ params: queryParams
2605
+ });
2606
+ return decodePageResult(response, promptTestResultMapper);
2607
+ }
2608
+ };
2609
+ }
2610
+ function createPromptTestEvaluationsService(transport, _config) {
2611
+ return {
2612
+ async list (params) {
2613
+ const queryParams = {};
2614
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2615
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2616
+ const response = await transport.get('/prompt-test-evaluations', {
2617
+ params: queryParams
2618
+ });
2619
+ return decodePageResult(response, promptTestEvaluationMapper);
2620
+ },
2621
+ async get (uniqueId) {
2622
+ const response = await transport.get(`/prompt-test-evaluations/${uniqueId}`);
2623
+ return decodeOne(response, promptTestEvaluationMapper);
2624
+ },
2625
+ async create (data) {
2626
+ const response = await transport.post('/prompt-test-evaluations', {
2627
+ prompt_test_evaluation: data
2628
+ });
2629
+ return decodeOne(response, promptTestEvaluationMapper);
2630
+ },
2631
+ async run (uniqueId) {
2632
+ const response = await transport.post(`/prompt-test-evaluations/${uniqueId}/run`, {});
2633
+ return decodeOne(response, promptTestEvaluationMapper);
2634
+ },
2635
+ async compareVersions (data) {
2636
+ const response = await transport.post('/prompt-test-evaluations/compare-versions', {
2637
+ version_a: data.versionA,
2638
+ version_b: data.versionB
2639
+ });
2640
+ return {
2641
+ versionA: response.version_a || data.versionA,
2642
+ versionB: response.version_b || data.versionB,
2643
+ results: response.results || []
2644
+ };
2645
+ }
2646
+ };
2647
+ }
2648
+
2649
+ const agentTestMapper = {
2650
+ type: 'agent_test',
2651
+ map: (resource)=>({
2652
+ id: resource.id,
2653
+ uniqueId: parseString(resource.attributes['unique_id']) || '',
2654
+ agentUniqueId: parseString(resource.attributes['agent_unique_id']) || '',
2655
+ name: parseString(resource.attributes['name']) || '',
2656
+ description: parseString(resource.attributes['description']) || undefined,
2657
+ input: parseString(resource.attributes['input']) || undefined,
2658
+ expectedOutput: parseString(resource.attributes['expected_output']) || undefined,
2659
+ variables: resource.attributes['variables'],
2660
+ enabled: resource.attributes['enabled'] != null ? parseBoolean(resource.attributes['enabled']) : undefined,
2661
+ status: parseString(resource.attributes['status']) || 'active',
2662
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
2663
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date()
2664
+ })
2665
+ };
2666
+ const agentTestResultMapper = {
2667
+ type: 'agent_test_result',
2668
+ map: (resource)=>({
2669
+ id: resource.id,
2670
+ uniqueId: parseString(resource.attributes['unique_id']) || '',
2671
+ testUniqueId: parseString(resource.attributes['test_unique_id']) || '',
2672
+ agentUniqueId: parseString(resource.attributes['agent_unique_id']) || '',
2673
+ input: parseString(resource.attributes['input']) || undefined,
2674
+ expectedOutput: parseString(resource.attributes['expected_output']) || undefined,
2675
+ actualOutput: parseString(resource.attributes['actual_output']) || undefined,
2676
+ passed: resource.attributes['passed'] != null ? parseBoolean(resource.attributes['passed']) : undefined,
2677
+ score: parseOptionalNumber(resource.attributes['score']),
2678
+ tokens: parseOptionalNumber(resource.attributes['tokens']),
2679
+ cost: parseOptionalNumber(resource.attributes['cost']),
2680
+ duration: parseOptionalNumber(resource.attributes['duration']),
2681
+ error: parseString(resource.attributes['error']) || undefined,
2682
+ status: parseString(resource.attributes['status']) || 'pending',
2683
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
2684
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date()
2685
+ })
2686
+ };
2687
+
2688
+ function buildAgentTestBody(data) {
2689
+ const body = {};
2690
+ if (data.name) body['name'] = data.name;
2691
+ if (data.description) body['description'] = data.description;
2692
+ if (data.input) body['input'] = data.input;
2693
+ if (data.expectedOutput) body['expected_output'] = data.expectedOutput;
2694
+ if (data.variables) body['variables'] = data.variables;
2695
+ if (data.enabled !== undefined) body['enabled'] = data.enabled;
2696
+ return body;
2697
+ }
2698
+ function createAgentTestsService(transport, _config) {
2699
+ return {
2700
+ async list (agentUniqueId, params) {
2701
+ const queryParams = {};
2702
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2703
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2704
+ if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
2705
+ if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
2706
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
2707
+ const response = await transport.get(`/agents/${agentUniqueId}/tests`, {
2708
+ params: queryParams
2709
+ });
2710
+ return decodePageResult(response, agentTestMapper);
2711
+ },
2712
+ async get (agentUniqueId, testUniqueId) {
2713
+ const response = await transport.get(`/agents/${agentUniqueId}/tests/${testUniqueId}`);
2714
+ return decodeOne(response, agentTestMapper);
2715
+ },
2716
+ async create (agentUniqueId, data) {
2717
+ const response = await transport.post(`/agents/${agentUniqueId}/tests`, {
2718
+ agent_test: buildAgentTestBody(data)
2719
+ });
2720
+ return decodeOne(response, agentTestMapper);
2721
+ },
2722
+ async update (agentUniqueId, testUniqueId, data) {
2723
+ const response = await transport.put(`/agents/${agentUniqueId}/tests/${testUniqueId}`, {
2724
+ agent_test: buildAgentTestBody(data)
2725
+ });
2726
+ return decodeOne(response, agentTestMapper);
2727
+ },
2728
+ async delete (agentUniqueId, testUniqueId) {
2729
+ await transport.delete(`/agents/${agentUniqueId}/tests/${testUniqueId}`);
2730
+ },
2731
+ async run (agentUniqueId, testUniqueId) {
2732
+ const response = await transport.post(`/agents/${agentUniqueId}/tests/${testUniqueId}/run`, {});
2733
+ return decodeOne(response, agentTestResultMapper);
2734
+ },
2735
+ async runAll (agentUniqueId) {
2736
+ const response = await transport.post(`/agents/${agentUniqueId}/tests/run-all`, {});
2737
+ const raw = response;
2738
+ const data = raw.data || raw;
2739
+ if (Array.isArray(data)) {
2740
+ return data.map((item)=>decodeOne({
2741
+ data: item
2742
+ }, agentTestResultMapper));
2743
+ }
2744
+ return [];
2745
+ },
2746
+ async listResults (agentUniqueId, testUniqueId, params) {
2747
+ const queryParams = {};
2748
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2749
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2750
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
2751
+ const response = await transport.get(`/agents/${agentUniqueId}/tests/${testUniqueId}/results`, {
2752
+ params: queryParams
2753
+ });
2754
+ return decodePageResult(response, agentTestResultMapper);
2755
+ },
2756
+ async getResult (agentUniqueId, testUniqueId, resultUniqueId) {
2757
+ const response = await transport.get(`/agents/${agentUniqueId}/tests/${testUniqueId}/results/${resultUniqueId}`);
2758
+ return decodeOne(response, agentTestResultMapper);
2759
+ },
2760
+ async listAgentResults (agentUniqueId, params) {
2761
+ const queryParams = {};
2762
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2763
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2764
+ if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
2765
+ const response = await transport.get(`/agents/${agentUniqueId}/test-results`, {
2766
+ params: queryParams
2767
+ });
2768
+ return decodePageResult(response, agentTestResultMapper);
2769
+ }
2770
+ };
2771
+ }
2772
+
2773
+ const promptTemplateMapper = {
2774
+ type: 'prompt_template',
2775
+ map: (resource)=>({
2776
+ id: resource.id,
2777
+ uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
2778
+ name: parseString(resource.attributes['name']) || '',
2779
+ description: parseString(resource.attributes['description']) || undefined,
2780
+ schema: resource.attributes['schema'],
2781
+ formDefinition: resource.attributes['form_definition'],
2782
+ status: parseString(resource.attributes['status']) || 'active',
2783
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
2784
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date()
2785
+ })
2786
+ };
2787
+
2788
+ function createPromptTemplatesService(transport, _config) {
2789
+ return {
2790
+ async list (params) {
2791
+ const queryParams = {};
2792
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2793
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2794
+ if (params == null ? void 0 : params.includeSchema) queryParams['include_schema'] = 'true';
2795
+ const response = await transport.get('/prompt_templates', {
2796
+ params: queryParams
2797
+ });
2798
+ return decodePageResult(response, promptTemplateMapper);
2799
+ },
2800
+ async get (id) {
2801
+ const response = await transport.get(`/prompt_templates/${id}`);
2802
+ return decodeOne(response, promptTemplateMapper);
2803
+ }
2804
+ };
2805
+ }
2806
+
2807
+ const companyKeyMapper = {
2808
+ type: 'company_key',
2809
+ map: (resource)=>({
2810
+ id: resource.id,
2811
+ uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
2812
+ name: parseString(resource.attributes['name']) || undefined,
2813
+ keyValue: parseString(resource.attributes['key_value']) || undefined,
2814
+ provider: parseString(resource.attributes['provider']) || undefined,
2815
+ status: parseString(resource.attributes['status']) || 'active',
2816
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
2817
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date()
2818
+ })
2819
+ };
2820
+
2821
+ function createCompanyKeysService(transport, _config) {
2822
+ return {
2823
+ async list (urlId, params) {
2824
+ const queryParams = {};
2825
+ if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
2826
+ if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
2827
+ const response = await transport.get(`/companies/${urlId}/keys`, {
2828
+ params: queryParams
2829
+ });
2830
+ return decodePageResult(response, companyKeyMapper);
2831
+ },
2832
+ async create (urlId, data) {
2833
+ const body = {};
2834
+ if (data.name) body['name'] = data.name;
2835
+ body['key_value'] = data.keyValue;
2836
+ if (data.provider) body['provider'] = data.provider;
2837
+ const response = await transport.post(`/companies/${urlId}/keys`, {
2838
+ key: body
2839
+ });
2840
+ return decodeOne(response, companyKeyMapper);
2841
+ },
2842
+ async delete (urlId, keyUniqueId) {
2843
+ await transport.delete(`/companies/${urlId}/keys/${keyUniqueId}`);
2844
+ }
2845
+ };
2846
+ }
2847
+
2848
+ const llmProviderMapper = {
2849
+ type: 'llm_provider',
2850
+ map: (resource)=>({
2851
+ id: resource.id,
2852
+ uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
2853
+ name: parseString(resource.attributes['name']) || '',
2854
+ providerType: parseString(resource.attributes['provider_type']) || undefined,
2855
+ apiUrl: parseString(resource.attributes['api_url']) || undefined,
2856
+ status: parseString(resource.attributes['status']) || 'active',
2857
+ createdAt: parseDate(resource.attributes['created_at']) || new Date(),
2858
+ updatedAt: parseDate(resource.attributes['updated_at']) || new Date()
2859
+ })
2860
+ };
2861
+
2862
+ function createLlmProvidersService(transport, _config) {
2863
+ return {
2864
+ async list () {
2865
+ const response = await transport.get('/llm-providers');
2866
+ return decodePageResult(response, llmProviderMapper);
2867
+ },
2868
+ async validate () {
2869
+ const response = await transport.get('/llm-providers/validate');
2870
+ return {
2871
+ valid: !!response.valid,
2872
+ message: response.message
2873
+ };
2874
+ },
2875
+ async models (provider) {
2876
+ const response = await transport.get(`/llm-providers/${provider}/models`);
2877
+ const data = response.data || response;
2878
+ if (Array.isArray(data)) {
2879
+ return data.map((m)=>({
2880
+ id: m.id || m.name,
2881
+ name: m.name || m.id,
2882
+ provider: m.provider || provider
2883
+ }));
2884
+ }
2885
+ return [];
2886
+ }
2887
+ };
2888
+ }
2889
+
2384
2890
  function createJarvisBlock(transport, config) {
2385
2891
  return {
2386
2892
  agents: createAgentsService(transport),
2387
- prompts: createPromptsService(transport),
2893
+ prompts: createPromptsService(transport, config, config.sseUrl),
2388
2894
  workflows: createWorkflowsService(transport),
2389
2895
  executions: createExecutionsService(transport),
2390
2896
  conversations: createConversationsService(transport),
@@ -2406,6 +2912,12 @@ function createJarvisBlock(transport, config) {
2406
2912
  conditions: createConditionsService(transport),
2407
2913
  stepTransitions: createStepTransitionsService(transport),
2408
2914
  analytics: createAnalyticsService(transport),
2915
+ promptTests: createPromptTestsService(transport),
2916
+ promptTestEvaluations: createPromptTestEvaluationsService(transport),
2917
+ agentTests: createAgentTestsService(transport),
2918
+ promptTemplates: createPromptTemplatesService(transport),
2919
+ companyKeys: createCompanyKeysService(transport),
2920
+ llmProviders: createLlmProvidersService(transport),
2409
2921
  health: ()=>transport.get('/health')
2410
2922
  };
2411
2923
  }
@@ -2418,8 +2930,16 @@ const jarvisBlockMetadata = {
2418
2930
  'Prompt',
2419
2931
  'Workflow',
2420
2932
  'Execution',
2421
- 'Conversation'
2933
+ 'Conversation',
2934
+ 'PromptTest',
2935
+ 'PromptTestResult',
2936
+ 'PromptTestEvaluation',
2937
+ 'AgentTest',
2938
+ 'AgentTestResult',
2939
+ 'PromptTemplate',
2940
+ 'CompanyKey',
2941
+ 'LlmProvider'
2422
2942
  ]
2423
2943
  };
2424
2944
 
2425
- export { agentMapper, aiModelMapper, clusterMapper, conversationMapper, createAIModelsService, createAgentRuntimeService, createAgentsService, createAnalyticsService, createClustersService, createConversationsService, createEntitiesService, createExecutionCommentsService, createExecutionsService, createJarvisBlock, createJarvisUsersService, createMailTemplatesService, createMarvinChatService, createPromptCommentsService, createPromptsService, createWorkflowInstancesService, createWorkflowParticipantsService, createWorkflowStepsService, createWorkflowsService, entityMapper, executionCommentMapper, executionMapper, jarvisBlockMetadata, jarvisUserMapper, mailTemplateMapper, promptCommentMapper, promptMapper, workflowInstanceMapper, workflowMapper, workflowParticipantMapper, workflowStepMapper };
2945
+ export { agentMapper, agentTestMapper, agentTestResultMapper, agentToolAssignmentMapper, agentToolMapper, aiModelMapper, clusterMapper, companyKeyMapper, conditionMapper, conversationMapper, createAIModelsService, createAgentRuntimeService, createAgentTestsService, createAgentToolAssignmentsService, createAgentToolsService, createAgentsService, createAnalyticsService, createClustersService, createCompanyKeysService, createConditionsService, createConversationsService, createEntitiesService, createExecutionCommentsService, createExecutionsService, createJarvisBlock, createJarvisUsersService, createLlmProvidersService, createMailTemplatesService, createMarvinChatService, createPromptCommentsService, createPromptTemplatesService, createPromptTestEvaluationsService, createPromptTestsService, createPromptsService, createStepTransitionsService, createToolsService, createWorkflowInstancesService, createWorkflowParticipantsService, createWorkflowStepsService, createWorkflowsService, entityMapper, executionCommentMapper, executionMapper, jarvisBlockMetadata, jarvisUserMapper, llmProviderMapper, mailTemplateMapper, promptCommentMapper, promptMapper, promptTemplateMapper, promptTestEvaluationMapper, promptTestMapper, promptTestResultMapper, stepTransitionMapper, toolMapper, workflowInstanceMapper, workflowMapper, workflowParticipantMapper, workflowStepMapper };
@@ -1,7 +1,7 @@
1
1
  export { createJarvisBlock, jarvisBlockMetadata } from './lib/jarvis.block.js';
2
2
  export type { JarvisBlock, JarvisBlockConfig } from './lib/jarvis.block.js';
3
- export type { Agent, CreateAgentRequest, UpdateAgentRequest, ListAgentsParams, Prompt, CreatePromptRequest, UpdatePromptRequest, ListPromptsParams, ExecutePromptRequest, ExecutePromptResponse, RenderPromptRequest, RenderPromptResponse, RenderPromptMeta, PlaceholderValue, Workflow, CreateWorkflowRequest, UpdateWorkflowRequest, ListWorkflowsParams, Execution, ListExecutionsParams, Conversation, ConversationMessage, CreateConversationRequest, SendMessageRequest, ListConversationsParams, AIModel, CreateAIModelRequest, UpdateAIModelRequest, ListAIModelsParams, Entity, RegisterEntityRequest, UpdateEntityRequest, ListEntitiesParams, Cluster, CreateClusterRequest, UpdateClusterRequest, ListClustersParams, JarvisUser, RegisterJarvisUserRequest, UpdateJarvisUserRequest, ListJarvisUsersParams, WorkflowParticipant, AddWorkflowParticipantRequest, UpdateWorkflowParticipantRequest, ListWorkflowParticipantsParams, WorkflowStep, AddWorkflowStepRequest, UpdateWorkflowStepRequest, AddStepPromptRequest, AddStepAgentRequest, WorkflowInstance, WorkflowStepLog, WorkflowInstanceDetails, WorkflowStepStatus, StartWorkflowRequest, StepWorkflowRequest, LogWorkflowStepRequest, AgentThread, AgentMessage, AgentMessageContent, AgentContext, CreateAgentThreadRequest, CreateAgentContextRequest, SendAgentMessageRequest, AgentRunExecution, ListAgentRunExecutionsParams, MailTemplate, CreateMailTemplateRequest, UpdateMailTemplateRequest, ListMailTemplatesParams, CreateMandrillTemplateRequest, UpdateMandrillTemplateRequest, MarvinContext, MarvinMessage, MarvinChatRequest, MarvinChatResponse, CreateMarvinContextRequest, SendMarvinMessageRequest, SendMarvinMessageResponse, PromptComment, CreatePromptCommentRequest, UpdatePromptCommentRequest, ListPromptCommentsParams, ReplyToCommentRequest, ExecutionComment, CreateExecutionCommentRequest, UpdateExecutionCommentRequest, ListExecutionCommentsParams, AnalyticsDateRange, AnalyticsOverview, AnalyticsUsageParams, AnalyticsUsageItem, AnalyticsCostParams, AnalyticsCostItem, AnalyticsFeedback, AnalyticsConversations, AnalyticsRag, AnalyticsAgentItem, AnalyticsTrace, } from './lib/types/index.js';
4
- export type { AgentsService, PromptsService, WorkflowsService, ExecutionsService, ConversationsService, AIModelsService, EntitiesService, ClustersService, JarvisUsersService, WorkflowParticipantsService, WorkflowStepsService, WorkflowInstancesService, AgentRuntimeService, MailTemplatesService, MarvinChatService, PromptCommentsService, ExecutionCommentsService, AnalyticsService, } from './lib/services/index.js';
5
- export { createAgentsService, createPromptsService, createWorkflowsService, createExecutionsService, createConversationsService, createAIModelsService, createEntitiesService, createClustersService, createJarvisUsersService, createWorkflowParticipantsService, createWorkflowStepsService, createWorkflowInstancesService, createAgentRuntimeService, createMailTemplatesService, createMarvinChatService, createPromptCommentsService, createExecutionCommentsService, createAnalyticsService, } from './lib/services/index.js';
6
- export { agentMapper, promptMapper, workflowMapper, executionMapper, conversationMapper, aiModelMapper, entityMapper, clusterMapper, jarvisUserMapper, workflowParticipantMapper, workflowStepMapper, workflowInstanceMapper, mailTemplateMapper, promptCommentMapper, executionCommentMapper, } from './lib/mappers/index.js';
3
+ export type { Agent, CreateAgentRequest, UpdateAgentRequest, ListAgentsParams, Prompt, CreatePromptRequest, UpdatePromptRequest, ListPromptsParams, ExecutePromptRequest, ExecutePromptResponse, RenderPromptRequest, RenderPromptResponse, RenderPromptMeta, PlaceholderValue, Workflow, CreateWorkflowRequest, UpdateWorkflowRequest, ListWorkflowsParams, Execution, ListExecutionsParams, Conversation, ConversationMessage, CreateConversationRequest, SendMessageRequest, ListConversationsParams, AIModel, CreateAIModelRequest, UpdateAIModelRequest, ListAIModelsParams, Entity, RegisterEntityRequest, UpdateEntityRequest, ListEntitiesParams, Cluster, CreateClusterRequest, UpdateClusterRequest, ListClustersParams, JarvisUser, RegisterJarvisUserRequest, UpdateJarvisUserRequest, ListJarvisUsersParams, WorkflowParticipant, AddWorkflowParticipantRequest, UpdateWorkflowParticipantRequest, ListWorkflowParticipantsParams, WorkflowStep, AddWorkflowStepRequest, UpdateWorkflowStepRequest, AddStepPromptRequest, AddStepAgentRequest, WorkflowInstance, WorkflowStepLog, WorkflowInstanceDetails, WorkflowStepStatus, StartWorkflowRequest, StepWorkflowRequest, LogWorkflowStepRequest, AgentThread, AgentMessage, AgentMessageContent, AgentContext, CreateAgentThreadRequest, CreateAgentContextRequest, SendAgentMessageRequest, AgentRunExecution, ListAgentRunExecutionsParams, MailTemplate, CreateMailTemplateRequest, UpdateMailTemplateRequest, ListMailTemplatesParams, CreateMandrillTemplateRequest, UpdateMandrillTemplateRequest, MarvinContext, MarvinMessage, MarvinChatRequest, MarvinChatResponse, CreateMarvinContextRequest, SendMarvinMessageRequest, SendMarvinMessageResponse, PromptComment, CreatePromptCommentRequest, UpdatePromptCommentRequest, ListPromptCommentsParams, ReplyToCommentRequest, ExecutionComment, CreateExecutionCommentRequest, UpdateExecutionCommentRequest, ListExecutionCommentsParams, Tool, CreateToolRequest, UpdateToolRequest, ListToolsParams, AgentTool, CreateAgentToolRequest, UpdateAgentToolRequest, ListAgentToolsParams, AgentToolAssignment, CreateAgentToolAssignmentRequest, UpdateAgentToolAssignmentRequest, ListAgentToolAssignmentsParams, Condition, CreateConditionRequest, UpdateConditionRequest, ListConditionsParams, StepTransition, CreateStepTransitionRequest, UpdateStepTransitionRequest, ListStepTransitionsParams, PromptTest, CreatePromptTestRequest, UpdatePromptTestRequest, ListPromptTestsParams, PromptTestResult, ListPromptTestResultsParams, PromptTestEvaluation, CreatePromptTestEvaluationRequest, CompareVersionsRequest, CompareVersionsResponse, AgentTest, CreateAgentTestRequest, UpdateAgentTestRequest, ListAgentTestsParams, AgentTestResult, ListAgentTestResultsParams, PromptTemplate, ListPromptTemplatesParams, CompanyKey, CreateCompanyKeyRequest, LlmProvider, LlmProviderModel, LlmProviderValidation, AnalyticsDateRange, AnalyticsOverview, AnalyticsUsageParams, AnalyticsUsageItem, AnalyticsCostParams, AnalyticsCostItem, AnalyticsFeedback, AnalyticsConversations, AnalyticsRag, AnalyticsAgentItem, AnalyticsTrace, } from './lib/types/index.js';
4
+ export type { AgentsService, PromptsService, WorkflowsService, ExecutionsService, ConversationsService, AIModelsService, EntitiesService, ClustersService, JarvisUsersService, WorkflowParticipantsService, WorkflowStepsService, WorkflowInstancesService, AgentRuntimeService, MailTemplatesService, MarvinChatService, PromptCommentsService, ExecutionCommentsService, ToolsService, AgentToolsService, AgentToolAssignmentsService, ConditionsService, StepTransitionsService, PromptTestsService, PromptTestEvaluationsService, AgentTestsService, PromptTemplatesService, CompanyKeysService, LlmProvidersService, OpenAIModel, AnalyticsService, } from './lib/services/index.js';
5
+ export { createAgentsService, createPromptsService, createWorkflowsService, createExecutionsService, createConversationsService, createAIModelsService, createEntitiesService, createClustersService, createJarvisUsersService, createWorkflowParticipantsService, createWorkflowStepsService, createWorkflowInstancesService, createAgentRuntimeService, createMailTemplatesService, createMarvinChatService, createPromptCommentsService, createExecutionCommentsService, createToolsService, createAgentToolsService, createAgentToolAssignmentsService, createConditionsService, createStepTransitionsService, createPromptTestsService, createPromptTestEvaluationsService, createAgentTestsService, createPromptTemplatesService, createCompanyKeysService, createLlmProvidersService, createAnalyticsService, } from './lib/services/index.js';
6
+ export { agentMapper, promptMapper, workflowMapper, executionMapper, conversationMapper, aiModelMapper, entityMapper, clusterMapper, jarvisUserMapper, workflowParticipantMapper, workflowStepMapper, workflowInstanceMapper, mailTemplateMapper, promptCommentMapper, executionCommentMapper, toolMapper, agentToolMapper, agentToolAssignmentMapper, conditionMapper, stepTransitionMapper, promptTestMapper, promptTestResultMapper, promptTestEvaluationMapper, agentTestMapper, agentTestResultMapper, promptTemplateMapper, companyKeyMapper, llmProviderMapper, } from './lib/mappers/index.js';
7
7
  //# sourceMappingURL=index.d.ts.map