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

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.
@@ -0,0 +1,26 @@
1
+ name: CI
2
+
3
+ # Validate su PR: lint + test (il test include la build).
4
+ # Il publish avviene solo al push su main (deploy.yml).
5
+ # Il pipeline Bitbucket non aveva validate su PR: aggiunta in migrazione.
6
+
7
+ on:
8
+ pull_request:
9
+ branches: [main]
10
+
11
+ concurrency:
12
+ group: ci-${{ github.ref }}
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ validate:
17
+ name: Validate
18
+ runs-on: ubuntu-latest
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - uses: actions/setup-node@v4
22
+ with:
23
+ node-version: 22
24
+ - run: npm ci
25
+ - run: npm run lint
26
+ - run: npm test
@@ -0,0 +1,81 @@
1
+ name: Deploy
2
+
3
+ # Push su main: versione riconciliata su NPM (dist della serie 0.1.x,
4
+ # lo stesso algoritmo della pipeline Bitbucket: patch-max su npm +1)
5
+ # → lint/test (miglioria: il BB non li eseguiva) → build → publish su
6
+ # npm tramite TRUSTED PUBLISHING OIDC (nessun token: GitHub firma ogni
7
+ # publish, configurato su npmjs.com → package → Trusted Publisher)
8
+ # → tag di versione. npm stesso è la guard anti-collisione: rifiuta
9
+ # (403) una versione già pubblicata, il run fallisce senza side-effect.
10
+
11
+ on:
12
+ push:
13
+ branches: [main]
14
+
15
+ concurrency:
16
+ group: npm-publish-persona-sdk-js
17
+ cancel-in-progress: false
18
+
19
+ permissions:
20
+ contents: write # push del tag di versione con GITHUB_TOKEN
21
+ id-token: write # OIDC → npm trusted publishing
22
+
23
+ jobs:
24
+ version:
25
+ name: Calcola versione (riconciliazione su npm, serie 0.1.x)
26
+ runs-on: ubuntu-latest
27
+ outputs:
28
+ version: ${{ steps.v.outputs.version }}
29
+ steps:
30
+ - id: v
31
+ run: |
32
+ PKG="@applica-software-guru/persona-sdk"
33
+ # patch-max sulla serie 0.1 (esclude prerelease), +1 —
34
+ # identico all'algoritmo della pipeline Bitbucket
35
+ NEXT=$(npm view "$PKG" versions --json | node -e '
36
+ const versions = JSON.parse(require("fs").readFileSync(0, "utf8"));
37
+ const prefix = "0.1.";
38
+ const patches = versions
39
+ .filter(v => v.startsWith(prefix) && !v.includes("-"))
40
+ .map(v => Number(v.slice(prefix.length)))
41
+ .filter(Number.isFinite);
42
+ console.log(prefix + (Math.max(...patches, 0) + 1));')
43
+ echo "Prossima versione: ${NEXT}"
44
+ echo "version=${NEXT}" >> "$GITHUB_OUTPUT"
45
+
46
+ publish:
47
+ name: Lint, test, build & publish su npm (OIDC)
48
+ runs-on: ubuntu-latest
49
+ needs: version
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+ - uses: actions/setup-node@v4
53
+ with:
54
+ node-version: 22
55
+ registry-url: 'https://registry.npmjs.org'
56
+ # niente cache npm nei rilasci (recommendation npm per trusted publishing)
57
+ - name: Assicura npm >= 11.5.1 (richiesto per trusted publishing OIDC)
58
+ run: npm install -g npm@^11
59
+ - name: Versiona il package
60
+ run: npm version "${{ needs.version.outputs.version }}" --no-git-tag-version
61
+ - run: npm ci
62
+ - run: npm run lint
63
+ - run: npm test
64
+ - name: Publish su npm (OIDC trusted publishing, nessun token)
65
+ run: npm publish --access public
66
+
67
+ tag-release:
68
+ name: Tag di versione
69
+ runs-on: ubuntu-latest
70
+ needs: [version, publish]
71
+ if: always() && needs.publish.result == 'success'
72
+ steps:
73
+ - uses: actions/checkout@v4
74
+ - name: Crea e pusha il tag
75
+ env:
76
+ VERSION: ${{ needs.version.outputs.version }}
77
+ run: |
78
+ git config user.name "RoBYCoNTe"
79
+ git config user.email "2301162+RoBYCoNTe@users.noreply.github.com"
80
+ git tag -a "${VERSION}" -m "Version ${VERSION}"
81
+ git push origin "${VERSION}"
@@ -0,0 +1,45 @@
1
+ # Migrazione Bitbucket → GitHub Actions
2
+
3
+ Repo migrato da `applicaguru/persona-sdk-js` (Bitbucket) a
4
+ `applica-software-guru/persona-sdk-js` (GitHub, privato) il
5
+ **2026-09-24**.
6
+
7
+ ## Fasi
8
+
9
+ 1. **Validazione locale** — lint (0 errori) + `npm test` (4/4,
10
+ build inclusa). Il pipeline BB non eseguiva test né lint sul push:
11
+ aggiunti in migrazione come miglioramento.
12
+ 2. **Repo GitHub** — creato privato; `main` (`74dc185`) + 46 tag
13
+ (serie `0.1.*` fino a `0.1.111`) + 2 rami WIP pushati tali quali:
14
+ `feature/sip-protocol` (SIP trunks/call-control, 3 commit) e
15
+ `refactor/litellm-model-config` (rimozione union `ModelName`,
16
+ 3 commit). I rami mergiati `feature/harness` e
17
+ `feature/voice-latency` non sono stati ripushati. Invariante
18
+ verificata: Bitbucket ⊆ GitHub (0 commit, 0 tag mancanti).
19
+ 3. **Pipeline** — `deploy.yml` (npm OIDC) + `ci.yml`, cutover.
20
+ 4. **Verifica** — run verde, `0.1.112` su npm, tag git.
21
+
22
+ ## Versioning
23
+
24
+ Alla migrazione le fonti erano **allineate**: npm latest = `0.1.111`
25
+ = tag git max. La formula replica l'algoritmo della pipeline BB
26
+ (patch-max sulla serie `0.1` da `npm view versions` +1; prerelease
27
+ escluse). Prima release GitHub: **`0.1.112`**. npm stesso è la guard
28
+ anti-collisione (rifiuta versioni duplicate). Il consumer principale
29
+ (`persona-cp`, dep `^0.1.110`) resta compatibile.
30
+
31
+ ## Pipeline decisionale (npm)
32
+
33
+ - **push su main** → version (riconciliazione npm) → lint/test →
34
+ **publish OIDC trusted publishing** (nessun token; configurato su
35
+ npmjs.com → package → Trusted Publisher, repo + workflow
36
+ `deploy.yml`) → tag di versione. Come il BB: ogni push su main è
37
+ una release.
38
+ - **PR** → `ci.yml`: validate (lint + test). Nuovo rispetto al BB.
39
+
40
+ ## Decisioni
41
+
42
+ - **Test**: suite esistente (`node --test`, 2 file) eseguita al
43
+ push — il BB la ignorava.
44
+ - **Segreti**: nessuno — OIDC trusted publishing.
45
+ - **Rimosso dal tree nel cutover**: `bitbucket-pipelines.yml`.
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ <div align="center">
2
+
3
+ [![Deploy](https://github.com/applica-software-guru/persona-sdk-js/actions/workflows/deploy.yml/badge.svg)](https://github.com/applica-software-guru/persona-sdk-js/actions/workflows/deploy.yml)
4
+
5
+ </div>
6
+
1
7
  # Persona SDK
2
8
 
3
9
  [![npm version](https://img.shields.io/npm/v/@applica-software-guru/persona-sdk)](https://www.npmjs.com/package/@applica-software-guru/persona-sdk)
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.112",
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
+ });
@@ -1,20 +0,0 @@
1
- image: node:22
2
-
3
- pipelines:
4
- branches:
5
- main:
6
- - step:
7
- name: Deploy
8
- deployment: Production
9
- script:
10
- - export VERSION_PREFIX=0.1
11
- - export PACKAGE_VERSION=$(npm view @applica-software-guru/persona-sdk versions --json | node -e "const versions = JSON.parse(require('fs').readFileSync(0, 'utf8')); const prefix = process.env.VERSION_PREFIX + '.'; const patches = versions.filter(v => v.startsWith(prefix) && !v.includes('-')).map(v => Number(v.slice(prefix.length))).filter(Number.isFinite); console.log(process.env.VERSION_PREFIX + '.' + (Math.max(...patches, 0) + 1));")
12
- - npm --no-git-tag-version version "$PACKAGE_VERSION" -m "Upgrade to new version"
13
- - npm install
14
- - npm run build
15
- - pipe: atlassian/npm-publish:0.3.2
16
- variables:
17
- NPM_TOKEN: $NPM_TOKEN
18
- EXTRA_ARGS: '--access public'
19
- - git tag -a "$PACKAGE_VERSION" -m "Version $PACKAGE_VERSION"
20
- - git push origin "$PACKAGE_VERSION"