@applica-software-guru/persona-sdk 0.1.110 → 0.1.111

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.
package/dist/index.d.ts CHANGED
@@ -401,6 +401,8 @@ export declare interface ExecuteRequest {
401
401
  initialData?: Record<string, unknown>;
402
402
  callbackUrl?: string;
403
403
  eventsHook?: string;
404
+ /** Execution-level automatic recovery rounds (undefined = server default). */
405
+ recoveryAttempts?: number;
404
406
  }
405
407
 
406
408
  export declare interface Execution {
@@ -1611,12 +1613,16 @@ export declare interface Workflow {
1611
1613
  * Configuration for "workflow" trigger destinations.
1612
1614
  * `timeout` is the maximum time in seconds to wait for the workflow
1613
1615
  * execution callback; when not set the server applies its default (300s).
1616
+ * `recoveryAttempts` is the execution-level automatic recovery rounds the
1617
+ * engine applies when a node fails for good (0 disables); when not set the
1618
+ * server applies its default (1 round) and caps the upper bound.
1614
1619
  */
1615
1620
  export declare interface WorkflowDestinationConfiguration {
1616
1621
  workflowId?: string;
1617
1622
  callbackUrl?: string;
1618
1623
  args?: Record<string, unknown>;
1619
1624
  timeout?: number;
1625
+ recoveryAttempts?: number;
1620
1626
  }
1621
1627
 
1622
1628
  export declare class WorkflowExecutionsApi extends HttpApi {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@applica-software-guru/persona-sdk",
3
3
  "description": "Official TypeScript SDK for the Persona API — manage agents, sessions, projects, knowledge bases, workflows, triggers and more.",
4
4
  "private": false,
5
- "version": "0.1.110",
5
+ "version": "0.1.111",
6
6
  "type": "module",
7
7
  "scripts": {
8
8
  "dev": "vite",
@@ -29,12 +29,16 @@ export interface TriggerSource {
29
29
  * Configuration for "workflow" trigger destinations.
30
30
  * `timeout` is the maximum time in seconds to wait for the workflow
31
31
  * execution callback; when not set the server applies its default (300s).
32
+ * `recoveryAttempts` is the execution-level automatic recovery rounds the
33
+ * engine applies when a node fails for good (0 disables); when not set the
34
+ * server applies its default (1 round) and caps the upper bound.
32
35
  */
33
36
  export interface WorkflowDestinationConfiguration {
34
37
  workflowId?: string;
35
38
  callbackUrl?: string;
36
39
  args?: Record<string, unknown>;
37
40
  timeout?: number;
41
+ recoveryAttempts?: number;
38
42
  }
39
43
 
40
44
  export type TriggerDestinationConfiguration =
@@ -137,6 +137,8 @@ export interface ExecuteRequest {
137
137
  initialData?: Record<string, unknown>;
138
138
  callbackUrl?: string;
139
139
  eventsHook?: string;
140
+ /** Execution-level automatic recovery rounds (undefined = server default). */
141
+ recoveryAttempts?: number;
140
142
  }
141
143
 
142
144
  export interface HumanTask {
@@ -0,0 +1,66 @@
1
+ import assert from 'node:assert/strict';
2
+ import test from 'node:test';
3
+
4
+ import { TriggersApi } from '../dist/bundle.es.js';
5
+
6
+ function jsonResponse(body) {
7
+ return new Response(JSON.stringify(body), {
8
+ status: 200,
9
+ headers: { 'Content-Type': 'application/json' },
10
+ });
11
+ }
12
+
13
+ const TRIGGER = {
14
+ name: 'email-trigger',
15
+ source: { type: 'imap' },
16
+ destination: {
17
+ type: 'workflow',
18
+ configuration: {
19
+ workflowId: 'wf-001',
20
+ recoveryAttempts: 2,
21
+ },
22
+ },
23
+ enabled: true,
24
+ };
25
+
26
+ test('trigger create forwards recoveryAttempts in the destination configuration', async (context) => {
27
+ const originalFetch = globalThis.fetch;
28
+ context.after(() => {
29
+ globalThis.fetch = originalFetch;
30
+ });
31
+
32
+ let requestBody;
33
+ globalThis.fetch = async (url, init) => {
34
+ requestBody = JSON.parse(init.body);
35
+ return jsonResponse({ id: 'trigger-001', ...TRIGGER });
36
+ };
37
+
38
+ const api = new TriggersApi('https://example.test', 'api-key');
39
+ await api.create(TRIGGER);
40
+
41
+ assert.equal(requestBody.destination.configuration.recoveryAttempts, 2);
42
+ });
43
+
44
+ test('trigger update forwards recoveryAttempts too', async (context) => {
45
+ const originalFetch = globalThis.fetch;
46
+ context.after(() => {
47
+ globalThis.fetch = originalFetch;
48
+ });
49
+
50
+ let requestBody;
51
+ globalThis.fetch = async (url, init) => {
52
+ requestBody = JSON.parse(init.body);
53
+ return jsonResponse({ id: 'trigger-001', ...TRIGGER });
54
+ };
55
+
56
+ const api = new TriggersApi('https://example.test', 'api-key');
57
+ await api.update('trigger-001', {
58
+ ...TRIGGER,
59
+ destination: {
60
+ type: 'workflow',
61
+ configuration: { workflowId: 'wf-001', recoveryAttempts: 0 },
62
+ },
63
+ });
64
+
65
+ assert.equal(requestBody.destination.configuration.recoveryAttempts, 0);
66
+ });