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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +65 -33
  2. package/dist/browser/index.js +520 -519
  3. package/dist/browser/operations/index.js +6 -6
  4. package/dist/browser/telemetry.js +4 -4
  5. package/dist/browser/workflows/generate-financial-summary.js +1 -1
  6. package/dist/browser/workflows/generate-openbanking-overview.js +1 -1
  7. package/dist/browser/workflows/index.js +203 -203
  8. package/dist/browser/workflows/ingest-email-threads.js +1 -1
  9. package/dist/browser/workflows/process-uploaded-document.js +1 -1
  10. package/dist/browser/workflows/refresh-openbanking-balances.js +1 -1
  11. package/dist/browser/workflows/sync-openbanking-accounts.js +1 -1
  12. package/dist/browser/workflows/sync-openbanking-transactions.js +1 -1
  13. package/dist/browser/workflows/upcoming-payments-reminder.js +1 -1
  14. package/dist/index.d.ts +4 -4
  15. package/dist/index.js +520 -519
  16. package/dist/node/index.js +520 -519
  17. package/dist/node/operations/index.js +6 -6
  18. package/dist/node/telemetry.js +4 -4
  19. package/dist/node/workflows/generate-financial-summary.js +1 -1
  20. package/dist/node/workflows/generate-openbanking-overview.js +1 -1
  21. package/dist/node/workflows/index.js +203 -203
  22. package/dist/node/workflows/ingest-email-threads.js +1 -1
  23. package/dist/node/workflows/process-uploaded-document.js +1 -1
  24. package/dist/node/workflows/refresh-openbanking-balances.js +1 -1
  25. package/dist/node/workflows/sync-openbanking-accounts.js +1 -1
  26. package/dist/node/workflows/sync-openbanking-transactions.js +1 -1
  27. package/dist/node/workflows/upcoming-payments-reminder.js +1 -1
  28. package/dist/operations/index.d.ts +1 -1
  29. package/dist/operations/index.js +6 -6
  30. package/dist/telemetry.js +4 -4
  31. package/dist/workflows/generate-financial-summary.js +1 -1
  32. package/dist/workflows/generate-openbanking-overview.js +1 -1
  33. package/dist/workflows/index.d.ts +4 -4
  34. package/dist/workflows/index.js +203 -203
  35. package/dist/workflows/ingest-email-threads.js +1 -1
  36. package/dist/workflows/process-uploaded-document.js +1 -1
  37. package/dist/workflows/refresh-openbanking-balances.js +1 -1
  38. package/dist/workflows/sync-openbanking-accounts.js +1 -1
  39. package/dist/workflows/sync-openbanking-transactions.js +1 -1
  40. package/dist/workflows/upcoming-payments-reminder.js +1 -1
  41. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -498,75 +498,6 @@ var example = defineExample({
498
498
  });
499
499
  var example_default = example;
500
500
 
501
- // src/tenant.sample.ts
502
- var pocketFamilyOfficeTenantSample = {
503
- meta: {
504
- id: "tenant-pfo-sample",
505
- tenantId: "tenant.family-office",
506
- appId: "pocket-family-office",
507
- blueprintName: "pocket-family-office.app",
508
- blueprintVersion: "1.0.0",
509
- environment: "production",
510
- version: "1.0.0",
511
- createdAt: new Date().toISOString(),
512
- updatedAt: new Date().toISOString(),
513
- status: "published"
514
- },
515
- featureFlags: [
516
- {
517
- key: "voice-summaries",
518
- enabled: true,
519
- description: "Enable spoken ElevenLabs summaries for daily briefings."
520
- }
521
- ],
522
- integrations: [
523
- { slotId: "primaryLLM", connectionId: "conn-mistral-primary" },
524
- { slotId: "primaryVectorDb", connectionId: "conn-qdrant-finance" },
525
- { slotId: "primaryStorage", connectionId: "conn-gcs-documents" },
526
- { slotId: "primaryOpenBanking", connectionId: "conn-powens-primary" },
527
- { slotId: "emailInbound", connectionId: "conn-gmail-threads" },
528
- { slotId: "emailOutbound", connectionId: "conn-postmark-outbound" },
529
- { slotId: "calendarScheduling", connectionId: "conn-google-calendar" },
530
- { slotId: "voicePlayback", connectionId: "conn-elevenlabs-voice" },
531
- { slotId: "smsNotifications", connectionId: "conn-twilio-sms" },
532
- { slotId: "paymentsProcessing", connectionId: "conn-stripe-recurring" }
533
- ],
534
- knowledge: [
535
- {
536
- spaceKey: "knowledge.financial-docs",
537
- scope: {
538
- workflows: [
539
- "pfo.workflow.process-uploaded-document",
540
- "pfo.workflow.generate-financial-summary"
541
- ]
542
- }
543
- },
544
- {
545
- spaceKey: "knowledge.email-threads",
546
- scope: {
547
- workflows: ["pfo.workflow.ingest-email-threads"]
548
- }
549
- },
550
- {
551
- spaceKey: "knowledge.financial-overview",
552
- scope: {
553
- workflows: [
554
- "pfo.workflow.sync-openbanking-transactions",
555
- "pfo.workflow.refresh-openbanking-balances",
556
- "pfo.workflow.generate-financial-summary",
557
- "pfo.workflow.generate-openbanking-overview"
558
- ]
559
- },
560
- required: false
561
- }
562
- ],
563
- locales: {
564
- defaultLocale: "en",
565
- enabledLocales: ["en"]
566
- },
567
- notes: "Sample tenant configuration for hackathon demos. Replace connection IDs with tenant-specific bindings when provisioning."
568
- };
569
-
570
501
  // src/knowledge/sources.sample.ts
571
502
  var now2 = new Date;
572
503
  var pocketFamilyOfficeKnowledgeSources = [
@@ -636,11 +567,7 @@ var pocketFamilyOfficeKnowledgeSources = [
636
567
  ];
637
568
 
638
569
  // src/operations/index.ts
639
- import {
640
- defineEnum,
641
- defineSchemaModel,
642
- ScalarTypeEnum
643
- } from "@contractspec/lib.schema";
570
+ import { OPENBANKING_TELEMETRY_EVENTS } from "@contractspec/lib.contracts-integrations";
644
571
  import {
645
572
  defineCommand,
646
573
  defineQuery
@@ -650,7 +577,11 @@ import {
650
577
  StabilityEnum as StabilityEnum2,
651
578
  TagsEnum as TagsEnum2
652
579
  } from "@contractspec/lib.contracts-spec/ownership";
653
- import { OPENBANKING_TELEMETRY_EVENTS } from "@contractspec/lib.contracts-integrations";
580
+ import {
581
+ defineEnum,
582
+ defineSchemaModel,
583
+ ScalarTypeEnum
584
+ } from "@contractspec/lib.schema";
654
585
  var SourceEnum = defineEnum("Source", ["upload", "email", "sync"]);
655
586
  var ChannelEnum = defineEnum("Channel", ["email", "sms", "both"]);
656
587
  var PeriodEnum = defineEnum("Period", ["P7d", "P30d", "P90d"]);
@@ -941,135 +872,335 @@ var pocketFamilyOfficeContracts = {
941
872
  "pfo.openbanking.generate-overview": generateOpenBankingOverviewContract
942
873
  };
943
874
 
944
- // src/workflows/process-uploaded-document.ts
945
- import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
875
+ // src/pocket-family-office.feature.ts
876
+ import { defineFeature } from "@contractspec/lib.contracts-spec";
877
+ var PocketFamilyOfficeFeature = defineFeature({
878
+ meta: {
879
+ key: "pocket-family-office",
880
+ version: "1.0.0",
881
+ title: "Pocket Family Office",
882
+ description: "Personal finance automation with document ingestion, open banking, and AI summaries",
883
+ domain: "finance",
884
+ owners: ["@platform.finance"],
885
+ tags: [
886
+ "finance",
887
+ "open-banking",
888
+ "documents",
889
+ "automation",
890
+ "family-office"
891
+ ],
892
+ stability: "experimental"
893
+ },
894
+ operations: [
895
+ { key: "pfo.documents.upload", version: "1.0.0" },
896
+ { key: "pfo.reminders.schedule-payment", version: "1.0.0" },
897
+ { key: "pfo.summary.generate", version: "1.0.0" },
898
+ { key: "pfo.email.sync-threads", version: "1.0.0" },
899
+ { key: "pfo.summary.dispatch", version: "1.0.0" },
900
+ { key: "pfo.openbanking.generate-overview", version: "1.0.0" }
901
+ ],
902
+ events: [],
903
+ presentations: [],
904
+ opToPresentation: [],
905
+ presentationsTargets: [],
906
+ capabilities: {
907
+ provides: [{ key: "pocket-family-office", version: "1.0.0" }],
908
+ requires: [
909
+ { key: "identity", version: "1.0.0" },
910
+ { key: "openbanking", version: "1.0.0" }
911
+ ]
912
+ },
913
+ workflows: [
914
+ { key: "pfo.workflow.sync-openbanking-accounts", version: "1.0.0" },
915
+ { key: "pfo.workflow.sync-openbanking-transactions", version: "1.0.0" },
916
+ { key: "pfo.workflow.refresh-openbanking-balances", version: "1.0.0" },
917
+ { key: "pfo.workflow.generate-openbanking-overview", version: "1.0.0" },
918
+ { key: "pfo.workflow.process-uploaded-document", version: "1.0.0" },
919
+ { key: "pfo.workflow.upcoming-payments-reminder", version: "1.0.0" },
920
+ { key: "pfo.workflow.generate-financial-summary", version: "1.0.0" },
921
+ { key: "pfo.workflow.ingest-email-threads", version: "1.0.0" }
922
+ ],
923
+ knowledge: [
924
+ { key: "knowledge.financial-docs", version: "1.0.0" },
925
+ { key: "knowledge.email-threads", version: "1.0.0" },
926
+ { key: "knowledge.financial-overview", version: "1.0.0" }
927
+ ],
928
+ telemetry: [{ key: "pfo.telemetry", version: "1.0.0" }],
929
+ policies: [{ key: "pfo.policy.tenancy", version: "1.0.0" }],
930
+ integrations: [
931
+ { key: "pfo.integration.openbanking", version: "1.0.0" },
932
+ { key: "pfo.integration.llm", version: "1.0.0" }
933
+ ],
934
+ jobs: [
935
+ { key: "pfo.job.doc-processing", version: "1.0.0" },
936
+ { key: "pfo.job.reminder-dispatch", version: "1.0.0" }
937
+ ],
938
+ docs: [
939
+ "docs.examples.pocket-family-office.goal",
940
+ "docs.examples.pocket-family-office.usage",
941
+ "docs.examples.pocket-family-office.reference"
942
+ ]
943
+ });
944
+
945
+ // src/telemetry.ts
946
+ import {
947
+ OPENBANKING_PII_FIELDS,
948
+ OPENBANKING_TELEMETRY_EVENTS as OPENBANKING_TELEMETRY_EVENTS2
949
+ } from "@contractspec/lib.contracts-integrations";
946
950
  import {
947
951
  OwnersEnum as OwnersEnum3,
948
952
  StabilityEnum as StabilityEnum3,
949
953
  TagsEnum as TagsEnum3
950
- } from "@contractspec/lib.contracts-spec";
951
- var processUploadedDocumentWorkflow = defineWorkflow({
954
+ } from "@contractspec/lib.contracts-spec/ownership";
955
+ var commonProperties = {
956
+ tenantId: {
957
+ type: "string",
958
+ required: true,
959
+ description: "Tenant identifier for multi-tenant isolation."
960
+ },
961
+ appId: {
962
+ type: "string",
963
+ required: true,
964
+ description: "Application identifier associated with the event."
965
+ },
966
+ blueprint: {
967
+ type: "string",
968
+ required: true,
969
+ description: "Blueprint name@version emitting the telemetry."
970
+ },
971
+ configVersion: {
972
+ type: "number",
973
+ required: true,
974
+ description: "Resolved app config version when the event was generated."
975
+ },
976
+ slotId: {
977
+ type: "string",
978
+ required: true,
979
+ description: "Integration slot identifier (e.g., primaryOpenBanking)."
980
+ },
981
+ connectionId: {
982
+ type: "string",
983
+ required: true,
984
+ description: "Integration connection ID used for the sync."
985
+ }
986
+ };
987
+ function piiSafeString(description) {
988
+ return {
989
+ type: "string",
990
+ description,
991
+ pii: false
992
+ };
993
+ }
994
+ var pocketFamilyOfficeTelemetry = {
952
995
  meta: {
953
- key: "pfo.workflow.process-uploaded-document",
996
+ key: "pfo.telemetry",
954
997
  version: "1.0.0",
955
- title: "Process Uploaded Document",
956
- description: "Stores an uploaded invoice/contract, queues ingestion, and records any follow-up reminders.",
998
+ title: "Pocket Family Office Telemetry",
999
+ description: "Operational telemetry for Pocket Family Office workflows, including Powens open banking syncs.",
957
1000
  domain: "finance",
958
1001
  owners: [OwnersEnum3.PlatformFinance],
959
- tags: ["documents", "ingestion", TagsEnum3.Automation],
1002
+ tags: ["open-banking", TagsEnum3.Automation],
960
1003
  stability: StabilityEnum3.Experimental
961
1004
  },
962
- definition: {
963
- entryStepId: "store",
964
- steps: [
965
- {
966
- id: "store",
967
- type: "automation",
968
- label: "Store and Queue Ingestion",
969
- description: "Persist the document to storage and enqueue the knowledge ingestion pipeline.",
970
- action: {
971
- operation: { key: "pfo.documents.upload", version: "1.0.0" }
1005
+ config: {
1006
+ defaultRetentionDays: 180,
1007
+ defaultSamplingRate: 1
1008
+ },
1009
+ events: [
1010
+ {
1011
+ key: OPENBANKING_TELEMETRY_EVENTS2.accountsSynced,
1012
+ version: "1.0.0",
1013
+ semantics: {
1014
+ what: "Open banking account synchronisation completed.",
1015
+ why: "Refresh canonical account metadata for reporting and workflows."
1016
+ },
1017
+ privacy: "internal",
1018
+ properties: {
1019
+ ...commonProperties,
1020
+ syncedCount: {
1021
+ type: "number",
1022
+ description: "Number of accounts synced successfully."
972
1023
  },
973
- requiredIntegrations: ["primaryStorage", "primaryVectorDb"],
974
- retry: {
975
- maxAttempts: 3,
976
- backoff: "exponential",
977
- delayMs: 500
1024
+ failedCount: {
1025
+ type: "number",
1026
+ description: "Number of accounts that failed to sync."
1027
+ },
1028
+ durationMs: {
1029
+ type: "number",
1030
+ description: "Duration of the sync job in milliseconds."
978
1031
  }
979
- },
980
- {
981
- id: "review",
982
- type: "human",
983
- label: "Optional Human Classification",
984
- description: "Finance lead can categorise the document while ingestion completes."
985
1032
  }
986
- ],
987
- transitions: [
988
- {
989
- from: "store",
990
- to: "review"
1033
+ },
1034
+ {
1035
+ key: OPENBANKING_TELEMETRY_EVENTS2.transactionsSynced,
1036
+ version: "1.0.0",
1037
+ semantics: {
1038
+ what: "Open banking transaction synchronisation completed.",
1039
+ why: "Keep canonical transaction ledger in sync for analytics."
1040
+ },
1041
+ privacy: "internal",
1042
+ properties: {
1043
+ ...commonProperties,
1044
+ accountId: {
1045
+ type: "string",
1046
+ description: "Bank account identifier used during the sync.",
1047
+ pii: false
1048
+ },
1049
+ syncedCount: {
1050
+ type: "number",
1051
+ description: "Number of transactions synced successfully."
1052
+ },
1053
+ failedCount: {
1054
+ type: "number",
1055
+ description: "Number of transactions that failed to sync."
1056
+ },
1057
+ from: {
1058
+ type: "timestamp",
1059
+ description: "Start timestamp for the sync window."
1060
+ },
1061
+ to: {
1062
+ type: "timestamp",
1063
+ description: "End timestamp for the sync window."
1064
+ }
991
1065
  }
992
- ]
993
- }
994
- });
1066
+ },
1067
+ {
1068
+ key: OPENBANKING_TELEMETRY_EVENTS2.balancesRefreshed,
1069
+ version: "1.0.0",
1070
+ semantics: {
1071
+ what: "Open banking balances refreshed.",
1072
+ why: "Provide accurate cash position for dashboards and alerts."
1073
+ },
1074
+ privacy: "internal",
1075
+ properties: {
1076
+ ...commonProperties,
1077
+ accountId: piiSafeString("Bank account identifier."),
1078
+ balanceTypes: {
1079
+ type: "json",
1080
+ description: "Balance types included in the refresh."
1081
+ },
1082
+ refreshedAt: {
1083
+ type: "timestamp",
1084
+ description: "Timestamp when balances were refreshed."
1085
+ }
1086
+ }
1087
+ },
1088
+ {
1089
+ key: OPENBANKING_TELEMETRY_EVENTS2.overviewGenerated,
1090
+ version: "1.0.0",
1091
+ semantics: {
1092
+ what: "Derived financial overview generated.",
1093
+ why: "Persist cashflow and category summaries into knowledge space."
1094
+ },
1095
+ privacy: "internal",
1096
+ properties: {
1097
+ ...commonProperties,
1098
+ knowledgeEntryId: piiSafeString("Identifier of the knowledge document containing the overview."),
1099
+ period: {
1100
+ type: "string",
1101
+ description: "Aggregation period used (week, month, quarter)."
1102
+ },
1103
+ periodStart: {
1104
+ type: "timestamp",
1105
+ description: "Start timestamp for the aggregation window."
1106
+ },
1107
+ periodEnd: {
1108
+ type: "timestamp",
1109
+ description: "End timestamp for the aggregation window."
1110
+ }
1111
+ },
1112
+ tags: ["knowledge", "analytics"]
1113
+ }
1114
+ ]
1115
+ };
1116
+ var OPENBANKING_SENSITIVE_FIELDS = OPENBANKING_PII_FIELDS;
995
1117
 
996
- // src/workflows/upcoming-payments-reminder.ts
997
- import { defineWorkflow as defineWorkflow2 } from "@contractspec/lib.contracts-spec/workflow";
998
- import {
999
- OwnersEnum as OwnersEnum4,
1000
- StabilityEnum as StabilityEnum4,
1001
- TagsEnum as TagsEnum4
1002
- } from "@contractspec/lib.contracts-spec";
1003
- var upcomingPaymentsReminderWorkflow = defineWorkflow2({
1118
+ // src/tenant.sample.ts
1119
+ var pocketFamilyOfficeTenantSample = {
1004
1120
  meta: {
1005
- key: "pfo.workflow.upcoming-payments-reminder",
1121
+ id: "tenant-pfo-sample",
1122
+ tenantId: "tenant.family-office",
1123
+ appId: "pocket-family-office",
1124
+ blueprintName: "pocket-family-office.app",
1125
+ blueprintVersion: "1.0.0",
1126
+ environment: "production",
1006
1127
  version: "1.0.0",
1007
- title: "Schedule Upcoming Payment Reminder",
1008
- description: "Collects payment metadata and schedules multi-channel reminders for bills that are due soon.",
1009
- domain: "finance",
1010
- owners: [OwnersEnum4.PlatformFinance],
1011
- tags: ["payments", "reminders", TagsEnum4.Automation],
1012
- stability: StabilityEnum4.Beta
1128
+ createdAt: new Date().toISOString(),
1129
+ updatedAt: new Date().toISOString(),
1130
+ status: "published"
1013
1131
  },
1014
- definition: {
1015
- entryStepId: "collect",
1016
- steps: [
1017
- {
1018
- id: "collect",
1019
- type: "human",
1020
- label: "Review Upcoming Bill",
1021
- description: "Confirm amount, due date, and preferred delivery channels before scheduling reminder."
1022
- },
1023
- {
1024
- id: "schedule",
1025
- type: "automation",
1026
- label: "Schedule Reminder",
1027
- action: {
1028
- operation: {
1029
- key: "pfo.reminders.schedule-payment",
1030
- version: "1.0.0"
1031
- }
1032
- },
1033
- requiredIntegrations: [
1034
- "emailOutbound",
1035
- "smsNotifications",
1036
- "calendarScheduling"
1037
- ],
1038
- retry: {
1039
- maxAttempts: 2,
1040
- backoff: "linear",
1041
- delayMs: 1000
1042
- }
1132
+ featureFlags: [
1133
+ {
1134
+ key: "voice-summaries",
1135
+ enabled: true,
1136
+ description: "Enable spoken ElevenLabs summaries for daily briefings."
1137
+ }
1138
+ ],
1139
+ integrations: [
1140
+ { slotId: "primaryLLM", connectionId: "conn-mistral-primary" },
1141
+ { slotId: "primaryVectorDb", connectionId: "conn-qdrant-finance" },
1142
+ { slotId: "primaryStorage", connectionId: "conn-gcs-documents" },
1143
+ { slotId: "primaryOpenBanking", connectionId: "conn-powens-primary" },
1144
+ { slotId: "emailInbound", connectionId: "conn-gmail-threads" },
1145
+ { slotId: "emailOutbound", connectionId: "conn-postmark-outbound" },
1146
+ { slotId: "calendarScheduling", connectionId: "conn-google-calendar" },
1147
+ { slotId: "voicePlayback", connectionId: "conn-elevenlabs-voice" },
1148
+ { slotId: "smsNotifications", connectionId: "conn-twilio-sms" },
1149
+ { slotId: "paymentsProcessing", connectionId: "conn-stripe-recurring" }
1150
+ ],
1151
+ knowledge: [
1152
+ {
1153
+ spaceKey: "knowledge.financial-docs",
1154
+ scope: {
1155
+ workflows: [
1156
+ "pfo.workflow.process-uploaded-document",
1157
+ "pfo.workflow.generate-financial-summary"
1158
+ ]
1043
1159
  }
1044
- ],
1045
- transitions: [
1046
- {
1047
- from: "collect",
1048
- to: "schedule",
1049
- condition: "output?.confirmed === true",
1050
- label: "Reminder confirmed"
1160
+ },
1161
+ {
1162
+ spaceKey: "knowledge.email-threads",
1163
+ scope: {
1164
+ workflows: ["pfo.workflow.ingest-email-threads"]
1051
1165
  }
1052
- ]
1053
- }
1054
- });
1166
+ },
1167
+ {
1168
+ spaceKey: "knowledge.financial-overview",
1169
+ scope: {
1170
+ workflows: [
1171
+ "pfo.workflow.sync-openbanking-transactions",
1172
+ "pfo.workflow.refresh-openbanking-balances",
1173
+ "pfo.workflow.generate-financial-summary",
1174
+ "pfo.workflow.generate-openbanking-overview"
1175
+ ]
1176
+ },
1177
+ required: false
1178
+ }
1179
+ ],
1180
+ locales: {
1181
+ defaultLocale: "en",
1182
+ enabledLocales: ["en"]
1183
+ },
1184
+ notes: "Sample tenant configuration for hackathon demos. Replace connection IDs with tenant-specific bindings when provisioning."
1185
+ };
1055
1186
 
1056
1187
  // src/workflows/generate-financial-summary.ts
1057
- import { defineWorkflow as defineWorkflow3 } from "@contractspec/lib.contracts-spec/workflow";
1058
1188
  import {
1059
- OwnersEnum as OwnersEnum5,
1060
- StabilityEnum as StabilityEnum5,
1061
- TagsEnum as TagsEnum5
1189
+ OwnersEnum as OwnersEnum4,
1190
+ StabilityEnum as StabilityEnum4,
1191
+ TagsEnum as TagsEnum4
1062
1192
  } from "@contractspec/lib.contracts-spec";
1063
- var generateFinancialSummaryWorkflow = defineWorkflow3({
1193
+ import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
1194
+ var generateFinancialSummaryWorkflow = defineWorkflow({
1064
1195
  meta: {
1065
1196
  key: "pfo.workflow.generate-financial-summary",
1066
1197
  version: "1.0.0",
1067
1198
  title: "Generate Financial Summary",
1068
1199
  description: "Retrieves the latest financial signals, generates an AI summary, and optionally distributes it by voice or email.",
1069
1200
  domain: "finance",
1070
- owners: [OwnersEnum5.PlatformFinance],
1071
- tags: ["summary", "ai", TagsEnum5.Automation],
1072
- stability: StabilityEnum5.Beta
1201
+ owners: [OwnersEnum4.PlatformFinance],
1202
+ tags: ["summary", "ai", TagsEnum4.Automation],
1203
+ stability: StabilityEnum4.Beta
1073
1204
  },
1074
1205
  definition: {
1075
1206
  entryStepId: "summarise",
@@ -1109,36 +1240,86 @@ var generateFinancialSummaryWorkflow = defineWorkflow3({
1109
1240
  }
1110
1241
  });
1111
1242
 
1112
- // src/workflows/ingest-email-threads.ts
1113
- import { defineWorkflow as defineWorkflow4 } from "@contractspec/lib.contracts-spec/workflow";
1243
+ // src/workflows/generate-openbanking-overview.ts
1114
1244
  import {
1115
- OwnersEnum as OwnersEnum6,
1116
- StabilityEnum as StabilityEnum6,
1117
- TagsEnum as TagsEnum6
1245
+ OwnersEnum as OwnersEnum5,
1246
+ StabilityEnum as StabilityEnum5,
1247
+ TagsEnum as TagsEnum5
1118
1248
  } from "@contractspec/lib.contracts-spec";
1119
- var ingestEmailThreadsWorkflow = defineWorkflow4({
1249
+ import { defineWorkflow as defineWorkflow2 } from "@contractspec/lib.contracts-spec/workflow";
1250
+ var OPEN_BANKING_CAPABILITIES = [
1251
+ { key: "openbanking.accounts.read", version: "1.0.0" },
1252
+ { key: "openbanking.transactions.read", version: "1.0.0" },
1253
+ { key: "openbanking.balances.read", version: "1.0.0" }
1254
+ ];
1255
+ var generateOpenBankingOverviewWorkflow = defineWorkflow2({
1120
1256
  meta: {
1121
- key: "pfo.workflow.ingest-email-threads",
1257
+ key: "pfo.workflow.generate-openbanking-overview",
1122
1258
  version: "1.0.0",
1123
- title: "Ingest Email Threads",
1124
- description: "Synchronises Gmail threads tagged with finance labels and indexes them into operational knowledge spaces.",
1125
- domain: "communications",
1126
- owners: [OwnersEnum6.PlatformMessaging],
1127
- tags: ["gmail", "knowledge", TagsEnum6.Automation],
1128
- stability: StabilityEnum6.Experimental
1259
+ title: "Generate Open Banking Overview",
1260
+ description: "Produces a derived financial overview and stores it in the operational knowledge space.",
1261
+ domain: "finance",
1262
+ owners: [OwnersEnum5.PlatformFinance],
1263
+ tags: ["open-banking", "summary", TagsEnum5.Automation],
1264
+ stability: StabilityEnum5.Experimental
1129
1265
  },
1130
1266
  definition: {
1131
- entryStepId: "sync",
1267
+ entryStepId: "generate-overview",
1132
1268
  steps: [
1133
1269
  {
1134
- id: "sync",
1270
+ id: "generate-overview",
1135
1271
  type: "automation",
1136
- label: "Sync Gmail Threads",
1137
- description: "Fetches Gmail threads and transforms them into knowledge fragments before vector indexing.",
1272
+ label: "Generate Overview",
1273
+ description: "Aggregate balances, cashflow, and category breakdowns into a knowledge entry.",
1138
1274
  action: {
1139
- operation: { key: "pfo.email.sync-threads", version: "1.0.0" }
1275
+ operation: {
1276
+ key: "pfo.openbanking.generate-overview",
1277
+ version: "1.0.0"
1278
+ }
1140
1279
  },
1141
- requiredIntegrations: ["emailInbound", "primaryVectorDb"],
1280
+ requiredIntegrations: ["primaryOpenBanking"],
1281
+ requiredCapabilities: OPEN_BANKING_CAPABILITIES,
1282
+ retry: {
1283
+ maxAttempts: 3,
1284
+ backoff: "exponential",
1285
+ delayMs: 1500
1286
+ }
1287
+ }
1288
+ ],
1289
+ transitions: []
1290
+ }
1291
+ });
1292
+
1293
+ // src/workflows/ingest-email-threads.ts
1294
+ import {
1295
+ OwnersEnum as OwnersEnum6,
1296
+ StabilityEnum as StabilityEnum6,
1297
+ TagsEnum as TagsEnum6
1298
+ } from "@contractspec/lib.contracts-spec";
1299
+ import { defineWorkflow as defineWorkflow3 } from "@contractspec/lib.contracts-spec/workflow";
1300
+ var ingestEmailThreadsWorkflow = defineWorkflow3({
1301
+ meta: {
1302
+ key: "pfo.workflow.ingest-email-threads",
1303
+ version: "1.0.0",
1304
+ title: "Ingest Email Threads",
1305
+ description: "Synchronises Gmail threads tagged with finance labels and indexes them into operational knowledge spaces.",
1306
+ domain: "communications",
1307
+ owners: [OwnersEnum6.PlatformMessaging],
1308
+ tags: ["gmail", "knowledge", TagsEnum6.Automation],
1309
+ stability: StabilityEnum6.Experimental
1310
+ },
1311
+ definition: {
1312
+ entryStepId: "sync",
1313
+ steps: [
1314
+ {
1315
+ id: "sync",
1316
+ type: "automation",
1317
+ label: "Sync Gmail Threads",
1318
+ description: "Fetches Gmail threads and transforms them into knowledge fragments before vector indexing.",
1319
+ action: {
1320
+ operation: { key: "pfo.email.sync-threads", version: "1.0.0" }
1321
+ },
1322
+ requiredIntegrations: ["emailInbound", "primaryVectorDb"],
1142
1323
  retry: {
1143
1324
  maxAttempts: 3,
1144
1325
  backoff: "exponential",
@@ -1163,165 +1344,155 @@ var ingestEmailThreadsWorkflow = defineWorkflow4({
1163
1344
  }
1164
1345
  });
1165
1346
 
1166
- // src/workflows/sync-openbanking-accounts.ts
1167
- import { defineWorkflow as defineWorkflow5 } from "@contractspec/lib.contracts-spec/workflow";
1347
+ // src/workflows/process-uploaded-document.ts
1168
1348
  import {
1169
1349
  OwnersEnum as OwnersEnum7,
1170
1350
  StabilityEnum as StabilityEnum7,
1171
1351
  TagsEnum as TagsEnum7
1172
1352
  } from "@contractspec/lib.contracts-spec";
1173
- var ACCOUNT_CAPABILITY = {
1174
- key: "openbanking.accounts.read",
1175
- version: "1.0.0"
1176
- };
1177
- var syncOpenBankingAccountsWorkflow = defineWorkflow5({
1353
+ import { defineWorkflow as defineWorkflow4 } from "@contractspec/lib.contracts-spec/workflow";
1354
+ var processUploadedDocumentWorkflow = defineWorkflow4({
1178
1355
  meta: {
1179
- key: "pfo.workflow.sync-openbanking-accounts",
1356
+ key: "pfo.workflow.process-uploaded-document",
1180
1357
  version: "1.0.0",
1181
- title: "Synchronise Open Banking Accounts",
1182
- description: "Validates Powens connectivity and synchronises bank account metadata into the canonical ledger.",
1358
+ title: "Process Uploaded Document",
1359
+ description: "Stores an uploaded invoice/contract, queues ingestion, and records any follow-up reminders.",
1183
1360
  domain: "finance",
1184
1361
  owners: [OwnersEnum7.PlatformFinance],
1185
- tags: ["open-banking", "powens", TagsEnum7.Automation],
1362
+ tags: ["documents", "ingestion", TagsEnum7.Automation],
1186
1363
  stability: StabilityEnum7.Experimental
1187
1364
  },
1188
1365
  definition: {
1189
- entryStepId: "sync-accounts",
1366
+ entryStepId: "store",
1190
1367
  steps: [
1191
1368
  {
1192
- id: "sync-accounts",
1369
+ id: "store",
1193
1370
  type: "automation",
1194
- label: "Sync Accounts",
1195
- description: "Refresh linked bank accounts via Powens and upsert canonical BankAccount records.",
1371
+ label: "Store and Queue Ingestion",
1372
+ description: "Persist the document to storage and enqueue the knowledge ingestion pipeline.",
1196
1373
  action: {
1197
- operation: { key: "openbanking.accounts.sync", version: "1.0.0" }
1374
+ operation: { key: "pfo.documents.upload", version: "1.0.0" }
1198
1375
  },
1199
- requiredIntegrations: ["primaryOpenBanking"],
1200
- requiredCapabilities: [ACCOUNT_CAPABILITY],
1376
+ requiredIntegrations: ["primaryStorage", "primaryVectorDb"],
1201
1377
  retry: {
1202
1378
  maxAttempts: 3,
1203
1379
  backoff: "exponential",
1204
- delayMs: 1000
1380
+ delayMs: 500
1205
1381
  }
1206
1382
  },
1207
1383
  {
1208
- id: "fetch-accounts",
1209
- type: "automation",
1210
- label: "Fetch Accounts",
1211
- description: "Retrieve the latest canonical account snapshot for downstream consumers.",
1212
- action: {
1213
- operation: { key: "openbanking.accounts.list", version: "1.0.0" }
1214
- },
1215
- requiredIntegrations: ["primaryOpenBanking"],
1216
- requiredCapabilities: [ACCOUNT_CAPABILITY],
1217
- retry: {
1218
- maxAttempts: 2,
1219
- backoff: "linear",
1220
- delayMs: 750
1221
- }
1384
+ id: "review",
1385
+ type: "human",
1386
+ label: "Optional Human Classification",
1387
+ description: "Finance lead can categorise the document while ingestion completes."
1222
1388
  }
1223
1389
  ],
1224
- transitions: [{ from: "sync-accounts", to: "fetch-accounts" }]
1390
+ transitions: [
1391
+ {
1392
+ from: "store",
1393
+ to: "review"
1394
+ }
1395
+ ]
1225
1396
  }
1226
1397
  });
1227
1398
 
1228
- // src/workflows/sync-openbanking-transactions.ts
1229
- import { defineWorkflow as defineWorkflow6 } from "@contractspec/lib.contracts-spec/workflow";
1399
+ // src/workflows/refresh-openbanking-balances.ts
1230
1400
  import {
1231
1401
  OwnersEnum as OwnersEnum8,
1232
1402
  StabilityEnum as StabilityEnum8,
1233
1403
  TagsEnum as TagsEnum8
1234
1404
  } from "@contractspec/lib.contracts-spec";
1235
- var TRANSACTION_CAPABILITY = {
1236
- key: "openbanking.transactions.read",
1405
+ import { defineWorkflow as defineWorkflow5 } from "@contractspec/lib.contracts-spec/workflow";
1406
+ var BALANCE_CAPABILITY = {
1407
+ key: "openbanking.balances.read",
1237
1408
  version: "1.0.0"
1238
1409
  };
1239
- var syncOpenBankingTransactionsWorkflow = defineWorkflow6({
1410
+ var refreshOpenBankingBalancesWorkflow = defineWorkflow5({
1240
1411
  meta: {
1241
- key: "pfo.workflow.sync-openbanking-transactions",
1412
+ key: "pfo.workflow.refresh-openbanking-balances",
1242
1413
  version: "1.0.0",
1243
- title: "Synchronise Open Banking Transactions",
1244
- description: "Fetches recent transactions from Powens for each linked account and stores them in the canonical ledger.",
1414
+ title: "Refresh Open Banking Balances",
1415
+ description: "Refreshes balances for synced accounts to surface the latest cash positions in dashboards.",
1245
1416
  domain: "finance",
1246
1417
  owners: [OwnersEnum8.PlatformFinance],
1247
1418
  tags: ["open-banking", "powens", TagsEnum8.Automation],
1248
1419
  stability: StabilityEnum8.Experimental
1249
1420
  },
1250
1421
  definition: {
1251
- entryStepId: "sync-transactions",
1422
+ entryStepId: "refresh-balances",
1252
1423
  steps: [
1253
1424
  {
1254
- id: "sync-transactions",
1425
+ id: "refresh-balances",
1255
1426
  type: "automation",
1256
- label: "Sync Transactions",
1257
- description: "Call the Powens provider to pull incremental transactions for active accounts.",
1427
+ label: "Refresh Balances",
1428
+ description: "Trigger the Powens provider to obtain current and available balances.",
1258
1429
  action: {
1259
- operation: { key: "openbanking.transactions.sync", version: "1.0.0" }
1430
+ operation: { key: "openbanking.balances.refresh", version: "1.0.0" }
1260
1431
  },
1261
1432
  requiredIntegrations: ["primaryOpenBanking"],
1262
- requiredCapabilities: [TRANSACTION_CAPABILITY],
1433
+ requiredCapabilities: [BALANCE_CAPABILITY],
1263
1434
  retry: {
1264
- maxAttempts: 4,
1435
+ maxAttempts: 3,
1265
1436
  backoff: "exponential",
1266
- delayMs: 1500
1437
+ delayMs: 1000
1267
1438
  }
1268
1439
  },
1269
1440
  {
1270
- id: "list-transactions",
1441
+ id: "fetch-balances",
1271
1442
  type: "automation",
1272
- label: "List Transactions",
1273
- description: "Retrieve the canonical transaction list for reporting and downstream analytics.",
1443
+ label: "Fetch Balances",
1444
+ description: "Load the canonical balance snapshots for downstream workflows and dashboards.",
1274
1445
  action: {
1275
- operation: { key: "openbanking.transactions.list", version: "1.0.0" }
1446
+ operation: { key: "openbanking.balances.get", version: "1.0.0" }
1276
1447
  },
1277
1448
  requiredIntegrations: ["primaryOpenBanking"],
1278
- requiredCapabilities: [TRANSACTION_CAPABILITY],
1449
+ requiredCapabilities: [BALANCE_CAPABILITY],
1279
1450
  retry: {
1280
1451
  maxAttempts: 2,
1281
1452
  backoff: "linear",
1282
- delayMs: 1000
1453
+ delayMs: 750
1283
1454
  }
1284
1455
  }
1285
1456
  ],
1286
- transitions: [{ from: "sync-transactions", to: "list-transactions" }]
1457
+ transitions: [{ from: "refresh-balances", to: "fetch-balances" }]
1287
1458
  }
1288
1459
  });
1289
1460
 
1290
- // src/workflows/refresh-openbanking-balances.ts
1291
- import { defineWorkflow as defineWorkflow7 } from "@contractspec/lib.contracts-spec/workflow";
1461
+ // src/workflows/sync-openbanking-accounts.ts
1292
1462
  import {
1293
1463
  OwnersEnum as OwnersEnum9,
1294
1464
  StabilityEnum as StabilityEnum9,
1295
1465
  TagsEnum as TagsEnum9
1296
1466
  } from "@contractspec/lib.contracts-spec";
1297
- var BALANCE_CAPABILITY = {
1298
- key: "openbanking.balances.read",
1467
+ import { defineWorkflow as defineWorkflow6 } from "@contractspec/lib.contracts-spec/workflow";
1468
+ var ACCOUNT_CAPABILITY = {
1469
+ key: "openbanking.accounts.read",
1299
1470
  version: "1.0.0"
1300
1471
  };
1301
- var refreshOpenBankingBalancesWorkflow = defineWorkflow7({
1472
+ var syncOpenBankingAccountsWorkflow = defineWorkflow6({
1302
1473
  meta: {
1303
- key: "pfo.workflow.refresh-openbanking-balances",
1474
+ key: "pfo.workflow.sync-openbanking-accounts",
1304
1475
  version: "1.0.0",
1305
- title: "Refresh Open Banking Balances",
1306
- description: "Refreshes balances for synced accounts to surface the latest cash positions in dashboards.",
1476
+ title: "Synchronise Open Banking Accounts",
1477
+ description: "Validates Powens connectivity and synchronises bank account metadata into the canonical ledger.",
1307
1478
  domain: "finance",
1308
1479
  owners: [OwnersEnum9.PlatformFinance],
1309
1480
  tags: ["open-banking", "powens", TagsEnum9.Automation],
1310
1481
  stability: StabilityEnum9.Experimental
1311
1482
  },
1312
1483
  definition: {
1313
- entryStepId: "refresh-balances",
1484
+ entryStepId: "sync-accounts",
1314
1485
  steps: [
1315
1486
  {
1316
- id: "refresh-balances",
1487
+ id: "sync-accounts",
1317
1488
  type: "automation",
1318
- label: "Refresh Balances",
1319
- description: "Trigger the Powens provider to obtain current and available balances.",
1489
+ label: "Sync Accounts",
1490
+ description: "Refresh linked bank accounts via Powens and upsert canonical BankAccount records.",
1320
1491
  action: {
1321
- operation: { key: "openbanking.balances.refresh", version: "1.0.0" }
1492
+ operation: { key: "openbanking.accounts.sync", version: "1.0.0" }
1322
1493
  },
1323
1494
  requiredIntegrations: ["primaryOpenBanking"],
1324
- requiredCapabilities: [BALANCE_CAPABILITY],
1495
+ requiredCapabilities: [ACCOUNT_CAPABILITY],
1325
1496
  retry: {
1326
1497
  maxAttempts: 3,
1327
1498
  backoff: "exponential",
@@ -1329,15 +1500,15 @@ var refreshOpenBankingBalancesWorkflow = defineWorkflow7({
1329
1500
  }
1330
1501
  },
1331
1502
  {
1332
- id: "fetch-balances",
1503
+ id: "fetch-accounts",
1333
1504
  type: "automation",
1334
- label: "Fetch Balances",
1335
- description: "Load the canonical balance snapshots for downstream workflows and dashboards.",
1505
+ label: "Fetch Accounts",
1506
+ description: "Retrieve the latest canonical account snapshot for downstream consumers.",
1336
1507
  action: {
1337
- operation: { key: "openbanking.balances.get", version: "1.0.0" }
1508
+ operation: { key: "openbanking.accounts.list", version: "1.0.0" }
1338
1509
  },
1339
1510
  requiredIntegrations: ["primaryOpenBanking"],
1340
- requiredCapabilities: [BALANCE_CAPABILITY],
1511
+ requiredCapabilities: [ACCOUNT_CAPABILITY],
1341
1512
  retry: {
1342
1513
  maxAttempts: 2,
1343
1514
  backoff: "linear",
@@ -1345,300 +1516,130 @@ var refreshOpenBankingBalancesWorkflow = defineWorkflow7({
1345
1516
  }
1346
1517
  }
1347
1518
  ],
1348
- transitions: [{ from: "refresh-balances", to: "fetch-balances" }]
1519
+ transitions: [{ from: "sync-accounts", to: "fetch-accounts" }]
1349
1520
  }
1350
1521
  });
1351
1522
 
1352
- // src/workflows/generate-openbanking-overview.ts
1353
- import { defineWorkflow as defineWorkflow8 } from "@contractspec/lib.contracts-spec/workflow";
1523
+ // src/workflows/sync-openbanking-transactions.ts
1354
1524
  import {
1355
1525
  OwnersEnum as OwnersEnum10,
1356
1526
  StabilityEnum as StabilityEnum10,
1357
1527
  TagsEnum as TagsEnum10
1358
1528
  } from "@contractspec/lib.contracts-spec";
1359
- var OPEN_BANKING_CAPABILITIES = [
1360
- { key: "openbanking.accounts.read", version: "1.0.0" },
1361
- { key: "openbanking.transactions.read", version: "1.0.0" },
1362
- { key: "openbanking.balances.read", version: "1.0.0" }
1363
- ];
1364
- var generateOpenBankingOverviewWorkflow = defineWorkflow8({
1529
+ import { defineWorkflow as defineWorkflow7 } from "@contractspec/lib.contracts-spec/workflow";
1530
+ var TRANSACTION_CAPABILITY = {
1531
+ key: "openbanking.transactions.read",
1532
+ version: "1.0.0"
1533
+ };
1534
+ var syncOpenBankingTransactionsWorkflow = defineWorkflow7({
1365
1535
  meta: {
1366
- key: "pfo.workflow.generate-openbanking-overview",
1536
+ key: "pfo.workflow.sync-openbanking-transactions",
1367
1537
  version: "1.0.0",
1368
- title: "Generate Open Banking Overview",
1369
- description: "Produces a derived financial overview and stores it in the operational knowledge space.",
1538
+ title: "Synchronise Open Banking Transactions",
1539
+ description: "Fetches recent transactions from Powens for each linked account and stores them in the canonical ledger.",
1370
1540
  domain: "finance",
1371
1541
  owners: [OwnersEnum10.PlatformFinance],
1372
- tags: ["open-banking", "summary", TagsEnum10.Automation],
1542
+ tags: ["open-banking", "powens", TagsEnum10.Automation],
1373
1543
  stability: StabilityEnum10.Experimental
1374
1544
  },
1375
1545
  definition: {
1376
- entryStepId: "generate-overview",
1546
+ entryStepId: "sync-transactions",
1377
1547
  steps: [
1378
1548
  {
1379
- id: "generate-overview",
1549
+ id: "sync-transactions",
1380
1550
  type: "automation",
1381
- label: "Generate Overview",
1382
- description: "Aggregate balances, cashflow, and category breakdowns into a knowledge entry.",
1551
+ label: "Sync Transactions",
1552
+ description: "Call the Powens provider to pull incremental transactions for active accounts.",
1383
1553
  action: {
1384
- operation: {
1385
- key: "pfo.openbanking.generate-overview",
1386
- version: "1.0.0"
1387
- }
1554
+ operation: { key: "openbanking.transactions.sync", version: "1.0.0" }
1388
1555
  },
1389
1556
  requiredIntegrations: ["primaryOpenBanking"],
1390
- requiredCapabilities: OPEN_BANKING_CAPABILITIES,
1557
+ requiredCapabilities: [TRANSACTION_CAPABILITY],
1391
1558
  retry: {
1392
- maxAttempts: 3,
1559
+ maxAttempts: 4,
1393
1560
  backoff: "exponential",
1394
1561
  delayMs: 1500
1395
1562
  }
1563
+ },
1564
+ {
1565
+ id: "list-transactions",
1566
+ type: "automation",
1567
+ label: "List Transactions",
1568
+ description: "Retrieve the canonical transaction list for reporting and downstream analytics.",
1569
+ action: {
1570
+ operation: { key: "openbanking.transactions.list", version: "1.0.0" }
1571
+ },
1572
+ requiredIntegrations: ["primaryOpenBanking"],
1573
+ requiredCapabilities: [TRANSACTION_CAPABILITY],
1574
+ retry: {
1575
+ maxAttempts: 2,
1576
+ backoff: "linear",
1577
+ delayMs: 1000
1578
+ }
1396
1579
  }
1397
1580
  ],
1398
- transitions: []
1581
+ transitions: [{ from: "sync-transactions", to: "list-transactions" }]
1399
1582
  }
1400
1583
  });
1401
- // src/telemetry.ts
1584
+
1585
+ // src/workflows/upcoming-payments-reminder.ts
1402
1586
  import {
1403
1587
  OwnersEnum as OwnersEnum11,
1404
1588
  StabilityEnum as StabilityEnum11,
1405
1589
  TagsEnum as TagsEnum11
1406
- } from "@contractspec/lib.contracts-spec/ownership";
1407
- import {
1408
- OPENBANKING_PII_FIELDS,
1409
- OPENBANKING_TELEMETRY_EVENTS as OPENBANKING_TELEMETRY_EVENTS2
1410
- } from "@contractspec/lib.contracts-integrations";
1411
- var commonProperties = {
1412
- tenantId: {
1413
- type: "string",
1414
- required: true,
1415
- description: "Tenant identifier for multi-tenant isolation."
1416
- },
1417
- appId: {
1418
- type: "string",
1419
- required: true,
1420
- description: "Application identifier associated with the event."
1421
- },
1422
- blueprint: {
1423
- type: "string",
1424
- required: true,
1425
- description: "Blueprint name@version emitting the telemetry."
1426
- },
1427
- configVersion: {
1428
- type: "number",
1429
- required: true,
1430
- description: "Resolved app config version when the event was generated."
1431
- },
1432
- slotId: {
1433
- type: "string",
1434
- required: true,
1435
- description: "Integration slot identifier (e.g., primaryOpenBanking)."
1436
- },
1437
- connectionId: {
1438
- type: "string",
1439
- required: true,
1440
- description: "Integration connection ID used for the sync."
1441
- }
1442
- };
1443
- function piiSafeString(description) {
1444
- return {
1445
- type: "string",
1446
- description,
1447
- pii: false
1448
- };
1449
- }
1450
- var pocketFamilyOfficeTelemetry = {
1590
+ } from "@contractspec/lib.contracts-spec";
1591
+ import { defineWorkflow as defineWorkflow8 } from "@contractspec/lib.contracts-spec/workflow";
1592
+ var upcomingPaymentsReminderWorkflow = defineWorkflow8({
1451
1593
  meta: {
1452
- key: "pfo.telemetry",
1594
+ key: "pfo.workflow.upcoming-payments-reminder",
1453
1595
  version: "1.0.0",
1454
- title: "Pocket Family Office Telemetry",
1455
- description: "Operational telemetry for Pocket Family Office workflows, including Powens open banking syncs.",
1596
+ title: "Schedule Upcoming Payment Reminder",
1597
+ description: "Collects payment metadata and schedules multi-channel reminders for bills that are due soon.",
1456
1598
  domain: "finance",
1457
1599
  owners: [OwnersEnum11.PlatformFinance],
1458
- tags: ["open-banking", TagsEnum11.Automation],
1459
- stability: StabilityEnum11.Experimental
1460
- },
1461
- config: {
1462
- defaultRetentionDays: 180,
1463
- defaultSamplingRate: 1
1600
+ tags: ["payments", "reminders", TagsEnum11.Automation],
1601
+ stability: StabilityEnum11.Beta
1464
1602
  },
1465
- events: [
1466
- {
1467
- key: OPENBANKING_TELEMETRY_EVENTS2.accountsSynced,
1468
- version: "1.0.0",
1469
- semantics: {
1470
- what: "Open banking account synchronisation completed.",
1471
- why: "Refresh canonical account metadata for reporting and workflows."
1472
- },
1473
- privacy: "internal",
1474
- properties: {
1475
- ...commonProperties,
1476
- syncedCount: {
1477
- type: "number",
1478
- description: "Number of accounts synced successfully."
1479
- },
1480
- failedCount: {
1481
- type: "number",
1482
- description: "Number of accounts that failed to sync."
1483
- },
1484
- durationMs: {
1485
- type: "number",
1486
- description: "Duration of the sync job in milliseconds."
1487
- }
1488
- }
1489
- },
1490
- {
1491
- key: OPENBANKING_TELEMETRY_EVENTS2.transactionsSynced,
1492
- version: "1.0.0",
1493
- semantics: {
1494
- what: "Open banking transaction synchronisation completed.",
1495
- why: "Keep canonical transaction ledger in sync for analytics."
1496
- },
1497
- privacy: "internal",
1498
- properties: {
1499
- ...commonProperties,
1500
- accountId: {
1501
- type: "string",
1502
- description: "Bank account identifier used during the sync.",
1503
- pii: false
1504
- },
1505
- syncedCount: {
1506
- type: "number",
1507
- description: "Number of transactions synced successfully."
1508
- },
1509
- failedCount: {
1510
- type: "number",
1511
- description: "Number of transactions that failed to sync."
1512
- },
1513
- from: {
1514
- type: "timestamp",
1515
- description: "Start timestamp for the sync window."
1516
- },
1517
- to: {
1518
- type: "timestamp",
1519
- description: "End timestamp for the sync window."
1520
- }
1521
- }
1522
- },
1523
- {
1524
- key: OPENBANKING_TELEMETRY_EVENTS2.balancesRefreshed,
1525
- version: "1.0.0",
1526
- semantics: {
1527
- what: "Open banking balances refreshed.",
1528
- why: "Provide accurate cash position for dashboards and alerts."
1603
+ definition: {
1604
+ entryStepId: "collect",
1605
+ steps: [
1606
+ {
1607
+ id: "collect",
1608
+ type: "human",
1609
+ label: "Review Upcoming Bill",
1610
+ description: "Confirm amount, due date, and preferred delivery channels before scheduling reminder."
1529
1611
  },
1530
- privacy: "internal",
1531
- properties: {
1532
- ...commonProperties,
1533
- accountId: piiSafeString("Bank account identifier."),
1534
- balanceTypes: {
1535
- type: "json",
1536
- description: "Balance types included in the refresh."
1612
+ {
1613
+ id: "schedule",
1614
+ type: "automation",
1615
+ label: "Schedule Reminder",
1616
+ action: {
1617
+ operation: {
1618
+ key: "pfo.reminders.schedule-payment",
1619
+ version: "1.0.0"
1620
+ }
1537
1621
  },
1538
- refreshedAt: {
1539
- type: "timestamp",
1540
- description: "Timestamp when balances were refreshed."
1622
+ requiredIntegrations: [
1623
+ "emailOutbound",
1624
+ "smsNotifications",
1625
+ "calendarScheduling"
1626
+ ],
1627
+ retry: {
1628
+ maxAttempts: 2,
1629
+ backoff: "linear",
1630
+ delayMs: 1000
1541
1631
  }
1542
1632
  }
1543
- },
1544
- {
1545
- key: OPENBANKING_TELEMETRY_EVENTS2.overviewGenerated,
1546
- version: "1.0.0",
1547
- semantics: {
1548
- what: "Derived financial overview generated.",
1549
- why: "Persist cashflow and category summaries into knowledge space."
1550
- },
1551
- privacy: "internal",
1552
- properties: {
1553
- ...commonProperties,
1554
- knowledgeEntryId: piiSafeString("Identifier of the knowledge document containing the overview."),
1555
- period: {
1556
- type: "string",
1557
- description: "Aggregation period used (week, month, quarter)."
1558
- },
1559
- periodStart: {
1560
- type: "timestamp",
1561
- description: "Start timestamp for the aggregation window."
1562
- },
1563
- periodEnd: {
1564
- type: "timestamp",
1565
- description: "End timestamp for the aggregation window."
1566
- }
1567
- },
1568
- tags: ["knowledge", "analytics"]
1569
- }
1570
- ]
1571
- };
1572
- var OPENBANKING_SENSITIVE_FIELDS = OPENBANKING_PII_FIELDS;
1573
-
1574
- // src/pocket-family-office.feature.ts
1575
- import { defineFeature } from "@contractspec/lib.contracts-spec";
1576
- var PocketFamilyOfficeFeature = defineFeature({
1577
- meta: {
1578
- key: "pocket-family-office",
1579
- version: "1.0.0",
1580
- title: "Pocket Family Office",
1581
- description: "Personal finance automation with document ingestion, open banking, and AI summaries",
1582
- domain: "finance",
1583
- owners: ["@platform.finance"],
1584
- tags: [
1585
- "finance",
1586
- "open-banking",
1587
- "documents",
1588
- "automation",
1589
- "family-office"
1590
1633
  ],
1591
- stability: "experimental"
1592
- },
1593
- operations: [
1594
- { key: "pfo.documents.upload", version: "1.0.0" },
1595
- { key: "pfo.reminders.schedule-payment", version: "1.0.0" },
1596
- { key: "pfo.summary.generate", version: "1.0.0" },
1597
- { key: "pfo.email.sync-threads", version: "1.0.0" },
1598
- { key: "pfo.summary.dispatch", version: "1.0.0" },
1599
- { key: "pfo.openbanking.generate-overview", version: "1.0.0" }
1600
- ],
1601
- events: [],
1602
- presentations: [],
1603
- opToPresentation: [],
1604
- presentationsTargets: [],
1605
- capabilities: {
1606
- provides: [{ key: "pocket-family-office", version: "1.0.0" }],
1607
- requires: [
1608
- { key: "identity", version: "1.0.0" },
1609
- { key: "openbanking", version: "1.0.0" }
1634
+ transitions: [
1635
+ {
1636
+ from: "collect",
1637
+ to: "schedule",
1638
+ condition: "output?.confirmed === true",
1639
+ label: "Reminder confirmed"
1640
+ }
1610
1641
  ]
1611
- },
1612
- workflows: [
1613
- { key: "pfo.workflow.sync-openbanking-accounts", version: "1.0.0" },
1614
- { key: "pfo.workflow.sync-openbanking-transactions", version: "1.0.0" },
1615
- { key: "pfo.workflow.refresh-openbanking-balances", version: "1.0.0" },
1616
- { key: "pfo.workflow.generate-openbanking-overview", version: "1.0.0" },
1617
- { key: "pfo.workflow.process-uploaded-document", version: "1.0.0" },
1618
- { key: "pfo.workflow.upcoming-payments-reminder", version: "1.0.0" },
1619
- { key: "pfo.workflow.generate-financial-summary", version: "1.0.0" },
1620
- { key: "pfo.workflow.ingest-email-threads", version: "1.0.0" }
1621
- ],
1622
- knowledge: [
1623
- { key: "knowledge.financial-docs", version: "1.0.0" },
1624
- { key: "knowledge.email-threads", version: "1.0.0" },
1625
- { key: "knowledge.financial-overview", version: "1.0.0" }
1626
- ],
1627
- telemetry: [{ key: "pfo.telemetry", version: "1.0.0" }],
1628
- policies: [{ key: "pfo.policy.tenancy", version: "1.0.0" }],
1629
- integrations: [
1630
- { key: "pfo.integration.openbanking", version: "1.0.0" },
1631
- { key: "pfo.integration.llm", version: "1.0.0" }
1632
- ],
1633
- jobs: [
1634
- { key: "pfo.job.doc-processing", version: "1.0.0" },
1635
- { key: "pfo.job.reminder-dispatch", version: "1.0.0" }
1636
- ],
1637
- docs: [
1638
- "docs.examples.pocket-family-office.goal",
1639
- "docs.examples.pocket-family-office.usage",
1640
- "docs.examples.pocket-family-office.reference"
1641
- ]
1642
+ }
1642
1643
  });
1643
1644
  export {
1644
1645
  uploadDocumentContract,