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