@contractspec/example.pocket-family-office 3.7.6 → 3.7.7

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 (41) hide show
  1. package/README.md +65 -33
  2. package/dist/browser/index.js +520 -519
  3. package/dist/browser/operations/index.js +6 -6
  4. package/dist/browser/telemetry.js +4 -4
  5. package/dist/browser/workflows/generate-financial-summary.js +1 -1
  6. package/dist/browser/workflows/generate-openbanking-overview.js +1 -1
  7. package/dist/browser/workflows/index.js +203 -203
  8. package/dist/browser/workflows/ingest-email-threads.js +1 -1
  9. package/dist/browser/workflows/process-uploaded-document.js +1 -1
  10. package/dist/browser/workflows/refresh-openbanking-balances.js +1 -1
  11. package/dist/browser/workflows/sync-openbanking-accounts.js +1 -1
  12. package/dist/browser/workflows/sync-openbanking-transactions.js +1 -1
  13. package/dist/browser/workflows/upcoming-payments-reminder.js +1 -1
  14. package/dist/index.d.ts +4 -4
  15. package/dist/index.js +520 -519
  16. package/dist/node/index.js +520 -519
  17. package/dist/node/operations/index.js +6 -6
  18. package/dist/node/telemetry.js +4 -4
  19. package/dist/node/workflows/generate-financial-summary.js +1 -1
  20. package/dist/node/workflows/generate-openbanking-overview.js +1 -1
  21. package/dist/node/workflows/index.js +203 -203
  22. package/dist/node/workflows/ingest-email-threads.js +1 -1
  23. package/dist/node/workflows/process-uploaded-document.js +1 -1
  24. package/dist/node/workflows/refresh-openbanking-balances.js +1 -1
  25. package/dist/node/workflows/sync-openbanking-accounts.js +1 -1
  26. package/dist/node/workflows/sync-openbanking-transactions.js +1 -1
  27. package/dist/node/workflows/upcoming-payments-reminder.js +1 -1
  28. package/dist/operations/index.d.ts +1 -1
  29. package/dist/operations/index.js +6 -6
  30. package/dist/telemetry.js +4 -4
  31. package/dist/workflows/generate-financial-summary.js +1 -1
  32. package/dist/workflows/generate-openbanking-overview.js +1 -1
  33. package/dist/workflows/index.d.ts +4 -4
  34. package/dist/workflows/index.js +203 -203
  35. package/dist/workflows/ingest-email-threads.js +1 -1
  36. package/dist/workflows/process-uploaded-document.js +1 -1
  37. package/dist/workflows/refresh-openbanking-balances.js +1 -1
  38. package/dist/workflows/sync-openbanking-accounts.js +1 -1
  39. package/dist/workflows/sync-openbanking-transactions.js +1 -1
  40. package/dist/workflows/upcoming-payments-reminder.js +1 -1
  41. package/package.json +6 -6
@@ -1,260 +1,250 @@
1
- // src/workflows/process-uploaded-document.ts
2
- import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
1
+ // src/workflows/generate-financial-summary.ts
3
2
  import {
4
3
  OwnersEnum,
5
4
  StabilityEnum,
6
5
  TagsEnum
7
6
  } from "@contractspec/lib.contracts-spec";
8
- var processUploadedDocumentWorkflow = defineWorkflow({
7
+ import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
8
+ var generateFinancialSummaryWorkflow = defineWorkflow({
9
9
  meta: {
10
- key: "pfo.workflow.process-uploaded-document",
10
+ key: "pfo.workflow.generate-financial-summary",
11
11
  version: "1.0.0",
12
- title: "Process Uploaded Document",
13
- description: "Stores an uploaded invoice/contract, queues ingestion, and records any follow-up reminders.",
12
+ title: "Generate Financial Summary",
13
+ description: "Retrieves the latest financial signals, generates an AI summary, and optionally distributes it by voice or email.",
14
14
  domain: "finance",
15
15
  owners: [OwnersEnum.PlatformFinance],
16
- tags: ["documents", "ingestion", TagsEnum.Automation],
17
- stability: StabilityEnum.Experimental
16
+ tags: ["summary", "ai", TagsEnum.Automation],
17
+ stability: StabilityEnum.Beta
18
18
  },
19
19
  definition: {
20
- entryStepId: "store",
20
+ entryStepId: "summarise",
21
21
  steps: [
22
22
  {
23
- id: "store",
23
+ id: "summarise",
24
24
  type: "automation",
25
- label: "Store and Queue Ingestion",
26
- description: "Persist the document to storage and enqueue the knowledge ingestion pipeline.",
25
+ label: "Generate Summary",
26
+ description: "Run retrieval augmented generation over the knowledge base to produce a household summary.",
27
27
  action: {
28
- operation: { key: "pfo.documents.upload", version: "1.0.0" }
28
+ operation: { key: "pfo.summary.generate", version: "1.0.0" }
29
29
  },
30
- requiredIntegrations: ["primaryStorage", "primaryVectorDb"],
30
+ requiredIntegrations: ["primaryLLM", "primaryVectorDb"],
31
31
  retry: {
32
32
  maxAttempts: 3,
33
33
  backoff: "exponential",
34
- delayMs: 500
34
+ delayMs: 750
35
35
  }
36
36
  },
37
37
  {
38
- id: "review",
39
- type: "human",
40
- label: "Optional Human Classification",
41
- description: "Finance lead can categorise the document while ingestion completes."
38
+ id: "distribute",
39
+ type: "automation",
40
+ label: "Distribute Summary",
41
+ description: "Send the generated summary via email and optionally synthesise a voice note.",
42
+ action: {
43
+ operation: { key: "pfo.summary.dispatch", version: "1.0.0" }
44
+ },
45
+ requiredIntegrations: ["emailOutbound"],
46
+ retry: {
47
+ maxAttempts: 2,
48
+ backoff: "linear",
49
+ delayMs: 500
50
+ }
42
51
  }
43
52
  ],
44
- transitions: [
45
- {
46
- from: "store",
47
- to: "review"
48
- }
49
- ]
53
+ transitions: [{ from: "summarise", to: "distribute" }]
50
54
  }
51
55
  });
52
56
 
53
- // src/workflows/upcoming-payments-reminder.ts
54
- import { defineWorkflow as defineWorkflow2 } from "@contractspec/lib.contracts-spec/workflow";
57
+ // src/workflows/generate-openbanking-overview.ts
55
58
  import {
56
59
  OwnersEnum as OwnersEnum2,
57
60
  StabilityEnum as StabilityEnum2,
58
61
  TagsEnum as TagsEnum2
59
62
  } from "@contractspec/lib.contracts-spec";
60
- var upcomingPaymentsReminderWorkflow = defineWorkflow2({
63
+ import { defineWorkflow as defineWorkflow2 } from "@contractspec/lib.contracts-spec/workflow";
64
+ var OPEN_BANKING_CAPABILITIES = [
65
+ { key: "openbanking.accounts.read", version: "1.0.0" },
66
+ { key: "openbanking.transactions.read", version: "1.0.0" },
67
+ { key: "openbanking.balances.read", version: "1.0.0" }
68
+ ];
69
+ var generateOpenBankingOverviewWorkflow = defineWorkflow2({
61
70
  meta: {
62
- key: "pfo.workflow.upcoming-payments-reminder",
71
+ key: "pfo.workflow.generate-openbanking-overview",
63
72
  version: "1.0.0",
64
- title: "Schedule Upcoming Payment Reminder",
65
- description: "Collects payment metadata and schedules multi-channel reminders for bills that are due soon.",
73
+ title: "Generate Open Banking Overview",
74
+ description: "Produces a derived financial overview and stores it in the operational knowledge space.",
66
75
  domain: "finance",
67
76
  owners: [OwnersEnum2.PlatformFinance],
68
- tags: ["payments", "reminders", TagsEnum2.Automation],
69
- stability: StabilityEnum2.Beta
77
+ tags: ["open-banking", "summary", TagsEnum2.Automation],
78
+ stability: StabilityEnum2.Experimental
70
79
  },
71
80
  definition: {
72
- entryStepId: "collect",
81
+ entryStepId: "generate-overview",
73
82
  steps: [
74
83
  {
75
- id: "collect",
76
- type: "human",
77
- label: "Review Upcoming Bill",
78
- description: "Confirm amount, due date, and preferred delivery channels before scheduling reminder."
79
- },
80
- {
81
- id: "schedule",
84
+ id: "generate-overview",
82
85
  type: "automation",
83
- label: "Schedule Reminder",
86
+ label: "Generate Overview",
87
+ description: "Aggregate balances, cashflow, and category breakdowns into a knowledge entry.",
84
88
  action: {
85
89
  operation: {
86
- key: "pfo.reminders.schedule-payment",
90
+ key: "pfo.openbanking.generate-overview",
87
91
  version: "1.0.0"
88
92
  }
89
93
  },
90
- requiredIntegrations: [
91
- "emailOutbound",
92
- "smsNotifications",
93
- "calendarScheduling"
94
- ],
94
+ requiredIntegrations: ["primaryOpenBanking"],
95
+ requiredCapabilities: OPEN_BANKING_CAPABILITIES,
95
96
  retry: {
96
- maxAttempts: 2,
97
- backoff: "linear",
98
- delayMs: 1000
97
+ maxAttempts: 3,
98
+ backoff: "exponential",
99
+ delayMs: 1500
99
100
  }
100
101
  }
101
102
  ],
102
- transitions: [
103
- {
104
- from: "collect",
105
- to: "schedule",
106
- condition: "output?.confirmed === true",
107
- label: "Reminder confirmed"
108
- }
109
- ]
103
+ transitions: []
110
104
  }
111
105
  });
112
106
 
113
- // src/workflows/generate-financial-summary.ts
114
- import { defineWorkflow as defineWorkflow3 } from "@contractspec/lib.contracts-spec/workflow";
107
+ // src/workflows/ingest-email-threads.ts
115
108
  import {
116
109
  OwnersEnum as OwnersEnum3,
117
110
  StabilityEnum as StabilityEnum3,
118
111
  TagsEnum as TagsEnum3
119
112
  } from "@contractspec/lib.contracts-spec";
120
- var generateFinancialSummaryWorkflow = defineWorkflow3({
113
+ import { defineWorkflow as defineWorkflow3 } from "@contractspec/lib.contracts-spec/workflow";
114
+ var ingestEmailThreadsWorkflow = defineWorkflow3({
121
115
  meta: {
122
- key: "pfo.workflow.generate-financial-summary",
116
+ key: "pfo.workflow.ingest-email-threads",
123
117
  version: "1.0.0",
124
- title: "Generate Financial Summary",
125
- description: "Retrieves the latest financial signals, generates an AI summary, and optionally distributes it by voice or email.",
126
- domain: "finance",
127
- owners: [OwnersEnum3.PlatformFinance],
128
- tags: ["summary", "ai", TagsEnum3.Automation],
129
- stability: StabilityEnum3.Beta
118
+ title: "Ingest Email Threads",
119
+ description: "Synchronises Gmail threads tagged with finance labels and indexes them into operational knowledge spaces.",
120
+ domain: "communications",
121
+ owners: [OwnersEnum3.PlatformMessaging],
122
+ tags: ["gmail", "knowledge", TagsEnum3.Automation],
123
+ stability: StabilityEnum3.Experimental
130
124
  },
131
125
  definition: {
132
- entryStepId: "summarise",
126
+ entryStepId: "sync",
133
127
  steps: [
134
128
  {
135
- id: "summarise",
129
+ id: "sync",
136
130
  type: "automation",
137
- label: "Generate Summary",
138
- description: "Run retrieval augmented generation over the knowledge base to produce a household summary.",
131
+ label: "Sync Gmail Threads",
132
+ description: "Fetches Gmail threads and transforms them into knowledge fragments before vector indexing.",
139
133
  action: {
140
- operation: { key: "pfo.summary.generate", version: "1.0.0" }
134
+ operation: { key: "pfo.email.sync-threads", version: "1.0.0" }
141
135
  },
142
- requiredIntegrations: ["primaryLLM", "primaryVectorDb"],
136
+ requiredIntegrations: ["emailInbound", "primaryVectorDb"],
143
137
  retry: {
144
138
  maxAttempts: 3,
145
139
  backoff: "exponential",
146
- delayMs: 750
140
+ delayMs: 1000
147
141
  }
148
142
  },
149
143
  {
150
- id: "distribute",
151
- type: "automation",
152
- label: "Distribute Summary",
153
- description: "Send the generated summary via email and optionally synthesise a voice note.",
154
- action: {
155
- operation: { key: "pfo.summary.dispatch", version: "1.0.0" }
156
- },
157
- requiredIntegrations: ["emailOutbound"],
158
- retry: {
159
- maxAttempts: 2,
160
- backoff: "linear",
161
- delayMs: 500
162
- }
144
+ id: "triage",
145
+ type: "human",
146
+ label: "Triage Exceptions",
147
+ description: "Operators can resolve sync failures or tag important threads for follow-up."
163
148
  }
164
149
  ],
165
- transitions: [{ from: "summarise", to: "distribute" }]
150
+ transitions: [
151
+ {
152
+ from: "sync",
153
+ to: "triage",
154
+ condition: "output?.syncedThreads === 0",
155
+ label: "No new threads"
156
+ }
157
+ ]
166
158
  }
167
159
  });
168
160
 
169
- // src/workflows/ingest-email-threads.ts
170
- import { defineWorkflow as defineWorkflow4 } from "@contractspec/lib.contracts-spec/workflow";
161
+ // src/workflows/process-uploaded-document.ts
171
162
  import {
172
163
  OwnersEnum as OwnersEnum4,
173
164
  StabilityEnum as StabilityEnum4,
174
165
  TagsEnum as TagsEnum4
175
166
  } from "@contractspec/lib.contracts-spec";
176
- var ingestEmailThreadsWorkflow = defineWorkflow4({
167
+ import { defineWorkflow as defineWorkflow4 } from "@contractspec/lib.contracts-spec/workflow";
168
+ var processUploadedDocumentWorkflow = defineWorkflow4({
177
169
  meta: {
178
- key: "pfo.workflow.ingest-email-threads",
170
+ key: "pfo.workflow.process-uploaded-document",
179
171
  version: "1.0.0",
180
- title: "Ingest Email Threads",
181
- description: "Synchronises Gmail threads tagged with finance labels and indexes them into operational knowledge spaces.",
182
- domain: "communications",
183
- owners: [OwnersEnum4.PlatformMessaging],
184
- tags: ["gmail", "knowledge", TagsEnum4.Automation],
172
+ title: "Process Uploaded Document",
173
+ description: "Stores an uploaded invoice/contract, queues ingestion, and records any follow-up reminders.",
174
+ domain: "finance",
175
+ owners: [OwnersEnum4.PlatformFinance],
176
+ tags: ["documents", "ingestion", TagsEnum4.Automation],
185
177
  stability: StabilityEnum4.Experimental
186
178
  },
187
179
  definition: {
188
- entryStepId: "sync",
180
+ entryStepId: "store",
189
181
  steps: [
190
182
  {
191
- id: "sync",
183
+ id: "store",
192
184
  type: "automation",
193
- label: "Sync Gmail Threads",
194
- description: "Fetches Gmail threads and transforms them into knowledge fragments before vector indexing.",
185
+ label: "Store and Queue Ingestion",
186
+ description: "Persist the document to storage and enqueue the knowledge ingestion pipeline.",
195
187
  action: {
196
- operation: { key: "pfo.email.sync-threads", version: "1.0.0" }
188
+ operation: { key: "pfo.documents.upload", version: "1.0.0" }
197
189
  },
198
- requiredIntegrations: ["emailInbound", "primaryVectorDb"],
190
+ requiredIntegrations: ["primaryStorage", "primaryVectorDb"],
199
191
  retry: {
200
192
  maxAttempts: 3,
201
193
  backoff: "exponential",
202
- delayMs: 1000
194
+ delayMs: 500
203
195
  }
204
196
  },
205
197
  {
206
- id: "triage",
198
+ id: "review",
207
199
  type: "human",
208
- label: "Triage Exceptions",
209
- description: "Operators can resolve sync failures or tag important threads for follow-up."
200
+ label: "Optional Human Classification",
201
+ description: "Finance lead can categorise the document while ingestion completes."
210
202
  }
211
203
  ],
212
204
  transitions: [
213
205
  {
214
- from: "sync",
215
- to: "triage",
216
- condition: "output?.syncedThreads === 0",
217
- label: "No new threads"
206
+ from: "store",
207
+ to: "review"
218
208
  }
219
209
  ]
220
210
  }
221
211
  });
222
212
 
223
- // src/workflows/sync-openbanking-accounts.ts
224
- import { defineWorkflow as defineWorkflow5 } from "@contractspec/lib.contracts-spec/workflow";
213
+ // src/workflows/refresh-openbanking-balances.ts
225
214
  import {
226
215
  OwnersEnum as OwnersEnum5,
227
216
  StabilityEnum as StabilityEnum5,
228
217
  TagsEnum as TagsEnum5
229
218
  } from "@contractspec/lib.contracts-spec";
230
- var ACCOUNT_CAPABILITY = {
231
- key: "openbanking.accounts.read",
219
+ import { defineWorkflow as defineWorkflow5 } from "@contractspec/lib.contracts-spec/workflow";
220
+ var BALANCE_CAPABILITY = {
221
+ key: "openbanking.balances.read",
232
222
  version: "1.0.0"
233
223
  };
234
- var syncOpenBankingAccountsWorkflow = defineWorkflow5({
224
+ var refreshOpenBankingBalancesWorkflow = defineWorkflow5({
235
225
  meta: {
236
- key: "pfo.workflow.sync-openbanking-accounts",
226
+ key: "pfo.workflow.refresh-openbanking-balances",
237
227
  version: "1.0.0",
238
- title: "Synchronise Open Banking Accounts",
239
- description: "Validates Powens connectivity and synchronises bank account metadata into the canonical ledger.",
228
+ title: "Refresh Open Banking Balances",
229
+ description: "Refreshes balances for synced accounts to surface the latest cash positions in dashboards.",
240
230
  domain: "finance",
241
231
  owners: [OwnersEnum5.PlatformFinance],
242
232
  tags: ["open-banking", "powens", TagsEnum5.Automation],
243
233
  stability: StabilityEnum5.Experimental
244
234
  },
245
235
  definition: {
246
- entryStepId: "sync-accounts",
236
+ entryStepId: "refresh-balances",
247
237
  steps: [
248
238
  {
249
- id: "sync-accounts",
239
+ id: "refresh-balances",
250
240
  type: "automation",
251
- label: "Sync Accounts",
252
- description: "Refresh linked bank accounts via Powens and upsert canonical BankAccount records.",
241
+ label: "Refresh Balances",
242
+ description: "Trigger the Powens provider to obtain current and available balances.",
253
243
  action: {
254
- operation: { key: "openbanking.accounts.sync", version: "1.0.0" }
244
+ operation: { key: "openbanking.balances.refresh", version: "1.0.0" }
255
245
  },
256
246
  requiredIntegrations: ["primaryOpenBanking"],
257
- requiredCapabilities: [ACCOUNT_CAPABILITY],
247
+ requiredCapabilities: [BALANCE_CAPABILITY],
258
248
  retry: {
259
249
  maxAttempts: 3,
260
250
  backoff: "exponential",
@@ -262,15 +252,15 @@ var syncOpenBankingAccountsWorkflow = defineWorkflow5({
262
252
  }
263
253
  },
264
254
  {
265
- id: "fetch-accounts",
255
+ id: "fetch-balances",
266
256
  type: "automation",
267
- label: "Fetch Accounts",
268
- description: "Retrieve the latest canonical account snapshot for downstream consumers.",
257
+ label: "Fetch Balances",
258
+ description: "Load the canonical balance snapshots for downstream workflows and dashboards.",
269
259
  action: {
270
- operation: { key: "openbanking.accounts.list", version: "1.0.0" }
260
+ operation: { key: "openbanking.balances.get", version: "1.0.0" }
271
261
  },
272
262
  requiredIntegrations: ["primaryOpenBanking"],
273
- requiredCapabilities: [ACCOUNT_CAPABILITY],
263
+ requiredCapabilities: [BALANCE_CAPABILITY],
274
264
  retry: {
275
265
  maxAttempts: 2,
276
266
  backoff: "linear",
@@ -278,181 +268,191 @@ var syncOpenBankingAccountsWorkflow = defineWorkflow5({
278
268
  }
279
269
  }
280
270
  ],
281
- transitions: [{ from: "sync-accounts", to: "fetch-accounts" }]
271
+ transitions: [{ from: "refresh-balances", to: "fetch-balances" }]
282
272
  }
283
273
  });
284
274
 
285
- // src/workflows/sync-openbanking-transactions.ts
286
- import { defineWorkflow as defineWorkflow6 } from "@contractspec/lib.contracts-spec/workflow";
275
+ // src/workflows/sync-openbanking-accounts.ts
287
276
  import {
288
277
  OwnersEnum as OwnersEnum6,
289
278
  StabilityEnum as StabilityEnum6,
290
279
  TagsEnum as TagsEnum6
291
280
  } from "@contractspec/lib.contracts-spec";
292
- var TRANSACTION_CAPABILITY = {
293
- key: "openbanking.transactions.read",
281
+ import { defineWorkflow as defineWorkflow6 } from "@contractspec/lib.contracts-spec/workflow";
282
+ var ACCOUNT_CAPABILITY = {
283
+ key: "openbanking.accounts.read",
294
284
  version: "1.0.0"
295
285
  };
296
- var syncOpenBankingTransactionsWorkflow = defineWorkflow6({
286
+ var syncOpenBankingAccountsWorkflow = defineWorkflow6({
297
287
  meta: {
298
- key: "pfo.workflow.sync-openbanking-transactions",
288
+ key: "pfo.workflow.sync-openbanking-accounts",
299
289
  version: "1.0.0",
300
- title: "Synchronise Open Banking Transactions",
301
- description: "Fetches recent transactions from Powens for each linked account and stores them in the canonical ledger.",
290
+ title: "Synchronise Open Banking Accounts",
291
+ description: "Validates Powens connectivity and synchronises bank account metadata into the canonical ledger.",
302
292
  domain: "finance",
303
293
  owners: [OwnersEnum6.PlatformFinance],
304
294
  tags: ["open-banking", "powens", TagsEnum6.Automation],
305
295
  stability: StabilityEnum6.Experimental
306
296
  },
307
297
  definition: {
308
- entryStepId: "sync-transactions",
298
+ entryStepId: "sync-accounts",
309
299
  steps: [
310
300
  {
311
- id: "sync-transactions",
301
+ id: "sync-accounts",
312
302
  type: "automation",
313
- label: "Sync Transactions",
314
- description: "Call the Powens provider to pull incremental transactions for active accounts.",
303
+ label: "Sync Accounts",
304
+ description: "Refresh linked bank accounts via Powens and upsert canonical BankAccount records.",
315
305
  action: {
316
- operation: { key: "openbanking.transactions.sync", version: "1.0.0" }
306
+ operation: { key: "openbanking.accounts.sync", version: "1.0.0" }
317
307
  },
318
308
  requiredIntegrations: ["primaryOpenBanking"],
319
- requiredCapabilities: [TRANSACTION_CAPABILITY],
309
+ requiredCapabilities: [ACCOUNT_CAPABILITY],
320
310
  retry: {
321
- maxAttempts: 4,
311
+ maxAttempts: 3,
322
312
  backoff: "exponential",
323
- delayMs: 1500
313
+ delayMs: 1000
324
314
  }
325
315
  },
326
316
  {
327
- id: "list-transactions",
317
+ id: "fetch-accounts",
328
318
  type: "automation",
329
- label: "List Transactions",
330
- description: "Retrieve the canonical transaction list for reporting and downstream analytics.",
319
+ label: "Fetch Accounts",
320
+ description: "Retrieve the latest canonical account snapshot for downstream consumers.",
331
321
  action: {
332
- operation: { key: "openbanking.transactions.list", version: "1.0.0" }
322
+ operation: { key: "openbanking.accounts.list", version: "1.0.0" }
333
323
  },
334
324
  requiredIntegrations: ["primaryOpenBanking"],
335
- requiredCapabilities: [TRANSACTION_CAPABILITY],
325
+ requiredCapabilities: [ACCOUNT_CAPABILITY],
336
326
  retry: {
337
327
  maxAttempts: 2,
338
328
  backoff: "linear",
339
- delayMs: 1000
329
+ delayMs: 750
340
330
  }
341
331
  }
342
332
  ],
343
- transitions: [{ from: "sync-transactions", to: "list-transactions" }]
333
+ transitions: [{ from: "sync-accounts", to: "fetch-accounts" }]
344
334
  }
345
335
  });
346
336
 
347
- // src/workflows/refresh-openbanking-balances.ts
348
- import { defineWorkflow as defineWorkflow7 } from "@contractspec/lib.contracts-spec/workflow";
337
+ // src/workflows/sync-openbanking-transactions.ts
349
338
  import {
350
339
  OwnersEnum as OwnersEnum7,
351
340
  StabilityEnum as StabilityEnum7,
352
341
  TagsEnum as TagsEnum7
353
342
  } from "@contractspec/lib.contracts-spec";
354
- var BALANCE_CAPABILITY = {
355
- key: "openbanking.balances.read",
343
+ import { defineWorkflow as defineWorkflow7 } from "@contractspec/lib.contracts-spec/workflow";
344
+ var TRANSACTION_CAPABILITY = {
345
+ key: "openbanking.transactions.read",
356
346
  version: "1.0.0"
357
347
  };
358
- var refreshOpenBankingBalancesWorkflow = defineWorkflow7({
348
+ var syncOpenBankingTransactionsWorkflow = defineWorkflow7({
359
349
  meta: {
360
- key: "pfo.workflow.refresh-openbanking-balances",
350
+ key: "pfo.workflow.sync-openbanking-transactions",
361
351
  version: "1.0.0",
362
- title: "Refresh Open Banking Balances",
363
- description: "Refreshes balances for synced accounts to surface the latest cash positions in dashboards.",
352
+ title: "Synchronise Open Banking Transactions",
353
+ description: "Fetches recent transactions from Powens for each linked account and stores them in the canonical ledger.",
364
354
  domain: "finance",
365
355
  owners: [OwnersEnum7.PlatformFinance],
366
356
  tags: ["open-banking", "powens", TagsEnum7.Automation],
367
357
  stability: StabilityEnum7.Experimental
368
358
  },
369
359
  definition: {
370
- entryStepId: "refresh-balances",
360
+ entryStepId: "sync-transactions",
371
361
  steps: [
372
362
  {
373
- id: "refresh-balances",
363
+ id: "sync-transactions",
374
364
  type: "automation",
375
- label: "Refresh Balances",
376
- description: "Trigger the Powens provider to obtain current and available balances.",
365
+ label: "Sync Transactions",
366
+ description: "Call the Powens provider to pull incremental transactions for active accounts.",
377
367
  action: {
378
- operation: { key: "openbanking.balances.refresh", version: "1.0.0" }
368
+ operation: { key: "openbanking.transactions.sync", version: "1.0.0" }
379
369
  },
380
370
  requiredIntegrations: ["primaryOpenBanking"],
381
- requiredCapabilities: [BALANCE_CAPABILITY],
371
+ requiredCapabilities: [TRANSACTION_CAPABILITY],
382
372
  retry: {
383
- maxAttempts: 3,
373
+ maxAttempts: 4,
384
374
  backoff: "exponential",
385
- delayMs: 1000
375
+ delayMs: 1500
386
376
  }
387
377
  },
388
378
  {
389
- id: "fetch-balances",
379
+ id: "list-transactions",
390
380
  type: "automation",
391
- label: "Fetch Balances",
392
- description: "Load the canonical balance snapshots for downstream workflows and dashboards.",
381
+ label: "List Transactions",
382
+ description: "Retrieve the canonical transaction list for reporting and downstream analytics.",
393
383
  action: {
394
- operation: { key: "openbanking.balances.get", version: "1.0.0" }
384
+ operation: { key: "openbanking.transactions.list", version: "1.0.0" }
395
385
  },
396
386
  requiredIntegrations: ["primaryOpenBanking"],
397
- requiredCapabilities: [BALANCE_CAPABILITY],
387
+ requiredCapabilities: [TRANSACTION_CAPABILITY],
398
388
  retry: {
399
389
  maxAttempts: 2,
400
390
  backoff: "linear",
401
- delayMs: 750
391
+ delayMs: 1000
402
392
  }
403
393
  }
404
394
  ],
405
- transitions: [{ from: "refresh-balances", to: "fetch-balances" }]
395
+ transitions: [{ from: "sync-transactions", to: "list-transactions" }]
406
396
  }
407
397
  });
408
398
 
409
- // src/workflows/generate-openbanking-overview.ts
410
- import { defineWorkflow as defineWorkflow8 } from "@contractspec/lib.contracts-spec/workflow";
399
+ // src/workflows/upcoming-payments-reminder.ts
411
400
  import {
412
401
  OwnersEnum as OwnersEnum8,
413
402
  StabilityEnum as StabilityEnum8,
414
403
  TagsEnum as TagsEnum8
415
404
  } from "@contractspec/lib.contracts-spec";
416
- var OPEN_BANKING_CAPABILITIES = [
417
- { key: "openbanking.accounts.read", version: "1.0.0" },
418
- { key: "openbanking.transactions.read", version: "1.0.0" },
419
- { key: "openbanking.balances.read", version: "1.0.0" }
420
- ];
421
- var generateOpenBankingOverviewWorkflow = defineWorkflow8({
405
+ import { defineWorkflow as defineWorkflow8 } from "@contractspec/lib.contracts-spec/workflow";
406
+ var upcomingPaymentsReminderWorkflow = defineWorkflow8({
422
407
  meta: {
423
- key: "pfo.workflow.generate-openbanking-overview",
408
+ key: "pfo.workflow.upcoming-payments-reminder",
424
409
  version: "1.0.0",
425
- title: "Generate Open Banking Overview",
426
- description: "Produces a derived financial overview and stores it in the operational knowledge space.",
410
+ title: "Schedule Upcoming Payment Reminder",
411
+ description: "Collects payment metadata and schedules multi-channel reminders for bills that are due soon.",
427
412
  domain: "finance",
428
413
  owners: [OwnersEnum8.PlatformFinance],
429
- tags: ["open-banking", "summary", TagsEnum8.Automation],
430
- stability: StabilityEnum8.Experimental
414
+ tags: ["payments", "reminders", TagsEnum8.Automation],
415
+ stability: StabilityEnum8.Beta
431
416
  },
432
417
  definition: {
433
- entryStepId: "generate-overview",
418
+ entryStepId: "collect",
434
419
  steps: [
435
420
  {
436
- id: "generate-overview",
421
+ id: "collect",
422
+ type: "human",
423
+ label: "Review Upcoming Bill",
424
+ description: "Confirm amount, due date, and preferred delivery channels before scheduling reminder."
425
+ },
426
+ {
427
+ id: "schedule",
437
428
  type: "automation",
438
- label: "Generate Overview",
439
- description: "Aggregate balances, cashflow, and category breakdowns into a knowledge entry.",
429
+ label: "Schedule Reminder",
440
430
  action: {
441
431
  operation: {
442
- key: "pfo.openbanking.generate-overview",
432
+ key: "pfo.reminders.schedule-payment",
443
433
  version: "1.0.0"
444
434
  }
445
435
  },
446
- requiredIntegrations: ["primaryOpenBanking"],
447
- requiredCapabilities: OPEN_BANKING_CAPABILITIES,
436
+ requiredIntegrations: [
437
+ "emailOutbound",
438
+ "smsNotifications",
439
+ "calendarScheduling"
440
+ ],
448
441
  retry: {
449
- maxAttempts: 3,
450
- backoff: "exponential",
451
- delayMs: 1500
442
+ maxAttempts: 2,
443
+ backoff: "linear",
444
+ delayMs: 1000
452
445
  }
453
446
  }
454
447
  ],
455
- transitions: []
448
+ transitions: [
449
+ {
450
+ from: "collect",
451
+ to: "schedule",
452
+ condition: "output?.confirmed === true",
453
+ label: "Reminder confirmed"
454
+ }
455
+ ]
456
456
  }
457
457
  });
458
458
  export {