@memberjunction/ng-dashboards 6.2.0-edge.5 → 6.2.0-edge.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.
- package/README.md +35 -0
- package/dist/AI/components/analytics/agent-runs/agent-run-analysis.component.js +2 -2
- package/dist/AI/components/analytics/agent-runs/agent-run-analysis.component.js.map +1 -1
- package/dist/AI/components/analytics/realtime/realtime-management.component.d.ts.map +1 -1
- package/dist/AI/components/analytics/realtime/realtime-management.component.js +3 -1
- package/dist/AI/components/analytics/realtime/realtime-management.component.js.map +1 -1
- package/dist/AI/components/analytics/realtime/realtime-overview.component.d.ts +1 -1
- package/dist/AI/components/analytics/realtime/realtime-overview.component.js +3 -3
- package/dist/AI/components/analytics/realtime/realtime-overview.component.js.map +1 -1
- package/dist/AI/components/analytics/realtime/realtime-session-data.d.ts +6 -4
- package/dist/AI/components/analytics/realtime/realtime-session-data.d.ts.map +1 -1
- package/dist/AI/components/analytics/realtime/realtime-session-data.js +8 -2
- package/dist/AI/components/analytics/realtime/realtime-session-data.js.map +1 -1
- package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.d.ts +1 -1
- package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.d.ts.map +1 -1
- package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.js +21 -13
- package/dist/AI/components/autotagging/autotagging-pipeline-resource.component.js.map +1 -1
- package/dist/AI/components/autotagging/components/classify-item-grid.component.js +1 -1
- package/dist/AI/components/autotagging/components/classify-item-grid.component.js.map +1 -1
- package/dist/AI/components/autotagging/components/classify-org-context-editor.component.d.ts.map +1 -1
- package/dist/AI/components/autotagging/components/classify-org-context-editor.component.js +1 -0
- package/dist/AI/components/autotagging/components/classify-org-context-editor.component.js.map +1 -1
- package/dist/AI/components/autotagging/dialogs/source-type-form.dialog.component.d.ts.map +1 -1
- package/dist/AI/components/autotagging/dialogs/source-type-form.dialog.component.js +1 -0
- package/dist/AI/components/autotagging/dialogs/source-type-form.dialog.component.js.map +1 -1
- package/dist/AI/components/autotagging/tabs/sources-tab.component.d.ts.map +1 -1
- package/dist/AI/components/autotagging/tabs/sources-tab.component.js +1 -0
- package/dist/AI/components/autotagging/tabs/sources-tab.component.js.map +1 -1
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.d.ts +7 -1
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.d.ts.map +1 -1
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.js +210 -57
- package/dist/AI/components/duplicates/duplicate-detection-resource.component.js.map +1 -1
- package/dist/AI/components/duplicates/duplicate-detection-run-scope.d.ts +12 -11
- package/dist/AI/components/duplicates/duplicate-detection-run-scope.d.ts.map +1 -1
- package/dist/AI/components/duplicates/duplicate-detection-run-scope.js +15 -15
- package/dist/AI/components/duplicates/duplicate-detection-run-scope.js.map +1 -1
- package/dist/AI/components/execution-monitoring.component.d.ts.map +1 -1
- package/dist/AI/components/execution-monitoring.component.js +28 -16
- package/dist/AI/components/execution-monitoring.component.js.map +1 -1
- package/dist/AI/components/prompts/model-prompt-priority-matrix.component.d.ts +1 -0
- package/dist/AI/components/prompts/model-prompt-priority-matrix.component.d.ts.map +1 -1
- package/dist/AI/components/prompts/model-prompt-priority-matrix.component.js +32 -8
- package/dist/AI/components/prompts/model-prompt-priority-matrix.component.js.map +1 -1
- package/dist/AI/components/tags/tags-resource.component.d.ts +1 -1
- package/dist/AI/components/tags/tags-resource.component.d.ts.map +1 -1
- package/dist/AI/components/tags/tags-resource.component.js +18 -9
- package/dist/AI/components/tags/tags-resource.component.js.map +1 -1
- package/dist/AI/components/vectors/sensitive-fields.d.ts +9 -4
- package/dist/AI/components/vectors/sensitive-fields.d.ts.map +1 -1
- package/dist/AI/components/vectors/sensitive-fields.js +39 -14
- package/dist/AI/components/vectors/sensitive-fields.js.map +1 -1
- package/dist/AI/components/vectors/vector-document-rules.d.ts +13 -0
- package/dist/AI/components/vectors/vector-document-rules.d.ts.map +1 -1
- package/dist/AI/components/vectors/vector-document-rules.js +14 -0
- package/dist/AI/components/vectors/vector-document-rules.js.map +1 -1
- package/dist/AI/components/vectors/vector-management-resource.component.d.ts +34 -14
- package/dist/AI/components/vectors/vector-management-resource.component.d.ts.map +1 -1
- package/dist/AI/components/vectors/vector-management-resource.component.js +134 -51
- package/dist/AI/components/vectors/vector-management-resource.component.js.map +1 -1
- package/dist/AI/components/vectors/vector-store-selection.d.ts +32 -0
- package/dist/AI/components/vectors/vector-store-selection.d.ts.map +1 -0
- package/dist/AI/components/vectors/vector-store-selection.js +57 -0
- package/dist/AI/components/vectors/vector-store-selection.js.map +1 -0
- package/dist/AI/services/ai-instrumentation.service.d.ts.map +1 -1
- package/dist/AI/services/ai-instrumentation.service.js +4 -2
- package/dist/AI/services/ai-instrumentation.service.js.map +1 -1
- package/dist/Actions/action-result-code.d.ts +80 -0
- package/dist/Actions/action-result-code.d.ts.map +1 -0
- package/dist/Actions/action-result-code.js +163 -0
- package/dist/Actions/action-result-code.js.map +1 -0
- package/dist/Actions/components/actions-overview.component.d.ts +8 -0
- package/dist/Actions/components/actions-overview.component.d.ts.map +1 -1
- package/dist/Actions/components/actions-overview.component.js +12 -9
- package/dist/Actions/components/actions-overview.component.js.map +1 -1
- package/dist/Actions/components/execution-monitoring.component.d.ts +29 -9
- package/dist/Actions/components/execution-monitoring.component.d.ts.map +1 -1
- package/dist/Actions/components/execution-monitoring.component.js +65 -42
- package/dist/Actions/components/execution-monitoring.component.js.map +1 -1
- package/dist/Actions/components/explorer/action-card.component.d.ts.map +1 -1
- package/dist/Actions/components/explorer/action-card.component.js +5 -4
- package/dist/Actions/components/explorer/action-card.component.js.map +1 -1
- package/dist/ChiefOfStaff/chief-of-staff-agent-context.d.ts +198 -0
- package/dist/ChiefOfStaff/chief-of-staff-agent-context.d.ts.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-agent-context.js +289 -0
- package/dist/ChiefOfStaff/chief-of-staff-agent-context.js.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-approvals.component.d.ts +29 -0
- package/dist/ChiefOfStaff/chief-of-staff-approvals.component.d.ts.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-approvals.component.js +666 -0
- package/dist/ChiefOfStaff/chief-of-staff-approvals.component.js.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-governance.component.d.ts +56 -0
- package/dist/ChiefOfStaff/chief-of-staff-governance.component.d.ts.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-governance.component.js +515 -0
- package/dist/ChiefOfStaff/chief-of-staff-governance.component.js.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-live-refresh.d.ts +14 -0
- package/dist/ChiefOfStaff/chief-of-staff-live-refresh.d.ts.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-live-refresh.js +39 -0
- package/dist/ChiefOfStaff/chief-of-staff-live-refresh.js.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-overview.component.d.ts +17 -0
- package/dist/ChiefOfStaff/chief-of-staff-overview.component.d.ts.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-overview.component.js +485 -0
- package/dist/ChiefOfStaff/chief-of-staff-overview.component.js.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-page-base.d.ts +139 -0
- package/dist/ChiefOfStaff/chief-of-staff-page-base.d.ts.map +1 -0
- package/dist/ChiefOfStaff/chief-of-staff-page-base.js +602 -0
- package/dist/ChiefOfStaff/chief-of-staff-page-base.js.map +1 -0
- package/dist/ChiefOfStaff/index.d.ts +6 -0
- package/dist/ChiefOfStaff/index.d.ts.map +1 -0
- package/dist/ChiefOfStaff/index.js +6 -0
- package/dist/ChiefOfStaff/index.js.map +1 -0
- package/dist/Communication/communication-logs-resource.component.d.ts.map +1 -1
- package/dist/Communication/communication-logs-resource.component.js +2 -1
- package/dist/Communication/communication-logs-resource.component.js.map +1 -1
- package/dist/Communication/communication-monitor-resource.component.d.ts.map +1 -1
- package/dist/Communication/communication-monitor-resource.component.js +26 -21
- package/dist/Communication/communication-monitor-resource.component.js.map +1 -1
- package/dist/Communication/communication-runs-resource.component.d.ts.map +1 -1
- package/dist/Communication/communication-runs-resource.component.js +14 -13
- package/dist/Communication/communication-runs-resource.component.js.map +1 -1
- package/dist/ComponentStudio/component-studio-dashboard.component.d.ts.map +1 -1
- package/dist/ComponentStudio/component-studio-dashboard.component.js +1 -0
- package/dist/ComponentStudio/component-studio-dashboard.component.js.map +1 -1
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.d.ts.map +1 -1
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.js +2 -1
- package/dist/ComponentStudio/components/artifact-selection-dialog.component.js.map +1 -1
- package/dist/ComponentStudio/services/component-version.service.d.ts.map +1 -1
- package/dist/ComponentStudio/services/component-version.service.js +3 -0
- package/dist/ComponentStudio/services/component-version.service.js.map +1 -1
- package/dist/DashboardEditor/dashboard-editor.component.d.ts +17 -2
- package/dist/DashboardEditor/dashboard-editor.component.d.ts.map +1 -1
- package/dist/DashboardEditor/dashboard-editor.component.js +94 -43
- package/dist/DashboardEditor/dashboard-editor.component.js.map +1 -1
- package/dist/DataExplorer/data-explorer-dashboard.component.d.ts +45 -2
- package/dist/DataExplorer/data-explorer-dashboard.component.d.ts.map +1 -1
- package/dist/DataExplorer/data-explorer-dashboard.component.js +178 -55
- package/dist/DataExplorer/data-explorer-dashboard.component.js.map +1 -1
- package/dist/DataExplorer/models/explorer-state.interface.d.ts +2 -0
- package/dist/DataExplorer/models/explorer-state.interface.d.ts.map +1 -1
- package/dist/DataExplorer/models/explorer-state.interface.js.map +1 -1
- package/dist/DevTools/graphql-console.component.js +2 -2
- package/dist/DevTools/lazy-module-status.component.js +2 -2
- package/dist/FormBuilder/form-builder-resource.component.d.ts.map +1 -1
- package/dist/FormBuilder/form-builder-resource.component.js +5 -0
- package/dist/FormBuilder/form-builder-resource.component.js.map +1 -1
- package/dist/Integration/components/connections/connections.component.js +2 -2
- package/dist/Integration/services/integration-data.service.d.ts +1 -1
- package/dist/Integration/services/integration-data.service.d.ts.map +1 -1
- package/dist/Integration/services/integration-data.service.js +4 -3
- package/dist/Integration/services/integration-data.service.js.map +1 -1
- package/dist/Lists/components/lists-browse-resource.component.js +1 -1
- package/dist/Lists/components/lists-browse-resource.component.js.map +1 -1
- package/dist/Lists/components/lists-my-lists-resource.component.js +1 -1
- package/dist/Lists/components/lists-my-lists-resource.component.js.map +1 -1
- package/dist/LoginStudio/login-studio-resource.component.d.ts +10 -2
- package/dist/LoginStudio/login-studio-resource.component.d.ts.map +1 -1
- package/dist/LoginStudio/login-studio-resource.component.js +111 -77
- package/dist/LoginStudio/login-studio-resource.component.js.map +1 -1
- package/dist/MCP/mcp-dashboard.component.d.ts +24 -4
- package/dist/MCP/mcp-dashboard.component.d.ts.map +1 -1
- package/dist/MCP/mcp-dashboard.component.js +118 -65
- package/dist/MCP/mcp-dashboard.component.js.map +1 -1
- package/dist/PredictiveStudio/business-predictions.view-models.d.ts +1 -1
- package/dist/PredictiveStudio/business-predictions.view-models.d.ts.map +1 -1
- package/dist/PredictiveStudio/business-predictions.view-models.js +3 -3
- package/dist/PredictiveStudio/business-predictions.view-models.js.map +1 -1
- package/dist/PredictiveStudio/components/ps-experiments.component.d.ts +6 -63
- package/dist/PredictiveStudio/components/ps-experiments.component.d.ts.map +1 -1
- package/dist/PredictiveStudio/components/ps-experiments.component.js +257 -521
- package/dist/PredictiveStudio/components/ps-experiments.component.js.map +1 -1
- package/dist/PredictiveStudio/components/ps-pipeline-wizard.component.d.ts +0 -18
- package/dist/PredictiveStudio/components/ps-pipeline-wizard.component.d.ts.map +1 -1
- package/dist/PredictiveStudio/components/ps-pipeline-wizard.component.js +124 -251
- package/dist/PredictiveStudio/components/ps-pipeline-wizard.component.js.map +1 -1
- package/dist/PredictiveStudio/components/ps-pipelines.component.d.ts +5 -9
- package/dist/PredictiveStudio/components/ps-pipelines.component.d.ts.map +1 -1
- package/dist/PredictiveStudio/components/ps-pipelines.component.js +98 -130
- package/dist/PredictiveStudio/components/ps-pipelines.component.js.map +1 -1
- package/dist/PredictiveStudio/components/ps-predictions-grid.component.d.ts +53 -4
- package/dist/PredictiveStudio/components/ps-predictions-grid.component.d.ts.map +1 -1
- package/dist/PredictiveStudio/components/ps-predictions-grid.component.js +338 -326
- package/dist/PredictiveStudio/components/ps-predictions-grid.component.js.map +1 -1
- package/dist/PredictiveStudio/components/ps-row-drivers.component.d.ts +19 -0
- package/dist/PredictiveStudio/components/ps-row-drivers.component.d.ts.map +1 -0
- package/dist/PredictiveStudio/components/ps-row-drivers.component.js +85 -0
- package/dist/PredictiveStudio/components/ps-row-drivers.component.js.map +1 -0
- package/dist/PredictiveStudio/engine/predictive-studio.engine.d.ts +19 -1
- package/dist/PredictiveStudio/engine/predictive-studio.engine.d.ts.map +1 -1
- package/dist/PredictiveStudio/engine/predictive-studio.engine.js +52 -2
- package/dist/PredictiveStudio/engine/predictive-studio.engine.js.map +1 -1
- package/dist/PredictiveStudio/predictive-studio-agent-context.d.ts +3 -1
- package/dist/PredictiveStudio/predictive-studio-agent-context.d.ts.map +1 -1
- package/dist/PredictiveStudio/predictive-studio-agent-context.js +3 -0
- package/dist/PredictiveStudio/predictive-studio-agent-context.js.map +1 -1
- package/dist/PredictiveStudio/predictive-studio-score-history.service.d.ts +27 -4
- package/dist/PredictiveStudio/predictive-studio-score-history.service.d.ts.map +1 -1
- package/dist/PredictiveStudio/predictive-studio-score-history.service.js +94 -61
- package/dist/PredictiveStudio/predictive-studio-score-history.service.js.map +1 -1
- package/dist/PredictiveStudio/resources/ps-predictions-resource.component.d.ts +29 -5
- package/dist/PredictiveStudio/resources/ps-predictions-resource.component.d.ts.map +1 -1
- package/dist/PredictiveStudio/resources/ps-predictions-resource.component.js +186 -103
- package/dist/PredictiveStudio/resources/ps-predictions-resource.component.js.map +1 -1
- package/dist/PredictiveStudio/resources/ps-studio-resource.component.js +1 -1
- package/dist/PredictiveStudio/resources/ps-studio-resource.component.js.map +1 -1
- package/dist/QueryBrowser/query-browser-resource.component.d.ts +26 -0
- package/dist/QueryBrowser/query-browser-resource.component.d.ts.map +1 -1
- package/dist/QueryBrowser/query-browser-resource.component.js +375 -252
- package/dist/QueryBrowser/query-browser-resource.component.js.map +1 -1
- package/dist/UserRoutines/user-routines-resource.component.d.ts +8 -1
- package/dist/UserRoutines/user-routines-resource.component.d.ts.map +1 -1
- package/dist/UserRoutines/user-routines-resource.component.js +22 -4
- package/dist/UserRoutines/user-routines-resource.component.js.map +1 -1
- package/dist/VersionHistory/components/diff-resource.component.d.ts.map +1 -1
- package/dist/VersionHistory/components/diff-resource.component.js +1 -0
- package/dist/VersionHistory/components/diff-resource.component.js.map +1 -1
- package/dist/VideoStudio/components/vs-archetype-editor.component.d.ts +162 -0
- package/dist/VideoStudio/components/vs-archetype-editor.component.d.ts.map +1 -0
- package/dist/VideoStudio/components/vs-archetype-editor.component.js +1105 -0
- package/dist/VideoStudio/components/vs-archetype-editor.component.js.map +1 -0
- package/dist/VideoStudio/components/vs-audio-options.component.d.ts +27 -0
- package/dist/VideoStudio/components/vs-audio-options.component.d.ts.map +1 -0
- package/dist/VideoStudio/components/vs-audio-options.component.js +119 -0
- package/dist/VideoStudio/components/vs-audio-options.component.js.map +1 -0
- package/dist/VideoStudio/components/vs-copilot-panel.component.d.ts +105 -0
- package/dist/VideoStudio/components/vs-copilot-panel.component.d.ts.map +1 -0
- package/dist/VideoStudio/components/vs-copilot-panel.component.js +560 -0
- package/dist/VideoStudio/components/vs-copilot-panel.component.js.map +1 -0
- package/dist/VideoStudio/components/vs-production-brief.component.d.ts +163 -0
- package/dist/VideoStudio/components/vs-production-brief.component.d.ts.map +1 -0
- package/dist/VideoStudio/components/vs-production-brief.component.js +1054 -0
- package/dist/VideoStudio/components/vs-production-brief.component.js.map +1 -0
- package/dist/VideoStudio/components/vs-setup-health-card.component.d.ts +43 -0
- package/dist/VideoStudio/components/vs-setup-health-card.component.d.ts.map +1 -0
- package/dist/VideoStudio/components/vs-setup-health-card.component.js +412 -0
- package/dist/VideoStudio/components/vs-setup-health-card.component.js.map +1 -0
- package/dist/VideoStudio/components/vs-studio-slide-in.component.d.ts +73 -0
- package/dist/VideoStudio/components/vs-studio-slide-in.component.d.ts.map +1 -0
- package/dist/VideoStudio/components/vs-studio-slide-in.component.js +271 -0
- package/dist/VideoStudio/components/vs-studio-slide-in.component.js.map +1 -0
- package/dist/VideoStudio/index.d.ts +12 -0
- package/dist/VideoStudio/index.d.ts.map +1 -0
- package/dist/VideoStudio/index.js +12 -0
- package/dist/VideoStudio/index.js.map +1 -0
- package/dist/VideoStudio/resources/video-studio-archetypes-resource.component.d.ts +118 -0
- package/dist/VideoStudio/resources/video-studio-archetypes-resource.component.d.ts.map +1 -0
- package/dist/VideoStudio/resources/video-studio-archetypes-resource.component.js +964 -0
- package/dist/VideoStudio/resources/video-studio-archetypes-resource.component.js.map +1 -0
- package/dist/VideoStudio/resources/video-studio-brand-kits-resource.component.d.ts +70 -0
- package/dist/VideoStudio/resources/video-studio-brand-kits-resource.component.d.ts.map +1 -0
- package/dist/VideoStudio/resources/video-studio-brand-kits-resource.component.js +600 -0
- package/dist/VideoStudio/resources/video-studio-brand-kits-resource.component.js.map +1 -0
- package/dist/VideoStudio/resources/video-studio-productions-resource.component.d.ts +182 -0
- package/dist/VideoStudio/resources/video-studio-productions-resource.component.d.ts.map +1 -0
- package/dist/VideoStudio/resources/video-studio-productions-resource.component.js +1481 -0
- package/dist/VideoStudio/resources/video-studio-productions-resource.component.js.map +1 -0
- package/dist/VideoStudio/services/vs-studio-slide-in-state.service.d.ts +102 -0
- package/dist/VideoStudio/services/vs-studio-slide-in-state.service.d.ts.map +1 -0
- package/dist/VideoStudio/services/vs-studio-slide-in-state.service.js +240 -0
- package/dist/VideoStudio/services/vs-studio-slide-in-state.service.js.map +1 -0
- package/dist/VideoStudio/video-studio-agent-context.d.ts +495 -0
- package/dist/VideoStudio/video-studio-agent-context.d.ts.map +1 -0
- package/dist/VideoStudio/video-studio-agent-context.js +992 -0
- package/dist/VideoStudio/video-studio-agent-context.js.map +1 -0
- package/dist/ai-dashboards.module.d.ts +25 -21
- package/dist/ai-dashboards.module.d.ts.map +1 -1
- package/dist/ai-dashboards.module.js +25 -3
- package/dist/ai-dashboards.module.js.map +1 -1
- package/dist/module.d.ts +13 -12
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +7 -0
- package/dist/module.js.map +1 -1
- package/dist/public-api.d.ts +8 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +10 -0
- package/dist/public-api.js.map +1 -1
- package/dist/shared/action-scheduled-job.d.ts.map +1 -1
- package/dist/shared/action-scheduled-job.js +2 -0
- package/dist/shared/action-scheduled-job.js.map +1 -1
- package/dist/video-studio-dashboards.module.d.ts +40 -0
- package/dist/video-studio-dashboards.module.d.ts.map +1 -0
- package/dist/video-studio-dashboards.module.js +159 -0
- package/dist/video-studio-dashboards.module.js.map +1 -0
- package/package.json +77 -71
- package/dist/PredictiveStudio/at-risk.view-models.d.ts +0 -120
- package/dist/PredictiveStudio/at-risk.view-models.d.ts.map +0 -1
- package/dist/PredictiveStudio/at-risk.view-models.js +0 -261
- package/dist/PredictiveStudio/at-risk.view-models.js.map +0 -1
- package/dist/PredictiveStudio/components/ps-confirm-modal.component.d.ts +0 -109
- package/dist/PredictiveStudio/components/ps-confirm-modal.component.d.ts.map +0 -1
- package/dist/PredictiveStudio/components/ps-confirm-modal.component.js +0 -323
- package/dist/PredictiveStudio/components/ps-confirm-modal.component.js.map +0 -1
- package/dist/PredictiveStudio/components/ps-run-experiment-modal.component.d.ts +0 -137
- package/dist/PredictiveStudio/components/ps-run-experiment-modal.component.d.ts.map +0 -1
- package/dist/PredictiveStudio/components/ps-run-experiment-modal.component.js +0 -826
- package/dist/PredictiveStudio/components/ps-run-experiment-modal.component.js.map +0 -1
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, unit-testable helpers for the Chief of Staff application's pages (Overview,
|
|
3
|
+
* Approvals & Wakes, Governance): their agent context, client tools and policy drafts.
|
|
4
|
+
*
|
|
5
|
+
* Core only: everything here reads core entities (`MJ: AI Agent User Policies`,
|
|
6
|
+
* `MJ: User Routines`, `MJ: AI Agent Requests`). Business data such as priorities, tasks and
|
|
7
|
+
* to-dos comes from Open Apps that add their own nav items to the Chief of Staff application
|
|
8
|
+
* through `NavItem.*` application settings; core never names an Open App's entities.
|
|
9
|
+
*
|
|
10
|
+
* 🚨 SAFETY BOUNDARY 🚨
|
|
11
|
+
* The Chief of Staff pages expose ONLY navigation / search /
|
|
12
|
+
* refresh / detail-view tools to the co-agent. DELIBERATELY NOT exposed as client tools
|
|
13
|
+
* (mutations stay human-driven in the UI):
|
|
14
|
+
* - Approving or rejecting `MJ: AI Agent Requests`
|
|
15
|
+
* - Modifying or saving `MJ: AI Agent User Policies` governance toggles / thresholds
|
|
16
|
+
* - Triggering "Wake Now" or pausing/resuming `MJ: User Routines`
|
|
17
|
+
*
|
|
18
|
+
* Published context exposes only aggregate counts, the current page and search, governance
|
|
19
|
+
* mode summaries, and bounded display names (capped at 25) — never raw request payloads,
|
|
20
|
+
* custom instructions overrides, or private message content.
|
|
21
|
+
*/
|
|
22
|
+
import type { MJAIAgentUserPolicyEntity, MJUserRoutineEntity, MJAIAgentRequestEntity } from '@memberjunction/core-entities';
|
|
23
|
+
import { type AgentToolResult } from '../shared/agent-tool-validation';
|
|
24
|
+
/**
|
|
25
|
+
* The pages serve one agent, identified by its metadata name. The id is resolved at runtime
|
|
26
|
+
* through `AIEngineBase.GetAgentByName`, never hardcoded.
|
|
27
|
+
*/
|
|
28
|
+
export declare const CHIEF_OF_STAFF_AGENT_NAME = "Chief of Staff";
|
|
29
|
+
/** The name of the Chief of Staff application whose nav items open the pages. */
|
|
30
|
+
export declare const CHIEF_OF_STAFF_APP_NAME = "Chief of Staff";
|
|
31
|
+
/** The Chief of Staff application's own pages; each is one nav item. */
|
|
32
|
+
export type ChiefOfStaffPage = 'overview' | 'approvals-wakes' | 'governance';
|
|
33
|
+
export declare const CHIEF_OF_STAFF_PAGES: readonly ChiefOfStaffPage[];
|
|
34
|
+
/** Each page's nav item label; must match the application's `DefaultNavItems`. */
|
|
35
|
+
export declare const CHIEF_OF_STAFF_PAGE_LABELS: Readonly<Record<ChiefOfStaffPage, string>>;
|
|
36
|
+
/** Each page's Font Awesome icon; matches the application's `DefaultNavItems`. */
|
|
37
|
+
export declare const CHIEF_OF_STAFF_PAGE_ICONS: Readonly<Record<ChiefOfStaffPage, string>>;
|
|
38
|
+
export type PolicyStatusValue = MJAIAgentUserPolicyEntity['Status'];
|
|
39
|
+
export type PolicyCoordinationModeValue = MJAIAgentUserPolicyEntity['CoordinationMode'];
|
|
40
|
+
export type PolicyDataAccessModeValue = MJAIAgentUserPolicyEntity['DefaultDataAccessMode'];
|
|
41
|
+
export type PolicyEmailChannelModeValue = MJAIAgentUserPolicyEntity['EmailChannelMode'];
|
|
42
|
+
export type PolicyCalendarChannelModeValue = MJAIAgentUserPolicyEntity['CalendarChannelMode'];
|
|
43
|
+
export type PolicyPhoneChannelModeValue = MJAIAgentUserPolicyEntity['PhoneChannelMode'];
|
|
44
|
+
export type PolicyMessagingChannelModeValue = MJAIAgentUserPolicyEntity['MessagingChannelMode'];
|
|
45
|
+
export type RoutineStatusValue = MJUserRoutineEntity['Status'];
|
|
46
|
+
export type RequestStatusValue = MJAIAgentRequestEntity['Status'];
|
|
47
|
+
export interface RoutineSummaryItem {
|
|
48
|
+
ID: string;
|
|
49
|
+
Name: string;
|
|
50
|
+
Status: RoutineStatusValue;
|
|
51
|
+
ScheduleMode: MJUserRoutineEntity['ScheduleMode'];
|
|
52
|
+
CronExpression: string | null;
|
|
53
|
+
NextRunAt: Date | string | null;
|
|
54
|
+
LastRunAt: Date | string | null;
|
|
55
|
+
LastRunStatus: MJUserRoutineEntity['LastRunStatus'];
|
|
56
|
+
}
|
|
57
|
+
/** The status label the pages show for a routine: the entity's Status, or 'Fired' for a spent one-shot. */
|
|
58
|
+
export type RoutineDisplayStatusValue = RoutineSummaryItem['Status'] | 'Fired';
|
|
59
|
+
/**
|
|
60
|
+
* True for a one-shot routine that has run and has no next time: the dispatcher disables a one-shot
|
|
61
|
+
* once it fires, so "Disabled" here means "done", not "broken". A one-shot still waiting for its
|
|
62
|
+
* time is not spent, whatever it has run before (a manual run keeps the schedule); a one-shot that
|
|
63
|
+
* was disabled before ever running is just disabled; a recurring routine is never spent.
|
|
64
|
+
*/
|
|
65
|
+
export declare function IsSpentOneShotRoutine(routine: Pick<RoutineSummaryItem, 'ScheduleMode' | 'NextRunAt' | 'LastRunAt' | 'Status'>): boolean;
|
|
66
|
+
/** 'Fired' for a spent one-shot, otherwise the routine's own Status. */
|
|
67
|
+
export declare function RoutineDisplayStatus(routine: Pick<RoutineSummaryItem, 'ScheduleMode' | 'NextRunAt' | 'LastRunAt' | 'Status'>): RoutineDisplayStatusValue;
|
|
68
|
+
/**
|
|
69
|
+
* Display order for the wake schedule: routines with a next wake first, soonest first; then the
|
|
70
|
+
* unscheduled (paused, or disabled before ever running); spent one-shots last, most recent first.
|
|
71
|
+
* Returns a new array.
|
|
72
|
+
*/
|
|
73
|
+
export declare function SortRoutinesForDisplay<T extends Pick<RoutineSummaryItem, 'ScheduleMode' | 'NextRunAt' | 'LastRunAt' | 'Status'>>(routines: readonly T[]): T[];
|
|
74
|
+
/**
|
|
75
|
+
* An outbound email waiting for approval, as the email action records it in the request's
|
|
76
|
+
* `Comments` (JSON with Operation / From / To / CCRecipients / Subject / Body).
|
|
77
|
+
*/
|
|
78
|
+
export interface EmailApprovalDraft {
|
|
79
|
+
Operation: 'Send' | 'Reply' | 'Forward';
|
|
80
|
+
From: string | null;
|
|
81
|
+
To: string;
|
|
82
|
+
CC: string[];
|
|
83
|
+
Subject: string;
|
|
84
|
+
Body: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Reads the email draft out of an approval request's Comments. Returns null when the comments are
|
|
88
|
+
* empty, not JSON, or not an email (a call brief, say), so callers can show the draft only when
|
|
89
|
+
* there is one. An older payload without `Operation` counts as a `Send` when To and Subject exist.
|
|
90
|
+
*/
|
|
91
|
+
export declare function ParseEmailApprovalPayload(comments: string | null | undefined): EmailApprovalDraft | null;
|
|
92
|
+
/** The draft as plain text for a mail client: headers, a blank line, then the body. */
|
|
93
|
+
export declare function FormatEmailDraftForClipboard(draft: EmailApprovalDraft): string;
|
|
94
|
+
export interface RequestSummaryItem {
|
|
95
|
+
ID: string;
|
|
96
|
+
Request: string;
|
|
97
|
+
Status: RequestStatusValue;
|
|
98
|
+
Priority: number;
|
|
99
|
+
RequestedAt: Date | string;
|
|
100
|
+
ExpiresAt: Date | string | null;
|
|
101
|
+
RequestType?: MJAIAgentRequestEntity['RequestType'];
|
|
102
|
+
RequestTypeID?: MJAIAgentRequestEntity['RequestTypeID'];
|
|
103
|
+
}
|
|
104
|
+
export interface PolicyGovernanceSummary {
|
|
105
|
+
HasPolicyRecord: boolean;
|
|
106
|
+
DisplayName: string;
|
|
107
|
+
Status: PolicyStatusValue;
|
|
108
|
+
OnboardingStatus: MJAIAgentUserPolicyEntity['OnboardingStatus'];
|
|
109
|
+
CoordinationMode: PolicyCoordinationModeValue;
|
|
110
|
+
DefaultDataAccessMode: PolicyDataAccessModeValue;
|
|
111
|
+
EmailChannelMode: PolicyEmailChannelModeValue;
|
|
112
|
+
CalendarChannelMode: PolicyCalendarChannelModeValue;
|
|
113
|
+
PhoneChannelMode: PolicyPhoneChannelModeValue;
|
|
114
|
+
MessagingChannelMode: PolicyMessagingChannelModeValue;
|
|
115
|
+
AllowInterAgentCoordination: boolean;
|
|
116
|
+
RequireApprovalForExternalComms: boolean;
|
|
117
|
+
RequireApprovalForFinancials: boolean;
|
|
118
|
+
RequireApprovalForDestructiveActions: boolean;
|
|
119
|
+
AutoApproveAmountThreshold: number | null;
|
|
120
|
+
}
|
|
121
|
+
/** The Governance page's editable copy of the user's policy. */
|
|
122
|
+
export interface GovernancePolicyDraft {
|
|
123
|
+
DisplayNameOverride: string;
|
|
124
|
+
Status: PolicyStatusValue;
|
|
125
|
+
OnboardingStatus: MJAIAgentUserPolicyEntity['OnboardingStatus'];
|
|
126
|
+
CoordinationMode: PolicyCoordinationModeValue;
|
|
127
|
+
DefaultDataAccessMode: PolicyDataAccessModeValue;
|
|
128
|
+
EmailChannelMode: PolicyEmailChannelModeValue;
|
|
129
|
+
CalendarChannelMode: PolicyCalendarChannelModeValue;
|
|
130
|
+
PhoneChannelMode: PolicyPhoneChannelModeValue;
|
|
131
|
+
MessagingChannelMode: PolicyMessagingChannelModeValue;
|
|
132
|
+
AllowInterAgentCoordination: boolean;
|
|
133
|
+
RequireApprovalForExternalComms: boolean;
|
|
134
|
+
RequireApprovalForFinancials: boolean;
|
|
135
|
+
RequireApprovalForDestructiveActions: boolean;
|
|
136
|
+
AutoApproveAmountThreshold: number | null;
|
|
137
|
+
InstructionsOverride: string;
|
|
138
|
+
}
|
|
139
|
+
/** The draft shown before the user has a policy record. */
|
|
140
|
+
export declare function CreateDefaultPolicyDraft(): GovernancePolicyDraft;
|
|
141
|
+
/** A draft copied from the user's policy record, or the default draft when there is none. */
|
|
142
|
+
export declare function BuildPolicyDraftFromEntity(entity: MJAIAgentUserPolicyEntity | null): GovernancePolicyDraft;
|
|
143
|
+
/** The display name: the draft's override, or 'My Chief of Staff'. */
|
|
144
|
+
export declare function ChiefOfStaffDisplayName(draft: Pick<GovernancePolicyDraft, 'DisplayNameOverride'>): string;
|
|
145
|
+
/** The governance summary published in the agent context. */
|
|
146
|
+
export declare function BuildGovernanceSummary(draft: GovernancePolicyDraft, hasPolicyRecord: boolean): PolicyGovernanceSummary;
|
|
147
|
+
export interface ChiefOfStaffMetrics {
|
|
148
|
+
PendingApprovalCount: number;
|
|
149
|
+
HighPriorityPendingCount: number;
|
|
150
|
+
ActiveWakeRoutineCount: number;
|
|
151
|
+
NextScheduledWakeAt: Date | null;
|
|
152
|
+
}
|
|
153
|
+
export interface ChiefOfStaffAgentContextInput {
|
|
154
|
+
Page: ChiefOfStaffPage;
|
|
155
|
+
SearchText: string;
|
|
156
|
+
Metrics: ChiefOfStaffMetrics;
|
|
157
|
+
Governance: PolicyGovernanceSummary;
|
|
158
|
+
Routines: readonly RoutineSummaryItem[];
|
|
159
|
+
PendingRequests: readonly RequestSummaryItem[];
|
|
160
|
+
}
|
|
161
|
+
export type AgentContextScalar = string | number | boolean | null;
|
|
162
|
+
export type AgentContextRecord = Record<string, AgentContextScalar | string[] | Record<string, AgentContextScalar>>;
|
|
163
|
+
/**
|
|
164
|
+
* Returns `true` when an `MJ: AI Agent Requests` row represents an actionable approval or
|
|
165
|
+
* review request for the Chief of Staff's Pending Approvals queue, and `false` when it
|
|
166
|
+
* is a conversational `Information` turn created by `BaseAgent` when ending a chat turn.
|
|
167
|
+
*/
|
|
168
|
+
export declare function IsApprovalRequest(req: {
|
|
169
|
+
RequestType?: MJAIAgentRequestEntity['RequestType'] | undefined;
|
|
170
|
+
RequestTypeID?: MJAIAgentRequestEntity['RequestTypeID'] | undefined;
|
|
171
|
+
}): boolean;
|
|
172
|
+
export declare function ParseOptionalDate(val: Date | string | null | undefined): Date | null;
|
|
173
|
+
/** ExtraFilters for the pages' three core-entity queries. Every clause is bound to the current user: the pages never show another user's Chief of Staff data. */
|
|
174
|
+
export interface ChiefOfStaffScopeFilters {
|
|
175
|
+
Policy: string;
|
|
176
|
+
Routines: string;
|
|
177
|
+
Requests: string;
|
|
178
|
+
}
|
|
179
|
+
export declare function BuildChiefOfStaffScopeFilters(currentUserId: string, chiefOfStaffAgentId: string): ChiefOfStaffScopeFilters;
|
|
180
|
+
/** The core counts: pending approvals and active wakes. */
|
|
181
|
+
export declare function CalculateChiefOfStaffMetrics(routines: readonly RoutineSummaryItem[], requests: readonly RequestSummaryItem[]): ChiefOfStaffMetrics;
|
|
182
|
+
export declare function BuildChiefOfStaffAgentContext(input: ChiefOfStaffAgentContextInput): AgentContextRecord;
|
|
183
|
+
/** Validates a page parameter against the Chief of Staff application's own pages. */
|
|
184
|
+
export declare function ValidateChiefOfStaffPageParam(raw: string | number | boolean | null | undefined): {
|
|
185
|
+
ok: true;
|
|
186
|
+
value: ChiefOfStaffPage;
|
|
187
|
+
} | {
|
|
188
|
+
ok: false;
|
|
189
|
+
result: AgentToolResult;
|
|
190
|
+
};
|
|
191
|
+
export declare function ValidateSearchQueryParam(raw: string | number | boolean | null | undefined): {
|
|
192
|
+
ok: true;
|
|
193
|
+
value: string;
|
|
194
|
+
} | {
|
|
195
|
+
ok: false;
|
|
196
|
+
result: AgentToolResult;
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=chief-of-staff-agent-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chief-of-staff-agent-context.d.ts","sourceRoot":"","sources":["../../src/ChiefOfStaff/chief-of-staff-agent-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EACR,yBAAyB,EACzB,mBAAmB,EACnB,sBAAsB,EACzB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAKH,KAAK,eAAe,EACvB,MAAM,iCAAiC,CAAC;AAEzC;;;GAGG;AACH,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAE1D,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,mBAAmB,CAAC;AAExD,wEAAwE;AACxE,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,iBAAiB,GAAG,YAAY,CAAC;AAC7E,eAAO,MAAM,oBAAoB,EAAE,SAAS,gBAAgB,EAIlD,CAAC;AAEX,kFAAkF;AAClF,eAAO,MAAM,0BAA0B,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAIjF,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,yBAAyB,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAIhF,CAAC;AAEF,MAAM,MAAM,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K,MAAM,WAAW,wBAAwB;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,6BAA6B,CAAC,aAAa,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,GAAG,wBAAwB,CAQ1H;AAGD,2DAA2D;AAC3D,wBAAgB,4BAA4B,CACxC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,EACvC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GACxC,mBAAmB,CAqBrB;AAED,wBAAgB,6BAA6B,CACzC,KAAK,EAAE,6BAA6B,GACrC,kBAAkB,CAiCpB;AAED,qFAAqF;AACrF,wBAAgB,6BAA6B,CACzC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAClD;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,gBAAgB,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAEhF;AAED,wBAAgB,wBAAwB,CACpC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,GAClD;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,CAAA;CAAE,CAEtE"}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, unit-testable helpers for the Chief of Staff application's pages (Overview,
|
|
3
|
+
* Approvals & Wakes, Governance): their agent context, client tools and policy drafts.
|
|
4
|
+
*
|
|
5
|
+
* Core only: everything here reads core entities (`MJ: AI Agent User Policies`,
|
|
6
|
+
* `MJ: User Routines`, `MJ: AI Agent Requests`). Business data such as priorities, tasks and
|
|
7
|
+
* to-dos comes from Open Apps that add their own nav items to the Chief of Staff application
|
|
8
|
+
* through `NavItem.*` application settings; core never names an Open App's entities.
|
|
9
|
+
*
|
|
10
|
+
* 🚨 SAFETY BOUNDARY 🚨
|
|
11
|
+
* The Chief of Staff pages expose ONLY navigation / search /
|
|
12
|
+
* refresh / detail-view tools to the co-agent. DELIBERATELY NOT exposed as client tools
|
|
13
|
+
* (mutations stay human-driven in the UI):
|
|
14
|
+
* - Approving or rejecting `MJ: AI Agent Requests`
|
|
15
|
+
* - Modifying or saving `MJ: AI Agent User Policies` governance toggles / thresholds
|
|
16
|
+
* - Triggering "Wake Now" or pausing/resuming `MJ: User Routines`
|
|
17
|
+
*
|
|
18
|
+
* Published context exposes only aggregate counts, the current page and search, governance
|
|
19
|
+
* mode summaries, and bounded display names (capped at 25) — never raw request payloads,
|
|
20
|
+
* custom instructions overrides, or private message content.
|
|
21
|
+
*/
|
|
22
|
+
import { EscapeSQLString } from '@memberjunction/global';
|
|
23
|
+
import { AGENT_CONTEXT_NAME_LIST_CAP, BoundNameList, ValidateEnumParam, ValidateStringParam, } from '../shared/agent-tool-validation';
|
|
24
|
+
/**
|
|
25
|
+
* The pages serve one agent, identified by its metadata name. The id is resolved at runtime
|
|
26
|
+
* through `AIEngineBase.GetAgentByName`, never hardcoded.
|
|
27
|
+
*/
|
|
28
|
+
export const CHIEF_OF_STAFF_AGENT_NAME = 'Chief of Staff';
|
|
29
|
+
/** The name of the Chief of Staff application whose nav items open the pages. */
|
|
30
|
+
export const CHIEF_OF_STAFF_APP_NAME = 'Chief of Staff';
|
|
31
|
+
export const CHIEF_OF_STAFF_PAGES = [
|
|
32
|
+
'overview',
|
|
33
|
+
'approvals-wakes',
|
|
34
|
+
'governance',
|
|
35
|
+
];
|
|
36
|
+
/** Each page's nav item label; must match the application's `DefaultNavItems`. */
|
|
37
|
+
export const CHIEF_OF_STAFF_PAGE_LABELS = {
|
|
38
|
+
overview: 'Overview',
|
|
39
|
+
'approvals-wakes': 'Approvals & Wakes',
|
|
40
|
+
governance: 'Governance',
|
|
41
|
+
};
|
|
42
|
+
/** Each page's Font Awesome icon; matches the application's `DefaultNavItems`. */
|
|
43
|
+
export const CHIEF_OF_STAFF_PAGE_ICONS = {
|
|
44
|
+
overview: 'fa-solid fa-compass',
|
|
45
|
+
'approvals-wakes': 'fa-solid fa-bell-concierge',
|
|
46
|
+
governance: 'fa-solid fa-shield-halved',
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* True for a one-shot routine that has run and has no next time: the dispatcher disables a one-shot
|
|
50
|
+
* once it fires, so "Disabled" here means "done", not "broken". A one-shot still waiting for its
|
|
51
|
+
* time is not spent, whatever it has run before (a manual run keeps the schedule); a one-shot that
|
|
52
|
+
* was disabled before ever running is just disabled; a recurring routine is never spent.
|
|
53
|
+
*/
|
|
54
|
+
export function IsSpentOneShotRoutine(routine) {
|
|
55
|
+
return routine.ScheduleMode === 'OneShot'
|
|
56
|
+
&& routine.Status === 'Disabled'
|
|
57
|
+
&& routine.NextRunAt == null
|
|
58
|
+
&& routine.LastRunAt != null;
|
|
59
|
+
}
|
|
60
|
+
/** 'Fired' for a spent one-shot, otherwise the routine's own Status. */
|
|
61
|
+
export function RoutineDisplayStatus(routine) {
|
|
62
|
+
return IsSpentOneShotRoutine(routine) ? 'Fired' : routine.Status;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Display order for the wake schedule: routines with a next wake first, soonest first; then the
|
|
66
|
+
* unscheduled (paused, or disabled before ever running); spent one-shots last, most recent first.
|
|
67
|
+
* Returns a new array.
|
|
68
|
+
*/
|
|
69
|
+
export function SortRoutinesForDisplay(routines) {
|
|
70
|
+
const rank = (r) => (IsSpentOneShotRoutine(r) ? 2 : r.NextRunAt != null ? 0 : 1);
|
|
71
|
+
const time = (value) => {
|
|
72
|
+
const parsed = ParseOptionalDate(value);
|
|
73
|
+
return parsed ? parsed.getTime() : Number.POSITIVE_INFINITY;
|
|
74
|
+
};
|
|
75
|
+
return [...routines].sort((a, b) => {
|
|
76
|
+
const ra = rank(a);
|
|
77
|
+
const rb = rank(b);
|
|
78
|
+
if (ra !== rb)
|
|
79
|
+
return ra - rb;
|
|
80
|
+
if (ra === 0)
|
|
81
|
+
return time(a.NextRunAt) - time(b.NextRunAt);
|
|
82
|
+
if (ra === 2)
|
|
83
|
+
return time(b.LastRunAt) - time(a.LastRunAt);
|
|
84
|
+
return 0;
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Reads the email draft out of an approval request's Comments. Returns null when the comments are
|
|
89
|
+
* empty, not JSON, or not an email (a call brief, say), so callers can show the draft only when
|
|
90
|
+
* there is one. An older payload without `Operation` counts as a `Send` when To and Subject exist.
|
|
91
|
+
*/
|
|
92
|
+
export function ParseEmailApprovalPayload(comments) {
|
|
93
|
+
const text = comments?.trim();
|
|
94
|
+
if (!text || !text.startsWith('{')) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
let raw;
|
|
98
|
+
try {
|
|
99
|
+
raw = JSON.parse(text);
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
if (!raw || typeof raw !== 'object') {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
const record = raw;
|
|
108
|
+
const to = stringField(record, 'To');
|
|
109
|
+
const subject = stringField(record, 'Subject');
|
|
110
|
+
const body = stringField(record, 'Body');
|
|
111
|
+
if (to == null || subject == null || body == null) {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
const operation = stringField(record, 'Operation');
|
|
115
|
+
const op = operation === 'Reply' || operation === 'Forward' ? operation : 'Send';
|
|
116
|
+
const cc = Array.isArray(record['CCRecipients'])
|
|
117
|
+
? record['CCRecipients'].filter((c) => typeof c === 'string' && c.trim().length > 0)
|
|
118
|
+
: [];
|
|
119
|
+
return { Operation: op, From: stringField(record, 'From'), To: to, CC: cc, Subject: subject, Body: body };
|
|
120
|
+
}
|
|
121
|
+
/** The draft as plain text for a mail client: headers, a blank line, then the body. */
|
|
122
|
+
export function FormatEmailDraftForClipboard(draft) {
|
|
123
|
+
const lines = [`To: ${draft.To}`];
|
|
124
|
+
if (draft.CC.length > 0) {
|
|
125
|
+
lines.push(`CC: ${draft.CC.join(', ')}`);
|
|
126
|
+
}
|
|
127
|
+
lines.push(`Subject: ${draft.Subject}`, '', draft.Body);
|
|
128
|
+
return lines.join('\n');
|
|
129
|
+
}
|
|
130
|
+
function stringField(record, key) {
|
|
131
|
+
const value = record[key];
|
|
132
|
+
return typeof value === 'string' ? value : null;
|
|
133
|
+
}
|
|
134
|
+
/** The draft shown before the user has a policy record. */
|
|
135
|
+
export function CreateDefaultPolicyDraft() {
|
|
136
|
+
return {
|
|
137
|
+
DisplayNameOverride: 'Chief of Staff',
|
|
138
|
+
Status: 'Active',
|
|
139
|
+
OnboardingStatus: 'Completed',
|
|
140
|
+
CoordinationMode: 'Coordinator',
|
|
141
|
+
DefaultDataAccessMode: 'UserCeiling',
|
|
142
|
+
EmailChannelMode: 'DraftOnly',
|
|
143
|
+
CalendarChannelMode: 'ProposeWithApproval',
|
|
144
|
+
PhoneChannelMode: 'Disabled',
|
|
145
|
+
MessagingChannelMode: 'Enabled',
|
|
146
|
+
AllowInterAgentCoordination: true,
|
|
147
|
+
RequireApprovalForExternalComms: true,
|
|
148
|
+
RequireApprovalForFinancials: true,
|
|
149
|
+
RequireApprovalForDestructiveActions: true,
|
|
150
|
+
AutoApproveAmountThreshold: 0,
|
|
151
|
+
InstructionsOverride: '',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
/** A draft copied from the user's policy record, or the default draft when there is none. */
|
|
155
|
+
export function BuildPolicyDraftFromEntity(entity) {
|
|
156
|
+
if (!entity) {
|
|
157
|
+
return CreateDefaultPolicyDraft();
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
DisplayNameOverride: entity.DisplayNameOverride ?? '',
|
|
161
|
+
Status: entity.Status,
|
|
162
|
+
OnboardingStatus: entity.OnboardingStatus,
|
|
163
|
+
CoordinationMode: entity.CoordinationMode,
|
|
164
|
+
DefaultDataAccessMode: entity.DefaultDataAccessMode,
|
|
165
|
+
EmailChannelMode: entity.EmailChannelMode,
|
|
166
|
+
CalendarChannelMode: entity.CalendarChannelMode,
|
|
167
|
+
PhoneChannelMode: entity.PhoneChannelMode,
|
|
168
|
+
MessagingChannelMode: entity.MessagingChannelMode,
|
|
169
|
+
AllowInterAgentCoordination: entity.AllowInterAgentCoordination,
|
|
170
|
+
RequireApprovalForExternalComms: entity.RequireApprovalForExternalComms,
|
|
171
|
+
RequireApprovalForFinancials: entity.RequireApprovalForFinancials,
|
|
172
|
+
RequireApprovalForDestructiveActions: entity.RequireApprovalForDestructiveActions,
|
|
173
|
+
AutoApproveAmountThreshold: entity.AutoApproveAmountThreshold,
|
|
174
|
+
InstructionsOverride: entity.InstructionsOverride ?? '',
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/** The display name: the draft's override, or 'My Chief of Staff'. */
|
|
178
|
+
export function ChiefOfStaffDisplayName(draft) {
|
|
179
|
+
const override = draft.DisplayNameOverride.trim();
|
|
180
|
+
return override.length > 0 ? override : 'My Chief of Staff';
|
|
181
|
+
}
|
|
182
|
+
/** The governance summary published in the agent context. */
|
|
183
|
+
export function BuildGovernanceSummary(draft, hasPolicyRecord) {
|
|
184
|
+
return {
|
|
185
|
+
HasPolicyRecord: hasPolicyRecord,
|
|
186
|
+
DisplayName: ChiefOfStaffDisplayName(draft),
|
|
187
|
+
Status: draft.Status,
|
|
188
|
+
OnboardingStatus: draft.OnboardingStatus,
|
|
189
|
+
CoordinationMode: draft.CoordinationMode,
|
|
190
|
+
DefaultDataAccessMode: draft.DefaultDataAccessMode,
|
|
191
|
+
EmailChannelMode: draft.EmailChannelMode,
|
|
192
|
+
CalendarChannelMode: draft.CalendarChannelMode,
|
|
193
|
+
PhoneChannelMode: draft.PhoneChannelMode,
|
|
194
|
+
MessagingChannelMode: draft.MessagingChannelMode,
|
|
195
|
+
AllowInterAgentCoordination: draft.AllowInterAgentCoordination,
|
|
196
|
+
RequireApprovalForExternalComms: draft.RequireApprovalForExternalComms,
|
|
197
|
+
RequireApprovalForFinancials: draft.RequireApprovalForFinancials,
|
|
198
|
+
RequireApprovalForDestructiveActions: draft.RequireApprovalForDestructiveActions,
|
|
199
|
+
AutoApproveAmountThreshold: draft.AutoApproveAmountThreshold,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Returns `true` when an `MJ: AI Agent Requests` row represents an actionable approval or
|
|
204
|
+
* review request for the Chief of Staff's Pending Approvals queue, and `false` when it
|
|
205
|
+
* is a conversational `Information` turn created by `BaseAgent` when ending a chat turn.
|
|
206
|
+
*/
|
|
207
|
+
export function IsApprovalRequest(req) {
|
|
208
|
+
// The RequestType virtual field carries the type name; classify on it alone.
|
|
209
|
+
const typeName = req.RequestType?.trim().toLowerCase() ?? '';
|
|
210
|
+
return typeName !== 'information';
|
|
211
|
+
}
|
|
212
|
+
export function ParseOptionalDate(val) {
|
|
213
|
+
if (!val) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
if (val instanceof Date) {
|
|
217
|
+
return isNaN(val.getTime()) ? null : val;
|
|
218
|
+
}
|
|
219
|
+
const parsed = new Date(val);
|
|
220
|
+
return isNaN(parsed.getTime()) ? null : parsed;
|
|
221
|
+
}
|
|
222
|
+
export function BuildChiefOfStaffScopeFilters(currentUserId, chiefOfStaffAgentId) {
|
|
223
|
+
const user = EscapeSQLString(currentUserId);
|
|
224
|
+
const agent = EscapeSQLString(chiefOfStaffAgentId);
|
|
225
|
+
return {
|
|
226
|
+
Policy: `AgentID = '${agent}' AND UserID = '${user}'`,
|
|
227
|
+
Routines: `UserID = '${user}' AND (RoutineType = 'AgentWake' OR TargetID = '${agent}')`,
|
|
228
|
+
Requests: `AgentID = '${agent}' AND RequestForUserID = '${user}' AND (RequestType IS NULL OR RequestType <> 'Information')`,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
/** The core counts: pending approvals and active wakes. */
|
|
232
|
+
export function CalculateChiefOfStaffMetrics(routines, requests) {
|
|
233
|
+
const pendingRequests = requests.filter((r) => r.Status === 'Requested' && IsApprovalRequest(r));
|
|
234
|
+
const highPriorityPending = pendingRequests.filter((r) => r.Priority >= 51);
|
|
235
|
+
const activeWakeRoutines = routines.filter((r) => r.Status === 'Active');
|
|
236
|
+
let nextScheduledWakeAt = null;
|
|
237
|
+
for (const routine of activeWakeRoutines) {
|
|
238
|
+
const nextRun = ParseOptionalDate(routine.NextRunAt);
|
|
239
|
+
if (nextRun && (!nextScheduledWakeAt || nextRun.getTime() < nextScheduledWakeAt.getTime())) {
|
|
240
|
+
nextScheduledWakeAt = nextRun;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
PendingApprovalCount: pendingRequests.length,
|
|
245
|
+
HighPriorityPendingCount: highPriorityPending.length,
|
|
246
|
+
ActiveWakeRoutineCount: activeWakeRoutines.length,
|
|
247
|
+
NextScheduledWakeAt: nextScheduledWakeAt,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
export function BuildChiefOfStaffAgentContext(input) {
|
|
251
|
+
const routineNames = input.Routines.map((r) => `${r.Name} (${r.Status})`).filter((n) => !!n);
|
|
252
|
+
const boundedRoutineNames = BoundNameList(routineNames, AGENT_CONTEXT_NAME_LIST_CAP);
|
|
253
|
+
return {
|
|
254
|
+
Surface: 'ChiefOfStaff',
|
|
255
|
+
Page: input.Page,
|
|
256
|
+
SearchText: input.SearchText,
|
|
257
|
+
PendingApprovalCount: input.Metrics.PendingApprovalCount,
|
|
258
|
+
HighPriorityPendingCount: input.Metrics.HighPriorityPendingCount,
|
|
259
|
+
ActiveWakeRoutineCount: input.Metrics.ActiveWakeRoutineCount,
|
|
260
|
+
NextScheduledWakeAt: input.Metrics.NextScheduledWakeAt
|
|
261
|
+
? input.Metrics.NextScheduledWakeAt.toISOString()
|
|
262
|
+
: null,
|
|
263
|
+
GovernanceSummary: {
|
|
264
|
+
DisplayName: input.Governance.DisplayName,
|
|
265
|
+
Status: input.Governance.Status,
|
|
266
|
+
OnboardingStatus: input.Governance.OnboardingStatus,
|
|
267
|
+
CoordinationMode: input.Governance.CoordinationMode,
|
|
268
|
+
DefaultDataAccessMode: input.Governance.DefaultDataAccessMode,
|
|
269
|
+
EmailChannelMode: input.Governance.EmailChannelMode,
|
|
270
|
+
CalendarChannelMode: input.Governance.CalendarChannelMode,
|
|
271
|
+
PhoneChannelMode: input.Governance.PhoneChannelMode,
|
|
272
|
+
MessagingChannelMode: input.Governance.MessagingChannelMode,
|
|
273
|
+
AllowInterAgentCoordination: input.Governance.AllowInterAgentCoordination,
|
|
274
|
+
RequireApprovalForExternalComms: input.Governance.RequireApprovalForExternalComms,
|
|
275
|
+
RequireApprovalForFinancials: input.Governance.RequireApprovalForFinancials,
|
|
276
|
+
RequireApprovalForDestructiveActions: input.Governance.RequireApprovalForDestructiveActions,
|
|
277
|
+
AutoApproveAmountThreshold: input.Governance.AutoApproveAmountThreshold,
|
|
278
|
+
},
|
|
279
|
+
VisibleWakeRoutineNames: boundedRoutineNames,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
/** Validates a page parameter against the Chief of Staff application's own pages. */
|
|
283
|
+
export function ValidateChiefOfStaffPageParam(raw) {
|
|
284
|
+
return ValidateEnumParam(raw, CHIEF_OF_STAFF_PAGES, 'page');
|
|
285
|
+
}
|
|
286
|
+
export function ValidateSearchQueryParam(raw) {
|
|
287
|
+
return ValidateStringParam(raw, 'query');
|
|
288
|
+
}
|
|
289
|
+
//# sourceMappingURL=chief-of-staff-agent-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chief-of-staff-agent-context.js","sourceRoot":"","sources":["../../src/ChiefOfStaff/chief-of-staff-agent-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;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AAE,KAAK,CAAC,UAAU,CAAC,oBAAoB;YAC3D,2BAA2B,EAAE,KAAK,CAAC,UAAU,CAAC,2BAA2B;YACzE,+BAA+B,EAAE,KAAK,CAAC,UAAU,CAAC,+BAA+B;YACjF,4BAA4B,EAAE,KAAK,CAAC,UAAU,CAAC,4BAA4B;YAC3E,oCAAoC,EAChC,KAAK,CAAC,UAAU,CAAC,oCAAoC;YACzD,0BAA0B,EAAE,KAAK,CAAC,UAAU,CAAC,0BAA0B;SAC1E;QACD,uBAAuB,EAAE,mBAAmB;KAC/C,CAAC;AACN,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,6BAA6B,CACzC,GAAiD;IAEjD,OAAO,iBAAiB,CAAC,GAAG,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,wBAAwB,CACpC,GAAiD;IAEjD,OAAO,mBAAmB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * Pure, unit-testable helpers for the Chief of Staff application's pages (Overview,\n * Approvals & Wakes, Governance): their agent context, client tools and policy drafts.\n *\n * Core only: everything here reads core entities (`MJ: AI Agent User Policies`,\n * `MJ: User Routines`, `MJ: AI Agent Requests`). Business data such as priorities, tasks and\n * to-dos comes from Open Apps that add their own nav items to the Chief of Staff application\n * through `NavItem.*` application settings; core never names an Open App's entities.\n *\n * 🚨 SAFETY BOUNDARY 🚨\n * The Chief of Staff pages expose ONLY navigation / search /\n * refresh / detail-view tools to the co-agent. DELIBERATELY NOT exposed as client tools\n * (mutations stay human-driven in the UI):\n * - Approving or rejecting `MJ: AI Agent Requests`\n * - Modifying or saving `MJ: AI Agent User Policies` governance toggles / thresholds\n * - Triggering \"Wake Now\" or pausing/resuming `MJ: User Routines`\n *\n * Published context exposes only aggregate counts, the current page and search, governance\n * mode summaries, and bounded display names (capped at 25) — never raw request payloads,\n * custom instructions overrides, or private message content.\n */\n\nimport type {\n MJAIAgentUserPolicyEntity,\n MJUserRoutineEntity,\n MJAIAgentRequestEntity,\n} from '@memberjunction/core-entities';\nimport { EscapeSQLString } from '@memberjunction/global';\nimport {\n AGENT_CONTEXT_NAME_LIST_CAP,\n BoundNameList,\n ValidateEnumParam,\n ValidateStringParam,\n type AgentToolResult,\n} from '../shared/agent-tool-validation';\n\n/**\n * The pages serve one agent, identified by its metadata name. The id is resolved at runtime\n * through `AIEngineBase.GetAgentByName`, never hardcoded.\n */\nexport const CHIEF_OF_STAFF_AGENT_NAME = 'Chief of Staff';\n\n/** The name of the Chief of Staff application whose nav items open the pages. */\nexport const CHIEF_OF_STAFF_APP_NAME = 'Chief of Staff';\n\n/** The Chief of Staff application's own pages; each is one nav item. */\nexport type ChiefOfStaffPage = 'overview' | 'approvals-wakes' | 'governance';\nexport const CHIEF_OF_STAFF_PAGES: readonly ChiefOfStaffPage[] = [\n 'overview',\n 'approvals-wakes',\n 'governance',\n] as const;\n\n/** Each page's nav item label; must match the application's `DefaultNavItems`. */\nexport const CHIEF_OF_STAFF_PAGE_LABELS: Readonly<Record<ChiefOfStaffPage, string>> = {\n overview: 'Overview',\n 'approvals-wakes': 'Approvals & Wakes',\n governance: 'Governance',\n};\n\n/** Each page's Font Awesome icon; matches the application's `DefaultNavItems`. */\nexport const CHIEF_OF_STAFF_PAGE_ICONS: Readonly<Record<ChiefOfStaffPage, string>> = {\n overview: 'fa-solid fa-compass',\n 'approvals-wakes': 'fa-solid fa-bell-concierge',\n governance: 'fa-solid fa-shield-halved',\n};\n\nexport type PolicyStatusValue = MJAIAgentUserPolicyEntity['Status'];\nexport type PolicyCoordinationModeValue = MJAIAgentUserPolicyEntity['CoordinationMode'];\nexport type PolicyDataAccessModeValue = MJAIAgentUserPolicyEntity['DefaultDataAccessMode'];\nexport type PolicyEmailChannelModeValue = MJAIAgentUserPolicyEntity['EmailChannelMode'];\nexport type PolicyCalendarChannelModeValue = MJAIAgentUserPolicyEntity['CalendarChannelMode'];\nexport type PolicyPhoneChannelModeValue = MJAIAgentUserPolicyEntity['PhoneChannelMode'];\nexport type PolicyMessagingChannelModeValue = MJAIAgentUserPolicyEntity['MessagingChannelMode'];\nexport type RoutineStatusValue = MJUserRoutineEntity['Status'];\nexport type RequestStatusValue = MJAIAgentRequestEntity['Status'];\n\nexport interface RoutineSummaryItem {\n ID: string;\n Name: string;\n Status: RoutineStatusValue;\n ScheduleMode: MJUserRoutineEntity['ScheduleMode'];\n CronExpression: string | null;\n NextRunAt: Date | string | null;\n LastRunAt: Date | string | null;\n LastRunStatus: MJUserRoutineEntity['LastRunStatus'];\n}\n\n/** The status label the pages show for a routine: the entity's Status, or 'Fired' for a spent one-shot. */\nexport type RoutineDisplayStatusValue = RoutineSummaryItem['Status'] | 'Fired';\n\n/**\n * True for a one-shot routine that has run and has no next time: the dispatcher disables a one-shot\n * once it fires, so \"Disabled\" here means \"done\", not \"broken\". A one-shot still waiting for its\n * time is not spent, whatever it has run before (a manual run keeps the schedule); a one-shot that\n * was disabled before ever running is just disabled; a recurring routine is never spent.\n */\nexport function IsSpentOneShotRoutine(routine: Pick<RoutineSummaryItem, 'ScheduleMode' | 'NextRunAt' | 'LastRunAt' | 'Status'>): boolean {\n return routine.ScheduleMode === 'OneShot'\n && routine.Status === 'Disabled'\n && routine.NextRunAt == null\n && routine.LastRunAt != null;\n}\n\n/** 'Fired' for a spent one-shot, otherwise the routine's own Status. */\nexport function RoutineDisplayStatus(routine: Pick<RoutineSummaryItem, 'ScheduleMode' | 'NextRunAt' | 'LastRunAt' | 'Status'>): RoutineDisplayStatusValue {\n return IsSpentOneShotRoutine(routine) ? 'Fired' : routine.Status;\n}\n\n/**\n * Display order for the wake schedule: routines with a next wake first, soonest first; then the\n * unscheduled (paused, or disabled before ever running); spent one-shots last, most recent first.\n * Returns a new array.\n */\nexport function SortRoutinesForDisplay<T extends Pick<RoutineSummaryItem, 'ScheduleMode' | 'NextRunAt' | 'LastRunAt' | 'Status'>>(routines: readonly T[]): T[] {\n const rank = (r: T): number => (IsSpentOneShotRoutine(r) ? 2 : r.NextRunAt != null ? 0 : 1);\n const time = (value: Date | string | null): number => {\n const parsed = ParseOptionalDate(value);\n return parsed ? parsed.getTime() : Number.POSITIVE_INFINITY;\n };\n return [...routines].sort((a, b) => {\n const ra = rank(a);\n const rb = rank(b);\n if (ra !== rb) return ra - rb;\n if (ra === 0) return time(a.NextRunAt) - time(b.NextRunAt);\n if (ra === 2) return time(b.LastRunAt) - time(a.LastRunAt);\n return 0;\n });\n}\n\n/**\n * An outbound email waiting for approval, as the email action records it in the request's\n * `Comments` (JSON with Operation / From / To / CCRecipients / Subject / Body).\n */\nexport interface EmailApprovalDraft {\n Operation: 'Send' | 'Reply' | 'Forward';\n From: string | null;\n To: string;\n CC: string[];\n Subject: string;\n Body: string;\n}\n\n/**\n * Reads the email draft out of an approval request's Comments. Returns null when the comments are\n * empty, not JSON, or not an email (a call brief, say), so callers can show the draft only when\n * there is one. An older payload without `Operation` counts as a `Send` when To and Subject exist.\n */\nexport function ParseEmailApprovalPayload(comments: string | null | undefined): EmailApprovalDraft | null {\n const text = comments?.trim();\n if (!text || !text.startsWith('{')) {\n return null;\n }\n let raw: unknown;\n try {\n raw = JSON.parse(text);\n } catch {\n return null;\n }\n if (!raw || typeof raw !== 'object') {\n return null;\n }\n const record = raw as Record<string, unknown>;\n const to = stringField(record, 'To');\n const subject = stringField(record, 'Subject');\n const body = stringField(record, 'Body');\n if (to == null || subject == null || body == null) {\n return null;\n }\n const operation = stringField(record, 'Operation');\n const op: EmailApprovalDraft['Operation'] = operation === 'Reply' || operation === 'Forward' ? operation : 'Send';\n const cc = Array.isArray(record['CCRecipients'])\n ? (record['CCRecipients'] as unknown[]).filter((c): c is string => typeof c === 'string' && c.trim().length > 0)\n : [];\n return { Operation: op, From: stringField(record, 'From'), To: to, CC: cc, Subject: subject, Body: body };\n}\n\n/** The draft as plain text for a mail client: headers, a blank line, then the body. */\nexport function FormatEmailDraftForClipboard(draft: EmailApprovalDraft): string {\n const lines = [`To: ${draft.To}`];\n if (draft.CC.length > 0) {\n lines.push(`CC: ${draft.CC.join(', ')}`);\n }\n lines.push(`Subject: ${draft.Subject}`, '', draft.Body);\n return lines.join('\\n');\n}\n\nfunction stringField(record: Record<string, unknown>, key: string): string | null {\n const value = record[key];\n return typeof value === 'string' ? value : null;\n}\n\nexport interface RequestSummaryItem {\n ID: string;\n Request: string;\n Status: RequestStatusValue;\n Priority: number;\n RequestedAt: Date | string;\n ExpiresAt: Date | string | null;\n RequestType?: MJAIAgentRequestEntity['RequestType'];\n RequestTypeID?: MJAIAgentRequestEntity['RequestTypeID'];\n}\n\nexport interface PolicyGovernanceSummary {\n HasPolicyRecord: boolean;\n DisplayName: string;\n Status: PolicyStatusValue;\n OnboardingStatus: MJAIAgentUserPolicyEntity['OnboardingStatus'];\n CoordinationMode: PolicyCoordinationModeValue;\n DefaultDataAccessMode: PolicyDataAccessModeValue;\n EmailChannelMode: PolicyEmailChannelModeValue;\n CalendarChannelMode: PolicyCalendarChannelModeValue;\n PhoneChannelMode: PolicyPhoneChannelModeValue;\n MessagingChannelMode: PolicyMessagingChannelModeValue;\n AllowInterAgentCoordination: boolean;\n RequireApprovalForExternalComms: boolean;\n RequireApprovalForFinancials: boolean;\n RequireApprovalForDestructiveActions: boolean;\n AutoApproveAmountThreshold: number | null;\n}\n\n/** The Governance page's editable copy of the user's policy. */\nexport interface GovernancePolicyDraft {\n DisplayNameOverride: string;\n Status: PolicyStatusValue;\n OnboardingStatus: MJAIAgentUserPolicyEntity['OnboardingStatus'];\n CoordinationMode: PolicyCoordinationModeValue;\n DefaultDataAccessMode: PolicyDataAccessModeValue;\n EmailChannelMode: PolicyEmailChannelModeValue;\n CalendarChannelMode: PolicyCalendarChannelModeValue;\n PhoneChannelMode: PolicyPhoneChannelModeValue;\n MessagingChannelMode: PolicyMessagingChannelModeValue;\n AllowInterAgentCoordination: boolean;\n RequireApprovalForExternalComms: boolean;\n RequireApprovalForFinancials: boolean;\n RequireApprovalForDestructiveActions: boolean;\n AutoApproveAmountThreshold: number | null;\n InstructionsOverride: string;\n}\n\n/** The draft shown before the user has a policy record. */\nexport function CreateDefaultPolicyDraft(): GovernancePolicyDraft {\n return {\n DisplayNameOverride: 'Chief of Staff',\n Status: 'Active',\n OnboardingStatus: 'Completed',\n CoordinationMode: 'Coordinator',\n DefaultDataAccessMode: 'UserCeiling',\n EmailChannelMode: 'DraftOnly',\n CalendarChannelMode: 'ProposeWithApproval',\n PhoneChannelMode: 'Disabled',\n MessagingChannelMode: 'Enabled',\n AllowInterAgentCoordination: true,\n RequireApprovalForExternalComms: true,\n RequireApprovalForFinancials: true,\n RequireApprovalForDestructiveActions: true,\n AutoApproveAmountThreshold: 0,\n InstructionsOverride: '',\n };\n}\n\n/** A draft copied from the user's policy record, or the default draft when there is none. */\nexport function BuildPolicyDraftFromEntity(entity: MJAIAgentUserPolicyEntity | null): GovernancePolicyDraft {\n if (!entity) {\n return CreateDefaultPolicyDraft();\n }\n return {\n DisplayNameOverride: entity.DisplayNameOverride ?? '',\n Status: entity.Status,\n OnboardingStatus: entity.OnboardingStatus,\n CoordinationMode: entity.CoordinationMode,\n DefaultDataAccessMode: entity.DefaultDataAccessMode,\n EmailChannelMode: entity.EmailChannelMode,\n CalendarChannelMode: entity.CalendarChannelMode,\n PhoneChannelMode: entity.PhoneChannelMode,\n MessagingChannelMode: entity.MessagingChannelMode,\n AllowInterAgentCoordination: entity.AllowInterAgentCoordination,\n RequireApprovalForExternalComms: entity.RequireApprovalForExternalComms,\n RequireApprovalForFinancials: entity.RequireApprovalForFinancials,\n RequireApprovalForDestructiveActions: entity.RequireApprovalForDestructiveActions,\n AutoApproveAmountThreshold: entity.AutoApproveAmountThreshold,\n InstructionsOverride: entity.InstructionsOverride ?? '',\n };\n}\n\n/** The display name: the draft's override, or 'My Chief of Staff'. */\nexport function ChiefOfStaffDisplayName(draft: Pick<GovernancePolicyDraft, 'DisplayNameOverride'>): string {\n const override = draft.DisplayNameOverride.trim();\n return override.length > 0 ? override : 'My Chief of Staff';\n}\n\n/** The governance summary published in the agent context. */\nexport function BuildGovernanceSummary(draft: GovernancePolicyDraft, hasPolicyRecord: boolean): PolicyGovernanceSummary {\n return {\n HasPolicyRecord: hasPolicyRecord,\n DisplayName: ChiefOfStaffDisplayName(draft),\n Status: draft.Status,\n OnboardingStatus: draft.OnboardingStatus,\n CoordinationMode: draft.CoordinationMode,\n DefaultDataAccessMode: draft.DefaultDataAccessMode,\n EmailChannelMode: draft.EmailChannelMode,\n CalendarChannelMode: draft.CalendarChannelMode,\n PhoneChannelMode: draft.PhoneChannelMode,\n MessagingChannelMode: draft.MessagingChannelMode,\n AllowInterAgentCoordination: draft.AllowInterAgentCoordination,\n RequireApprovalForExternalComms: draft.RequireApprovalForExternalComms,\n RequireApprovalForFinancials: draft.RequireApprovalForFinancials,\n RequireApprovalForDestructiveActions: draft.RequireApprovalForDestructiveActions,\n AutoApproveAmountThreshold: draft.AutoApproveAmountThreshold,\n };\n}\n\nexport interface ChiefOfStaffMetrics {\n PendingApprovalCount: number;\n HighPriorityPendingCount: number;\n ActiveWakeRoutineCount: number;\n NextScheduledWakeAt: Date | null;\n}\n\nexport interface ChiefOfStaffAgentContextInput {\n Page: ChiefOfStaffPage;\n SearchText: string;\n Metrics: ChiefOfStaffMetrics;\n Governance: PolicyGovernanceSummary;\n Routines: readonly RoutineSummaryItem[];\n PendingRequests: readonly RequestSummaryItem[];\n}\n\nexport type AgentContextScalar = string | number | boolean | null;\nexport type AgentContextRecord = Record<\n string,\n AgentContextScalar | string[] | Record<string, AgentContextScalar>\n>;\n\n/**\n * Returns `true` when an `MJ: AI Agent Requests` row represents an actionable approval or\n * review request for the Chief of Staff's Pending Approvals queue, and `false` when it\n * is a conversational `Information` turn created by `BaseAgent` when ending a chat turn.\n */\nexport function IsApprovalRequest(req: {\n RequestType?: MJAIAgentRequestEntity['RequestType'] | undefined;\n RequestTypeID?: MJAIAgentRequestEntity['RequestTypeID'] | undefined;\n}): boolean {\n // The RequestType virtual field carries the type name; classify on it alone.\n const typeName = req.RequestType?.trim().toLowerCase() ?? '';\n return typeName !== 'information';\n}\n\nexport function ParseOptionalDate(val: Date | string | null | undefined): Date | null {\n if (!val) {\n return null;\n }\n if (val instanceof Date) {\n return isNaN(val.getTime()) ? null : val;\n }\n const parsed = new Date(val);\n return isNaN(parsed.getTime()) ? null : parsed;\n}\n\n/** ExtraFilters for the pages' three core-entity queries. Every clause is bound to the current user: the pages never show another user's Chief of Staff data. */\nexport interface ChiefOfStaffScopeFilters {\n Policy: string;\n Routines: string;\n Requests: string;\n}\n\nexport function BuildChiefOfStaffScopeFilters(currentUserId: string, chiefOfStaffAgentId: string): ChiefOfStaffScopeFilters {\n const user = EscapeSQLString(currentUserId);\n const agent = EscapeSQLString(chiefOfStaffAgentId);\n return {\n Policy: `AgentID = '${agent}' AND UserID = '${user}'`,\n Routines: `UserID = '${user}' AND (RoutineType = 'AgentWake' OR TargetID = '${agent}')`,\n Requests: `AgentID = '${agent}' AND RequestForUserID = '${user}' AND (RequestType IS NULL OR RequestType <> 'Information')`,\n };\n}\n\n\n/** The core counts: pending approvals and active wakes. */\nexport function CalculateChiefOfStaffMetrics(\n routines: readonly RoutineSummaryItem[],\n requests: readonly RequestSummaryItem[],\n): ChiefOfStaffMetrics {\n const pendingRequests = requests.filter(\n (r) => r.Status === 'Requested' && IsApprovalRequest(r),\n );\n const highPriorityPending = pendingRequests.filter((r) => r.Priority >= 51);\n\n const activeWakeRoutines = routines.filter((r) => r.Status === 'Active');\n let nextScheduledWakeAt: Date | null = null;\n for (const routine of activeWakeRoutines) {\n const nextRun = ParseOptionalDate(routine.NextRunAt);\n if (nextRun && (!nextScheduledWakeAt || nextRun.getTime() < nextScheduledWakeAt.getTime())) {\n nextScheduledWakeAt = nextRun;\n }\n }\n\n return {\n PendingApprovalCount: pendingRequests.length,\n HighPriorityPendingCount: highPriorityPending.length,\n ActiveWakeRoutineCount: activeWakeRoutines.length,\n NextScheduledWakeAt: nextScheduledWakeAt,\n };\n}\n\nexport function BuildChiefOfStaffAgentContext(\n input: ChiefOfStaffAgentContextInput,\n): AgentContextRecord {\n const routineNames = input.Routines.map((r) => `${r.Name} (${r.Status})`).filter((n) => !!n);\n const boundedRoutineNames = BoundNameList(routineNames, AGENT_CONTEXT_NAME_LIST_CAP);\n\n return {\n Surface: 'ChiefOfStaff',\n Page: input.Page,\n SearchText: input.SearchText,\n PendingApprovalCount: input.Metrics.PendingApprovalCount,\n HighPriorityPendingCount: input.Metrics.HighPriorityPendingCount,\n ActiveWakeRoutineCount: input.Metrics.ActiveWakeRoutineCount,\n NextScheduledWakeAt: input.Metrics.NextScheduledWakeAt\n ? input.Metrics.NextScheduledWakeAt.toISOString()\n : null,\n GovernanceSummary: {\n DisplayName: input.Governance.DisplayName,\n Status: input.Governance.Status,\n OnboardingStatus: input.Governance.OnboardingStatus,\n CoordinationMode: input.Governance.CoordinationMode,\n DefaultDataAccessMode: input.Governance.DefaultDataAccessMode,\n EmailChannelMode: input.Governance.EmailChannelMode,\n CalendarChannelMode: input.Governance.CalendarChannelMode,\n PhoneChannelMode: input.Governance.PhoneChannelMode,\n MessagingChannelMode: input.Governance.MessagingChannelMode,\n AllowInterAgentCoordination: input.Governance.AllowInterAgentCoordination,\n RequireApprovalForExternalComms: input.Governance.RequireApprovalForExternalComms,\n RequireApprovalForFinancials: input.Governance.RequireApprovalForFinancials,\n RequireApprovalForDestructiveActions:\n input.Governance.RequireApprovalForDestructiveActions,\n AutoApproveAmountThreshold: input.Governance.AutoApproveAmountThreshold,\n },\n VisibleWakeRoutineNames: boundedRoutineNames,\n };\n}\n\n/** Validates a page parameter against the Chief of Staff application's own pages. */\nexport function ValidateChiefOfStaffPageParam(\n raw: string | number | boolean | null | undefined,\n): { ok: true; value: ChiefOfStaffPage } | { ok: false; result: AgentToolResult } {\n return ValidateEnumParam(raw, CHIEF_OF_STAFF_PAGES, 'page');\n}\n\nexport function ValidateSearchQueryParam(\n raw: string | number | boolean | null | undefined,\n): { ok: true; value: string } | { ok: false; result: AgentToolResult } {\n return ValidateStringParam(raw, 'query');\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { MJAIAgentRequestEntity, MJUserRoutineEntity } from '@memberjunction/core-entities';
|
|
2
|
+
import { ChiefOfStaffPage } from './chief-of-staff-agent-context';
|
|
3
|
+
import { BaseChiefOfStaffPage, ChiefOfStaffClientTool } from './chief-of-staff-page-base';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
/**
|
|
6
|
+
* The Chief of Staff application's Approvals & Wakes page: every pending approval with its
|
|
7
|
+
* recent decisions, and every wake routine with Wake Now, pause and its briefings. The search
|
|
8
|
+
* box filters both lists and round-trips through the `search` query param.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ChiefOfStaffApprovalsComponent extends BaseChiefOfStaffPage {
|
|
11
|
+
protected readonly Page: ChiefOfStaffPage;
|
|
12
|
+
private initialParamsApplied;
|
|
13
|
+
/** When true, the wake list also shows spent one-shots (reminders that have fired). Off by default. */
|
|
14
|
+
ShowFiredRoutines: boolean;
|
|
15
|
+
get RecentResolvedRequests(): MJAIAgentRequestEntity[];
|
|
16
|
+
/** Spent one-shots: reminders and one-time wakes that have already fired. */
|
|
17
|
+
get FiredRoutineCount(): number;
|
|
18
|
+
get FilteredRoutines(): MJUserRoutineEntity[];
|
|
19
|
+
ToggleShowFiredRoutines(): void;
|
|
20
|
+
OnSearchChange(value: string): void;
|
|
21
|
+
protected OnPageInit(): void;
|
|
22
|
+
protected OnQueryParamsChanged(params: Record<string, string>, _source: 'popstate' | 'deeplink'): void;
|
|
23
|
+
private syncQueryParams;
|
|
24
|
+
protected PageAgentTools(): ChiefOfStaffClientTool[];
|
|
25
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ChiefOfStaffApprovalsComponent, never>;
|
|
26
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ChiefOfStaffApprovalsComponent, "mj-chief-of-staff-approvals", never, {}, {}, never, never, false, never>;
|
|
27
|
+
}
|
|
28
|
+
export declare function LoadChiefOfStaffApprovals(): void;
|
|
29
|
+
//# sourceMappingURL=chief-of-staff-approvals.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chief-of-staff-approvals.component.d.ts","sourceRoot":"","sources":["../../src/ChiefOfStaff/chief-of-staff-approvals.component.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAG5F,OAAO,EAAE,gBAAgB,EAAsE,MAAM,gCAAgC,CAAC;AACtI,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;;AAE1F;;;;GAIG;AACH,qBAQa,8BAA+B,SAAQ,oBAAoB;IACpE,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAqB;IAC9D,OAAO,CAAC,oBAAoB,CAAS;IAErC,uGAAuG;IAChG,iBAAiB,UAAS;IAEjC,IAAW,sBAAsB,IAAI,sBAAsB,EAAE,CAE5D;IAED,6EAA6E;IAC7E,IAAW,iBAAiB,IAAI,MAAM,CAErC;IAED,IAAW,gBAAgB,IAAI,mBAAmB,EAAE,CAWnD;IAEM,uBAAuB,IAAI,IAAI;IAK/B,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;cAOvB,UAAU,IAAI,IAAI;cAKlB,oBAAoB,CACnC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,OAAO,EAAE,UAAU,GAAG,UAAU,GACjC,IAAI;IAMP,OAAO,CAAC,eAAe;cASJ,cAAc,IAAI,sBAAsB,EAAE;yCAhEpD,8BAA8B;2CAA9B,8BAA8B;CAkG1C;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
|