@applica-software-guru/persona-sdk 0.1.100 → 0.1.102

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 (171) hide show
  1. package/.eslintrc.cjs +6 -5
  2. package/.nvmrc +1 -1
  3. package/.prettierignore +3 -5
  4. package/.prettierrc +3 -5
  5. package/README.md +360 -20
  6. package/bitbucket-pipelines.yml +6 -5
  7. package/dist/bundle.cjs.js +1 -27
  8. package/dist/bundle.cjs.js.map +1 -1
  9. package/dist/bundle.es.js +753 -5084
  10. package/dist/bundle.es.js.map +1 -1
  11. package/dist/index.d.ts +1504 -8
  12. package/package.json +9 -51
  13. package/src/agents/agents-api.ts +66 -0
  14. package/src/agents/types.ts +349 -0
  15. package/src/auth/api-key-auth.ts +13 -0
  16. package/src/auth/authentication-provider.ts +4 -0
  17. package/src/auth/bearer-token-auth.ts +13 -0
  18. package/src/auth/index.ts +3 -0
  19. package/src/billing/billing-client.ts +182 -0
  20. package/src/billing/types.ts +166 -0
  21. package/src/credentials/credentials-api.ts +40 -0
  22. package/src/credentials/types.ts +67 -0
  23. package/src/exceptions.ts +10 -0
  24. package/src/features/feature-templates-api.ts +43 -0
  25. package/src/features/features-api.ts +16 -0
  26. package/src/features/types.ts +25 -0
  27. package/src/http-api.ts +102 -0
  28. package/src/index.ts +181 -7
  29. package/src/knowledges/knowledge-base-documents-api.ts +39 -0
  30. package/src/knowledges/knowledge-bases-api.ts +48 -0
  31. package/src/knowledges/types.ts +70 -0
  32. package/src/known-models/known-models-api.ts +33 -0
  33. package/src/known-models/types.ts +7 -0
  34. package/src/missions/missions-api.ts +62 -0
  35. package/src/missions/types.ts +25 -0
  36. package/src/paginated.ts +6 -0
  37. package/src/persona-sdk.ts +104 -0
  38. package/src/projects/projects-api.ts +90 -0
  39. package/src/projects/types.ts +52 -0
  40. package/src/revisions/types.ts +9 -0
  41. package/src/service-prices/service-prices-api.ts +33 -0
  42. package/src/service-prices/types.ts +8 -0
  43. package/src/sessions/sessions-api.ts +90 -0
  44. package/src/sessions/types.ts +150 -0
  45. package/src/triggers/trigger-executions-api.ts +28 -0
  46. package/src/triggers/triggers-api.ts +38 -0
  47. package/src/triggers/types.ts +50 -0
  48. package/src/values/values-api.ts +84 -0
  49. package/src/workflows/human-tasks-api.ts +44 -0
  50. package/src/workflows/types.ts +173 -0
  51. package/src/workflows/workflow-executions-api.ts +94 -0
  52. package/src/workflows/workflows-api.ts +57 -0
  53. package/tsconfig.json +20 -28
  54. package/vite.config.ts +20 -67
  55. package/.github/copilot-instructions.md +0 -3
  56. package/CLAUDE.md +0 -3
  57. package/GEMINI.md +0 -3
  58. package/components.json +0 -24
  59. package/dist/bundle.iife.js +0 -28
  60. package/dist/bundle.iife.js.map +0 -1
  61. package/dist/bundle.umd.js +0 -28
  62. package/dist/bundle.umd.js.map +0 -1
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/logging.d.ts +0 -18
  65. package/dist/logging.d.ts.map +0 -1
  66. package/dist/messages.d.ts +0 -9
  67. package/dist/messages.d.ts.map +0 -1
  68. package/dist/projects.d.ts +0 -17
  69. package/dist/projects.d.ts.map +0 -1
  70. package/dist/protocol/base.d.ts +0 -25
  71. package/dist/protocol/base.d.ts.map +0 -1
  72. package/dist/protocol/index.d.ts +0 -6
  73. package/dist/protocol/index.d.ts.map +0 -1
  74. package/dist/protocol/rest.d.ts +0 -25
  75. package/dist/protocol/rest.d.ts.map +0 -1
  76. package/dist/protocol/transaction.d.ts +0 -56
  77. package/dist/protocol/transaction.d.ts.map +0 -1
  78. package/dist/protocol/webrtc.d.ts +0 -60
  79. package/dist/protocol/webrtc.d.ts.map +0 -1
  80. package/dist/protocol/websocket.d.ts +0 -22
  81. package/dist/protocol/websocket.d.ts.map +0 -1
  82. package/dist/runtime/context.d.ts +0 -34
  83. package/dist/runtime/context.d.ts.map +0 -1
  84. package/dist/runtime/file-attachment-adapter.d.ts +0 -15
  85. package/dist/runtime/file-attachment-adapter.d.ts.map +0 -1
  86. package/dist/runtime/handlers.d.ts +0 -21
  87. package/dist/runtime/handlers.d.ts.map +0 -1
  88. package/dist/runtime/listeners.d.ts +0 -6
  89. package/dist/runtime/listeners.d.ts.map +0 -1
  90. package/dist/runtime/protocols.d.ts +0 -17
  91. package/dist/runtime/protocols.d.ts.map +0 -1
  92. package/dist/runtime/threads.d.ts +0 -34
  93. package/dist/runtime/threads.d.ts.map +0 -1
  94. package/dist/runtime/utils.d.ts +0 -10
  95. package/dist/runtime/utils.d.ts.map +0 -1
  96. package/dist/runtime.d.ts +0 -6
  97. package/dist/runtime.d.ts.map +0 -1
  98. package/dist/storage/base.d.ts +0 -9
  99. package/dist/storage/base.d.ts.map +0 -1
  100. package/dist/storage/index.d.ts +0 -3
  101. package/dist/storage/index.d.ts.map +0 -1
  102. package/dist/storage/persona.d.ts +0 -29
  103. package/dist/storage/persona.d.ts.map +0 -1
  104. package/dist/tools.d.ts +0 -72
  105. package/dist/tools.d.ts.map +0 -1
  106. package/dist/types.d.ts +0 -237
  107. package/dist/types.d.ts.map +0 -1
  108. package/docs/README.md +0 -13
  109. package/docs/api-reference.md +0 -16
  110. package/docs/contributing.md +0 -21
  111. package/docs/customization.md +0 -74
  112. package/docs/features.md +0 -7
  113. package/docs/installation.md +0 -9
  114. package/docs/messages.md +0 -214
  115. package/docs/protocols.md +0 -39
  116. package/docs/transactions.md +0 -121
  117. package/docs/usage.md +0 -40
  118. package/jsconfig.node.json +0 -10
  119. package/playground/index.html +0 -14
  120. package/playground/src/app.tsx +0 -10
  121. package/playground/src/chat.tsx +0 -117
  122. package/playground/src/components/assistant-ui/assistant-modal.tsx +0 -57
  123. package/playground/src/components/assistant-ui/attachment.tsx +0 -197
  124. package/playground/src/components/assistant-ui/markdown-text.tsx +0 -228
  125. package/playground/src/components/assistant-ui/thread-list.tsx +0 -91
  126. package/playground/src/components/assistant-ui/thread.tsx +0 -302
  127. package/playground/src/components/assistant-ui/threadlist-sidebar.tsx +0 -59
  128. package/playground/src/components/assistant-ui/tool-fallback.tsx +0 -93
  129. package/playground/src/components/assistant-ui/tooltip-icon-button.tsx +0 -42
  130. package/playground/src/components/chat/logging.tsx +0 -53
  131. package/playground/src/components/ui/avatar.tsx +0 -51
  132. package/playground/src/components/ui/button.tsx +0 -60
  133. package/playground/src/components/ui/dialog.tsx +0 -141
  134. package/playground/src/components/ui/input.tsx +0 -21
  135. package/playground/src/components/ui/separator.tsx +0 -26
  136. package/playground/src/components/ui/sheet.tsx +0 -139
  137. package/playground/src/components/ui/sidebar.tsx +0 -619
  138. package/playground/src/components/ui/skeleton.tsx +0 -13
  139. package/playground/src/components/ui/tooltip.tsx +0 -59
  140. package/playground/src/hooks/theme.ts +0 -70
  141. package/playground/src/hooks/use-mobile.ts +0 -19
  142. package/playground/src/lib/utils.ts +0 -6
  143. package/playground/src/main.tsx +0 -10
  144. package/playground/src/styles.css +0 -120
  145. package/playground/src/tools.ts +0 -149
  146. package/playground/src/vite-env.d.ts +0 -1
  147. package/preview-build.sh +0 -23
  148. package/src/logging.ts +0 -34
  149. package/src/messages.ts +0 -202
  150. package/src/projects.ts +0 -57
  151. package/src/protocol/base.ts +0 -73
  152. package/src/protocol/index.ts +0 -5
  153. package/src/protocol/rest.ts +0 -107
  154. package/src/protocol/transaction.ts +0 -182
  155. package/src/protocol/webrtc.ts +0 -379
  156. package/src/protocol/websocket.ts +0 -111
  157. package/src/runtime/context.ts +0 -88
  158. package/src/runtime/file-attachment-adapter.ts +0 -48
  159. package/src/runtime/handlers.ts +0 -322
  160. package/src/runtime/index.ts +0 -6
  161. package/src/runtime/listeners.ts +0 -79
  162. package/src/runtime/protocols.ts +0 -169
  163. package/src/runtime/threads.ts +0 -105
  164. package/src/runtime/utils.ts +0 -46
  165. package/src/runtime.tsx +0 -334
  166. package/src/storage/base.ts +0 -13
  167. package/src/storage/index.ts +0 -2
  168. package/src/storage/persona.ts +0 -138
  169. package/src/tools.ts +0 -211
  170. package/src/types.ts +0 -284
  171. package/tsconfig.node.json +0 -15
package/.eslintrc.cjs CHANGED
@@ -1,11 +1,12 @@
1
1
  module.exports = {
2
2
  root: true,
3
- env: { browser: true, es2020: true },
4
- extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended'],
5
- ignorePatterns: ['dist', '.eslintrc.cjs'],
3
+ env: { node: true, browser: true, es2022: true },
6
4
  parser: '@typescript-eslint/parser',
7
- plugins: ['react-refresh'],
5
+ parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
6
+ plugins: ['@typescript-eslint', 'prettier'],
7
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
8
8
  rules: {
9
- 'react-refresh/only-export-components': ['none', { allowConstantExport: true }],
9
+ '@typescript-eslint/no-explicit-any': 'off',
10
+ '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
10
11
  },
11
12
  };
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- 22
1
+ 22
package/.prettierignore CHANGED
@@ -1,5 +1,3 @@
1
- # Ignore artifacts:
2
- build
3
-
4
- # Ignore all HTML files:
5
- **/*.html
1
+ node_modules/
2
+ dist/
3
+ *.md
package/.prettierrc CHANGED
@@ -1,8 +1,6 @@
1
1
  {
2
- "bracketSpacing": true,
3
- "printWidth": 140,
2
+ "semi": true,
4
3
  "singleQuote": true,
5
- "tabWidth": 2,
6
- "trailingComma": "all",
7
- "useTabs": false
4
+ "trailingComma": "es5",
5
+ "printWidth": 120
8
6
  }
package/README.md CHANGED
@@ -1,33 +1,373 @@
1
- # Persona SDK ⚙️
1
+ # Persona SDK
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@applica-software-guru/persona-sdk)](https://www.npmjs.com/package/@applica-software-guru/persona-sdk)
4
- [![Build Status](https://img.shields.io/badge/build-passing-brightgreen)](#)
5
- [![Documentation](https://img.shields.io/badge/docs-available-blue)](docs/README.md)
6
4
 
7
- Persona SDK is the official SDK for the Persona API. It provides a simple and efficient way to integrate the Persona API into your applications using [assistant-ui](https://www.assistant-ui.com/).
5
+ Official TypeScript SDK for the Persona API. Manage agents, sessions, projects, knowledge bases, workflows, triggers, missions and more from any JavaScript/TypeScript application.
8
6
 
9
- ---
7
+ ## Install
10
8
 
11
- ## Table of Contents
9
+ ```bash
10
+ npm install @applica-software-guru/persona-sdk
11
+ ```
12
12
 
13
- - [Features](docs/features.md)
14
- - [Installation](docs/installation.md)
15
- - [Usage](docs/usage.md)
16
- - [Messages and Storage](docs/messages.md)
17
- - [Protocols Overview](docs/protocols.md)
18
- - [API Reference](docs/api-reference.md)
19
- - [Transactions and Tools](docs/transactions.md)
20
- - [Customization](docs/customization.md)
21
- - [Contributing](docs/contributing.md)
13
+ ## Quick Start
22
14
 
23
- ---
15
+ ```typescript
16
+ import { PersonaSdk } from '@applica-software-guru/persona-sdk';
24
17
 
25
- ## Support
18
+ const sdk = new PersonaSdk(
19
+ 'https://persona.applica.guru/api', // persona-core base URL
20
+ 'https://persona.applica.guru/workflows', // workflows service base URL
21
+ 'https://persona.applica.guru/billing' // billing service base URL (optional)
22
+ );
26
23
 
27
- For questions or support, contact us at [info@applica.guru](mailto:info@applica.guru).
24
+ // Authenticate with a project API key
25
+ const agents = await sdk.agents('prs_your_project_api_key').list(null, 1, 20);
26
+ console.log(`Total agents: ${agents.total}`);
27
+ ```
28
28
 
29
- ---
29
+ The `PersonaSdk` constructor accepts:
30
+ 1. **`baseUrl`** — persona-core API base URL (required)
31
+ 2. **`workflowsBaseUrl`** — workflows service base URL (required)
32
+ 3. **`billingBaseUrl`** — billing service base URL (optional, defaults to `https://persona.applica.guru/billing`)
33
+
34
+ Each resource is exposed as a factory method that requires authentication credentials.
35
+
36
+ ## Authentication
37
+
38
+ The SDK supports two authentication methods. Pass either a string (API key) or
39
+ an `AuthenticationProvider` instance to any resource factory.
40
+
41
+ ### API Key
42
+
43
+ The simplest method — pass the API key string directly. The SDK wraps it in an
44
+ `ApiKeyAuthenticationProvider` and sends it as the `x-persona-apikey` header.
45
+
46
+ Accepts:
47
+
48
+ - **Master key** — full admin access (server-to-server only)
49
+ - **Project API key** (`prs_...`) — scoped to a single project
50
+ - **Agent API key** (`prs_ag_...`) — scoped to a single agent
51
+
52
+ ```typescript
53
+ const projects = await sdk.projects('prs_your_project_api_key').getMine();
54
+ ```
55
+
56
+ ### IAM Bearer Token
57
+
58
+ For applications that authenticate end users via IAM, pass a
59
+ `BearerTokenAuthenticationProvider` with a valid JWT:
60
+
61
+ ```typescript
62
+ import { BearerTokenAuthenticationProvider } from '@applica-software-guru/persona-sdk';
63
+
64
+ const auth = new BearerTokenAuthenticationProvider(iamJwtToken);
65
+ const projects = await sdk.projects(auth).getMine();
66
+ ```
67
+
68
+ The token is sent as the `Authorization: Bearer <token>` header. The server
69
+ validates it via the IAM service and resolves the user's project automatically.
70
+ Use this method when building user-facing apps (e.g. control panels) where the
71
+ user logs in through IAM.
72
+
73
+ ### Custom provider
74
+
75
+ Implement your own provider via the `AuthenticationProvider` interface:
76
+
77
+ ```typescript
78
+ import { AuthenticationProvider } from '@applica-software-guru/persona-sdk';
79
+
80
+ class MyProvider implements AuthenticationProvider {
81
+ applyHeaders(headers: Headers): void {
82
+ headers.set('x-custom-header', 'value');
83
+ }
84
+
85
+ getCredentials(): string {
86
+ return 'my-credentials';
87
+ }
88
+ }
89
+ ```
90
+
91
+ ## Usage Examples
92
+
93
+ ### Agents
94
+
95
+ ```typescript
96
+ const agentsApi = sdk.agents('your-api-key');
97
+
98
+ // List agents (with optional server-side filters)
99
+ const { items, total } = await agentsApi.list('search-term', 1, 20);
100
+
101
+ // Filter by project
102
+ const projectAgents = await agentsApi.list(null, 1, 20, { projectId: 'my-project-id' });
103
+
104
+ // Get a single agent
105
+ const agent = await agentsApi.get('agent-id');
106
+
107
+ // Create an agent
108
+ const agent = await agentsApi.create({
109
+ name: 'My Agent',
110
+ description: 'A helpful assistant',
111
+ systemInstructions: 'You are a helpful assistant.',
112
+ });
113
+
114
+ // Update an agent
115
+ const updated = await agentsApi.update({
116
+ id: 'agent-id',
117
+ name: 'Updated Name',
118
+ });
119
+
120
+ // Delete an agent
121
+ await agentsApi.remove('agent-id');
122
+
123
+ // Generate system instructions with AI (project-scoped architect)
124
+ const instructions = await agentsApi.generateSystemInstructions(
125
+ 'Create a customer support agent that handles billing inquiries',
126
+ 'optional-session-id', // for multi-turn refinement
127
+ );
128
+
129
+ // Get the project's architect agent configuration
130
+ const architect = await agentsApi.getArchitect();
131
+ ```
132
+
133
+ ### Sessions
134
+
135
+ ```typescript
136
+ const sessionsApi = sdk.sessions('your-api-key');
137
+
138
+ // List sessions
139
+ const sessions = await sessionsApi.list(null, null, null, null, 1, 20);
140
+
141
+ // Generate a message
142
+ const response = await sessionsApi.generateMessage('session-code', {
143
+ userMessage: 'Hello, how are you?',
144
+ });
145
+
146
+ // Get session messages
147
+ const messages = await sessionsApi.findMessages('session-code', 1, 50);
148
+
149
+ // Get usage info
150
+ const usage = await sessionsApi.getUsage('session-id');
151
+ ```
152
+
153
+ ### Projects
154
+
155
+ ```typescript
156
+ const projectsApi = sdk.projects('your-api-key');
157
+
158
+ // Get current project
159
+ const project = await projectsApi.getMine();
160
+
161
+ // Create a project
162
+ const project = await projectsApi.create({ name: 'My Project' });
163
+
164
+ // Get subscription info
165
+ const subscription = await projectsApi.getSubscription('project-id');
166
+ ```
167
+
168
+ ### Knowledge Bases
169
+
170
+ ```typescript
171
+ const kbApi = sdk.knowledgeBases('your-api-key');
172
+
173
+ // List knowledge bases
174
+ const knowledgeBases = await kbApi.list(null, 1, 20);
175
+
176
+ // Create a knowledge base
177
+ const kb = await kbApi.create({ name: 'My Knowledge Base' });
178
+
179
+ // Upload a document
180
+ const doc = await kbApi.documents(kb.id).upload({
181
+ name: 'document.pdf',
182
+ uri: 'https://example.com/document.pdf',
183
+ });
184
+
185
+ // Search chunks
186
+ const chunks = await kbApi.searchChunks(kb.id, { query: 'search term', limit: 5 });
187
+ ```
188
+
189
+ ### Workflows
190
+
191
+ ```typescript
192
+ const workflowsApi = sdk.workflows('your-api-key');
193
+
194
+ // List workflows
195
+ const workflows = await workflowsApi.list(null, 1, 20);
196
+
197
+ // Execute a workflow
198
+ const execution = await workflowsApi.executions().run('workflow-id', {
199
+ userId: 'user-123',
200
+ initialData: { key: 'value' },
201
+ });
202
+ ```
203
+
204
+ ### Credentials
205
+
206
+ ```typescript
207
+ const credentialsApi = sdk.credentials('your-api-key');
208
+
209
+ // List credentials
210
+ const creds = await credentialsApi.list();
211
+
212
+ // Authorize OAuth2
213
+ const result = await credentialsApi.authorize('google', {
214
+ name: 'My Google Account',
215
+ clientId: '...',
216
+ clientSecret: '...',
217
+ });
218
+ ```
219
+
220
+ ### Triggers
221
+
222
+ ```typescript
223
+ const triggersApi = sdk.triggers('your-api-key');
224
+
225
+ // List triggers
226
+ const triggers = await triggersApi.list(null, 1, 20);
227
+
228
+ // Execute a trigger
229
+ const result = await triggersApi.executions().execute('trigger-id', {});
230
+ ```
231
+
232
+ ### Features
233
+
234
+ ```typescript
235
+ const featuresApi = sdk.features('your-api-key');
236
+
237
+ // List feature templates
238
+ const templates = await featuresApi.templates().list(null, 1, 20);
239
+
240
+ // Get MCP available tools
241
+ const tools = await featuresApi.templates().getMcpAvailableTools({
242
+ type: 'mcp',
243
+ name: 'my-server',
244
+ transport: { url: 'https://mcp.example.com' },
245
+ });
246
+ ```
247
+
248
+ ### Missions
249
+
250
+ ```typescript
251
+ const missionsApi = sdk.missions('your-api-key');
252
+
253
+ // List missions
254
+ const missions = await missionsApi.list(null, null, 1, 20);
255
+
256
+ // Create and execute
257
+ const mission = await missionsApi.create({ name: 'My Mission' });
258
+ await missionsApi.execute(mission.id);
259
+ ```
260
+
261
+ ### Billing
262
+
263
+ The `BillingClient` manages customers, subscriptions, credits and invoices.
264
+ When using `PersonaSdk`, the billing base URL is configured in the constructor
265
+ and `billing()` follows the same authentication pattern as all other APIs.
266
+
267
+ ```typescript
268
+ // Via PersonaSdk (recommended) — uses billingBaseUrl from constructor
269
+ const billing = sdk.billing('your-api-key');
270
+ const billing = sdk.billing(new BearerTokenAuthenticationProvider(token));
271
+
272
+ // Standalone usage with explicit base URL
273
+ import { BillingClient } from '@applica-software-guru/persona-sdk';
274
+ const billing = new BillingClient('https://persona.applica.guru/billing', 'your-api-key');
275
+
276
+ // Customer management
277
+ const customer = await billing.createCustomer({
278
+ owner: 'user-123',
279
+ name: 'Acme Corp',
280
+ email: 'billing@acme.com',
281
+ });
282
+ const existing = await billing.getCustomer('user-123');
283
+ await billing.updateCustomer('user-123', { name: 'Acme Inc.' });
284
+ await billing.deleteCustomer('user-123');
285
+
286
+ // Subscription management
287
+ const subscription = await billing.createSubscription({ owner: 'user-123' });
288
+ const current = await billing.getSubscription('user-123');
289
+ await billing.cancelSubscription('user-123');
290
+
291
+ // Plan changes
292
+ await billing.beginUpgrade('user-123', { toPlanType: 'pro' });
293
+ await billing.downgrade('user-123', { toPlanType: 'starter' });
294
+ await billing.mentorize('user-123', { endDate: '2026-12-31' });
295
+
296
+ // Credits
297
+ await billing.addCredits('user-123', 100);
298
+ await billing.useCredits('user-123', 10, ['chat', 'voice'], 'reference-id');
299
+ const credits = await billing.getCredits('user-123');
300
+ const valid = await billing.isValid('user-123');
301
+
302
+ // Invoices
303
+ const invoices = await billing.listInvoices('user-123', '2026-01-01', '2026-12-31');
304
+
305
+ // Project-level billing
306
+ const projectSub = await billing.getProjectSubscription('project-id');
307
+ await billing.changeProjectSubscriptionPlan('project-id', { toPlanType: 'pro' });
308
+ await billing.addProjectSubscriptionCredits('project-id', { credits: 50 });
309
+ ```
310
+
311
+ ## Server-side Filtering
312
+
313
+ All paginated `list` methods accept an optional `extraParams` argument as the
314
+ last parameter. These key-value pairs are appended to the query string, enabling
315
+ server-side filters such as `projectId`:
316
+
317
+ ```typescript
318
+ // Filter agents by project
319
+ const agents = await sdk.agents(auth).list(null, 1, 20, { projectId: 'abc123' });
320
+
321
+ // Combine keyword search with project filter
322
+ const results = await sdk.knowledgeBases(auth).list('my-kb', 1, 20, { projectId: 'abc123' });
323
+ ```
324
+
325
+ Supported on: `AgentsApi`, `KnowledgeBasesApi`, `WorkflowsApi`, `TriggersApi`,
326
+ `FeatureTemplatesApi`, `ServicePricesApi`.
327
+
328
+ ## Error Handling
329
+
330
+ ```typescript
331
+ import { ApiException } from '@applica-software-guru/persona-sdk';
332
+
333
+ try {
334
+ const agent = await sdk.agents('api-key').get('invalid-id');
335
+ } catch (error) {
336
+ if (error instanceof ApiException) {
337
+ console.error(`API Error ${error.statusCode}: ${error.body}`);
338
+ } else {
339
+ throw error;
340
+ }
341
+ }
342
+ ```
343
+
344
+ ## API Reference
345
+
346
+ | Resource | Methods |
347
+ |---|---|
348
+ | **ProjectsApi** | `list`, `get`, `getMine`, `create`, `update`, `remove`, `getSubscription`, `changeSubscriptionPlan`, `addSubscriptionCredits` |
349
+ | **AgentsApi** | `list`, `get`, `create`, `update`, `remove`, `getSynthesizerSupportedVoices`, `listRevisions`, `getRevision`, `rollback`, `generateSystemInstructions`, `getArchitect` |
350
+ | **SessionsApi** | `list`, `get`, `getUsage`, `generateMessage`, `findMessages`, `remove` |
351
+ | **KnowledgeBasesApi** | `list`, `get`, `create`, `update`, `remove`, `documents()`, `searchChunks` |
352
+ | **KnowledgeBaseDocumentsApi** | `list`, `upload`, `get`, `reprocess`, `remove` |
353
+ | **WorkflowsApi** | `list`, `create`, `update`, `remove`, `get`, `executions()`, `listRevisions`, `getRevision`, `rollback` |
354
+ | **WorkflowExecutionsApi** | `list`, `get`, `run`, `queue` |
355
+ | **CredentialsApi** | `authorize`, `handleOAuth2Callback`, `list`, `getByProvider`, `getById`, `remove` |
356
+ | **TriggersApi** | `list`, `create`, `update`, `remove`, `get`, `executions()` |
357
+ | **TriggerExecutionsApi** | `list`, `execute`, `get`, `remove` |
358
+ | **FeaturesApi** | `templates()` |
359
+ | **FeatureTemplatesApi** | `list`, `get`, `create`, `update`, `patch`, `remove`, `getMcpAvailableTools` |
360
+ | **MissionsApi** | `list`, `get`, `create`, `update`, `remove`, `generate`, `execute`, `retry`, `replan`, `sendInstruction`, `stop`, `resume` |
361
+ | **ServicePricesApi** | `list`, `get`, `create`, `update`, `remove` |
362
+ | **BillingClient** | `createCustomer`, `updateCustomer`, `getCustomer`, `saveCustomer`, `deleteCustomer`, `createSubscription`, `getSubscription`, `cancelSubscription`, `beginUpgrade`, `downgrade`, `mentorize`, `addCredits`, `useCredits`, `getCredits`, `isValid`, `listInvoices`, `getProjectSubscription`, `changeProjectSubscriptionPlan`, `addProjectSubscriptionCredits` |
363
+
364
+ ## Compatibility
365
+
366
+ - **Runtime**: Browser (Chrome, Firefox, Safari, Edge), Node.js 18+
367
+ - **Frameworks**: React, Vue, Angular, Svelte, Next.js, Vite, Webpack
368
+ - **Module systems**: ESM, CommonJS
369
+ - **TypeScript**: Full type definitions included
30
370
 
31
371
  ## License
32
372
 
33
- This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
373
+ MIT
@@ -1,4 +1,4 @@
1
- image: node:20
1
+ image: node:22
2
2
 
3
3
  pipelines:
4
4
  branches:
@@ -7,13 +7,14 @@ pipelines:
7
7
  name: Deploy
8
8
  deployment: Production
9
9
  script:
10
- - export VERSION=0.1
11
- - npm --no-git-tag-version version "$VERSION.$BITBUCKET_BUILD_NUMBER" -m "Upgrade to new version"
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"
12
13
  - npm install
13
14
  - npm run build
14
15
  - pipe: atlassian/npm-publish:0.3.2
15
16
  variables:
16
17
  NPM_TOKEN: $NPM_TOKEN
17
18
  EXTRA_ARGS: '--access public'
18
- - git tag -a "$VERSION.$BITBUCKET_BUILD_NUMBER" -m "Version $VERSION.$BITBUCKET_BUILD_NUMBER"
19
- - git push origin "$VERSION.$BITBUCKET_BUILD_NUMBER"
19
+ - git tag -a "$PACKAGE_VERSION" -m "Version $PACKAGE_VERSION"
20
+ - git push origin "$PACKAGE_VERSION"