@contractspec/example.pocket-family-office 3.7.17 → 3.7.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blueprint.js +1 -197
- package/dist/browser/blueprint.js +1 -197
- package/dist/browser/connections/samples.js +1 -197
- package/dist/browser/docs/index.js +3 -48
- package/dist/browser/docs/pocket-family-office.docblock.js +3 -48
- package/dist/browser/example.js +1 -42
- package/dist/browser/index.js +4 -1660
- package/dist/browser/knowledge/sources.sample.js +1 -70
- package/dist/browser/operations/index.js +1 -314
- package/dist/browser/pocket-family-office.capability.js +1 -19
- package/dist/browser/pocket-family-office.feature.js +2 -86
- package/dist/browser/telemetry.js +1 -176
- package/dist/browser/tenant.sample.js +1 -71
- package/dist/browser/workflows/generate-financial-summary.js +1 -58
- package/dist/browser/workflows/generate-openbanking-overview.js +1 -52
- package/dist/browser/workflows/index.js +1 -467
- package/dist/browser/workflows/ingest-email-threads.js +1 -56
- package/dist/browser/workflows/process-uploaded-document.js +1 -54
- package/dist/browser/workflows/refresh-openbanking-balances.js +1 -64
- package/dist/browser/workflows/sync-openbanking-accounts.js +1 -64
- package/dist/browser/workflows/sync-openbanking-transactions.js +1 -64
- package/dist/browser/workflows/upcoming-payments-reminder.js +1 -62
- package/dist/connections/samples.js +1 -197
- package/dist/docs/index.js +3 -48
- package/dist/docs/pocket-family-office.docblock.js +3 -48
- package/dist/example.js +1 -42
- package/dist/index.js +4 -1660
- package/dist/knowledge/sources.sample.js +1 -70
- package/dist/node/blueprint.js +1 -197
- package/dist/node/connections/samples.js +1 -197
- package/dist/node/docs/index.js +3 -48
- package/dist/node/docs/pocket-family-office.docblock.js +3 -48
- package/dist/node/example.js +1 -42
- package/dist/node/index.js +4 -1660
- package/dist/node/knowledge/sources.sample.js +1 -70
- package/dist/node/operations/index.js +1 -314
- package/dist/node/pocket-family-office.capability.js +1 -19
- package/dist/node/pocket-family-office.feature.js +2 -86
- package/dist/node/telemetry.js +1 -176
- package/dist/node/tenant.sample.js +1 -71
- package/dist/node/workflows/generate-financial-summary.js +1 -58
- package/dist/node/workflows/generate-openbanking-overview.js +1 -52
- package/dist/node/workflows/index.js +1 -467
- package/dist/node/workflows/ingest-email-threads.js +1 -56
- package/dist/node/workflows/process-uploaded-document.js +1 -54
- package/dist/node/workflows/refresh-openbanking-balances.js +1 -64
- package/dist/node/workflows/sync-openbanking-accounts.js +1 -64
- package/dist/node/workflows/sync-openbanking-transactions.js +1 -64
- package/dist/node/workflows/upcoming-payments-reminder.js +1 -62
- package/dist/operations/index.js +1 -314
- package/dist/pocket-family-office.capability.js +1 -19
- package/dist/pocket-family-office.feature.js +2 -86
- package/dist/telemetry.js +1 -176
- package/dist/tenant.sample.js +1 -71
- package/dist/workflows/generate-financial-summary.js +1 -58
- package/dist/workflows/generate-openbanking-overview.js +1 -52
- package/dist/workflows/index.js +1 -467
- package/dist/workflows/ingest-email-threads.js +1 -56
- package/dist/workflows/process-uploaded-document.js +1 -54
- package/dist/workflows/refresh-openbanking-balances.js +1 -64
- package/dist/workflows/sync-openbanking-accounts.js +1 -64
- package/dist/workflows/sync-openbanking-transactions.js +1 -64
- package/dist/workflows/upcoming-payments-reminder.js +1 -62
- package/package.json +7 -7
package/dist/browser/index.js
CHANGED
|
@@ -1,403 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
OwnersEnum,
|
|
4
|
-
StabilityEnum,
|
|
5
|
-
TagsEnum
|
|
6
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
7
|
-
var cap = (key, version) => ({ key, version });
|
|
8
|
-
var pocketFamilyOfficeBlueprint = {
|
|
9
|
-
meta: {
|
|
10
|
-
key: "pocket-family-office.app",
|
|
11
|
-
version: "1.0.0",
|
|
12
|
-
appId: "pocket-family-office",
|
|
13
|
-
title: "Pocket Family Office",
|
|
14
|
-
description: "Household finance automation: ingest documents, track bills, remind payments, and summarise cashflow.",
|
|
15
|
-
domain: "finance",
|
|
16
|
-
owners: [OwnersEnum.PlatformFinance],
|
|
17
|
-
tags: [TagsEnum.Guide, "finance", "automation"],
|
|
18
|
-
stability: StabilityEnum.Experimental
|
|
19
|
-
},
|
|
20
|
-
capabilities: {
|
|
21
|
-
enabled: [
|
|
22
|
-
cap("ai.chat", "1.0.0"),
|
|
23
|
-
cap("ai.embeddings", "1.0.0"),
|
|
24
|
-
cap("vector-db.search", "1.0.0"),
|
|
25
|
-
cap("vector-db.storage", "1.0.0"),
|
|
26
|
-
cap("storage.objects", "1.0.0"),
|
|
27
|
-
cap("email.inbound", "1.0.0"),
|
|
28
|
-
cap("email.transactional", "1.0.0"),
|
|
29
|
-
cap("calendar.events", "1.0.0"),
|
|
30
|
-
cap("sms.outbound", "1.0.0"),
|
|
31
|
-
cap("ai.voice.tts", "1.0.0"),
|
|
32
|
-
cap("payments.psp", "1.0.0"),
|
|
33
|
-
cap("openbanking.accounts.read", "1.0.0"),
|
|
34
|
-
cap("openbanking.transactions.read", "1.0.0"),
|
|
35
|
-
cap("openbanking.balances.read", "1.0.0")
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
integrationSlots: [
|
|
39
|
-
{
|
|
40
|
-
slotId: "primaryLLM",
|
|
41
|
-
requiredCategory: "ai-llm",
|
|
42
|
-
allowedModes: ["managed", "byok"],
|
|
43
|
-
requiredCapabilities: [cap("ai.chat", "1.0.0")],
|
|
44
|
-
required: true,
|
|
45
|
-
description: "Chat completion provider powering summarisation, explanations, and insights."
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
slotId: "primaryVectorDb",
|
|
49
|
-
requiredCategory: "vector-db",
|
|
50
|
-
allowedModes: ["managed", "byok"],
|
|
51
|
-
requiredCapabilities: [cap("vector-db.search", "1.0.0")],
|
|
52
|
-
required: true,
|
|
53
|
-
description: "Vector database storing embeddings for financial documents and email threads."
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
slotId: "primaryStorage",
|
|
57
|
-
requiredCategory: "storage",
|
|
58
|
-
allowedModes: ["managed", "byok"],
|
|
59
|
-
requiredCapabilities: [cap("storage.objects", "1.0.0")],
|
|
60
|
-
required: true,
|
|
61
|
-
description: "Object storage used for raw uploads and normalised documents."
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
slotId: "primaryOpenBanking",
|
|
65
|
-
requiredCategory: "open-banking",
|
|
66
|
-
allowedModes: ["byok"],
|
|
67
|
-
requiredCapabilities: [
|
|
68
|
-
cap("openbanking.accounts.read", "1.0.0"),
|
|
69
|
-
cap("openbanking.transactions.read", "1.0.0"),
|
|
70
|
-
cap("openbanking.balances.read", "1.0.0")
|
|
71
|
-
],
|
|
72
|
-
required: true,
|
|
73
|
-
description: "Powens BYOK connection powering bank account, transaction, and balance synchronisation."
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
slotId: "emailInbound",
|
|
77
|
-
requiredCategory: "email",
|
|
78
|
-
allowedModes: ["managed", "byok"],
|
|
79
|
-
requiredCapabilities: [cap("email.inbound", "1.0.0")],
|
|
80
|
-
required: true,
|
|
81
|
-
description: "Inbound email/thread sync (Gmail) feeding the knowledge corpus."
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
slotId: "emailOutbound",
|
|
85
|
-
requiredCategory: "email",
|
|
86
|
-
allowedModes: ["managed", "byok"],
|
|
87
|
-
requiredCapabilities: [cap("email.transactional", "1.0.0")],
|
|
88
|
-
required: true,
|
|
89
|
-
description: "Transactional email delivery for reminders and summaries."
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
slotId: "calendarScheduling",
|
|
93
|
-
requiredCategory: "calendar",
|
|
94
|
-
allowedModes: ["managed", "byok"],
|
|
95
|
-
requiredCapabilities: [cap("calendar.events", "1.0.0")],
|
|
96
|
-
required: true,
|
|
97
|
-
description: "Creates calendar holds for bill reviews and handoff meetings."
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
slotId: "voicePlayback",
|
|
101
|
-
requiredCategory: "ai-voice-tts",
|
|
102
|
-
allowedModes: ["managed", "byok"],
|
|
103
|
-
requiredCapabilities: [cap("ai.voice.tts", "1.0.0")],
|
|
104
|
-
required: false,
|
|
105
|
-
description: "Optional voice synthesis for spoken summaries (ElevenLabs)."
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
slotId: "smsNotifications",
|
|
109
|
-
requiredCategory: "sms",
|
|
110
|
-
allowedModes: ["managed", "byok"],
|
|
111
|
-
requiredCapabilities: [cap("sms.outbound", "1.0.0")],
|
|
112
|
-
required: false,
|
|
113
|
-
description: "SMS provider used for urgent reminders."
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
slotId: "paymentsProcessing",
|
|
117
|
-
requiredCategory: "payments",
|
|
118
|
-
allowedModes: ["managed", "byok"],
|
|
119
|
-
requiredCapabilities: [cap("payments.psp", "1.0.0")],
|
|
120
|
-
required: false,
|
|
121
|
-
description: "Optional payments processor enabling bill pay automations."
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
workflows: {
|
|
125
|
-
processUploadedDocument: {
|
|
126
|
-
key: "pfo.workflow.process-uploaded-document",
|
|
127
|
-
version: "1.0.0"
|
|
128
|
-
},
|
|
129
|
-
upcomingPaymentsReminder: {
|
|
130
|
-
key: "pfo.workflow.upcoming-payments-reminder",
|
|
131
|
-
version: "1.0.0"
|
|
132
|
-
},
|
|
133
|
-
generateFinancialSummary: {
|
|
134
|
-
key: "pfo.workflow.generate-financial-summary",
|
|
135
|
-
version: "1.0.0"
|
|
136
|
-
},
|
|
137
|
-
ingestEmailThreads: {
|
|
138
|
-
key: "pfo.workflow.ingest-email-threads",
|
|
139
|
-
version: "1.0.0"
|
|
140
|
-
},
|
|
141
|
-
syncOpenBankingAccounts: {
|
|
142
|
-
key: "pfo.workflow.sync-openbanking-accounts",
|
|
143
|
-
version: "1.0.0"
|
|
144
|
-
},
|
|
145
|
-
syncOpenBankingTransactions: {
|
|
146
|
-
key: "pfo.workflow.sync-openbanking-transactions",
|
|
147
|
-
version: "1.0.0"
|
|
148
|
-
},
|
|
149
|
-
refreshOpenBankingBalances: {
|
|
150
|
-
key: "pfo.workflow.refresh-openbanking-balances",
|
|
151
|
-
version: "1.0.0"
|
|
152
|
-
},
|
|
153
|
-
generateOpenBankingOverview: {
|
|
154
|
-
key: "pfo.workflow.generate-openbanking-overview",
|
|
155
|
-
version: "1.0.0"
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
policies: [
|
|
159
|
-
{ key: "pfo.policy.tenancy", version: "1.0.0" },
|
|
160
|
-
{ key: "knowledge.access.financial-docs", version: "1.0.0" }
|
|
161
|
-
],
|
|
162
|
-
telemetry: {
|
|
163
|
-
spec: { key: "pfo.telemetry", version: "1.0.0" }
|
|
164
|
-
},
|
|
165
|
-
featureFlags: [
|
|
166
|
-
{
|
|
167
|
-
key: "voice-summaries",
|
|
168
|
-
enabled: false,
|
|
169
|
-
description: "Enable ElevenLabs spoken summaries in addition to email distribution."
|
|
170
|
-
}
|
|
171
|
-
],
|
|
172
|
-
routes: [
|
|
173
|
-
{
|
|
174
|
-
path: "/dashboard",
|
|
175
|
-
label: "Overview",
|
|
176
|
-
workflow: "pfo.workflow.generate-financial-summary"
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
path: "/documents/upload",
|
|
180
|
-
label: "Upload Document",
|
|
181
|
-
workflow: "pfo.workflow.process-uploaded-document"
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
path: "/communications",
|
|
185
|
-
label: "Inbox",
|
|
186
|
-
workflow: "pfo.workflow.ingest-email-threads"
|
|
187
|
-
}
|
|
188
|
-
],
|
|
189
|
-
notes: "Pocket Family Office blueprint pulling together finance automations for the hackathon reference implementation."
|
|
190
|
-
};
|
|
191
|
-
function registerPocketFamilyOfficeBlueprint(registry) {
|
|
192
|
-
return registry.register(pocketFamilyOfficeBlueprint);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// src/connections/samples.ts
|
|
196
|
-
var now = new Date;
|
|
197
|
-
var baseMeta = {
|
|
198
|
-
tenantId: "tenant.family-office",
|
|
199
|
-
createdAt: now,
|
|
200
|
-
updatedAt: now
|
|
201
|
-
};
|
|
202
|
-
var pocketFamilyOfficeConnections = [
|
|
203
|
-
{
|
|
204
|
-
meta: {
|
|
205
|
-
...baseMeta,
|
|
206
|
-
id: "conn-mistral-primary",
|
|
207
|
-
integrationKey: "ai-llm.mistral",
|
|
208
|
-
integrationVersion: "1.0.0",
|
|
209
|
-
label: "Mistral Primary"
|
|
210
|
-
},
|
|
211
|
-
ownershipMode: "managed",
|
|
212
|
-
config: {
|
|
213
|
-
model: "mistral-large-latest",
|
|
214
|
-
embeddingModel: "mistral-embed"
|
|
215
|
-
},
|
|
216
|
-
secretProvider: "gcp-secret-manager",
|
|
217
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/mistral-api-key/versions/latest",
|
|
218
|
-
status: "connected",
|
|
219
|
-
health: {
|
|
220
|
-
status: "connected",
|
|
221
|
-
checkedAt: now,
|
|
222
|
-
latencyMs: 180
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
meta: {
|
|
227
|
-
...baseMeta,
|
|
228
|
-
id: "conn-qdrant-finance",
|
|
229
|
-
integrationKey: "vectordb.qdrant",
|
|
230
|
-
integrationVersion: "1.0.0",
|
|
231
|
-
label: "Qdrant Finance Cluster"
|
|
232
|
-
},
|
|
233
|
-
ownershipMode: "managed",
|
|
234
|
-
config: {
|
|
235
|
-
apiUrl: "https://qdrant.pfo.internal",
|
|
236
|
-
collectionPrefix: "tenant-family-office"
|
|
237
|
-
},
|
|
238
|
-
secretProvider: "gcp-secret-manager",
|
|
239
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/qdrant-api-key/versions/latest",
|
|
240
|
-
status: "connected",
|
|
241
|
-
health: { status: "connected", checkedAt: now, latencyMs: 95 }
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
meta: {
|
|
245
|
-
...baseMeta,
|
|
246
|
-
id: "conn-gcs-documents",
|
|
247
|
-
integrationKey: "storage.gcs",
|
|
248
|
-
integrationVersion: "1.0.0",
|
|
249
|
-
label: "GCS Documents Bucket"
|
|
250
|
-
},
|
|
251
|
-
ownershipMode: "managed",
|
|
252
|
-
config: {
|
|
253
|
-
bucket: "pfo-uploads",
|
|
254
|
-
prefix: "financial-docs/"
|
|
255
|
-
},
|
|
256
|
-
secretProvider: "gcp-secret-manager",
|
|
257
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/gcs-service-account/versions/latest",
|
|
258
|
-
status: "connected",
|
|
259
|
-
health: { status: "connected", checkedAt: now, latencyMs: 60 }
|
|
260
|
-
},
|
|
261
|
-
{
|
|
262
|
-
meta: {
|
|
263
|
-
...baseMeta,
|
|
264
|
-
id: "conn-gmail-threads",
|
|
265
|
-
integrationKey: "email.gmail",
|
|
266
|
-
integrationVersion: "1.0.0",
|
|
267
|
-
label: "Gmail Household Threads"
|
|
268
|
-
},
|
|
269
|
-
ownershipMode: "byok",
|
|
270
|
-
config: {
|
|
271
|
-
labelIds: ["FINANCE", "INBOX"],
|
|
272
|
-
includeSpamTrash: false
|
|
273
|
-
},
|
|
274
|
-
secretProvider: "gcp-secret-manager",
|
|
275
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/gmail-refresh-token/versions/latest",
|
|
276
|
-
status: "connected",
|
|
277
|
-
health: { status: "connected", checkedAt: now, latencyMs: 320 }
|
|
278
|
-
},
|
|
279
|
-
{
|
|
280
|
-
meta: {
|
|
281
|
-
...baseMeta,
|
|
282
|
-
id: "conn-postmark-outbound",
|
|
283
|
-
integrationKey: "email.postmark",
|
|
284
|
-
integrationVersion: "1.0.0",
|
|
285
|
-
label: "Postmark Transactional"
|
|
286
|
-
},
|
|
287
|
-
ownershipMode: "managed",
|
|
288
|
-
config: {
|
|
289
|
-
messageStream: "outbound",
|
|
290
|
-
fromEmail: "family.office@pfo.dev"
|
|
291
|
-
},
|
|
292
|
-
secretProvider: "gcp-secret-manager",
|
|
293
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/postmark-server-token/versions/latest",
|
|
294
|
-
status: "connected",
|
|
295
|
-
health: { status: "connected", checkedAt: now, latencyMs: 210 }
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
meta: {
|
|
299
|
-
...baseMeta,
|
|
300
|
-
id: "conn-google-calendar",
|
|
301
|
-
integrationKey: "calendar.google",
|
|
302
|
-
integrationVersion: "1.0.0",
|
|
303
|
-
label: "Household Calendar"
|
|
304
|
-
},
|
|
305
|
-
ownershipMode: "managed",
|
|
306
|
-
config: {
|
|
307
|
-
calendarId: "primary"
|
|
308
|
-
},
|
|
309
|
-
secretProvider: "gcp-secret-manager",
|
|
310
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/google-calendar-service-account/versions/latest",
|
|
311
|
-
status: "connected",
|
|
312
|
-
health: { status: "connected", checkedAt: now, latencyMs: 140 }
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
meta: {
|
|
316
|
-
...baseMeta,
|
|
317
|
-
id: "conn-elevenlabs-voice",
|
|
318
|
-
integrationKey: "ai-voice.elevenlabs",
|
|
319
|
-
integrationVersion: "1.0.0",
|
|
320
|
-
label: "ElevenLabs Voice"
|
|
321
|
-
},
|
|
322
|
-
ownershipMode: "byok",
|
|
323
|
-
config: {
|
|
324
|
-
defaultVoiceId: "pNInz6obpgDQGcFmaJgB"
|
|
325
|
-
},
|
|
326
|
-
secretProvider: "gcp-secret-manager",
|
|
327
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/elevenlabs-api-key/versions/latest",
|
|
328
|
-
status: "connected",
|
|
329
|
-
health: { status: "connected", checkedAt: now, latencyMs: 250 }
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
meta: {
|
|
333
|
-
...baseMeta,
|
|
334
|
-
id: "conn-twilio-sms",
|
|
335
|
-
integrationKey: "sms.twilio",
|
|
336
|
-
integrationVersion: "1.0.0",
|
|
337
|
-
label: "Twilio SMS"
|
|
338
|
-
},
|
|
339
|
-
ownershipMode: "managed",
|
|
340
|
-
config: {
|
|
341
|
-
fromNumber: "+15552340000"
|
|
342
|
-
},
|
|
343
|
-
secretProvider: "gcp-secret-manager",
|
|
344
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/twilio-auth-token/versions/latest",
|
|
345
|
-
status: "connected",
|
|
346
|
-
health: { status: "connected", checkedAt: now, latencyMs: 180 }
|
|
347
|
-
},
|
|
348
|
-
{
|
|
349
|
-
meta: {
|
|
350
|
-
...baseMeta,
|
|
351
|
-
id: "conn-stripe-recurring",
|
|
352
|
-
integrationKey: "payments.stripe",
|
|
353
|
-
integrationVersion: "1.0.0",
|
|
354
|
-
label: "Stripe Recurring Billing"
|
|
355
|
-
},
|
|
356
|
-
ownershipMode: "managed",
|
|
357
|
-
config: {
|
|
358
|
-
accountId: "acct_1PFOHACKATHON",
|
|
359
|
-
region: "eu-west-1"
|
|
360
|
-
},
|
|
361
|
-
secretProvider: "gcp-secret-manager",
|
|
362
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/stripe-secret-key/versions/latest",
|
|
363
|
-
status: "connected",
|
|
364
|
-
health: { status: "connected", checkedAt: now, latencyMs: 220 }
|
|
365
|
-
},
|
|
366
|
-
{
|
|
367
|
-
meta: {
|
|
368
|
-
...baseMeta,
|
|
369
|
-
id: "conn-powens-primary",
|
|
370
|
-
integrationKey: "openbanking.powens",
|
|
371
|
-
integrationVersion: "1.0.0",
|
|
372
|
-
label: "Powens Open Banking"
|
|
373
|
-
},
|
|
374
|
-
ownershipMode: "byok",
|
|
375
|
-
config: {
|
|
376
|
-
environment: "sandbox",
|
|
377
|
-
baseUrl: "https://api-sandbox.powens.com/v2"
|
|
378
|
-
},
|
|
379
|
-
secretProvider: "gcp-secret-manager",
|
|
380
|
-
secretRef: "gcp://projects/pfo-hackathon/secrets/powens-credentials/versions/latest",
|
|
381
|
-
status: "connected",
|
|
382
|
-
health: { status: "connected", checkedAt: now, latencyMs: 410 }
|
|
383
|
-
}
|
|
384
|
-
];
|
|
385
|
-
function getPocketFamilyOfficeConnection(connectionId) {
|
|
386
|
-
return pocketFamilyOfficeConnections.find((connection) => connection.meta.id === connectionId);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// src/docs/pocket-family-office.docblock.ts
|
|
390
|
-
import { registerDocBlocks } from "@contractspec/lib.contracts-spec/docs";
|
|
391
|
-
var pocketFamilyOfficeDocBlocks = [
|
|
392
|
-
{
|
|
393
|
-
id: "docs.examples.pocket-family-office.goal",
|
|
394
|
-
title: "Pocket Family Office — Goal",
|
|
395
|
-
summary: "Secure personal finance automation combining documents and open banking.",
|
|
396
|
-
kind: "goal",
|
|
397
|
-
visibility: "public",
|
|
398
|
-
route: "/docs/examples/pocket-family-office/goal",
|
|
399
|
-
tags: ["finance", "goal"],
|
|
400
|
-
body: `## Why it matters
|
|
1
|
+
import{OwnersEnum as v,StabilityEnum as b,TagsEnum as x}from"@contractspec/lib.contracts-spec/ownership";var t=(r,m)=>({key:r,version:m}),w={meta:{key:"pocket-family-office.app",version:"1.0.0",appId:"pocket-family-office",title:"Pocket Family Office",description:"Household finance automation: ingest documents, track bills, remind payments, and summarise cashflow.",domain:"finance",owners:[v.PlatformFinance],tags:[x.Guide,"finance","automation"],stability:b.Experimental},capabilities:{enabled:[t("ai.chat","1.0.0"),t("ai.embeddings","1.0.0"),t("vector-db.search","1.0.0"),t("vector-db.storage","1.0.0"),t("storage.objects","1.0.0"),t("email.inbound","1.0.0"),t("email.transactional","1.0.0"),t("calendar.events","1.0.0"),t("sms.outbound","1.0.0"),t("ai.voice.tts","1.0.0"),t("payments.psp","1.0.0"),t("openbanking.accounts.read","1.0.0"),t("openbanking.transactions.read","1.0.0"),t("openbanking.balances.read","1.0.0")]},integrationSlots:[{slotId:"primaryLLM",requiredCategory:"ai-llm",allowedModes:["managed","byok"],requiredCapabilities:[t("ai.chat","1.0.0")],required:!0,description:"Chat completion provider powering summarisation, explanations, and insights."},{slotId:"primaryVectorDb",requiredCategory:"vector-db",allowedModes:["managed","byok"],requiredCapabilities:[t("vector-db.search","1.0.0")],required:!0,description:"Vector database storing embeddings for financial documents and email threads."},{slotId:"primaryStorage",requiredCategory:"storage",allowedModes:["managed","byok"],requiredCapabilities:[t("storage.objects","1.0.0")],required:!0,description:"Object storage used for raw uploads and normalised documents."},{slotId:"primaryOpenBanking",requiredCategory:"open-banking",allowedModes:["byok"],requiredCapabilities:[t("openbanking.accounts.read","1.0.0"),t("openbanking.transactions.read","1.0.0"),t("openbanking.balances.read","1.0.0")],required:!0,description:"Powens BYOK connection powering bank account, transaction, and balance synchronisation."},{slotId:"emailInbound",requiredCategory:"email",allowedModes:["managed","byok"],requiredCapabilities:[t("email.inbound","1.0.0")],required:!0,description:"Inbound email/thread sync (Gmail) feeding the knowledge corpus."},{slotId:"emailOutbound",requiredCategory:"email",allowedModes:["managed","byok"],requiredCapabilities:[t("email.transactional","1.0.0")],required:!0,description:"Transactional email delivery for reminders and summaries."},{slotId:"calendarScheduling",requiredCategory:"calendar",allowedModes:["managed","byok"],requiredCapabilities:[t("calendar.events","1.0.0")],required:!0,description:"Creates calendar holds for bill reviews and handoff meetings."},{slotId:"voicePlayback",requiredCategory:"ai-voice-tts",allowedModes:["managed","byok"],requiredCapabilities:[t("ai.voice.tts","1.0.0")],required:!1,description:"Optional voice synthesis for spoken summaries (ElevenLabs)."},{slotId:"smsNotifications",requiredCategory:"sms",allowedModes:["managed","byok"],requiredCapabilities:[t("sms.outbound","1.0.0")],required:!1,description:"SMS provider used for urgent reminders."},{slotId:"paymentsProcessing",requiredCategory:"payments",allowedModes:["managed","byok"],requiredCapabilities:[t("payments.psp","1.0.0")],required:!1,description:"Optional payments processor enabling bill pay automations."}],workflows:{processUploadedDocument:{key:"pfo.workflow.process-uploaded-document",version:"1.0.0"},upcomingPaymentsReminder:{key:"pfo.workflow.upcoming-payments-reminder",version:"1.0.0"},generateFinancialSummary:{key:"pfo.workflow.generate-financial-summary",version:"1.0.0"},ingestEmailThreads:{key:"pfo.workflow.ingest-email-threads",version:"1.0.0"},syncOpenBankingAccounts:{key:"pfo.workflow.sync-openbanking-accounts",version:"1.0.0"},syncOpenBankingTransactions:{key:"pfo.workflow.sync-openbanking-transactions",version:"1.0.0"},refreshOpenBankingBalances:{key:"pfo.workflow.refresh-openbanking-balances",version:"1.0.0"},generateOpenBankingOverview:{key:"pfo.workflow.generate-openbanking-overview",version:"1.0.0"}},policies:[{key:"pfo.policy.tenancy",version:"1.0.0"},{key:"knowledge.access.financial-docs",version:"1.0.0"}],telemetry:{spec:{key:"pfo.telemetry",version:"1.0.0"}},featureFlags:[{key:"voice-summaries",enabled:!1,description:"Enable ElevenLabs spoken summaries in addition to email distribution."}],routes:[{path:"/dashboard",label:"Overview",workflow:"pfo.workflow.generate-financial-summary"},{path:"/documents/upload",label:"Upload Document",workflow:"pfo.workflow.process-uploaded-document"},{path:"/communications",label:"Inbox",workflow:"pfo.workflow.ingest-email-threads"}],notes:"Pocket Family Office blueprint pulling together finance automations for the hackathon reference implementation."};function $e(r){return r.register(w)}var o=new Date,a={tenantId:"tenant.family-office",createdAt:o,updatedAt:o},M=[{meta:{...a,id:"conn-mistral-primary",integrationKey:"ai-llm.mistral",integrationVersion:"1.0.0",label:"Mistral Primary"},ownershipMode:"managed",config:{model:"mistral-large-latest",embeddingModel:"mistral-embed"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/mistral-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:180}},{meta:{...a,id:"conn-qdrant-finance",integrationKey:"vectordb.qdrant",integrationVersion:"1.0.0",label:"Qdrant Finance Cluster"},ownershipMode:"managed",config:{apiUrl:"https://qdrant.pfo.internal",collectionPrefix:"tenant-family-office"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/qdrant-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:95}},{meta:{...a,id:"conn-gcs-documents",integrationKey:"storage.gcs",integrationVersion:"1.0.0",label:"GCS Documents Bucket"},ownershipMode:"managed",config:{bucket:"pfo-uploads",prefix:"financial-docs/"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/gcs-service-account/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:60}},{meta:{...a,id:"conn-gmail-threads",integrationKey:"email.gmail",integrationVersion:"1.0.0",label:"Gmail Household Threads"},ownershipMode:"byok",config:{labelIds:["FINANCE","INBOX"],includeSpamTrash:!1},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/gmail-refresh-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:320}},{meta:{...a,id:"conn-postmark-outbound",integrationKey:"email.postmark",integrationVersion:"1.0.0",label:"Postmark Transactional"},ownershipMode:"managed",config:{messageStream:"outbound",fromEmail:"family.office@pfo.dev"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/postmark-server-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:210}},{meta:{...a,id:"conn-google-calendar",integrationKey:"calendar.google",integrationVersion:"1.0.0",label:"Household Calendar"},ownershipMode:"managed",config:{calendarId:"primary"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/google-calendar-service-account/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:140}},{meta:{...a,id:"conn-elevenlabs-voice",integrationKey:"ai-voice.elevenlabs",integrationVersion:"1.0.0",label:"ElevenLabs Voice"},ownershipMode:"byok",config:{defaultVoiceId:"pNInz6obpgDQGcFmaJgB"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/elevenlabs-api-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:250}},{meta:{...a,id:"conn-twilio-sms",integrationKey:"sms.twilio",integrationVersion:"1.0.0",label:"Twilio SMS"},ownershipMode:"managed",config:{fromNumber:"+15552340000"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/twilio-auth-token/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:180}},{meta:{...a,id:"conn-stripe-recurring",integrationKey:"payments.stripe",integrationVersion:"1.0.0",label:"Stripe Recurring Billing"},ownershipMode:"managed",config:{accountId:"acct_1PFOHACKATHON",region:"eu-west-1"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/stripe-secret-key/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:220}},{meta:{...a,id:"conn-powens-primary",integrationKey:"openbanking.powens",integrationVersion:"1.0.0",label:"Powens Open Banking"},ownershipMode:"byok",config:{environment:"sandbox",baseUrl:"https://api-sandbox.powens.com/v2"},secretProvider:"gcp-secret-manager",secretRef:"gcp://projects/pfo-hackathon/secrets/powens-credentials/versions/latest",status:"connected",health:{status:"connected",checkedAt:o,latencyMs:410}}];function Ce(r){return M.find((m)=>m.meta.id===r)}import{registerDocBlocks as I}from"@contractspec/lib.contracts-spec/docs";var K=[{id:"docs.examples.pocket-family-office.goal",title:"Pocket Family Office — Goal",summary:"Secure personal finance automation combining documents and open banking.",kind:"goal",visibility:"public",route:"/docs/examples/pocket-family-office/goal",tags:["finance","goal"],body:`## Why it matters
|
|
401
2
|
- Automate document ingestion (receipts, statements) and link to transactions.
|
|
402
3
|
- Provides a "family office" grade overview for individuals.
|
|
403
4
|
- Uses open banking for real-time data and AI for insights.
|
|
@@ -410,17 +11,7 @@ var pocketFamilyOfficeDocBlocks = [
|
|
|
410
11
|
## Success criteria
|
|
411
12
|
- Successful ingestion and classification of documents.
|
|
412
13
|
- Accurate syncing of open banking data.
|
|
413
|
-
- Generation of useful financial summaries.`
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
id: "docs.examples.pocket-family-office.usage",
|
|
417
|
-
title: "Pocket Family Office — Usage",
|
|
418
|
-
summary: "How to deploy and use the personal finance automation template.",
|
|
419
|
-
kind: "usage",
|
|
420
|
-
visibility: "public",
|
|
421
|
-
route: "/docs/examples/pocket-family-office/usage",
|
|
422
|
-
tags: ["finance", "usage"],
|
|
423
|
-
body: `## Setup
|
|
14
|
+
- Generation of useful financial summaries.`},{id:"docs.examples.pocket-family-office.usage",title:"Pocket Family Office — Usage",summary:"How to deploy and use the personal finance automation template.",kind:"usage",visibility:"public",route:"/docs/examples/pocket-family-office/usage",tags:["finance","usage"],body:`## Setup
|
|
424
15
|
1) Configure Open Banking credentials (e.g., using a provider mock or sandbox).
|
|
425
16
|
2) internalize the 'pocket-family-office' feature into your workspace.
|
|
426
17
|
3) Set up document storage buckets/paths.
|
|
@@ -432,524 +23,7 @@ var pocketFamilyOfficeDocBlocks = [
|
|
|
432
23
|
|
|
433
24
|
## Guardrails
|
|
434
25
|
- PII is redacted in summaries by default.
|
|
435
|
-
- Read-only access to bank data (no write/payment initiation in this template).`
|
|
436
|
-
},
|
|
437
|
-
{
|
|
438
|
-
id: "docs.examples.pocket-family-office.reference",
|
|
439
|
-
title: "Pocket Family Office — Reference",
|
|
440
|
-
summary: "Key components of the Pocket Family Office system.",
|
|
441
|
-
kind: "reference",
|
|
442
|
-
visibility: "public",
|
|
443
|
-
route: "/docs/examples/pocket-family-office",
|
|
444
|
-
tags: ["finance", "reference"],
|
|
445
|
-
body: `## Workflows
|
|
446
|
-
- \`process-uploaded-document\`: Extracts data from PDFs/Images.
|
|
447
|
-
- \`sync-openbanking-transactions\`: Fetches latest transactions.
|
|
448
|
-
- \`generate-financial-summary\`: AI-driven report generation.
|
|
449
|
-
- \`upcoming-payments-reminder\`: Scans needed actions.
|
|
450
|
-
|
|
451
|
-
## Operations
|
|
452
|
-
- \`pfo.documents.upload\`: Secure upload endpoint for documents.
|
|
453
|
-
|
|
454
|
-
## Capabilities
|
|
455
|
-
- Requires: \`identity\`, \`openbanking\`.
|
|
456
|
-
- Provides: \`pocket-family-office\`.`
|
|
457
|
-
}
|
|
458
|
-
];
|
|
459
|
-
registerDocBlocks(pocketFamilyOfficeDocBlocks);
|
|
460
|
-
// src/example.ts
|
|
461
|
-
import { defineExample } from "@contractspec/lib.contracts-spec";
|
|
462
|
-
var example = defineExample({
|
|
463
|
-
meta: {
|
|
464
|
-
key: "pocket-family-office",
|
|
465
|
-
version: "1.0.0",
|
|
466
|
-
title: "Pocket Family Office",
|
|
467
|
-
description: "Personal finance automation with document ingestion, open banking, and AI summaries",
|
|
468
|
-
kind: "template",
|
|
469
|
-
visibility: "public",
|
|
470
|
-
stability: "experimental",
|
|
471
|
-
owners: ["@platform.finance"],
|
|
472
|
-
tags: [
|
|
473
|
-
"finance",
|
|
474
|
-
"open-banking",
|
|
475
|
-
"documents",
|
|
476
|
-
"automation",
|
|
477
|
-
"family-office"
|
|
478
|
-
]
|
|
479
|
-
},
|
|
480
|
-
docs: {
|
|
481
|
-
rootDocId: "docs.examples.pocket-family-office"
|
|
482
|
-
},
|
|
483
|
-
entrypoints: {
|
|
484
|
-
packageName: "@contractspec/example.pocket-family-office",
|
|
485
|
-
feature: "./feature",
|
|
486
|
-
docs: "./docs"
|
|
487
|
-
},
|
|
488
|
-
surfaces: {
|
|
489
|
-
templates: true,
|
|
490
|
-
sandbox: {
|
|
491
|
-
enabled: true,
|
|
492
|
-
modes: ["playground", "specs", "builder"]
|
|
493
|
-
},
|
|
494
|
-
studio: { enabled: true, installable: true },
|
|
495
|
-
mcp: { enabled: true }
|
|
496
|
-
}
|
|
497
|
-
});
|
|
498
|
-
var example_default = example;
|
|
499
|
-
|
|
500
|
-
// src/knowledge/sources.sample.ts
|
|
501
|
-
var now2 = new Date;
|
|
502
|
-
var pocketFamilyOfficeKnowledgeSources = [
|
|
503
|
-
{
|
|
504
|
-
meta: {
|
|
505
|
-
id: "source-financial-uploads",
|
|
506
|
-
tenantId: "tenant.family-office",
|
|
507
|
-
spaceKey: "knowledge.financial-docs",
|
|
508
|
-
spaceVersion: "1.0.0",
|
|
509
|
-
label: "Uploaded Financial Documents",
|
|
510
|
-
sourceType: "file_upload",
|
|
511
|
-
createdAt: now2,
|
|
512
|
-
updatedAt: now2
|
|
513
|
-
},
|
|
514
|
-
config: {
|
|
515
|
-
bucket: "pfo-uploads",
|
|
516
|
-
prefix: "financial-docs/"
|
|
517
|
-
},
|
|
518
|
-
syncSchedule: {
|
|
519
|
-
enabled: true,
|
|
520
|
-
intervalMs: 15 * 60 * 1000
|
|
521
|
-
},
|
|
522
|
-
lastSync: {
|
|
523
|
-
timestamp: now2,
|
|
524
|
-
success: true
|
|
525
|
-
}
|
|
526
|
-
},
|
|
527
|
-
{
|
|
528
|
-
meta: {
|
|
529
|
-
id: "source-gmail-threads",
|
|
530
|
-
tenantId: "tenant.family-office",
|
|
531
|
-
spaceKey: "knowledge.email-threads",
|
|
532
|
-
spaceVersion: "1.0.0",
|
|
533
|
-
label: "Household Gmail Threads",
|
|
534
|
-
sourceType: "email",
|
|
535
|
-
createdAt: now2,
|
|
536
|
-
updatedAt: now2
|
|
537
|
-
},
|
|
538
|
-
config: {
|
|
539
|
-
labelIds: ["INBOX", "FINANCE"]
|
|
540
|
-
},
|
|
541
|
-
syncSchedule: {
|
|
542
|
-
enabled: true,
|
|
543
|
-
intervalMs: 5 * 60 * 1000
|
|
544
|
-
},
|
|
545
|
-
lastSync: {
|
|
546
|
-
timestamp: now2,
|
|
547
|
-
success: true
|
|
548
|
-
}
|
|
549
|
-
},
|
|
550
|
-
{
|
|
551
|
-
meta: {
|
|
552
|
-
id: "source-financial-overview",
|
|
553
|
-
tenantId: "tenant.family-office",
|
|
554
|
-
spaceKey: "knowledge.financial-overview",
|
|
555
|
-
spaceVersion: "1.0.0",
|
|
556
|
-
label: "Financial Overview",
|
|
557
|
-
sourceType: "api",
|
|
558
|
-
createdAt: now2,
|
|
559
|
-
updatedAt: now2
|
|
560
|
-
},
|
|
561
|
-
config: {},
|
|
562
|
-
syncSchedule: {
|
|
563
|
-
enabled: false
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
];
|
|
567
|
-
|
|
568
|
-
// src/operations/index.ts
|
|
569
|
-
import { OPENBANKING_TELEMETRY_EVENTS } from "@contractspec/lib.contracts-integrations";
|
|
570
|
-
import {
|
|
571
|
-
defineCommand,
|
|
572
|
-
defineQuery
|
|
573
|
-
} from "@contractspec/lib.contracts-spec";
|
|
574
|
-
import {
|
|
575
|
-
OwnersEnum as OwnersEnum2,
|
|
576
|
-
StabilityEnum as StabilityEnum2,
|
|
577
|
-
TagsEnum as TagsEnum2
|
|
578
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
579
|
-
import {
|
|
580
|
-
defineEnum,
|
|
581
|
-
defineSchemaModel,
|
|
582
|
-
ScalarTypeEnum
|
|
583
|
-
} from "@contractspec/lib.schema";
|
|
584
|
-
var SourceEnum = defineEnum("Source", ["upload", "email", "sync"]);
|
|
585
|
-
var ChannelEnum = defineEnum("Channel", ["email", "sms", "both"]);
|
|
586
|
-
var PeriodEnum = defineEnum("Period", ["P7d", "P30d", "P90d"]);
|
|
587
|
-
var ObPeriodEnum = defineEnum("ObPeriod", ["Pweek", "Pmonth", "Pquarter"]);
|
|
588
|
-
var UploadDocumentInputModel = defineSchemaModel({
|
|
589
|
-
name: "UploadDocumentInput",
|
|
590
|
-
fields: {
|
|
591
|
-
bucket: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
592
|
-
objectKey: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
593
|
-
mimeType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },
|
|
594
|
-
bytes: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
595
|
-
tags: {
|
|
596
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
597
|
-
isOptional: false,
|
|
598
|
-
isArray: true
|
|
599
|
-
},
|
|
600
|
-
uploadedAt: { type: ScalarTypeEnum.Date(), isOptional: false },
|
|
601
|
-
source: { type: SourceEnum, isOptional: false }
|
|
602
|
-
}
|
|
603
|
-
});
|
|
604
|
-
var UploadDocumentOutputModel = defineSchemaModel({
|
|
605
|
-
name: "UploadDocumentOutput",
|
|
606
|
-
fields: {
|
|
607
|
-
documentId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
608
|
-
ingestionJobId: {
|
|
609
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
610
|
-
isOptional: false
|
|
611
|
-
}
|
|
612
|
-
}
|
|
613
|
-
});
|
|
614
|
-
var uploadDocumentContract = defineCommand({
|
|
615
|
-
meta: {
|
|
616
|
-
key: "pfo.documents.upload",
|
|
617
|
-
version: "1.0.0",
|
|
618
|
-
description: "Stores an object in tenant storage and schedules ingestion into the knowledge base.",
|
|
619
|
-
goal: "Allow users to ingest financial documents for processing.",
|
|
620
|
-
context: "Part of the finance domain. Documents are uploaded to object storage and then processed by the ingestion pipeline.",
|
|
621
|
-
owners: [OwnersEnum2.PlatformFinance],
|
|
622
|
-
tags: ["documents", "ingestion", TagsEnum2.Guide],
|
|
623
|
-
stability: StabilityEnum2.Experimental
|
|
624
|
-
},
|
|
625
|
-
io: {
|
|
626
|
-
input: UploadDocumentInputModel,
|
|
627
|
-
output: UploadDocumentOutputModel
|
|
628
|
-
},
|
|
629
|
-
policy: {
|
|
630
|
-
auth: "user",
|
|
631
|
-
rateLimit: {
|
|
632
|
-
rpm: 30,
|
|
633
|
-
key: "user"
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
});
|
|
637
|
-
var PaymentReminderInputModel = defineSchemaModel({
|
|
638
|
-
name: "PaymentReminderInput",
|
|
639
|
-
fields: {
|
|
640
|
-
billId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
641
|
-
recipientEmail: { type: ScalarTypeEnum.EmailAddress(), isOptional: false },
|
|
642
|
-
recipientPhone: {
|
|
643
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
644
|
-
isOptional: true
|
|
645
|
-
},
|
|
646
|
-
dueDate: { type: ScalarTypeEnum.Date(), isOptional: false },
|
|
647
|
-
amountCents: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
648
|
-
currency: { type: ScalarTypeEnum.Currency(), isOptional: false },
|
|
649
|
-
channel: { type: ChannelEnum, isOptional: false },
|
|
650
|
-
memo: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
651
|
-
}
|
|
652
|
-
});
|
|
653
|
-
var PaymentReminderOutputModel = defineSchemaModel({
|
|
654
|
-
name: "PaymentReminderOutput",
|
|
655
|
-
fields: {
|
|
656
|
-
reminderId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
657
|
-
scheduledAt: { type: ScalarTypeEnum.Date(), isOptional: false }
|
|
658
|
-
}
|
|
659
|
-
});
|
|
660
|
-
var schedulePaymentReminderContract = defineCommand({
|
|
661
|
-
meta: {
|
|
662
|
-
key: "pfo.reminders.schedule-payment",
|
|
663
|
-
version: "1.0.0",
|
|
664
|
-
description: "Queues outbound email/SMS reminders for upcoming bills and adds an optional calendar hold.",
|
|
665
|
-
goal: "Ensure bills are paid on time by notifying users.",
|
|
666
|
-
context: "Finance automation. Reminders are sent via configured channels (email, SMS).",
|
|
667
|
-
owners: [OwnersEnum2.PlatformFinance],
|
|
668
|
-
tags: ["payments", "reminders", TagsEnum2.Automation],
|
|
669
|
-
stability: StabilityEnum2.Beta
|
|
670
|
-
},
|
|
671
|
-
io: {
|
|
672
|
-
input: PaymentReminderInputModel,
|
|
673
|
-
output: PaymentReminderOutputModel
|
|
674
|
-
},
|
|
675
|
-
policy: {
|
|
676
|
-
auth: "user"
|
|
677
|
-
}
|
|
678
|
-
});
|
|
679
|
-
var FinancialSummaryInputModel = defineSchemaModel({
|
|
680
|
-
name: "FinancialSummaryInput",
|
|
681
|
-
fields: {
|
|
682
|
-
period: { type: PeriodEnum, isOptional: false },
|
|
683
|
-
includeVoiceSummary: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
684
|
-
}
|
|
685
|
-
});
|
|
686
|
-
var SummaryHighlightModel = defineSchemaModel({
|
|
687
|
-
name: "SummaryHighlight",
|
|
688
|
-
fields: {
|
|
689
|
-
label: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
690
|
-
value: { type: ScalarTypeEnum.String_unsecure(), isOptional: false }
|
|
691
|
-
}
|
|
692
|
-
});
|
|
693
|
-
var FinancialSummaryOutputModel = defineSchemaModel({
|
|
694
|
-
name: "FinancialSummaryOutput",
|
|
695
|
-
fields: {
|
|
696
|
-
summaryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
697
|
-
generatedAt: { type: ScalarTypeEnum.Date(), isOptional: false },
|
|
698
|
-
markdown: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
699
|
-
highlights: {
|
|
700
|
-
type: SummaryHighlightModel,
|
|
701
|
-
isOptional: false,
|
|
702
|
-
isArray: true
|
|
703
|
-
},
|
|
704
|
-
cashflowDelta: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false }
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
var generateFinancialSummaryContract = defineQuery({
|
|
708
|
-
meta: {
|
|
709
|
-
key: "pfo.summary.generate",
|
|
710
|
-
version: "1.0.0",
|
|
711
|
-
description: "Runs RAG over financial documents and email threads to provide a natural-language summary with key metrics.",
|
|
712
|
-
goal: "Provide a quick overview of financial status and recent activity.",
|
|
713
|
-
context: "Uses RAG over ingested knowledge. Summaries can be dispatched or viewed in app.",
|
|
714
|
-
owners: [OwnersEnum2.PlatformFinance],
|
|
715
|
-
tags: ["summary", "ai", TagsEnum2.Automation],
|
|
716
|
-
stability: StabilityEnum2.Beta
|
|
717
|
-
},
|
|
718
|
-
io: {
|
|
719
|
-
input: FinancialSummaryInputModel,
|
|
720
|
-
output: FinancialSummaryOutputModel
|
|
721
|
-
},
|
|
722
|
-
policy: {
|
|
723
|
-
auth: "user"
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
var SyncEmailThreadsInputModel = defineSchemaModel({
|
|
727
|
-
name: "SyncEmailThreadsInput",
|
|
728
|
-
fields: {
|
|
729
|
-
labelIds: {
|
|
730
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
731
|
-
isOptional: false,
|
|
732
|
-
isArray: true
|
|
733
|
-
},
|
|
734
|
-
maxThreads: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
735
|
-
syncSinceMinutes: {
|
|
736
|
-
type: ScalarTypeEnum.Int_unsecure(),
|
|
737
|
-
isOptional: false
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
});
|
|
741
|
-
var SyncEmailThreadsOutputModel = defineSchemaModel({
|
|
742
|
-
name: "SyncEmailThreadsOutput",
|
|
743
|
-
fields: {
|
|
744
|
-
syncedThreads: { type: ScalarTypeEnum.Int_unsecure(), isOptional: false },
|
|
745
|
-
lastMessageAt: { type: ScalarTypeEnum.Date(), isOptional: true }
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
var syncEmailThreadsContract = defineCommand({
|
|
749
|
-
meta: {
|
|
750
|
-
key: "pfo.email.sync-threads",
|
|
751
|
-
version: "1.0.0",
|
|
752
|
-
description: "Triggers ingestion of Gmail threads into the operational knowledge space.",
|
|
753
|
-
goal: "Keep knowledge base up to date with email communications.",
|
|
754
|
-
context: "Syncs from Gmail integration. Only includes threads matching configured labels.",
|
|
755
|
-
owners: [OwnersEnum2.PlatformMessaging],
|
|
756
|
-
tags: ["gmail", "knowledge", TagsEnum2.Automation],
|
|
757
|
-
stability: StabilityEnum2.Beta
|
|
758
|
-
},
|
|
759
|
-
io: {
|
|
760
|
-
input: SyncEmailThreadsInputModel,
|
|
761
|
-
output: SyncEmailThreadsOutputModel
|
|
762
|
-
},
|
|
763
|
-
policy: {
|
|
764
|
-
auth: "user"
|
|
765
|
-
}
|
|
766
|
-
});
|
|
767
|
-
var SummaryDispatchInputModel = defineSchemaModel({
|
|
768
|
-
name: "SummaryDispatchInput",
|
|
769
|
-
fields: {
|
|
770
|
-
summaryId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
771
|
-
recipientEmail: { type: ScalarTypeEnum.EmailAddress(), isOptional: false },
|
|
772
|
-
recipientName: {
|
|
773
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
774
|
-
isOptional: true
|
|
775
|
-
},
|
|
776
|
-
includeVoice: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
777
|
-
voiceRecipient: {
|
|
778
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
779
|
-
isOptional: true
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
});
|
|
783
|
-
var SummaryDispatchOutputModel = defineSchemaModel({
|
|
784
|
-
name: "SummaryDispatchOutput",
|
|
785
|
-
fields: {
|
|
786
|
-
dispatchId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
787
|
-
emailSent: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
788
|
-
voiceUrl: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
789
|
-
}
|
|
790
|
-
});
|
|
791
|
-
var dispatchFinancialSummaryContract = defineCommand({
|
|
792
|
-
meta: {
|
|
793
|
-
key: "pfo.summary.dispatch",
|
|
794
|
-
version: "1.0.0",
|
|
795
|
-
description: "Delivers the generated summary via email and optionally synthesises a voice note.",
|
|
796
|
-
goal: "Deliver financial insights to users proactively.",
|
|
797
|
-
context: "Dispatches summaries generated by pfo.summary.generate via email or voice.",
|
|
798
|
-
owners: [OwnersEnum2.PlatformMessaging],
|
|
799
|
-
tags: ["summary", "communications", TagsEnum2.Automation],
|
|
800
|
-
stability: StabilityEnum2.Experimental
|
|
801
|
-
},
|
|
802
|
-
io: {
|
|
803
|
-
input: SummaryDispatchInputModel,
|
|
804
|
-
output: SummaryDispatchOutputModel
|
|
805
|
-
},
|
|
806
|
-
policy: {
|
|
807
|
-
auth: "user"
|
|
808
|
-
}
|
|
809
|
-
});
|
|
810
|
-
var OpenBankingOverviewInputModel = defineSchemaModel({
|
|
811
|
-
name: "OpenBankingOverviewInput",
|
|
812
|
-
fields: {
|
|
813
|
-
tenantId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
814
|
-
accountIds: {
|
|
815
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
816
|
-
isOptional: true,
|
|
817
|
-
isArray: true
|
|
818
|
-
},
|
|
819
|
-
period: { type: ObPeriodEnum, isOptional: false },
|
|
820
|
-
asOf: { type: ScalarTypeEnum.Date(), isOptional: true },
|
|
821
|
-
includeCategories: { type: ScalarTypeEnum.Boolean(), isOptional: false },
|
|
822
|
-
includeCashflowTrend: { type: ScalarTypeEnum.Boolean(), isOptional: false }
|
|
823
|
-
}
|
|
824
|
-
});
|
|
825
|
-
var OpenBankingOverviewOutputModel = defineSchemaModel({
|
|
826
|
-
name: "OpenBankingOverviewOutput",
|
|
827
|
-
fields: {
|
|
828
|
-
knowledgeEntryId: {
|
|
829
|
-
type: ScalarTypeEnum.String_unsecure(),
|
|
830
|
-
isOptional: false
|
|
831
|
-
},
|
|
832
|
-
periodStart: { type: ScalarTypeEnum.Date(), isOptional: false },
|
|
833
|
-
periodEnd: { type: ScalarTypeEnum.Date(), isOptional: false },
|
|
834
|
-
generatedAt: { type: ScalarTypeEnum.Date(), isOptional: false },
|
|
835
|
-
summaryPath: { type: ScalarTypeEnum.String_unsecure(), isOptional: true }
|
|
836
|
-
}
|
|
837
|
-
});
|
|
838
|
-
var generateOpenBankingOverviewContract = defineCommand({
|
|
839
|
-
meta: {
|
|
840
|
-
key: "pfo.openbanking.generate-overview",
|
|
841
|
-
version: "1.0.0",
|
|
842
|
-
description: "Aggregates balances and transactions into a derived financial overview stored in the knowledge layer.",
|
|
843
|
-
goal: "Create a periodic financial snapshot.",
|
|
844
|
-
context: "Aggregates data from open banking integration into a document.",
|
|
845
|
-
owners: [OwnersEnum2.PlatformFinance],
|
|
846
|
-
tags: ["open-banking", "summary", TagsEnum2.Automation],
|
|
847
|
-
stability: StabilityEnum2.Experimental
|
|
848
|
-
},
|
|
849
|
-
io: {
|
|
850
|
-
input: OpenBankingOverviewInputModel,
|
|
851
|
-
output: OpenBankingOverviewOutputModel
|
|
852
|
-
},
|
|
853
|
-
policy: {
|
|
854
|
-
auth: "user"
|
|
855
|
-
},
|
|
856
|
-
telemetry: {
|
|
857
|
-
success: {
|
|
858
|
-
event: {
|
|
859
|
-
key: OPENBANKING_TELEMETRY_EVENTS.overviewGenerated,
|
|
860
|
-
version: "1.0.0"
|
|
861
|
-
}
|
|
862
|
-
}
|
|
863
|
-
}
|
|
864
|
-
});
|
|
865
|
-
var pocketFamilyOfficeContracts = {
|
|
866
|
-
"pfo.documents.upload": uploadDocumentContract,
|
|
867
|
-
"pfo.reminders.schedule-payment": schedulePaymentReminderContract,
|
|
868
|
-
"pfo.summary.generate": generateFinancialSummaryContract,
|
|
869
|
-
"pfo.summary.dispatch": dispatchFinancialSummaryContract,
|
|
870
|
-
"pfo.email.sync-threads": syncEmailThreadsContract,
|
|
871
|
-
"pfo.openbanking.generate-overview": generateOpenBankingOverviewContract
|
|
872
|
-
};
|
|
873
|
-
|
|
874
|
-
// src/pocket-family-office.feature.ts
|
|
875
|
-
import { defineFeature } from "@contractspec/lib.contracts-spec";
|
|
876
|
-
var PocketFamilyOfficeFeature = defineFeature({
|
|
877
|
-
meta: {
|
|
878
|
-
key: "pocket-family-office",
|
|
879
|
-
version: "1.0.0",
|
|
880
|
-
title: "Pocket Family Office",
|
|
881
|
-
description: "Personal finance automation with document ingestion, open banking, and AI summaries",
|
|
882
|
-
domain: "finance",
|
|
883
|
-
owners: ["@platform.finance"],
|
|
884
|
-
tags: [
|
|
885
|
-
"finance",
|
|
886
|
-
"open-banking",
|
|
887
|
-
"documents",
|
|
888
|
-
"automation",
|
|
889
|
-
"family-office"
|
|
890
|
-
],
|
|
891
|
-
stability: "experimental"
|
|
892
|
-
},
|
|
893
|
-
operations: [
|
|
894
|
-
{ key: "pfo.documents.upload", version: "1.0.0" },
|
|
895
|
-
{ key: "pfo.reminders.schedule-payment", version: "1.0.0" },
|
|
896
|
-
{ key: "pfo.summary.generate", version: "1.0.0" },
|
|
897
|
-
{ key: "pfo.email.sync-threads", version: "1.0.0" },
|
|
898
|
-
{ key: "pfo.summary.dispatch", version: "1.0.0" },
|
|
899
|
-
{ key: "pfo.openbanking.generate-overview", version: "1.0.0" }
|
|
900
|
-
],
|
|
901
|
-
events: [],
|
|
902
|
-
presentations: [],
|
|
903
|
-
opToPresentation: [],
|
|
904
|
-
presentationsTargets: [],
|
|
905
|
-
capabilities: {
|
|
906
|
-
provides: [{ key: "pocket-family-office", version: "1.0.0" }],
|
|
907
|
-
requires: [
|
|
908
|
-
{ key: "identity", version: "1.0.0" },
|
|
909
|
-
{ key: "openbanking", version: "1.0.0" }
|
|
910
|
-
]
|
|
911
|
-
},
|
|
912
|
-
workflows: [
|
|
913
|
-
{ key: "pfo.workflow.sync-openbanking-accounts", version: "1.0.0" },
|
|
914
|
-
{ key: "pfo.workflow.sync-openbanking-transactions", version: "1.0.0" },
|
|
915
|
-
{ key: "pfo.workflow.refresh-openbanking-balances", version: "1.0.0" },
|
|
916
|
-
{ key: "pfo.workflow.generate-openbanking-overview", version: "1.0.0" },
|
|
917
|
-
{ key: "pfo.workflow.process-uploaded-document", version: "1.0.0" },
|
|
918
|
-
{ key: "pfo.workflow.upcoming-payments-reminder", version: "1.0.0" },
|
|
919
|
-
{ key: "pfo.workflow.generate-financial-summary", version: "1.0.0" },
|
|
920
|
-
{ key: "pfo.workflow.ingest-email-threads", version: "1.0.0" }
|
|
921
|
-
],
|
|
922
|
-
knowledge: [
|
|
923
|
-
{ key: "knowledge.financial-docs", version: "1.0.0" },
|
|
924
|
-
{ key: "knowledge.email-threads", version: "1.0.0" },
|
|
925
|
-
{ key: "knowledge.financial-overview", version: "1.0.0" }
|
|
926
|
-
],
|
|
927
|
-
telemetry: [{ key: "pfo.telemetry", version: "1.0.0" }],
|
|
928
|
-
policies: [{ key: "pfo.policy.tenancy", version: "1.0.0" }],
|
|
929
|
-
integrations: [
|
|
930
|
-
{ key: "pfo.integration.openbanking", version: "1.0.0" },
|
|
931
|
-
{ key: "pfo.integration.llm", version: "1.0.0" }
|
|
932
|
-
],
|
|
933
|
-
jobs: [
|
|
934
|
-
{ key: "pfo.job.doc-processing", version: "1.0.0" },
|
|
935
|
-
{ key: "pfo.job.reminder-dispatch", version: "1.0.0" }
|
|
936
|
-
],
|
|
937
|
-
docs: [
|
|
938
|
-
"docs.examples.pocket-family-office.goal",
|
|
939
|
-
"docs.examples.pocket-family-office.usage",
|
|
940
|
-
"docs.examples.pocket-family-office.reference"
|
|
941
|
-
]
|
|
942
|
-
});
|
|
943
|
-
var tech_contracts_vertical_pocket_family_office_DocBlocks = [
|
|
944
|
-
{
|
|
945
|
-
id: "docs.tech.contracts.vertical-pocket-family-office",
|
|
946
|
-
title: "Pocket Family Office Vertical",
|
|
947
|
-
summary: "Pocket Family Office is a ContractSpec reference vertical that",
|
|
948
|
-
kind: "reference",
|
|
949
|
-
visibility: "public",
|
|
950
|
-
route: "/docs/tech/contracts/vertical-pocket-family-office",
|
|
951
|
-
tags: ["tech", "contracts", "vertical-pocket-family-office"],
|
|
952
|
-
body: `# Pocket Family Office Vertical
|
|
26
|
+
- Read-only access to bank data (no write/payment initiation in this template).`},{id:"docs.examples.pocket-family-office.reference",title:"Pocket Family Office — Reference",summary:"Key components of the Pocket Family Office system.",kind:"reference",visibility:"public",route:"/docs/examples/pocket-family-office",tags:["finance","reference"],body:"## Workflows\n- `process-uploaded-document`: Extracts data from PDFs/Images.\n- `sync-openbanking-transactions`: Fetches latest transactions.\n- `generate-financial-summary`: AI-driven report generation.\n- `upcoming-payments-reminder`: Scans needed actions.\n\n## Operations\n- `pfo.documents.upload`: Secure upload endpoint for documents.\n\n## Capabilities\n- Requires: `identity`, `openbanking`.\n- Provides: `pocket-family-office`."}];I(K);import{defineExample as V}from"@contractspec/lib.contracts-spec";var j=V({meta:{key:"pocket-family-office",version:"1.0.0",title:"Pocket Family Office",description:"Personal finance automation with document ingestion, open banking, and AI summaries",kind:"template",visibility:"public",stability:"experimental",owners:["@platform.finance"],tags:["finance","open-banking","documents","automation","family-office"]},docs:{rootDocId:"docs.examples.pocket-family-office"},entrypoints:{packageName:"@contractspec/example.pocket-family-office",feature:"./feature",docs:"./docs"},surfaces:{templates:!0,sandbox:{enabled:!0,modes:["playground","specs","builder"]},studio:{enabled:!0,installable:!0},mcp:{enabled:!0}}}),F=j;var s=new Date,Ye=[{meta:{id:"source-financial-uploads",tenantId:"tenant.family-office",spaceKey:"knowledge.financial-docs",spaceVersion:"1.0.0",label:"Uploaded Financial Documents",sourceType:"file_upload",createdAt:s,updatedAt:s},config:{bucket:"pfo-uploads",prefix:"financial-docs/"},syncSchedule:{enabled:!0,intervalMs:900000},lastSync:{timestamp:s,success:!0}},{meta:{id:"source-gmail-threads",tenantId:"tenant.family-office",spaceKey:"knowledge.email-threads",spaceVersion:"1.0.0",label:"Household Gmail Threads",sourceType:"email",createdAt:s,updatedAt:s},config:{labelIds:["INBOX","FINANCE"]},syncSchedule:{enabled:!0,intervalMs:300000},lastSync:{timestamp:s,success:!0}},{meta:{id:"source-financial-overview",tenantId:"tenant.family-office",spaceKey:"knowledge.financial-overview",spaceVersion:"1.0.0",label:"Financial Overview",sourceType:"api",createdAt:s,updatedAt:s},config:{},syncSchedule:{enabled:!1}}];import{OPENBANKING_TELEMETRY_EVENTS as q}from"@contractspec/lib.contracts-integrations";import{defineCommand as l,defineQuery as D}from"@contractspec/lib.contracts-spec";import{OwnersEnum as i,StabilityEnum as c,TagsEnum as d}from"@contractspec/lib.contracts-spec/ownership";import{defineEnum as g,defineSchemaModel as n,ScalarTypeEnum as e}from"@contractspec/lib.schema";var H=g("Source",["upload","email","sync"]),R=g("Channel",["email","sms","both"]),Q=g("Period",["P7d","P30d","P90d"]),X=g("ObPeriod",["Pweek","Pmonth","Pquarter"]),z=n({name:"UploadDocumentInput",fields:{bucket:{type:e.NonEmptyString(),isOptional:!1},objectKey:{type:e.NonEmptyString(),isOptional:!1},mimeType:{type:e.NonEmptyString(),isOptional:!1},bytes:{type:e.Int_unsecure(),isOptional:!1},tags:{type:e.String_unsecure(),isOptional:!1,isArray:!0},uploadedAt:{type:e.Date(),isOptional:!1},source:{type:H,isOptional:!1}}}),J=n({name:"UploadDocumentOutput",fields:{documentId:{type:e.String_unsecure(),isOptional:!1},ingestionJobId:{type:e.String_unsecure(),isOptional:!1}}}),U=l({meta:{key:"pfo.documents.upload",version:"1.0.0",description:"Stores an object in tenant storage and schedules ingestion into the knowledge base.",goal:"Allow users to ingest financial documents for processing.",context:"Part of the finance domain. Documents are uploaded to object storage and then processed by the ingestion pipeline.",owners:[i.PlatformFinance],tags:["documents","ingestion",d.Guide],stability:c.Experimental},io:{input:z,output:J},policy:{auth:"user",rateLimit:{rpm:30,key:"user"}}}),Z=n({name:"PaymentReminderInput",fields:{billId:{type:e.String_unsecure(),isOptional:!1},recipientEmail:{type:e.EmailAddress(),isOptional:!1},recipientPhone:{type:e.String_unsecure(),isOptional:!0},dueDate:{type:e.Date(),isOptional:!1},amountCents:{type:e.Int_unsecure(),isOptional:!1},currency:{type:e.Currency(),isOptional:!1},channel:{type:R,isOptional:!1},memo:{type:e.String_unsecure(),isOptional:!0}}}),$=n({name:"PaymentReminderOutput",fields:{reminderId:{type:e.String_unsecure(),isOptional:!1},scheduledAt:{type:e.Date(),isOptional:!1}}}),P=l({meta:{key:"pfo.reminders.schedule-payment",version:"1.0.0",description:"Queues outbound email/SMS reminders for upcoming bills and adds an optional calendar hold.",goal:"Ensure bills are paid on time by notifying users.",context:"Finance automation. Reminders are sent via configured channels (email, SMS).",owners:[i.PlatformFinance],tags:["payments","reminders",d.Automation],stability:c.Beta},io:{input:Z,output:$},policy:{auth:"user"}}),C=n({name:"FinancialSummaryInput",fields:{period:{type:Q,isOptional:!1},includeVoiceSummary:{type:e.Boolean(),isOptional:!1}}}),G=n({name:"SummaryHighlight",fields:{label:{type:e.String_unsecure(),isOptional:!1},value:{type:e.String_unsecure(),isOptional:!1}}}),S=n({name:"FinancialSummaryOutput",fields:{summaryId:{type:e.String_unsecure(),isOptional:!1},generatedAt:{type:e.Date(),isOptional:!1},markdown:{type:e.String_unsecure(),isOptional:!1},highlights:{type:G,isOptional:!1,isArray:!0},cashflowDelta:{type:e.Float_unsecure(),isOptional:!1}}}),A=D({meta:{key:"pfo.summary.generate",version:"1.0.0",description:"Runs RAG over financial documents and email threads to provide a natural-language summary with key metrics.",goal:"Provide a quick overview of financial status and recent activity.",context:"Uses RAG over ingested knowledge. Summaries can be dispatched or viewed in app.",owners:[i.PlatformFinance],tags:["summary","ai",d.Automation],stability:c.Beta},io:{input:C,output:S},policy:{auth:"user"}}),W=n({name:"SyncEmailThreadsInput",fields:{labelIds:{type:e.String_unsecure(),isOptional:!1,isArray:!0},maxThreads:{type:e.Int_unsecure(),isOptional:!1},syncSinceMinutes:{type:e.Int_unsecure(),isOptional:!1}}}),L=n({name:"SyncEmailThreadsOutput",fields:{syncedThreads:{type:e.Int_unsecure(),isOptional:!1},lastMessageAt:{type:e.Date(),isOptional:!0}}}),Y=l({meta:{key:"pfo.email.sync-threads",version:"1.0.0",description:"Triggers ingestion of Gmail threads into the operational knowledge space.",goal:"Keep knowledge base up to date with email communications.",context:"Syncs from Gmail integration. Only includes threads matching configured labels.",owners:[i.PlatformMessaging],tags:["gmail","knowledge",d.Automation],stability:c.Beta},io:{input:W,output:L},policy:{auth:"user"}}),B=n({name:"SummaryDispatchInput",fields:{summaryId:{type:e.String_unsecure(),isOptional:!1},recipientEmail:{type:e.EmailAddress(),isOptional:!1},recipientName:{type:e.String_unsecure(),isOptional:!0},includeVoice:{type:e.Boolean(),isOptional:!1},voiceRecipient:{type:e.String_unsecure(),isOptional:!0}}}),O=n({name:"SummaryDispatchOutput",fields:{dispatchId:{type:e.String_unsecure(),isOptional:!1},emailSent:{type:e.Boolean(),isOptional:!1},voiceUrl:{type:e.String_unsecure(),isOptional:!0}}}),_=l({meta:{key:"pfo.summary.dispatch",version:"1.0.0",description:"Delivers the generated summary via email and optionally synthesises a voice note.",goal:"Deliver financial insights to users proactively.",context:"Dispatches summaries generated by pfo.summary.generate via email or voice.",owners:[i.PlatformMessaging],tags:["summary","communications",d.Automation],stability:c.Experimental},io:{input:B,output:O},policy:{auth:"user"}}),N=n({name:"OpenBankingOverviewInput",fields:{tenantId:{type:e.String_unsecure(),isOptional:!1},accountIds:{type:e.String_unsecure(),isOptional:!0,isArray:!0},period:{type:X,isOptional:!1},asOf:{type:e.Date(),isOptional:!0},includeCategories:{type:e.Boolean(),isOptional:!1},includeCashflowTrend:{type:e.Boolean(),isOptional:!1}}}),T=n({name:"OpenBankingOverviewOutput",fields:{knowledgeEntryId:{type:e.String_unsecure(),isOptional:!1},periodStart:{type:e.Date(),isOptional:!1},periodEnd:{type:e.Date(),isOptional:!1},generatedAt:{type:e.Date(),isOptional:!1},summaryPath:{type:e.String_unsecure(),isOptional:!0}}}),E=l({meta:{key:"pfo.openbanking.generate-overview",version:"1.0.0",description:"Aggregates balances and transactions into a derived financial overview stored in the knowledge layer.",goal:"Create a periodic financial snapshot.",context:"Aggregates data from open banking integration into a document.",owners:[i.PlatformFinance],tags:["open-banking","summary",d.Automation],stability:c.Experimental},io:{input:N,output:T},policy:{auth:"user"},telemetry:{success:{event:{key:q.overviewGenerated,version:"1.0.0"}}}}),Ee={"pfo.documents.upload":U,"pfo.reminders.schedule-payment":P,"pfo.summary.generate":A,"pfo.summary.dispatch":_,"pfo.email.sync-threads":Y,"pfo.openbanking.generate-overview":E};import{defineFeature as ee}from"@contractspec/lib.contracts-spec";var nt=ee({meta:{key:"pocket-family-office",version:"1.0.0",title:"Pocket Family Office",description:"Personal finance automation with document ingestion, open banking, and AI summaries",domain:"finance",owners:["@platform.finance"],tags:["finance","open-banking","documents","automation","family-office"],stability:"experimental"},operations:[{key:"pfo.documents.upload",version:"1.0.0"},{key:"pfo.reminders.schedule-payment",version:"1.0.0"},{key:"pfo.summary.generate",version:"1.0.0"},{key:"pfo.email.sync-threads",version:"1.0.0"},{key:"pfo.summary.dispatch",version:"1.0.0"},{key:"pfo.openbanking.generate-overview",version:"1.0.0"}],events:[],presentations:[],opToPresentation:[],presentationsTargets:[],capabilities:{provides:[{key:"pocket-family-office",version:"1.0.0"}],requires:[{key:"identity",version:"1.0.0"},{key:"openbanking",version:"1.0.0"}]},workflows:[{key:"pfo.workflow.sync-openbanking-accounts",version:"1.0.0"},{key:"pfo.workflow.sync-openbanking-transactions",version:"1.0.0"},{key:"pfo.workflow.refresh-openbanking-balances",version:"1.0.0"},{key:"pfo.workflow.generate-openbanking-overview",version:"1.0.0"},{key:"pfo.workflow.process-uploaded-document",version:"1.0.0"},{key:"pfo.workflow.upcoming-payments-reminder",version:"1.0.0"},{key:"pfo.workflow.generate-financial-summary",version:"1.0.0"},{key:"pfo.workflow.ingest-email-threads",version:"1.0.0"}],knowledge:[{key:"knowledge.financial-docs",version:"1.0.0"},{key:"knowledge.email-threads",version:"1.0.0"},{key:"knowledge.financial-overview",version:"1.0.0"}],telemetry:[{key:"pfo.telemetry",version:"1.0.0"}],policies:[{key:"pfo.policy.tenancy",version:"1.0.0"}],integrations:[{key:"pfo.integration.openbanking",version:"1.0.0"},{key:"pfo.integration.llm",version:"1.0.0"}],jobs:[{key:"pfo.job.doc-processing",version:"1.0.0"},{key:"pfo.job.reminder-dispatch",version:"1.0.0"}],docs:["docs.examples.pocket-family-office.goal","docs.examples.pocket-family-office.usage","docs.examples.pocket-family-office.reference"]}),ot=[{id:"docs.tech.contracts.vertical-pocket-family-office",title:"Pocket Family Office Vertical",summary:"Pocket Family Office is a ContractSpec reference vertical that",kind:"reference",visibility:"public",route:"/docs/tech/contracts/vertical-pocket-family-office",tags:["tech","contracts","vertical-pocket-family-office"],body:`# Pocket Family Office Vertical
|
|
953
27
|
|
|
954
28
|
Pocket Family Office is a ContractSpec reference vertical that
|
|
955
29
|
demonstrates finance automation atop the integration and knowledge
|
|
@@ -1054,734 +128,4 @@ tenant-specific IDs/secret references before deploying.
|
|
|
1054
128
|
|
|
1055
129
|
|
|
1056
130
|
|
|
1057
|
-
`
|
|
1058
|
-
}
|
|
1059
|
-
];
|
|
1060
|
-
|
|
1061
|
-
// src/telemetry.ts
|
|
1062
|
-
import {
|
|
1063
|
-
OPENBANKING_PII_FIELDS,
|
|
1064
|
-
OPENBANKING_TELEMETRY_EVENTS as OPENBANKING_TELEMETRY_EVENTS2
|
|
1065
|
-
} from "@contractspec/lib.contracts-integrations";
|
|
1066
|
-
import {
|
|
1067
|
-
OwnersEnum as OwnersEnum3,
|
|
1068
|
-
StabilityEnum as StabilityEnum3,
|
|
1069
|
-
TagsEnum as TagsEnum3
|
|
1070
|
-
} from "@contractspec/lib.contracts-spec/ownership";
|
|
1071
|
-
var commonProperties = {
|
|
1072
|
-
tenantId: {
|
|
1073
|
-
type: "string",
|
|
1074
|
-
required: true,
|
|
1075
|
-
description: "Tenant identifier for multi-tenant isolation."
|
|
1076
|
-
},
|
|
1077
|
-
appId: {
|
|
1078
|
-
type: "string",
|
|
1079
|
-
required: true,
|
|
1080
|
-
description: "Application identifier associated with the event."
|
|
1081
|
-
},
|
|
1082
|
-
blueprint: {
|
|
1083
|
-
type: "string",
|
|
1084
|
-
required: true,
|
|
1085
|
-
description: "Blueprint name@version emitting the telemetry."
|
|
1086
|
-
},
|
|
1087
|
-
configVersion: {
|
|
1088
|
-
type: "number",
|
|
1089
|
-
required: true,
|
|
1090
|
-
description: "Resolved app config version when the event was generated."
|
|
1091
|
-
},
|
|
1092
|
-
slotId: {
|
|
1093
|
-
type: "string",
|
|
1094
|
-
required: true,
|
|
1095
|
-
description: "Integration slot identifier (e.g., primaryOpenBanking)."
|
|
1096
|
-
},
|
|
1097
|
-
connectionId: {
|
|
1098
|
-
type: "string",
|
|
1099
|
-
required: true,
|
|
1100
|
-
description: "Integration connection ID used for the sync."
|
|
1101
|
-
}
|
|
1102
|
-
};
|
|
1103
|
-
function piiSafeString(description) {
|
|
1104
|
-
return {
|
|
1105
|
-
type: "string",
|
|
1106
|
-
description,
|
|
1107
|
-
pii: false
|
|
1108
|
-
};
|
|
1109
|
-
}
|
|
1110
|
-
var pocketFamilyOfficeTelemetry = {
|
|
1111
|
-
meta: {
|
|
1112
|
-
key: "pfo.telemetry",
|
|
1113
|
-
version: "1.0.0",
|
|
1114
|
-
title: "Pocket Family Office Telemetry",
|
|
1115
|
-
description: "Operational telemetry for Pocket Family Office workflows, including Powens open banking syncs.",
|
|
1116
|
-
domain: "finance",
|
|
1117
|
-
owners: [OwnersEnum3.PlatformFinance],
|
|
1118
|
-
tags: ["open-banking", TagsEnum3.Automation],
|
|
1119
|
-
stability: StabilityEnum3.Experimental
|
|
1120
|
-
},
|
|
1121
|
-
config: {
|
|
1122
|
-
defaultRetentionDays: 180,
|
|
1123
|
-
defaultSamplingRate: 1
|
|
1124
|
-
},
|
|
1125
|
-
events: [
|
|
1126
|
-
{
|
|
1127
|
-
key: OPENBANKING_TELEMETRY_EVENTS2.accountsSynced,
|
|
1128
|
-
version: "1.0.0",
|
|
1129
|
-
semantics: {
|
|
1130
|
-
what: "Open banking account synchronisation completed.",
|
|
1131
|
-
why: "Refresh canonical account metadata for reporting and workflows."
|
|
1132
|
-
},
|
|
1133
|
-
privacy: "internal",
|
|
1134
|
-
properties: {
|
|
1135
|
-
...commonProperties,
|
|
1136
|
-
syncedCount: {
|
|
1137
|
-
type: "number",
|
|
1138
|
-
description: "Number of accounts synced successfully."
|
|
1139
|
-
},
|
|
1140
|
-
failedCount: {
|
|
1141
|
-
type: "number",
|
|
1142
|
-
description: "Number of accounts that failed to sync."
|
|
1143
|
-
},
|
|
1144
|
-
durationMs: {
|
|
1145
|
-
type: "number",
|
|
1146
|
-
description: "Duration of the sync job in milliseconds."
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
},
|
|
1150
|
-
{
|
|
1151
|
-
key: OPENBANKING_TELEMETRY_EVENTS2.transactionsSynced,
|
|
1152
|
-
version: "1.0.0",
|
|
1153
|
-
semantics: {
|
|
1154
|
-
what: "Open banking transaction synchronisation completed.",
|
|
1155
|
-
why: "Keep canonical transaction ledger in sync for analytics."
|
|
1156
|
-
},
|
|
1157
|
-
privacy: "internal",
|
|
1158
|
-
properties: {
|
|
1159
|
-
...commonProperties,
|
|
1160
|
-
accountId: {
|
|
1161
|
-
type: "string",
|
|
1162
|
-
description: "Bank account identifier used during the sync.",
|
|
1163
|
-
pii: false
|
|
1164
|
-
},
|
|
1165
|
-
syncedCount: {
|
|
1166
|
-
type: "number",
|
|
1167
|
-
description: "Number of transactions synced successfully."
|
|
1168
|
-
},
|
|
1169
|
-
failedCount: {
|
|
1170
|
-
type: "number",
|
|
1171
|
-
description: "Number of transactions that failed to sync."
|
|
1172
|
-
},
|
|
1173
|
-
from: {
|
|
1174
|
-
type: "timestamp",
|
|
1175
|
-
description: "Start timestamp for the sync window."
|
|
1176
|
-
},
|
|
1177
|
-
to: {
|
|
1178
|
-
type: "timestamp",
|
|
1179
|
-
description: "End timestamp for the sync window."
|
|
1180
|
-
}
|
|
1181
|
-
}
|
|
1182
|
-
},
|
|
1183
|
-
{
|
|
1184
|
-
key: OPENBANKING_TELEMETRY_EVENTS2.balancesRefreshed,
|
|
1185
|
-
version: "1.0.0",
|
|
1186
|
-
semantics: {
|
|
1187
|
-
what: "Open banking balances refreshed.",
|
|
1188
|
-
why: "Provide accurate cash position for dashboards and alerts."
|
|
1189
|
-
},
|
|
1190
|
-
privacy: "internal",
|
|
1191
|
-
properties: {
|
|
1192
|
-
...commonProperties,
|
|
1193
|
-
accountId: piiSafeString("Bank account identifier."),
|
|
1194
|
-
balanceTypes: {
|
|
1195
|
-
type: "json",
|
|
1196
|
-
description: "Balance types included in the refresh."
|
|
1197
|
-
},
|
|
1198
|
-
refreshedAt: {
|
|
1199
|
-
type: "timestamp",
|
|
1200
|
-
description: "Timestamp when balances were refreshed."
|
|
1201
|
-
}
|
|
1202
|
-
}
|
|
1203
|
-
},
|
|
1204
|
-
{
|
|
1205
|
-
key: OPENBANKING_TELEMETRY_EVENTS2.overviewGenerated,
|
|
1206
|
-
version: "1.0.0",
|
|
1207
|
-
semantics: {
|
|
1208
|
-
what: "Derived financial overview generated.",
|
|
1209
|
-
why: "Persist cashflow and category summaries into knowledge space."
|
|
1210
|
-
},
|
|
1211
|
-
privacy: "internal",
|
|
1212
|
-
properties: {
|
|
1213
|
-
...commonProperties,
|
|
1214
|
-
knowledgeEntryId: piiSafeString("Identifier of the knowledge document containing the overview."),
|
|
1215
|
-
period: {
|
|
1216
|
-
type: "string",
|
|
1217
|
-
description: "Aggregation period used (week, month, quarter)."
|
|
1218
|
-
},
|
|
1219
|
-
periodStart: {
|
|
1220
|
-
type: "timestamp",
|
|
1221
|
-
description: "Start timestamp for the aggregation window."
|
|
1222
|
-
},
|
|
1223
|
-
periodEnd: {
|
|
1224
|
-
type: "timestamp",
|
|
1225
|
-
description: "End timestamp for the aggregation window."
|
|
1226
|
-
}
|
|
1227
|
-
},
|
|
1228
|
-
tags: ["knowledge", "analytics"]
|
|
1229
|
-
}
|
|
1230
|
-
]
|
|
1231
|
-
};
|
|
1232
|
-
var OPENBANKING_SENSITIVE_FIELDS = OPENBANKING_PII_FIELDS;
|
|
1233
|
-
|
|
1234
|
-
// src/tenant.sample.ts
|
|
1235
|
-
var pocketFamilyOfficeTenantSample = {
|
|
1236
|
-
meta: {
|
|
1237
|
-
id: "tenant-pfo-sample",
|
|
1238
|
-
tenantId: "tenant.family-office",
|
|
1239
|
-
appId: "pocket-family-office",
|
|
1240
|
-
blueprintName: "pocket-family-office.app",
|
|
1241
|
-
blueprintVersion: "1.0.0",
|
|
1242
|
-
environment: "production",
|
|
1243
|
-
version: "1.0.0",
|
|
1244
|
-
createdAt: new Date().toISOString(),
|
|
1245
|
-
updatedAt: new Date().toISOString(),
|
|
1246
|
-
status: "published"
|
|
1247
|
-
},
|
|
1248
|
-
featureFlags: [
|
|
1249
|
-
{
|
|
1250
|
-
key: "voice-summaries",
|
|
1251
|
-
enabled: true,
|
|
1252
|
-
description: "Enable spoken ElevenLabs summaries for daily briefings."
|
|
1253
|
-
}
|
|
1254
|
-
],
|
|
1255
|
-
integrations: [
|
|
1256
|
-
{ slotId: "primaryLLM", connectionId: "conn-mistral-primary" },
|
|
1257
|
-
{ slotId: "primaryVectorDb", connectionId: "conn-qdrant-finance" },
|
|
1258
|
-
{ slotId: "primaryStorage", connectionId: "conn-gcs-documents" },
|
|
1259
|
-
{ slotId: "primaryOpenBanking", connectionId: "conn-powens-primary" },
|
|
1260
|
-
{ slotId: "emailInbound", connectionId: "conn-gmail-threads" },
|
|
1261
|
-
{ slotId: "emailOutbound", connectionId: "conn-postmark-outbound" },
|
|
1262
|
-
{ slotId: "calendarScheduling", connectionId: "conn-google-calendar" },
|
|
1263
|
-
{ slotId: "voicePlayback", connectionId: "conn-elevenlabs-voice" },
|
|
1264
|
-
{ slotId: "smsNotifications", connectionId: "conn-twilio-sms" },
|
|
1265
|
-
{ slotId: "paymentsProcessing", connectionId: "conn-stripe-recurring" }
|
|
1266
|
-
],
|
|
1267
|
-
knowledge: [
|
|
1268
|
-
{
|
|
1269
|
-
spaceKey: "knowledge.financial-docs",
|
|
1270
|
-
scope: {
|
|
1271
|
-
workflows: [
|
|
1272
|
-
"pfo.workflow.process-uploaded-document",
|
|
1273
|
-
"pfo.workflow.generate-financial-summary"
|
|
1274
|
-
]
|
|
1275
|
-
}
|
|
1276
|
-
},
|
|
1277
|
-
{
|
|
1278
|
-
spaceKey: "knowledge.email-threads",
|
|
1279
|
-
scope: {
|
|
1280
|
-
workflows: ["pfo.workflow.ingest-email-threads"]
|
|
1281
|
-
}
|
|
1282
|
-
},
|
|
1283
|
-
{
|
|
1284
|
-
spaceKey: "knowledge.financial-overview",
|
|
1285
|
-
scope: {
|
|
1286
|
-
workflows: [
|
|
1287
|
-
"pfo.workflow.sync-openbanking-transactions",
|
|
1288
|
-
"pfo.workflow.refresh-openbanking-balances",
|
|
1289
|
-
"pfo.workflow.generate-financial-summary",
|
|
1290
|
-
"pfo.workflow.generate-openbanking-overview"
|
|
1291
|
-
]
|
|
1292
|
-
},
|
|
1293
|
-
required: false
|
|
1294
|
-
}
|
|
1295
|
-
],
|
|
1296
|
-
locales: {
|
|
1297
|
-
defaultLocale: "en",
|
|
1298
|
-
enabledLocales: ["en"]
|
|
1299
|
-
},
|
|
1300
|
-
notes: "Sample tenant configuration for hackathon demos. Replace connection IDs with tenant-specific bindings when provisioning."
|
|
1301
|
-
};
|
|
1302
|
-
|
|
1303
|
-
// src/workflows/generate-financial-summary.ts
|
|
1304
|
-
import {
|
|
1305
|
-
OwnersEnum as OwnersEnum4,
|
|
1306
|
-
StabilityEnum as StabilityEnum4,
|
|
1307
|
-
TagsEnum as TagsEnum4
|
|
1308
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1309
|
-
import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow/spec";
|
|
1310
|
-
var generateFinancialSummaryWorkflow = defineWorkflow({
|
|
1311
|
-
meta: {
|
|
1312
|
-
key: "pfo.workflow.generate-financial-summary",
|
|
1313
|
-
version: "1.0.0",
|
|
1314
|
-
title: "Generate Financial Summary",
|
|
1315
|
-
description: "Retrieves the latest financial signals, generates an AI summary, and optionally distributes it by voice or email.",
|
|
1316
|
-
domain: "finance",
|
|
1317
|
-
owners: [OwnersEnum4.PlatformFinance],
|
|
1318
|
-
tags: ["summary", "ai", TagsEnum4.Automation],
|
|
1319
|
-
stability: StabilityEnum4.Beta
|
|
1320
|
-
},
|
|
1321
|
-
definition: {
|
|
1322
|
-
entryStepId: "summarise",
|
|
1323
|
-
steps: [
|
|
1324
|
-
{
|
|
1325
|
-
id: "summarise",
|
|
1326
|
-
type: "automation",
|
|
1327
|
-
label: "Generate Summary",
|
|
1328
|
-
description: "Run retrieval augmented generation over the knowledge base to produce a household summary.",
|
|
1329
|
-
action: {
|
|
1330
|
-
operation: { key: "pfo.summary.generate", version: "1.0.0" }
|
|
1331
|
-
},
|
|
1332
|
-
requiredIntegrations: ["primaryLLM", "primaryVectorDb"],
|
|
1333
|
-
retry: {
|
|
1334
|
-
maxAttempts: 3,
|
|
1335
|
-
backoff: "exponential",
|
|
1336
|
-
delayMs: 750
|
|
1337
|
-
}
|
|
1338
|
-
},
|
|
1339
|
-
{
|
|
1340
|
-
id: "distribute",
|
|
1341
|
-
type: "automation",
|
|
1342
|
-
label: "Distribute Summary",
|
|
1343
|
-
description: "Send the generated summary via email and optionally synthesise a voice note.",
|
|
1344
|
-
action: {
|
|
1345
|
-
operation: { key: "pfo.summary.dispatch", version: "1.0.0" }
|
|
1346
|
-
},
|
|
1347
|
-
requiredIntegrations: ["emailOutbound"],
|
|
1348
|
-
retry: {
|
|
1349
|
-
maxAttempts: 2,
|
|
1350
|
-
backoff: "linear",
|
|
1351
|
-
delayMs: 500
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
],
|
|
1355
|
-
transitions: [{ from: "summarise", to: "distribute" }]
|
|
1356
|
-
}
|
|
1357
|
-
});
|
|
1358
|
-
|
|
1359
|
-
// src/workflows/generate-openbanking-overview.ts
|
|
1360
|
-
import {
|
|
1361
|
-
OwnersEnum as OwnersEnum5,
|
|
1362
|
-
StabilityEnum as StabilityEnum5,
|
|
1363
|
-
TagsEnum as TagsEnum5
|
|
1364
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1365
|
-
import { defineWorkflow as defineWorkflow2 } from "@contractspec/lib.contracts-spec/workflow/spec";
|
|
1366
|
-
var OPEN_BANKING_CAPABILITIES = [
|
|
1367
|
-
{ key: "openbanking.accounts.read", version: "1.0.0" },
|
|
1368
|
-
{ key: "openbanking.transactions.read", version: "1.0.0" },
|
|
1369
|
-
{ key: "openbanking.balances.read", version: "1.0.0" }
|
|
1370
|
-
];
|
|
1371
|
-
var generateOpenBankingOverviewWorkflow = defineWorkflow2({
|
|
1372
|
-
meta: {
|
|
1373
|
-
key: "pfo.workflow.generate-openbanking-overview",
|
|
1374
|
-
version: "1.0.0",
|
|
1375
|
-
title: "Generate Open Banking Overview",
|
|
1376
|
-
description: "Produces a derived financial overview and stores it in the operational knowledge space.",
|
|
1377
|
-
domain: "finance",
|
|
1378
|
-
owners: [OwnersEnum5.PlatformFinance],
|
|
1379
|
-
tags: ["open-banking", "summary", TagsEnum5.Automation],
|
|
1380
|
-
stability: StabilityEnum5.Experimental
|
|
1381
|
-
},
|
|
1382
|
-
definition: {
|
|
1383
|
-
entryStepId: "generate-overview",
|
|
1384
|
-
steps: [
|
|
1385
|
-
{
|
|
1386
|
-
id: "generate-overview",
|
|
1387
|
-
type: "automation",
|
|
1388
|
-
label: "Generate Overview",
|
|
1389
|
-
description: "Aggregate balances, cashflow, and category breakdowns into a knowledge entry.",
|
|
1390
|
-
action: {
|
|
1391
|
-
operation: {
|
|
1392
|
-
key: "pfo.openbanking.generate-overview",
|
|
1393
|
-
version: "1.0.0"
|
|
1394
|
-
}
|
|
1395
|
-
},
|
|
1396
|
-
requiredIntegrations: ["primaryOpenBanking"],
|
|
1397
|
-
requiredCapabilities: OPEN_BANKING_CAPABILITIES,
|
|
1398
|
-
retry: {
|
|
1399
|
-
maxAttempts: 3,
|
|
1400
|
-
backoff: "exponential",
|
|
1401
|
-
delayMs: 1500
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
],
|
|
1405
|
-
transitions: []
|
|
1406
|
-
}
|
|
1407
|
-
});
|
|
1408
|
-
|
|
1409
|
-
// src/workflows/ingest-email-threads.ts
|
|
1410
|
-
import {
|
|
1411
|
-
OwnersEnum as OwnersEnum6,
|
|
1412
|
-
StabilityEnum as StabilityEnum6,
|
|
1413
|
-
TagsEnum as TagsEnum6
|
|
1414
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1415
|
-
import { defineWorkflow as defineWorkflow3 } from "@contractspec/lib.contracts-spec/workflow/spec";
|
|
1416
|
-
var ingestEmailThreadsWorkflow = defineWorkflow3({
|
|
1417
|
-
meta: {
|
|
1418
|
-
key: "pfo.workflow.ingest-email-threads",
|
|
1419
|
-
version: "1.0.0",
|
|
1420
|
-
title: "Ingest Email Threads",
|
|
1421
|
-
description: "Synchronises Gmail threads tagged with finance labels and indexes them into operational knowledge spaces.",
|
|
1422
|
-
domain: "communications",
|
|
1423
|
-
owners: [OwnersEnum6.PlatformMessaging],
|
|
1424
|
-
tags: ["gmail", "knowledge", TagsEnum6.Automation],
|
|
1425
|
-
stability: StabilityEnum6.Experimental
|
|
1426
|
-
},
|
|
1427
|
-
definition: {
|
|
1428
|
-
entryStepId: "sync",
|
|
1429
|
-
steps: [
|
|
1430
|
-
{
|
|
1431
|
-
id: "sync",
|
|
1432
|
-
type: "automation",
|
|
1433
|
-
label: "Sync Gmail Threads",
|
|
1434
|
-
description: "Fetches Gmail threads and transforms them into knowledge fragments before vector indexing.",
|
|
1435
|
-
action: {
|
|
1436
|
-
operation: { key: "pfo.email.sync-threads", version: "1.0.0" }
|
|
1437
|
-
},
|
|
1438
|
-
requiredIntegrations: ["emailInbound", "primaryVectorDb"],
|
|
1439
|
-
retry: {
|
|
1440
|
-
maxAttempts: 3,
|
|
1441
|
-
backoff: "exponential",
|
|
1442
|
-
delayMs: 1000
|
|
1443
|
-
}
|
|
1444
|
-
},
|
|
1445
|
-
{
|
|
1446
|
-
id: "triage",
|
|
1447
|
-
type: "human",
|
|
1448
|
-
label: "Triage Exceptions",
|
|
1449
|
-
description: "Operators can resolve sync failures or tag important threads for follow-up."
|
|
1450
|
-
}
|
|
1451
|
-
],
|
|
1452
|
-
transitions: [
|
|
1453
|
-
{
|
|
1454
|
-
from: "sync",
|
|
1455
|
-
to: "triage",
|
|
1456
|
-
condition: "output?.syncedThreads === 0",
|
|
1457
|
-
label: "No new threads"
|
|
1458
|
-
}
|
|
1459
|
-
]
|
|
1460
|
-
}
|
|
1461
|
-
});
|
|
1462
|
-
|
|
1463
|
-
// src/workflows/process-uploaded-document.ts
|
|
1464
|
-
import {
|
|
1465
|
-
OwnersEnum as OwnersEnum7,
|
|
1466
|
-
StabilityEnum as StabilityEnum7,
|
|
1467
|
-
TagsEnum as TagsEnum7
|
|
1468
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1469
|
-
import { defineWorkflow as defineWorkflow4 } from "@contractspec/lib.contracts-spec/workflow/spec";
|
|
1470
|
-
var processUploadedDocumentWorkflow = defineWorkflow4({
|
|
1471
|
-
meta: {
|
|
1472
|
-
key: "pfo.workflow.process-uploaded-document",
|
|
1473
|
-
version: "1.0.0",
|
|
1474
|
-
title: "Process Uploaded Document",
|
|
1475
|
-
description: "Stores an uploaded invoice/contract, queues ingestion, and records any follow-up reminders.",
|
|
1476
|
-
domain: "finance",
|
|
1477
|
-
owners: [OwnersEnum7.PlatformFinance],
|
|
1478
|
-
tags: ["documents", "ingestion", TagsEnum7.Automation],
|
|
1479
|
-
stability: StabilityEnum7.Experimental
|
|
1480
|
-
},
|
|
1481
|
-
definition: {
|
|
1482
|
-
entryStepId: "store",
|
|
1483
|
-
steps: [
|
|
1484
|
-
{
|
|
1485
|
-
id: "store",
|
|
1486
|
-
type: "automation",
|
|
1487
|
-
label: "Store and Queue Ingestion",
|
|
1488
|
-
description: "Persist the document to storage and enqueue the knowledge ingestion pipeline.",
|
|
1489
|
-
action: {
|
|
1490
|
-
operation: { key: "pfo.documents.upload", version: "1.0.0" }
|
|
1491
|
-
},
|
|
1492
|
-
requiredIntegrations: ["primaryStorage", "primaryVectorDb"],
|
|
1493
|
-
retry: {
|
|
1494
|
-
maxAttempts: 3,
|
|
1495
|
-
backoff: "exponential",
|
|
1496
|
-
delayMs: 500
|
|
1497
|
-
}
|
|
1498
|
-
},
|
|
1499
|
-
{
|
|
1500
|
-
id: "review",
|
|
1501
|
-
type: "human",
|
|
1502
|
-
label: "Optional Human Classification",
|
|
1503
|
-
description: "Finance lead can categorise the document while ingestion completes."
|
|
1504
|
-
}
|
|
1505
|
-
],
|
|
1506
|
-
transitions: [
|
|
1507
|
-
{
|
|
1508
|
-
from: "store",
|
|
1509
|
-
to: "review"
|
|
1510
|
-
}
|
|
1511
|
-
]
|
|
1512
|
-
}
|
|
1513
|
-
});
|
|
1514
|
-
|
|
1515
|
-
// src/workflows/refresh-openbanking-balances.ts
|
|
1516
|
-
import {
|
|
1517
|
-
OwnersEnum as OwnersEnum8,
|
|
1518
|
-
StabilityEnum as StabilityEnum8,
|
|
1519
|
-
TagsEnum as TagsEnum8
|
|
1520
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1521
|
-
import { defineWorkflow as defineWorkflow5 } from "@contractspec/lib.contracts-spec/workflow/spec";
|
|
1522
|
-
var BALANCE_CAPABILITY = {
|
|
1523
|
-
key: "openbanking.balances.read",
|
|
1524
|
-
version: "1.0.0"
|
|
1525
|
-
};
|
|
1526
|
-
var refreshOpenBankingBalancesWorkflow = defineWorkflow5({
|
|
1527
|
-
meta: {
|
|
1528
|
-
key: "pfo.workflow.refresh-openbanking-balances",
|
|
1529
|
-
version: "1.0.0",
|
|
1530
|
-
title: "Refresh Open Banking Balances",
|
|
1531
|
-
description: "Refreshes balances for synced accounts to surface the latest cash positions in dashboards.",
|
|
1532
|
-
domain: "finance",
|
|
1533
|
-
owners: [OwnersEnum8.PlatformFinance],
|
|
1534
|
-
tags: ["open-banking", "powens", TagsEnum8.Automation],
|
|
1535
|
-
stability: StabilityEnum8.Experimental
|
|
1536
|
-
},
|
|
1537
|
-
definition: {
|
|
1538
|
-
entryStepId: "refresh-balances",
|
|
1539
|
-
steps: [
|
|
1540
|
-
{
|
|
1541
|
-
id: "refresh-balances",
|
|
1542
|
-
type: "automation",
|
|
1543
|
-
label: "Refresh Balances",
|
|
1544
|
-
description: "Trigger the Powens provider to obtain current and available balances.",
|
|
1545
|
-
action: {
|
|
1546
|
-
operation: { key: "openbanking.balances.refresh", version: "1.0.0" }
|
|
1547
|
-
},
|
|
1548
|
-
requiredIntegrations: ["primaryOpenBanking"],
|
|
1549
|
-
requiredCapabilities: [BALANCE_CAPABILITY],
|
|
1550
|
-
retry: {
|
|
1551
|
-
maxAttempts: 3,
|
|
1552
|
-
backoff: "exponential",
|
|
1553
|
-
delayMs: 1000
|
|
1554
|
-
}
|
|
1555
|
-
},
|
|
1556
|
-
{
|
|
1557
|
-
id: "fetch-balances",
|
|
1558
|
-
type: "automation",
|
|
1559
|
-
label: "Fetch Balances",
|
|
1560
|
-
description: "Load the canonical balance snapshots for downstream workflows and dashboards.",
|
|
1561
|
-
action: {
|
|
1562
|
-
operation: { key: "openbanking.balances.get", version: "1.0.0" }
|
|
1563
|
-
},
|
|
1564
|
-
requiredIntegrations: ["primaryOpenBanking"],
|
|
1565
|
-
requiredCapabilities: [BALANCE_CAPABILITY],
|
|
1566
|
-
retry: {
|
|
1567
|
-
maxAttempts: 2,
|
|
1568
|
-
backoff: "linear",
|
|
1569
|
-
delayMs: 750
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
],
|
|
1573
|
-
transitions: [{ from: "refresh-balances", to: "fetch-balances" }]
|
|
1574
|
-
}
|
|
1575
|
-
});
|
|
1576
|
-
|
|
1577
|
-
// src/workflows/sync-openbanking-accounts.ts
|
|
1578
|
-
import {
|
|
1579
|
-
OwnersEnum as OwnersEnum9,
|
|
1580
|
-
StabilityEnum as StabilityEnum9,
|
|
1581
|
-
TagsEnum as TagsEnum9
|
|
1582
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1583
|
-
import { defineWorkflow as defineWorkflow6 } from "@contractspec/lib.contracts-spec/workflow/spec";
|
|
1584
|
-
var ACCOUNT_CAPABILITY = {
|
|
1585
|
-
key: "openbanking.accounts.read",
|
|
1586
|
-
version: "1.0.0"
|
|
1587
|
-
};
|
|
1588
|
-
var syncOpenBankingAccountsWorkflow = defineWorkflow6({
|
|
1589
|
-
meta: {
|
|
1590
|
-
key: "pfo.workflow.sync-openbanking-accounts",
|
|
1591
|
-
version: "1.0.0",
|
|
1592
|
-
title: "Synchronise Open Banking Accounts",
|
|
1593
|
-
description: "Validates Powens connectivity and synchronises bank account metadata into the canonical ledger.",
|
|
1594
|
-
domain: "finance",
|
|
1595
|
-
owners: [OwnersEnum9.PlatformFinance],
|
|
1596
|
-
tags: ["open-banking", "powens", TagsEnum9.Automation],
|
|
1597
|
-
stability: StabilityEnum9.Experimental
|
|
1598
|
-
},
|
|
1599
|
-
definition: {
|
|
1600
|
-
entryStepId: "sync-accounts",
|
|
1601
|
-
steps: [
|
|
1602
|
-
{
|
|
1603
|
-
id: "sync-accounts",
|
|
1604
|
-
type: "automation",
|
|
1605
|
-
label: "Sync Accounts",
|
|
1606
|
-
description: "Refresh linked bank accounts via Powens and upsert canonical BankAccount records.",
|
|
1607
|
-
action: {
|
|
1608
|
-
operation: { key: "openbanking.accounts.sync", version: "1.0.0" }
|
|
1609
|
-
},
|
|
1610
|
-
requiredIntegrations: ["primaryOpenBanking"],
|
|
1611
|
-
requiredCapabilities: [ACCOUNT_CAPABILITY],
|
|
1612
|
-
retry: {
|
|
1613
|
-
maxAttempts: 3,
|
|
1614
|
-
backoff: "exponential",
|
|
1615
|
-
delayMs: 1000
|
|
1616
|
-
}
|
|
1617
|
-
},
|
|
1618
|
-
{
|
|
1619
|
-
id: "fetch-accounts",
|
|
1620
|
-
type: "automation",
|
|
1621
|
-
label: "Fetch Accounts",
|
|
1622
|
-
description: "Retrieve the latest canonical account snapshot for downstream consumers.",
|
|
1623
|
-
action: {
|
|
1624
|
-
operation: { key: "openbanking.accounts.list", version: "1.0.0" }
|
|
1625
|
-
},
|
|
1626
|
-
requiredIntegrations: ["primaryOpenBanking"],
|
|
1627
|
-
requiredCapabilities: [ACCOUNT_CAPABILITY],
|
|
1628
|
-
retry: {
|
|
1629
|
-
maxAttempts: 2,
|
|
1630
|
-
backoff: "linear",
|
|
1631
|
-
delayMs: 750
|
|
1632
|
-
}
|
|
1633
|
-
}
|
|
1634
|
-
],
|
|
1635
|
-
transitions: [{ from: "sync-accounts", to: "fetch-accounts" }]
|
|
1636
|
-
}
|
|
1637
|
-
});
|
|
1638
|
-
|
|
1639
|
-
// src/workflows/sync-openbanking-transactions.ts
|
|
1640
|
-
import {
|
|
1641
|
-
OwnersEnum as OwnersEnum10,
|
|
1642
|
-
StabilityEnum as StabilityEnum10,
|
|
1643
|
-
TagsEnum as TagsEnum10
|
|
1644
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1645
|
-
import { defineWorkflow as defineWorkflow7 } from "@contractspec/lib.contracts-spec/workflow/spec";
|
|
1646
|
-
var TRANSACTION_CAPABILITY = {
|
|
1647
|
-
key: "openbanking.transactions.read",
|
|
1648
|
-
version: "1.0.0"
|
|
1649
|
-
};
|
|
1650
|
-
var syncOpenBankingTransactionsWorkflow = defineWorkflow7({
|
|
1651
|
-
meta: {
|
|
1652
|
-
key: "pfo.workflow.sync-openbanking-transactions",
|
|
1653
|
-
version: "1.0.0",
|
|
1654
|
-
title: "Synchronise Open Banking Transactions",
|
|
1655
|
-
description: "Fetches recent transactions from Powens for each linked account and stores them in the canonical ledger.",
|
|
1656
|
-
domain: "finance",
|
|
1657
|
-
owners: [OwnersEnum10.PlatformFinance],
|
|
1658
|
-
tags: ["open-banking", "powens", TagsEnum10.Automation],
|
|
1659
|
-
stability: StabilityEnum10.Experimental
|
|
1660
|
-
},
|
|
1661
|
-
definition: {
|
|
1662
|
-
entryStepId: "sync-transactions",
|
|
1663
|
-
steps: [
|
|
1664
|
-
{
|
|
1665
|
-
id: "sync-transactions",
|
|
1666
|
-
type: "automation",
|
|
1667
|
-
label: "Sync Transactions",
|
|
1668
|
-
description: "Call the Powens provider to pull incremental transactions for active accounts.",
|
|
1669
|
-
action: {
|
|
1670
|
-
operation: { key: "openbanking.transactions.sync", version: "1.0.0" }
|
|
1671
|
-
},
|
|
1672
|
-
requiredIntegrations: ["primaryOpenBanking"],
|
|
1673
|
-
requiredCapabilities: [TRANSACTION_CAPABILITY],
|
|
1674
|
-
retry: {
|
|
1675
|
-
maxAttempts: 4,
|
|
1676
|
-
backoff: "exponential",
|
|
1677
|
-
delayMs: 1500
|
|
1678
|
-
}
|
|
1679
|
-
},
|
|
1680
|
-
{
|
|
1681
|
-
id: "list-transactions",
|
|
1682
|
-
type: "automation",
|
|
1683
|
-
label: "List Transactions",
|
|
1684
|
-
description: "Retrieve the canonical transaction list for reporting and downstream analytics.",
|
|
1685
|
-
action: {
|
|
1686
|
-
operation: { key: "openbanking.transactions.list", version: "1.0.0" }
|
|
1687
|
-
},
|
|
1688
|
-
requiredIntegrations: ["primaryOpenBanking"],
|
|
1689
|
-
requiredCapabilities: [TRANSACTION_CAPABILITY],
|
|
1690
|
-
retry: {
|
|
1691
|
-
maxAttempts: 2,
|
|
1692
|
-
backoff: "linear",
|
|
1693
|
-
delayMs: 1000
|
|
1694
|
-
}
|
|
1695
|
-
}
|
|
1696
|
-
],
|
|
1697
|
-
transitions: [{ from: "sync-transactions", to: "list-transactions" }]
|
|
1698
|
-
}
|
|
1699
|
-
});
|
|
1700
|
-
|
|
1701
|
-
// src/workflows/upcoming-payments-reminder.ts
|
|
1702
|
-
import {
|
|
1703
|
-
OwnersEnum as OwnersEnum11,
|
|
1704
|
-
StabilityEnum as StabilityEnum11,
|
|
1705
|
-
TagsEnum as TagsEnum11
|
|
1706
|
-
} from "@contractspec/lib.contracts-spec";
|
|
1707
|
-
import { defineWorkflow as defineWorkflow8 } from "@contractspec/lib.contracts-spec/workflow/spec";
|
|
1708
|
-
var upcomingPaymentsReminderWorkflow = defineWorkflow8({
|
|
1709
|
-
meta: {
|
|
1710
|
-
key: "pfo.workflow.upcoming-payments-reminder",
|
|
1711
|
-
version: "1.0.0",
|
|
1712
|
-
title: "Schedule Upcoming Payment Reminder",
|
|
1713
|
-
description: "Collects payment metadata and schedules multi-channel reminders for bills that are due soon.",
|
|
1714
|
-
domain: "finance",
|
|
1715
|
-
owners: [OwnersEnum11.PlatformFinance],
|
|
1716
|
-
tags: ["payments", "reminders", TagsEnum11.Automation],
|
|
1717
|
-
stability: StabilityEnum11.Beta
|
|
1718
|
-
},
|
|
1719
|
-
definition: {
|
|
1720
|
-
entryStepId: "collect",
|
|
1721
|
-
steps: [
|
|
1722
|
-
{
|
|
1723
|
-
id: "collect",
|
|
1724
|
-
type: "human",
|
|
1725
|
-
label: "Review Upcoming Bill",
|
|
1726
|
-
description: "Confirm amount, due date, and preferred delivery channels before scheduling reminder."
|
|
1727
|
-
},
|
|
1728
|
-
{
|
|
1729
|
-
id: "schedule",
|
|
1730
|
-
type: "automation",
|
|
1731
|
-
label: "Schedule Reminder",
|
|
1732
|
-
action: {
|
|
1733
|
-
operation: {
|
|
1734
|
-
key: "pfo.reminders.schedule-payment",
|
|
1735
|
-
version: "1.0.0"
|
|
1736
|
-
}
|
|
1737
|
-
},
|
|
1738
|
-
requiredIntegrations: [
|
|
1739
|
-
"emailOutbound",
|
|
1740
|
-
"smsNotifications",
|
|
1741
|
-
"calendarScheduling"
|
|
1742
|
-
],
|
|
1743
|
-
retry: {
|
|
1744
|
-
maxAttempts: 2,
|
|
1745
|
-
backoff: "linear",
|
|
1746
|
-
delayMs: 1000
|
|
1747
|
-
}
|
|
1748
|
-
}
|
|
1749
|
-
],
|
|
1750
|
-
transitions: [
|
|
1751
|
-
{
|
|
1752
|
-
from: "collect",
|
|
1753
|
-
to: "schedule",
|
|
1754
|
-
condition: "output?.confirmed === true",
|
|
1755
|
-
label: "Reminder confirmed"
|
|
1756
|
-
}
|
|
1757
|
-
]
|
|
1758
|
-
}
|
|
1759
|
-
});
|
|
1760
|
-
export {
|
|
1761
|
-
uploadDocumentContract,
|
|
1762
|
-
upcomingPaymentsReminderWorkflow,
|
|
1763
|
-
tech_contracts_vertical_pocket_family_office_DocBlocks,
|
|
1764
|
-
syncOpenBankingTransactionsWorkflow,
|
|
1765
|
-
syncOpenBankingAccountsWorkflow,
|
|
1766
|
-
syncEmailThreadsContract,
|
|
1767
|
-
schedulePaymentReminderContract,
|
|
1768
|
-
registerPocketFamilyOfficeBlueprint,
|
|
1769
|
-
refreshOpenBankingBalancesWorkflow,
|
|
1770
|
-
processUploadedDocumentWorkflow,
|
|
1771
|
-
pocketFamilyOfficeTenantSample,
|
|
1772
|
-
pocketFamilyOfficeTelemetry,
|
|
1773
|
-
pocketFamilyOfficeKnowledgeSources,
|
|
1774
|
-
pocketFamilyOfficeContracts,
|
|
1775
|
-
pocketFamilyOfficeConnections,
|
|
1776
|
-
pocketFamilyOfficeBlueprint,
|
|
1777
|
-
ingestEmailThreadsWorkflow,
|
|
1778
|
-
getPocketFamilyOfficeConnection,
|
|
1779
|
-
generateOpenBankingOverviewWorkflow,
|
|
1780
|
-
generateOpenBankingOverviewContract,
|
|
1781
|
-
generateFinancialSummaryWorkflow,
|
|
1782
|
-
generateFinancialSummaryContract,
|
|
1783
|
-
example_default as example,
|
|
1784
|
-
dispatchFinancialSummaryContract,
|
|
1785
|
-
PocketFamilyOfficeFeature,
|
|
1786
|
-
OPENBANKING_SENSITIVE_FIELDS
|
|
1787
|
-
};
|
|
131
|
+
`}];import{OPENBANKING_PII_FIELDS as te,OPENBANKING_TELEMETRY_EVENTS as f}from"@contractspec/lib.contracts-integrations";import{OwnersEnum as ne,StabilityEnum as oe,TagsEnum as ae}from"@contractspec/lib.contracts-spec/ownership";var p={tenantId:{type:"string",required:!0,description:"Tenant identifier for multi-tenant isolation."},appId:{type:"string",required:!0,description:"Application identifier associated with the event."},blueprint:{type:"string",required:!0,description:"Blueprint name@version emitting the telemetry."},configVersion:{type:"number",required:!0,description:"Resolved app config version when the event was generated."},slotId:{type:"string",required:!0,description:"Integration slot identifier (e.g., primaryOpenBanking)."},connectionId:{type:"string",required:!0,description:"Integration connection ID used for the sync."}};function h(r){return{type:"string",description:r,pii:!1}}var it={meta:{key:"pfo.telemetry",version:"1.0.0",title:"Pocket Family Office Telemetry",description:"Operational telemetry for Pocket Family Office workflows, including Powens open banking syncs.",domain:"finance",owners:[ne.PlatformFinance],tags:["open-banking",ae.Automation],stability:oe.Experimental},config:{defaultRetentionDays:180,defaultSamplingRate:1},events:[{key:f.accountsSynced,version:"1.0.0",semantics:{what:"Open banking account synchronisation completed.",why:"Refresh canonical account metadata for reporting and workflows."},privacy:"internal",properties:{...p,syncedCount:{type:"number",description:"Number of accounts synced successfully."},failedCount:{type:"number",description:"Number of accounts that failed to sync."},durationMs:{type:"number",description:"Duration of the sync job in milliseconds."}}},{key:f.transactionsSynced,version:"1.0.0",semantics:{what:"Open banking transaction synchronisation completed.",why:"Keep canonical transaction ledger in sync for analytics."},privacy:"internal",properties:{...p,accountId:{type:"string",description:"Bank account identifier used during the sync.",pii:!1},syncedCount:{type:"number",description:"Number of transactions synced successfully."},failedCount:{type:"number",description:"Number of transactions that failed to sync."},from:{type:"timestamp",description:"Start timestamp for the sync window."},to:{type:"timestamp",description:"End timestamp for the sync window."}}},{key:f.balancesRefreshed,version:"1.0.0",semantics:{what:"Open banking balances refreshed.",why:"Provide accurate cash position for dashboards and alerts."},privacy:"internal",properties:{...p,accountId:h("Bank account identifier."),balanceTypes:{type:"json",description:"Balance types included in the refresh."},refreshedAt:{type:"timestamp",description:"Timestamp when balances were refreshed."}}},{key:f.overviewGenerated,version:"1.0.0",semantics:{what:"Derived financial overview generated.",why:"Persist cashflow and category summaries into knowledge space."},privacy:"internal",properties:{...p,knowledgeEntryId:h("Identifier of the knowledge document containing the overview."),period:{type:"string",description:"Aggregation period used (week, month, quarter)."},periodStart:{type:"timestamp",description:"Start timestamp for the aggregation window."},periodEnd:{type:"timestamp",description:"End timestamp for the aggregation window."}},tags:["knowledge","analytics"]}]},ct=te;var lt={meta:{id:"tenant-pfo-sample",tenantId:"tenant.family-office",appId:"pocket-family-office",blueprintName:"pocket-family-office.app",blueprintVersion:"1.0.0",environment:"production",version:"1.0.0",createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),status:"published"},featureFlags:[{key:"voice-summaries",enabled:!0,description:"Enable spoken ElevenLabs summaries for daily briefings."}],integrations:[{slotId:"primaryLLM",connectionId:"conn-mistral-primary"},{slotId:"primaryVectorDb",connectionId:"conn-qdrant-finance"},{slotId:"primaryStorage",connectionId:"conn-gcs-documents"},{slotId:"primaryOpenBanking",connectionId:"conn-powens-primary"},{slotId:"emailInbound",connectionId:"conn-gmail-threads"},{slotId:"emailOutbound",connectionId:"conn-postmark-outbound"},{slotId:"calendarScheduling",connectionId:"conn-google-calendar"},{slotId:"voicePlayback",connectionId:"conn-elevenlabs-voice"},{slotId:"smsNotifications",connectionId:"conn-twilio-sms"},{slotId:"paymentsProcessing",connectionId:"conn-stripe-recurring"}],knowledge:[{spaceKey:"knowledge.financial-docs",scope:{workflows:["pfo.workflow.process-uploaded-document","pfo.workflow.generate-financial-summary"]}},{spaceKey:"knowledge.email-threads",scope:{workflows:["pfo.workflow.ingest-email-threads"]}},{spaceKey:"knowledge.financial-overview",scope:{workflows:["pfo.workflow.sync-openbanking-transactions","pfo.workflow.refresh-openbanking-balances","pfo.workflow.generate-financial-summary","pfo.workflow.generate-openbanking-overview"]},required:!1}],locales:{defaultLocale:"en",enabledLocales:["en"]},notes:"Sample tenant configuration for hackathon demos. Replace connection IDs with tenant-specific bindings when provisioning."};import{OwnersEnum as se,StabilityEnum as re,TagsEnum as ie}from"@contractspec/lib.contracts-spec";import{defineWorkflow as ce}from"@contractspec/lib.contracts-spec/workflow/spec";var mt=ce({meta:{key:"pfo.workflow.generate-financial-summary",version:"1.0.0",title:"Generate Financial Summary",description:"Retrieves the latest financial signals, generates an AI summary, and optionally distributes it by voice or email.",domain:"finance",owners:[se.PlatformFinance],tags:["summary","ai",ie.Automation],stability:re.Beta},definition:{entryStepId:"summarise",steps:[{id:"summarise",type:"automation",label:"Generate Summary",description:"Run retrieval augmented generation over the knowledge base to produce a household summary.",action:{operation:{key:"pfo.summary.generate",version:"1.0.0"}},requiredIntegrations:["primaryLLM","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:750}},{id:"distribute",type:"automation",label:"Distribute Summary",description:"Send the generated summary via email and optionally synthesise a voice note.",action:{operation:{key:"pfo.summary.dispatch",version:"1.0.0"}},requiredIntegrations:["emailOutbound"],retry:{maxAttempts:2,backoff:"linear",delayMs:500}}],transitions:[{from:"summarise",to:"distribute"}]}});import{OwnersEnum as de,StabilityEnum as le,TagsEnum as ge}from"@contractspec/lib.contracts-spec";import{defineWorkflow as fe}from"@contractspec/lib.contracts-spec/workflow/spec";var pe=[{key:"openbanking.accounts.read",version:"1.0.0"},{key:"openbanking.transactions.read",version:"1.0.0"},{key:"openbanking.balances.read",version:"1.0.0"}],kt=fe({meta:{key:"pfo.workflow.generate-openbanking-overview",version:"1.0.0",title:"Generate Open Banking Overview",description:"Produces a derived financial overview and stores it in the operational knowledge space.",domain:"finance",owners:[de.PlatformFinance],tags:["open-banking","summary",ge.Automation],stability:le.Experimental},definition:{entryStepId:"generate-overview",steps:[{id:"generate-overview",type:"automation",label:"Generate Overview",description:"Aggregate balances, cashflow, and category breakdowns into a knowledge entry.",action:{operation:{key:"pfo.openbanking.generate-overview",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:pe,retry:{maxAttempts:3,backoff:"exponential",delayMs:1500}}],transitions:[]}});import{OwnersEnum as me,StabilityEnum as he,TagsEnum as ue}from"@contractspec/lib.contracts-spec";import{defineWorkflow as ye}from"@contractspec/lib.contracts-spec/workflow/spec";var wt=ye({meta:{key:"pfo.workflow.ingest-email-threads",version:"1.0.0",title:"Ingest Email Threads",description:"Synchronises Gmail threads tagged with finance labels and indexes them into operational knowledge spaces.",domain:"communications",owners:[me.PlatformMessaging],tags:["gmail","knowledge",ue.Automation],stability:he.Experimental},definition:{entryStepId:"sync",steps:[{id:"sync",type:"automation",label:"Sync Gmail Threads",description:"Fetches Gmail threads and transforms them into knowledge fragments before vector indexing.",action:{operation:{key:"pfo.email.sync-threads",version:"1.0.0"}},requiredIntegrations:["emailInbound","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"triage",type:"human",label:"Triage Exceptions",description:"Operators can resolve sync failures or tag important threads for follow-up."}],transitions:[{from:"sync",to:"triage",condition:"output?.syncedThreads === 0",label:"No new threads"}]}});import{OwnersEnum as ke,StabilityEnum as ve,TagsEnum as be}from"@contractspec/lib.contracts-spec";import{defineWorkflow as xe}from"@contractspec/lib.contracts-spec/workflow/spec";var Vt=xe({meta:{key:"pfo.workflow.process-uploaded-document",version:"1.0.0",title:"Process Uploaded Document",description:"Stores an uploaded invoice/contract, queues ingestion, and records any follow-up reminders.",domain:"finance",owners:[ke.PlatformFinance],tags:["documents","ingestion",be.Automation],stability:ve.Experimental},definition:{entryStepId:"store",steps:[{id:"store",type:"automation",label:"Store and Queue Ingestion",description:"Persist the document to storage and enqueue the knowledge ingestion pipeline.",action:{operation:{key:"pfo.documents.upload",version:"1.0.0"}},requiredIntegrations:["primaryStorage","primaryVectorDb"],retry:{maxAttempts:3,backoff:"exponential",delayMs:500}},{id:"review",type:"human",label:"Optional Human Classification",description:"Finance lead can categorise the document while ingestion completes."}],transitions:[{from:"store",to:"review"}]}});import{OwnersEnum as we,StabilityEnum as Me,TagsEnum as Ie}from"@contractspec/lib.contracts-spec";import{defineWorkflow as Ke}from"@contractspec/lib.contracts-spec/workflow/spec";var u={key:"openbanking.balances.read",version:"1.0.0"},Dt=Ke({meta:{key:"pfo.workflow.refresh-openbanking-balances",version:"1.0.0",title:"Refresh Open Banking Balances",description:"Refreshes balances for synced accounts to surface the latest cash positions in dashboards.",domain:"finance",owners:[we.PlatformFinance],tags:["open-banking","powens",Ie.Automation],stability:Me.Experimental},definition:{entryStepId:"refresh-balances",steps:[{id:"refresh-balances",type:"automation",label:"Refresh Balances",description:"Trigger the Powens provider to obtain current and available balances.",action:{operation:{key:"openbanking.balances.refresh",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[u],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"fetch-balances",type:"automation",label:"Fetch Balances",description:"Load the canonical balance snapshots for downstream workflows and dashboards.",action:{operation:{key:"openbanking.balances.get",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[u],retry:{maxAttempts:2,backoff:"linear",delayMs:750}}],transitions:[{from:"refresh-balances",to:"fetch-balances"}]}});import{OwnersEnum as Ve,StabilityEnum as je,TagsEnum as Fe}from"@contractspec/lib.contracts-spec";import{defineWorkflow as qe}from"@contractspec/lib.contracts-spec/workflow/spec";var y={key:"openbanking.accounts.read",version:"1.0.0"},Xt=qe({meta:{key:"pfo.workflow.sync-openbanking-accounts",version:"1.0.0",title:"Synchronise Open Banking Accounts",description:"Validates Powens connectivity and synchronises bank account metadata into the canonical ledger.",domain:"finance",owners:[Ve.PlatformFinance],tags:["open-banking","powens",Fe.Automation],stability:je.Experimental},definition:{entryStepId:"sync-accounts",steps:[{id:"sync-accounts",type:"automation",label:"Sync Accounts",description:"Refresh linked bank accounts via Powens and upsert canonical BankAccount records.",action:{operation:{key:"openbanking.accounts.sync",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[y],retry:{maxAttempts:3,backoff:"exponential",delayMs:1000}},{id:"fetch-accounts",type:"automation",label:"Fetch Accounts",description:"Retrieve the latest canonical account snapshot for downstream consumers.",action:{operation:{key:"openbanking.accounts.list",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[y],retry:{maxAttempts:2,backoff:"linear",delayMs:750}}],transitions:[{from:"sync-accounts",to:"fetch-accounts"}]}});import{OwnersEnum as De,StabilityEnum as He,TagsEnum as Re}from"@contractspec/lib.contracts-spec";import{defineWorkflow as Qe}from"@contractspec/lib.contracts-spec/workflow/spec";var k={key:"openbanking.transactions.read",version:"1.0.0"},Zt=Qe({meta:{key:"pfo.workflow.sync-openbanking-transactions",version:"1.0.0",title:"Synchronise Open Banking Transactions",description:"Fetches recent transactions from Powens for each linked account and stores them in the canonical ledger.",domain:"finance",owners:[De.PlatformFinance],tags:["open-banking","powens",Re.Automation],stability:He.Experimental},definition:{entryStepId:"sync-transactions",steps:[{id:"sync-transactions",type:"automation",label:"Sync Transactions",description:"Call the Powens provider to pull incremental transactions for active accounts.",action:{operation:{key:"openbanking.transactions.sync",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[k],retry:{maxAttempts:4,backoff:"exponential",delayMs:1500}},{id:"list-transactions",type:"automation",label:"List Transactions",description:"Retrieve the canonical transaction list for reporting and downstream analytics.",action:{operation:{key:"openbanking.transactions.list",version:"1.0.0"}},requiredIntegrations:["primaryOpenBanking"],requiredCapabilities:[k],retry:{maxAttempts:2,backoff:"linear",delayMs:1000}}],transitions:[{from:"sync-transactions",to:"list-transactions"}]}});import{OwnersEnum as Xe,StabilityEnum as ze,TagsEnum as Je}from"@contractspec/lib.contracts-spec";import{defineWorkflow as Ue}from"@contractspec/lib.contracts-spec/workflow/spec";var Gt=Ue({meta:{key:"pfo.workflow.upcoming-payments-reminder",version:"1.0.0",title:"Schedule Upcoming Payment Reminder",description:"Collects payment metadata and schedules multi-channel reminders for bills that are due soon.",domain:"finance",owners:[Xe.PlatformFinance],tags:["payments","reminders",Je.Automation],stability:ze.Beta},definition:{entryStepId:"collect",steps:[{id:"collect",type:"human",label:"Review Upcoming Bill",description:"Confirm amount, due date, and preferred delivery channels before scheduling reminder."},{id:"schedule",type:"automation",label:"Schedule Reminder",action:{operation:{key:"pfo.reminders.schedule-payment",version:"1.0.0"}},requiredIntegrations:["emailOutbound","smsNotifications","calendarScheduling"],retry:{maxAttempts:2,backoff:"linear",delayMs:1000}}],transitions:[{from:"collect",to:"schedule",condition:"output?.confirmed === true",label:"Reminder confirmed"}]}});export{U as uploadDocumentContract,Gt as upcomingPaymentsReminderWorkflow,ot as tech_contracts_vertical_pocket_family_office_DocBlocks,Zt as syncOpenBankingTransactionsWorkflow,Xt as syncOpenBankingAccountsWorkflow,Y as syncEmailThreadsContract,P as schedulePaymentReminderContract,$e as registerPocketFamilyOfficeBlueprint,Dt as refreshOpenBankingBalancesWorkflow,Vt as processUploadedDocumentWorkflow,lt as pocketFamilyOfficeTenantSample,it as pocketFamilyOfficeTelemetry,Ye as pocketFamilyOfficeKnowledgeSources,Ee as pocketFamilyOfficeContracts,M as pocketFamilyOfficeConnections,w as pocketFamilyOfficeBlueprint,wt as ingestEmailThreadsWorkflow,Ce as getPocketFamilyOfficeConnection,kt as generateOpenBankingOverviewWorkflow,E as generateOpenBankingOverviewContract,mt as generateFinancialSummaryWorkflow,A as generateFinancialSummaryContract,F as example,_ as dispatchFinancialSummaryContract,nt as PocketFamilyOfficeFeature,ct as OPENBANKING_SENSITIVE_FIELDS};
|