@open-mercato/core 0.7.1-develop.7178.1.ab93fbaf4e → 0.7.1-develop.7180.1.9717fbbb43
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/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/staff_time_entry/index.js +14 -0
- package/dist/generated/entities/staff_time_entry/index.js.map +2 -2
- package/dist/generated/entities/staff_time_entry_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_entry_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_project/index.js +16 -0
- package/dist/generated/entities/staff_time_project/index.js.map +2 -2
- package/dist/generated/entities/staff_time_report/index.js +57 -0
- package/dist/generated/entities/staff_time_report/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_entry/index.js +27 -0
- package/dist/generated/entities/staff_time_report_entry/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_event/index.js +21 -0
- package/dist/generated/entities/staff_time_report_event/index.js.map +7 -0
- package/dist/generated/entities/staff_time_report_project/index.js +15 -0
- package/dist/generated/entities/staff_time_report_project/index.js.map +7 -0
- package/dist/generated/entities/staff_time_tag/index.js +21 -0
- package/dist/generated/entities/staff_time_tag/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task/index.js +37 -0
- package/dist/generated/entities/staff_time_task/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_comment/index.js +21 -0
- package/dist/generated/entities/staff_time_task_comment/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_status/index.js +29 -0
- package/dist/generated/entities/staff_time_task_status/index.js.map +7 -0
- package/dist/generated/entities/staff_time_task_tag/index.js +15 -0
- package/dist/generated/entities/staff_time_task_tag/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +11 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +149 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/timesheetFixtures.js +7 -0
- package/dist/helpers/integration/timesheetFixtures.js.map +2 -2
- package/dist/modules/auth/cli.js +16 -0
- package/dist/modules/auth/cli.js.map +2 -2
- package/dist/modules/auth/lib/backendChrome.js +1 -0
- package/dist/modules/auth/lib/backendChrome.js.map +2 -2
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js +44 -0
- package/dist/modules/customer_accounts/lib/customerRoleAcls.js.map +7 -0
- package/dist/modules/customer_accounts/setup.js +1 -28
- package/dist/modules/customer_accounts/setup.js.map +2 -2
- package/dist/modules/data_sync/api/options.js +2 -0
- package/dist/modules/data_sync/api/options.js.map +2 -2
- package/dist/modules/data_sync/backend/data-sync/page.js +39 -17
- package/dist/modules/data_sync/backend/data-sync/page.js.map +2 -2
- package/dist/modules/data_sync/lib/start-controls.js +42 -0
- package/dist/modules/data_sync/lib/start-controls.js.map +7 -0
- package/dist/modules/staff/acl.js +9 -1
- package/dist/modules/staff/acl.js.map +2 -2
- package/dist/modules/staff/ai-agents.js +142 -0
- package/dist/modules/staff/ai-agents.js.map +7 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js +348 -0
- package/dist/modules/staff/ai-tools/time-tracking-pack.js.map +7 -0
- package/dist/modules/staff/ai-tools/types.js +54 -0
- package/dist/modules/staff/ai-tools/types.js.map +7 -0
- package/dist/modules/staff/ai-tools.js +8 -0
- package/dist/modules/staff/ai-tools.js.map +7 -0
- package/dist/modules/staff/analytics.js +84 -1
- package/dist/modules/staff/analytics.js.map +2 -2
- package/dist/modules/staff/api/guards.js +37 -3
- package/dist/modules/staff/api/guards.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/accept/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/accept/route.js.map +2 -2
- package/dist/modules/staff/api/leave-requests/reject/route.js +1 -3
- package/dist/modules/staff/api/leave-requests/reject/route.js.map +2 -2
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js +131 -0
- package/dist/modules/staff/api/portal/time-reports/[id]/route.js.map +7 -0
- package/dist/modules/staff/api/portal/time-reports/route.js +179 -0
- package/dist/modules/staff/api/portal/time-reports/route.js.map +7 -0
- package/dist/modules/staff/api/team-members/self/route.js +1 -3
- package/dist/modules/staff/api/team-members/self/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/assign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/assign/route.js.map +2 -2
- package/dist/modules/staff/api/team-members/tags/unassign/route.js +1 -3
- package/dist/modules/staff/api/team-members/tags/unassign/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js +174 -0
- package/dist/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.js.map +7 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js +226 -0
- package/dist/modules/staff/api/timesheets/access-requests/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js +15 -8
- package/dist/modules/staff/api/timesheets/my-projects/[projectId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-projects/route.js +13 -1
- package/dist/modules/staff/api/timesheets/my-projects/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js +42 -0
- package/dist/modules/staff/api/timesheets/my-work/myWorkAggregate.js.map +7 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js +383 -0
- package/dist/modules/staff/api/timesheets/my-work/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js +14 -2
- package/dist/modules/staff/api/timesheets/projects/kpis/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js +168 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/close/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js +246 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/export/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js +183 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/sheet/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js +164 -0
- package/dist/modules/staff/api/timesheets/reports/[id]/unlock/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js +360 -0
- package/dist/modules/staff/api/timesheets/reports/preview/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/route.js +316 -0
- package/dist/modules/staff/api/timesheets/reports/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js +63 -0
- package/dist/modules/staff/api/timesheets/reports/shared.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js +164 -0
- package/dist/modules/staff/api/timesheets/settings/reapply-rounding/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js +168 -0
- package/dist/modules/staff/api/timesheets/settings/rounding-impact/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/settings/route.js +199 -0
- package/dist/modules/staff/api/timesheets/settings/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/access.js +76 -0
- package/dist/modules/staff/api/timesheets/tags/access.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js +235 -0
- package/dist/modules/staff/api/timesheets/tags/entry-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/route.js +160 -0
- package/dist/modules/staff/api/timesheets/tags/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js +233 -0
- package/dist/modules/staff/api/timesheets/tags/task-assignments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js +188 -0
- package/dist/modules/staff/api/timesheets/task-statuses/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js +399 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/comments/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js +210 -0
- package/dist/modules/staff/api/timesheets/tasks/[id]/status/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js +333 -0
- package/dist/modules/staff/api/timesheets/tasks/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js +228 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js +29 -10
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js +31 -18
- package/dist/modules/staff/api/timesheets/time-entries/[id]/segments/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js +21 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js +27 -7
- package/dist/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js +215 -32
- package/dist/modules/staff/api/timesheets/time-entries/bulk/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js +378 -0
- package/dist/modules/staff/api/timesheets/time-entries/copy-day/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js +340 -0
- package/dist/modules/staff/api/timesheets/time-entries/overlaps/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-entries/route.js +238 -26
- package/dist/modules/staff/api/timesheets/time-entries/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js +23 -8
- package/dist/modules/staff/api/timesheets/time-entries/start-timer/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js +209 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.js.map +7 -0
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js +59 -2
- package/dist/modules/staff/api/timesheets/time-projects/[id]/employees/route.js.map +2 -2
- package/dist/modules/staff/api/timesheets/time-projects/route.js +264 -22
- package/dist/modules/staff/api/timesheets/time-projects/route.js.map +2 -2
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js +110 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js +981 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/entries/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js +583 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js +15 -0
- package/dist/modules/staff/backend/staff/time-tracking/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js +65 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js +229 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js +1014 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js +97 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js +1040 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js +19 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js +353 -0
- package/dist/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js +457 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js +697 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js +16 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/create/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js +174 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/reports/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js +546 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/settings/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js +710 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/GridView.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js +646 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.js.map +7 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js +18 -0
- package/dist/modules/staff/backend/staff/time-tracking/timesheet/page.meta.js.map +7 -0
- package/dist/modules/staff/backend/staff/timesheets/page.js +4 -793
- package/dist/modules/staff/backend/staff/timesheets/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js +2 -7
- package/dist/modules/staff/backend/staff/timesheets/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js +5 -136
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js +5 -445
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.js.map +3 -3
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js +4 -76
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js +1 -7
- package/dist/modules/staff/backend/staff/timesheets/projects/create/page.meta.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js +4 -613
- package/dist/modules/staff/backend/staff/timesheets/projects/page.js.map +2 -2
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js +2 -17
- package/dist/modules/staff/backend/staff/timesheets/projects/page.meta.js.map +2 -2
- package/dist/modules/staff/ce.js +40 -0
- package/dist/modules/staff/ce.js.map +2 -2
- package/dist/modules/staff/cli.js +166 -1
- package/dist/modules/staff/cli.js.map +2 -2
- package/dist/modules/staff/commands/index.js +5 -0
- package/dist/modules/staff/commands/index.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-entries.js +569 -21
- package/dist/modules/staff/commands/timesheets-entries.js.map +3 -3
- package/dist/modules/staff/commands/timesheets-projects.js +450 -7
- package/dist/modules/staff/commands/timesheets-projects.js.map +2 -2
- package/dist/modules/staff/commands/timesheets-reports.js +1036 -0
- package/dist/modules/staff/commands/timesheets-reports.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tags.js +1015 -0
- package/dist/modules/staff/commands/timesheets-tags.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js +438 -0
- package/dist/modules/staff/commands/timesheets-task-comments.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js +723 -0
- package/dist/modules/staff/commands/timesheets-task-statuses.js.map +7 -0
- package/dist/modules/staff/commands/timesheets-tasks.js +834 -0
- package/dist/modules/staff/commands/timesheets-tasks.js.map +7 -0
- package/dist/modules/staff/data/enrichers.js +426 -12
- package/dist/modules/staff/data/enrichers.js.map +2 -2
- package/dist/modules/staff/data/entities.js +552 -3
- package/dist/modules/staff/data/entities.js.map +2 -2
- package/dist/modules/staff/data/extensions.js +41 -0
- package/dist/modules/staff/data/extensions.js.map +7 -0
- package/dist/modules/staff/data/validators.js +254 -9
- package/dist/modules/staff/data/validators.js.map +2 -2
- package/dist/modules/staff/di.js +42 -1
- package/dist/modules/staff/di.js.map +2 -2
- package/dist/modules/staff/events.js +84 -6
- package/dist/modules/staff/events.js.map +2 -2
- package/dist/modules/staff/events.payloads.js +158 -0
- package/dist/modules/staff/events.payloads.js.map +7 -0
- package/dist/modules/staff/extension-points.js +261 -0
- package/dist/modules/staff/extension-points.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js +138 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js +12 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js +133 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.js.map +7 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js +19 -0
- package/dist/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.js.map +7 -0
- package/dist/modules/staff/lib/crud.js +11 -1
- package/dist/modules/staff/lib/crud.js.map +2 -2
- package/dist/modules/staff/lib/time-tracking/access.js +92 -0
- package/dist/modules/staff/lib/time-tracking/access.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/billability.js +39 -0
- package/dist/modules/staff/lib/time-tracking/billability.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js +68 -0
- package/dist/modules/staff/lib/time-tracking/capacity.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js +15 -0
- package/dist/modules/staff/lib/time-tracking/componentContracts.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/cost.js +82 -0
- package/dist/modules/staff/lib/time-tracking/cost.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/duration.js +55 -0
- package/dist/modules/staff/lib/time-tracking/duration.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js +41 -0
- package/dist/modules/staff/lib/time-tracking/featureAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/interval.js +72 -0
- package/dist/modules/staff/lib/time-tracking/interval.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js +88 -0
- package/dist/modules/staff/lib/time-tracking/migrateProjectCodes.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js +10 -0
- package/dist/modules/staff/lib/time-tracking/moneyVisibility.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js +87 -0
- package/dist/modules/staff/lib/time-tracking/overlap.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js +27 -0
- package/dist/modules/staff/lib/time-tracking/portalRecipients.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js +16 -0
- package/dist/modules/staff/lib/time-tracking/portalReports.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js +135 -0
- package/dist/modules/staff/lib/time-tracking/projectCode.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js +187 -0
- package/dist/modules/staff/lib/time-tracking/reapplyRounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js +80 -0
- package/dist/modules/staff/lib/time-tracking/recalculationRunner.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js +56 -0
- package/dist/modules/staff/lib/time-tracking/recalculations.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js +63 -0
- package/dist/modules/staff/lib/time-tracking/registries/invoke.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js +62 -0
- package/dist/modules/staff/lib/time-tracking/registries/registry.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js +21 -0
- package/dist/modules/staff/lib/time-tracking/registries/scope.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js +34 -0
- package/dist/modules/staff/lib/time-tracking/rollup.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js +66 -0
- package/dist/modules/staff/lib/time-tracking/rounding.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js +39 -0
- package/dist/modules/staff/lib/time-tracking/roundingImpact.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js +214 -0
- package/dist/modules/staff/lib/time-tracking/settingKeys.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/settings.js +87 -0
- package/dist/modules/staff/lib/time-tracking/settings.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js +9 -0
- package/dist/modules/staff/lib/time-tracking/sqlInClause.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js +48 -0
- package/dist/modules/staff/lib/time-tracking/timeEntrySources.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js +283 -0
- package/dist/modules/staff/lib/time-tracking-ui/BoardFilterChips.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js +324 -0
- package/dist/modules/staff/lib/time-tracking-ui/CustomerPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js +121 -0
- package/dist/modules/staff/lib/time-tracking-ui/DurationInput.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryDetailsFields.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js +89 -0
- package/dist/modules/staff/lib/time-tracking-ui/EntryFilterBar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js +855 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanBoard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js +360 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanCard.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js +259 -0
- package/dist/modules/staff/lib/time-tracking-ui/KanbanColumn.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js +238 -0
- package/dist/modules/staff/lib/time-tracking-ui/NewTaskDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js +130 -0
- package/dist/modules/staff/lib/time-tracking-ui/NoProjectAccess.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js +98 -0
- package/dist/modules/staff/lib/time-tracking-ui/PeriodSelector.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js +27 -0
- package/dist/modules/staff/lib/time-tracking-ui/PhasePlaceholder.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js +166 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCodeField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js +295 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js +212 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectFormSections.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js +729 -0
- package/dist/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js +217 -0
- package/dist/modules/staff/lib/time-tracking-ui/ReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js +158 -0
- package/dist/modules/staff/lib/time-tracking-ui/TagPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js +224 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskBoardScreen.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js +93 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskCommentThread.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js +1196 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskDrawer.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskListView.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js +307 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskPicker.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js +284 -0
- package/dist/modules/staff/lib/time-tracking-ui/TaskQuickLog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js +73 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js +1499 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDialog.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js +95 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js +188 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetCalendar.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js +61 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js +45 -0
- package/dist/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js +176 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardDirectory.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js +82 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js +5 -0
- package/dist/modules/staff/lib/time-tracking-ui/boardSummary.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js +152 -0
- package/dist/modules/staff/lib/time-tracking-ui/kanbanBoardData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js +92 -0
- package/dist/modules/staff/lib/time-tracking-ui/projectTeamAssignment.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js +111 -0
- package/dist/modules/staff/lib/time-tracking-ui/taskDrawerData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js +243 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryDialogState.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeEntryListData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js +105 -0
- package/dist/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js +132 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetData.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js +205 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetPeriod.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js +53 -0
- package/dist/modules/staff/lib/time-tracking-ui/timesheetTargets.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js +77 -0
- package/dist/modules/staff/lib/time-tracking-ui/useBoardFilters.js.map +7 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js +151 -0
- package/dist/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.js.map +7 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js +809 -0
- package/dist/modules/staff/lib/timeTrackingSeeds.js.map +7 -0
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js +2 -3
- package/dist/modules/staff/lib/timesheets/timeEntryCacheInvalidation.js.map +2 -2
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js +152 -0
- package/dist/modules/staff/lib/timesheets/timeEntryDecoration.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js +36 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetBurn.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js +66 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThreshold.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js +78 -0
- package/dist/modules/staff/lib/timesheets-projects/budgetThresholdState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js +81 -0
- package/dist/modules/staff/lib/timesheets-projects/computeProjectFinancials.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js +44 -0
- package/dist/modules/staff/lib/timesheets-projects/reportSelection.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js +169 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js +22 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js +51 -1
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectCard.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js +70 -0
- package/dist/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js +63 -0
- package/dist/modules/staff/lib/timesheets-reports/buildReportSheet.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js +170 -0
- package/dist/modules/staff/lib/timesheets-reports/loadReportData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js +205 -0
- package/dist/modules/staff/lib/timesheets-reports/pdf.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js +68 -0
- package/dist/modules/staff/lib/timesheets-reports/reportApprovalPolicies.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js +135 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js +48 -0
- package/dist/modules/staff/lib/timesheets-reports/reportConfigState.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js +262 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExport.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js +34 -0
- package/dist/modules/staff/lib/timesheets-reports/reportExportFormats.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js +79 -0
- package/dist/modules/staff/lib/timesheets-reports/reportGroupings.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js +11 -0
- package/dist/modules/staff/lib/timesheets-reports/reportLabels.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js +83 -0
- package/dist/modules/staff/lib/timesheets-reports/reportReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js +42 -0
- package/dist/modules/staff/lib/timesheets-reports/reportRows.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js +107 -0
- package/dist/modules/staff/lib/timesheets-reports/reportSheetData.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js +289 -0
- package/dist/modules/staff/lib/timesheets-reports/reportTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js +145 -0
- package/dist/modules/staff/lib/timesheets-reports/xlsx.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js +116 -0
- package/dist/modules/staff/lib/timesheets-tasks/computeTaskRollups.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js +50 -0
- package/dist/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js +27 -0
- package/dist/modules/staff/lib/timesheets-tasks/seedProjectStatuses.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js +65 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusPositions.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/statusSlug.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js +31 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHierarchy.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js +17 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskHoursTotals.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js +51 -0
- package/dist/modules/staff/lib/timesheets-tasks/taskReference.js.map +7 -0
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js +11 -4
- package/dist/modules/staff/lib/timesheets-ui/CreateProjectDialog.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/ListView.js +369 -111
- package/dist/modules/staff/lib/timesheets-ui/ListView.js.map +2 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js +47 -2
- package/dist/modules/staff/lib/timesheets-ui/TimerBar.js.map +2 -2
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js +79 -0
- package/dist/modules/staff/migrations/Migration20260813073131_staff.js.map +7 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js +15 -0
- package/dist/modules/staff/migrations/Migration20260824143357_staff.js.map +7 -0
- package/dist/modules/staff/notifications.client.js +16 -0
- package/dist/modules/staff/notifications.client.js.map +7 -0
- package/dist/modules/staff/notifications.handlers.js +80 -0
- package/dist/modules/staff/notifications.handlers.js.map +7 -0
- package/dist/modules/staff/notifications.js +168 -0
- package/dist/modules/staff/notifications.js.map +2 -2
- package/dist/modules/staff/search.js +159 -1
- package/dist/modules/staff/search.js.map +2 -2
- package/dist/modules/staff/setup.js +20 -1
- package/dist/modules/staff/setup.js.map +2 -2
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js +68 -0
- package/dist/modules/staff/subscribers/time-project-access-requested-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js +149 -0
- package/dist/modules/staff/subscribers/time-project-budget-threshold-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js +78 -0
- package/dist/modules/staff/subscribers/time-report-approved-notification.js.map +7 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js +78 -0
- package/dist/modules/staff/subscribers/time-report-portal-broadcast.js.map +7 -0
- package/dist/modules/staff/translations.js +4 -1
- package/dist/modules/staff/translations.js.map +2 -2
- package/dist/modules/staff/widgets/components.js +7 -0
- package/dist/modules/staff/widgets/components.js.map +7 -0
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js +5 -4
- package/dist/modules/staff/widgets/injection/timer-sidebar-indicator/widget.js.map +2 -2
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js +135 -0
- package/dist/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.js.map +7 -0
- package/dist/modules/staff/widgets/notifications/index.js +5 -0
- package/dist/modules/staff/widgets/notifications/index.js.map +7 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js +43 -0
- package/dist/modules/staff/workers/timesheets-reapply-rounding.js.map +7 -0
- package/generated/entities/staff_time_entry/index.ts +7 -0
- package/generated/entities/staff_time_entry_tag/index.ts +6 -0
- package/generated/entities/staff_time_project/index.ts +8 -0
- package/generated/entities/staff_time_report/index.ts +27 -0
- package/generated/entities/staff_time_report_entry/index.ts +12 -0
- package/generated/entities/staff_time_report_event/index.ts +9 -0
- package/generated/entities/staff_time_report_project/index.ts +6 -0
- package/generated/entities/staff_time_tag/index.ts +9 -0
- package/generated/entities/staff_time_task/index.ts +17 -0
- package/generated/entities/staff_time_task_comment/index.ts +9 -0
- package/generated/entities/staff_time_task_status/index.ts +13 -0
- package/generated/entities/staff_time_task_tag/index.ts +6 -0
- package/generated/entities.ids.generated.ts +11 -1
- package/generated/entity-fields-registry.ts +149 -0
- package/package.json +7 -7
- package/src/helpers/integration/timesheetFixtures.ts +31 -1
- package/src/modules/auth/README.md +1 -1
- package/src/modules/auth/cli.ts +35 -1
- package/src/modules/auth/i18n/de.json +7 -0
- package/src/modules/auth/i18n/en.json +7 -0
- package/src/modules/auth/i18n/es.json +7 -0
- package/src/modules/auth/i18n/ko.json +7 -0
- package/src/modules/auth/i18n/pl.json +7 -0
- package/src/modules/auth/lib/backendChrome.tsx +1 -0
- package/src/modules/customer_accounts/lib/customerRoleAcls.ts +79 -0
- package/src/modules/customer_accounts/setup.ts +1 -45
- package/src/modules/data_sync/AGENTS.md +34 -0
- package/src/modules/data_sync/api/options.ts +2 -0
- package/src/modules/data_sync/backend/data-sync/page.tsx +82 -33
- package/src/modules/data_sync/i18n/de.json +1 -0
- package/src/modules/data_sync/i18n/en.json +1 -0
- package/src/modules/data_sync/i18n/es.json +1 -0
- package/src/modules/data_sync/i18n/ko.json +1 -0
- package/src/modules/data_sync/i18n/pl.json +1 -0
- package/src/modules/data_sync/lib/adapter.ts +45 -0
- package/src/modules/data_sync/lib/start-controls.ts +89 -0
- package/src/modules/staff/AGENTS.md +769 -1
- package/src/modules/staff/acl.ts +9 -0
- package/src/modules/staff/ai-agents.ts +189 -0
- package/src/modules/staff/ai-tools/time-tracking-pack.ts +494 -0
- package/src/modules/staff/ai-tools/types.ts +82 -0
- package/src/modules/staff/ai-tools.ts +13 -0
- package/src/modules/staff/analytics.ts +113 -0
- package/src/modules/staff/api/guards.ts +85 -3
- package/src/modules/staff/api/leave-requests/accept/route.ts +0 -2
- package/src/modules/staff/api/leave-requests/reject/route.ts +0 -2
- package/src/modules/staff/api/portal/time-reports/[id]/route.ts +182 -0
- package/src/modules/staff/api/portal/time-reports/route.ts +270 -0
- package/src/modules/staff/api/team-members/self/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/assign/route.ts +0 -2
- package/src/modules/staff/api/team-members/tags/unassign/route.ts +0 -2
- package/src/modules/staff/api/timesheets/_shared/withTimesheetInterceptors.ts +292 -0
- package/src/modules/staff/api/timesheets/access-requests/route.ts +299 -0
- package/src/modules/staff/api/timesheets/my-projects/[projectId]/route.ts +15 -7
- package/src/modules/staff/api/timesheets/my-projects/route.ts +14 -1
- package/src/modules/staff/api/timesheets/my-work/myWorkAggregate.ts +90 -0
- package/src/modules/staff/api/timesheets/my-work/route.ts +475 -0
- package/src/modules/staff/api/timesheets/projects/kpis/route.ts +15 -2
- package/src/modules/staff/api/timesheets/reports/[id]/close/route.ts +203 -0
- package/src/modules/staff/api/timesheets/reports/[id]/export/route.ts +315 -0
- package/src/modules/staff/api/timesheets/reports/[id]/sheet/route.ts +220 -0
- package/src/modules/staff/api/timesheets/reports/[id]/unlock/route.ts +208 -0
- package/src/modules/staff/api/timesheets/reports/preview/route.ts +449 -0
- package/src/modules/staff/api/timesheets/reports/route.ts +386 -0
- package/src/modules/staff/api/timesheets/reports/shared.ts +121 -0
- package/src/modules/staff/api/timesheets/settings/reapply-rounding/route.ts +205 -0
- package/src/modules/staff/api/timesheets/settings/rounding-impact/route.ts +226 -0
- package/src/modules/staff/api/timesheets/settings/route.ts +242 -0
- package/src/modules/staff/api/timesheets/tags/access.ts +134 -0
- package/src/modules/staff/api/timesheets/tags/entry-assignments/route.ts +290 -0
- package/src/modules/staff/api/timesheets/tags/route.ts +177 -0
- package/src/modules/staff/api/timesheets/tags/task-assignments/route.ts +294 -0
- package/src/modules/staff/api/timesheets/task-statuses/route.ts +232 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/comments/route.ts +532 -0
- package/src/modules/staff/api/timesheets/tasks/[id]/status/route.ts +271 -0
- package/src/modules/staff/api/timesheets/tasks/route.ts +443 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/duplicate/route.ts +306 -0
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/[segmentId]/route.ts +32 -10
- package/src/modules/staff/api/timesheets/time-entries/[id]/segments/route.ts +32 -17
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-start/route.ts +27 -6
- package/src/modules/staff/api/timesheets/time-entries/[id]/timer-stop/route.ts +36 -6
- package/src/modules/staff/api/timesheets/time-entries/bulk/route.ts +331 -34
- package/src/modules/staff/api/timesheets/time-entries/copy-day/route.ts +533 -0
- package/src/modules/staff/api/timesheets/time-entries/overlaps/route.ts +457 -0
- package/src/modules/staff/api/timesheets/time-entries/route.ts +378 -24
- package/src/modules/staff/api/timesheets/time-entries/start-timer/route.ts +31 -9
- package/src/modules/staff/api/timesheets/time-projects/[id]/change-currency/route.ts +246 -0
- package/src/modules/staff/api/timesheets/time-projects/[id]/employees/route.ts +62 -2
- package/src/modules/staff/api/timesheets/time-projects/route.ts +397 -22
- package/src/modules/staff/backend/staff/time-tracking/board/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/board/page.tsx +151 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/entries/page.tsx +1229 -0
- package/src/modules/staff/backend/staff/time-tracking/page.meta.ts +11 -0
- package/src/modules/staff/backend/staff/time-tracking/page.tsx +823 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/board/page.tsx +81 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/edit/page.tsx +275 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/[id]/page.tsx +1420 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/create/page.tsx +109 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.meta.ts +15 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/page.tsx +1254 -0
- package/src/modules/staff/backend/staff/time-tracking/projects/projectFormConfig.ts +466 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/[id]/page.tsx +632 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.meta.ts +12 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/create/page.tsx +867 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/reports/page.tsx +246 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/settings/page.tsx +701 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/GridView.tsx +953 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.meta.ts +14 -0
- package/src/modules/staff/backend/staff/time-tracking/timesheet/page.tsx +800 -0
- package/src/modules/staff/backend/staff/timesheets/page.meta.ts +6 -6
- package/src/modules/staff/backend/staff/timesheets/page.tsx +12 -1010
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/edit/page.tsx +4 -158
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/[id]/page.tsx +4 -609
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.meta.ts +0 -6
- package/src/modules/staff/backend/staff/timesheets/projects/create/page.tsx +3 -89
- package/src/modules/staff/backend/staff/timesheets/projects/page.meta.ts +2 -19
- package/src/modules/staff/backend/staff/timesheets/projects/page.tsx +3 -778
- package/src/modules/staff/ce.ts +63 -0
- package/src/modules/staff/cli.ts +207 -1
- package/src/modules/staff/commands/index.ts +5 -0
- package/src/modules/staff/commands/timesheets-entries.ts +1006 -28
- package/src/modules/staff/commands/timesheets-projects.ts +593 -7
- package/src/modules/staff/commands/timesheets-reports.ts +1329 -0
- package/src/modules/staff/commands/timesheets-tags.ts +1315 -0
- package/src/modules/staff/commands/timesheets-task-comments.ts +583 -0
- package/src/modules/staff/commands/timesheets-task-statuses.ts +889 -0
- package/src/modules/staff/commands/timesheets-tasks.ts +1121 -0
- package/src/modules/staff/data/enrichers.ts +675 -10
- package/src/modules/staff/data/entities.ts +494 -2
- package/src/modules/staff/data/extensions.ts +68 -0
- package/src/modules/staff/data/validators.ts +348 -3
- package/src/modules/staff/di.ts +96 -0
- package/src/modules/staff/events.payloads.ts +268 -0
- package/src/modules/staff/events.ts +87 -5
- package/src/modules/staff/extension-points.ts +308 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.meta.ts +10 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/[id]/page.tsx +225 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.meta.ts +17 -0
- package/src/modules/staff/frontend/[orgSlug]/portal/time-reports/page.tsx +182 -0
- package/src/modules/staff/i18n/de.json +899 -0
- package/src/modules/staff/i18n/en.json +899 -0
- package/src/modules/staff/i18n/es.json +899 -0
- package/src/modules/staff/i18n/ko.json +899 -0
- package/src/modules/staff/i18n/pl.json +899 -0
- package/src/modules/staff/lib/crud.ts +14 -3
- package/src/modules/staff/lib/time-tracking/access.ts +155 -0
- package/src/modules/staff/lib/time-tracking/billability.ts +68 -0
- package/src/modules/staff/lib/time-tracking/capacity.ts +124 -0
- package/src/modules/staff/lib/time-tracking/componentContracts.ts +26 -0
- package/src/modules/staff/lib/time-tracking/cost.ts +144 -0
- package/src/modules/staff/lib/time-tracking/duration.ts +68 -0
- package/src/modules/staff/lib/time-tracking/featureAccess.ts +115 -0
- package/src/modules/staff/lib/time-tracking/interval.ts +90 -0
- package/src/modules/staff/lib/time-tracking/migrateProjectCodes.ts +161 -0
- package/src/modules/staff/lib/time-tracking/moneyVisibility.ts +37 -0
- package/src/modules/staff/lib/time-tracking/overlap.ts +159 -0
- package/src/modules/staff/lib/time-tracking/portalRecipients.ts +76 -0
- package/src/modules/staff/lib/time-tracking/portalReports.ts +31 -0
- package/src/modules/staff/lib/time-tracking/projectCode.ts +221 -0
- package/src/modules/staff/lib/time-tracking/reapplyRounding.ts +313 -0
- package/src/modules/staff/lib/time-tracking/recalculationRunner.ts +118 -0
- package/src/modules/staff/lib/time-tracking/recalculations.ts +135 -0
- package/src/modules/staff/lib/time-tracking/registries/invoke.ts +122 -0
- package/src/modules/staff/lib/time-tracking/registries/registry.ts +124 -0
- package/src/modules/staff/lib/time-tracking/registries/scope.ts +56 -0
- package/src/modules/staff/lib/time-tracking/rollup.ts +59 -0
- package/src/modules/staff/lib/time-tracking/rounding.ts +126 -0
- package/src/modules/staff/lib/time-tracking/roundingImpact.ts +75 -0
- package/src/modules/staff/lib/time-tracking/settingKeys.ts +274 -0
- package/src/modules/staff/lib/time-tracking/settings.ts +168 -0
- package/src/modules/staff/lib/time-tracking/sqlInClause.ts +22 -0
- package/src/modules/staff/lib/time-tracking/timeEntrySources.ts +85 -0
- package/src/modules/staff/lib/time-tracking-ui/BoardFilterChips.tsx +360 -0
- package/src/modules/staff/lib/time-tracking-ui/CustomerPicker.tsx +427 -0
- package/src/modules/staff/lib/time-tracking-ui/DurationInput.tsx +192 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryDetailsFields.tsx +224 -0
- package/src/modules/staff/lib/time-tracking-ui/EntryFilterBar.tsx +144 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanBoard.tsx +1065 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanCard.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/KanbanColumn.tsx +316 -0
- package/src/modules/staff/lib/time-tracking-ui/NewTaskDialog.tsx +291 -0
- package/src/modules/staff/lib/time-tracking-ui/NoProjectAccess.tsx +162 -0
- package/src/modules/staff/lib/time-tracking-ui/PeriodSelector.tsx +149 -0
- package/src/modules/staff/lib/time-tracking-ui/PhasePlaceholder.tsx +31 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCodeField.tsx +230 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectCurrencyField.tsx +432 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectFormSections.tsx +323 -0
- package/src/modules/staff/lib/time-tracking-ui/ProjectTeamDrawer.tsx +930 -0
- package/src/modules/staff/lib/time-tracking-ui/ReportSheet.tsx +357 -0
- package/src/modules/staff/lib/time-tracking-ui/TagPicker.tsx +195 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskBoardScreen.tsx +243 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskCommentThread.tsx +137 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskDrawer.tsx +1405 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskListView.tsx +260 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskPicker.tsx +435 -0
- package/src/modules/staff/lib/time-tracking-ui/TaskQuickLog.tsx +296 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntriesSummaryFooter.tsx +97 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDialog.tsx +1929 -0
- package/src/modules/staff/lib/time-tracking-ui/TimeEntryDurationCell.tsx +126 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetCalendar.tsx +265 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetPeriodFooter.tsx +78 -0
- package/src/modules/staff/lib/time-tracking-ui/TimesheetViewSwitch.tsx +70 -0
- package/src/modules/staff/lib/time-tracking-ui/boardDirectory.ts +231 -0
- package/src/modules/staff/lib/time-tracking-ui/boardFilters.ts +128 -0
- package/src/modules/staff/lib/time-tracking-ui/boardSummary.ts +20 -0
- package/src/modules/staff/lib/time-tracking-ui/kanbanBoardData.ts +228 -0
- package/src/modules/staff/lib/time-tracking-ui/projectTeamAssignment.ts +143 -0
- package/src/modules/staff/lib/time-tracking-ui/taskDrawerData.ts +194 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryDialogState.ts +400 -0
- package/src/modules/staff/lib/time-tracking-ui/timeEntryListData.ts +271 -0
- package/src/modules/staff/lib/time-tracking-ui/timeTrackingSettingsForm.ts +168 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetData.ts +225 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetPeriod.ts +278 -0
- package/src/modules/staff/lib/time-tracking-ui/timesheetTargets.ts +93 -0
- package/src/modules/staff/lib/time-tracking-ui/useBoardFilters.ts +107 -0
- package/src/modules/staff/lib/time-tracking-ui/useTimesheetPreferences.ts +245 -0
- package/src/modules/staff/lib/timeTrackingSeeds.ts +1037 -0
- package/src/modules/staff/lib/timesheets/timeEntryCacheInvalidation.ts +11 -10
- package/src/modules/staff/lib/timesheets/timeEntryDecoration.ts +256 -0
- package/src/modules/staff/lib/timesheets-projects/budgetBurn.ts +60 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThreshold.ts +135 -0
- package/src/modules/staff/lib/timesheets-projects/budgetThresholdState.ts +137 -0
- package/src/modules/staff/lib/timesheets-projects/computeProjectFinancials.ts +142 -0
- package/src/modules/staff/lib/timesheets-projects/reportSelection.ts +82 -0
- package/src/modules/staff/lib/timesheets-projects-ui/AssignMembersDialog.tsx +237 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectBudgetCell.tsx +33 -0
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectCard.tsx +56 -1
- package/src/modules/staff/lib/timesheets-projects-ui/ProjectsBulkActionsBar.tsx +90 -0
- package/src/modules/staff/lib/timesheets-reports/buildReportSheet.ts +125 -0
- package/src/modules/staff/lib/timesheets-reports/loadReportData.ts +251 -0
- package/src/modules/staff/lib/timesheets-reports/pdf.ts +263 -0
- package/src/modules/staff/lib/timesheets-reports/reportApprovalPolicies.ts +137 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigData.ts +247 -0
- package/src/modules/staff/lib/timesheets-reports/reportConfigState.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportExport.ts +373 -0
- package/src/modules/staff/lib/timesheets-reports/reportExportFormats.ts +71 -0
- package/src/modules/staff/lib/timesheets-reports/reportGroupings.ts +153 -0
- package/src/modules/staff/lib/timesheets-reports/reportLabels.ts +23 -0
- package/src/modules/staff/lib/timesheets-reports/reportReference.ts +146 -0
- package/src/modules/staff/lib/timesheets-reports/reportRows.ts +89 -0
- package/src/modules/staff/lib/timesheets-reports/reportSheetData.ts +196 -0
- package/src/modules/staff/lib/timesheets-reports/reportTotals.ts +544 -0
- package/src/modules/staff/lib/timesheets-reports/xlsx.ts +207 -0
- package/src/modules/staff/lib/timesheets-tasks/computeTaskRollups.ts +238 -0
- package/src/modules/staff/lib/timesheets-tasks/defaultStatusTemplate.ts +90 -0
- package/src/modules/staff/lib/timesheets-tasks/seedProjectStatuses.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/statusPositions.ts +132 -0
- package/src/modules/staff/lib/timesheets-tasks/statusSlug.ts +43 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHierarchy.ts +99 -0
- package/src/modules/staff/lib/timesheets-tasks/taskHoursTotals.ts +42 -0
- package/src/modules/staff/lib/timesheets-tasks/taskReference.ts +108 -0
- package/src/modules/staff/lib/timesheets-ui/CreateProjectDialog.tsx +18 -4
- package/src/modules/staff/lib/timesheets-ui/ListView.tsx +504 -149
- package/src/modules/staff/lib/timesheets-ui/TimerBar.tsx +50 -2
- package/src/modules/staff/migrations/.snapshot-open-mercato.json +3244 -228
- package/src/modules/staff/migrations/Migration20260813073131_staff.ts +94 -0
- package/src/modules/staff/migrations/Migration20260824143357_staff.ts +17 -0
- package/src/modules/staff/notifications.client.ts +16 -0
- package/src/modules/staff/notifications.handlers.ts +88 -0
- package/src/modules/staff/notifications.ts +163 -0
- package/src/modules/staff/search.ts +191 -1
- package/src/modules/staff/setup.ts +22 -0
- package/src/modules/staff/subscribers/time-project-access-requested-notification.ts +95 -0
- package/src/modules/staff/subscribers/time-project-budget-threshold-notification.ts +226 -0
- package/src/modules/staff/subscribers/time-report-approved-notification.ts +116 -0
- package/src/modules/staff/subscribers/time-report-portal-broadcast.ts +120 -0
- package/src/modules/staff/translations.ts +17 -0
- package/src/modules/staff/widgets/components.ts +34 -0
- package/src/modules/staff/widgets/injection/timer-sidebar-indicator/widget.tsx +6 -5
- package/src/modules/staff/widgets/notifications/TimeProjectAccessRequestedRenderer.tsx +138 -0
- package/src/modules/staff/widgets/notifications/index.ts +1 -0
- package/src/modules/staff/workers/timesheets-reapply-rounding.ts +59 -0
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js +0 -123
- package/dist/modules/staff/backend/staff/timesheets/projects/projectFormConfig.js.map +0 -7
- package/src/modules/staff/backend/staff/timesheets/projects/projectFormConfig.ts +0 -138
package/src/modules/staff/acl.ts
CHANGED
|
@@ -19,6 +19,15 @@ export const features = [
|
|
|
19
19
|
// Timesheets (Phase 2)
|
|
20
20
|
{ id: 'staff.timesheets.approve', title: 'Approve reportee time', module: 'staff' },
|
|
21
21
|
{ id: 'staff.timesheets.lock', title: 'Lock time periods', module: 'staff' },
|
|
22
|
+
|
|
23
|
+
// Time tracking (Phase 2)
|
|
24
|
+
{ id: 'staff.timesheets.tasks.view', title: 'View tasks', module: 'staff' },
|
|
25
|
+
{ id: 'staff.timesheets.tasks.manage', title: 'Create/edit tasks', module: 'staff' },
|
|
26
|
+
{ id: 'staff.timesheets.reports.view', title: 'View customer reports', module: 'staff' },
|
|
27
|
+
{ id: 'staff.timesheets.reports.manage', title: 'Create/edit customer reports', module: 'staff' },
|
|
28
|
+
{ id: 'staff.timesheets.reports.unlock', title: 'Unlock reported entries', module: 'staff' },
|
|
29
|
+
{ id: 'staff.timesheets.settings.manage', title: 'Manage time tracking settings', module: 'staff' },
|
|
30
|
+
{ id: 'staff.timesheets.rates.view', title: 'View rates and cost', module: 'staff' },
|
|
22
31
|
]
|
|
23
32
|
|
|
24
33
|
export default features
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EP-49 — `staff.time_tracking_assistant`.
|
|
3
|
+
*
|
|
4
|
+
* A write-capable chat agent over the time-tracking tool pack. Its whole reason
|
|
5
|
+
* to exist is the sentence "log yesterday afternoon on the Acme migration" —
|
|
6
|
+
* which is a mutation, so the agent ships `mutationPolicy: 'confirm-required'`
|
|
7
|
+
* and every write surfaces as an approval card before it persists. A per-tenant
|
|
8
|
+
* override can downgrade it to `read-only`, in which case the runtime filters the
|
|
9
|
+
* three write tools out before the model ever sees them.
|
|
10
|
+
*
|
|
11
|
+
* `requiredFeatures` is the read floor. Each individual tool re-declares its own
|
|
12
|
+
* `staff.timesheets.*` gate, and the API operation runner refuses a route whose
|
|
13
|
+
* required features the tool does not carry, so a viewer who reaches the agent
|
|
14
|
+
* still cannot reach `staff.log_time`.
|
|
15
|
+
*
|
|
16
|
+
* The prompt is a structured `PromptTemplate` with the seven named sections the
|
|
17
|
+
* override system addresses by name.
|
|
18
|
+
*/
|
|
19
|
+
import type { AiAgentDefinition } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/ai-agent-definition'
|
|
20
|
+
|
|
21
|
+
type PromptSectionName =
|
|
22
|
+
| 'role'
|
|
23
|
+
| 'scope'
|
|
24
|
+
| 'data'
|
|
25
|
+
| 'tools'
|
|
26
|
+
| 'attachments'
|
|
27
|
+
| 'mutationPolicy'
|
|
28
|
+
| 'responseStyle'
|
|
29
|
+
|
|
30
|
+
interface PromptSection {
|
|
31
|
+
name: PromptSectionName
|
|
32
|
+
content: string
|
|
33
|
+
order: number
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface PromptTemplate {
|
|
37
|
+
id: string
|
|
38
|
+
sections: PromptSection[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const AGENT_ID = 'staff.time_tracking_assistant'
|
|
42
|
+
const MODULE_ID = 'staff'
|
|
43
|
+
|
|
44
|
+
const ALLOWED_TOOLS: readonly string[] = [
|
|
45
|
+
'staff.summarize_week',
|
|
46
|
+
'staff.find_missing_days',
|
|
47
|
+
'staff.draft_client_report',
|
|
48
|
+
'staff.log_time',
|
|
49
|
+
'staff.start_timer',
|
|
50
|
+
'staff.stop_timer',
|
|
51
|
+
'meta.describe_agent',
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
const REQUIRED_FEATURES: readonly string[] = ['staff.timesheets.view']
|
|
55
|
+
|
|
56
|
+
const PROMPT_SECTIONS: PromptSection[] = [
|
|
57
|
+
{
|
|
58
|
+
name: 'role',
|
|
59
|
+
order: 1,
|
|
60
|
+
content: [
|
|
61
|
+
'ROLE',
|
|
62
|
+
'You are the Time Tracking Assistant inside Open Mercato. You help one person',
|
|
63
|
+
'keep their own timesheet honest: logging work they did, starting and stopping',
|
|
64
|
+
'timers, summarizing what they logged, and spotting days they missed.',
|
|
65
|
+
].join('\n'),
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'scope',
|
|
69
|
+
order: 2,
|
|
70
|
+
content: [
|
|
71
|
+
'SCOPE',
|
|
72
|
+
'You act as the signed-in user and nobody else. No tool accepts another',
|
|
73
|
+
"person's staff member id, and you must never offer to log time for a",
|
|
74
|
+
'colleague — that is a backoffice action on /backend/staff/time-tracking.',
|
|
75
|
+
'Respect tenant and organization isolation; the tools enforce it, do not try',
|
|
76
|
+
'to work around a refusal.',
|
|
77
|
+
'Act, do not interrogate. "How did my week go?" is a call to',
|
|
78
|
+
'staff.summarize_week with the current week, not a request for clarification.',
|
|
79
|
+
].join('\n'),
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'data',
|
|
83
|
+
order: 3,
|
|
84
|
+
content: [
|
|
85
|
+
'DATA',
|
|
86
|
+
'You can read the signed-in user\'s time entries and preview a customer',
|
|
87
|
+
'report over projects they can already see. All durations are MINUTES.',
|
|
88
|
+
'You never see rates, costs or amounts: they are gated on a feature this',
|
|
89
|
+
'agent does not carry, and staff.draft_client_report deliberately asks for a',
|
|
90
|
+
'preview without them. If the operator asks what something is worth, say the',
|
|
91
|
+
'figures are on the report screen and give the hours instead.',
|
|
92
|
+
'Never invent a project id, a task id or a time entry id. Use only ids a',
|
|
93
|
+
'previous tool call returned.',
|
|
94
|
+
].join('\n'),
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'tools',
|
|
98
|
+
order: 4,
|
|
99
|
+
content: [
|
|
100
|
+
'TOOLS',
|
|
101
|
+
'- staff.summarize_week — totals per day and per project for a date range.',
|
|
102
|
+
'- staff.find_missing_days — days in a range with no logged time.',
|
|
103
|
+
'- staff.draft_client_report — what a customer report would contain, without',
|
|
104
|
+
' creating one. Nothing is written and nothing is locked.',
|
|
105
|
+
'- staff.log_time — create one time entry.',
|
|
106
|
+
'- staff.start_timer / staff.stop_timer — begin and end a running timer.',
|
|
107
|
+
'Prefer the narrowest tool. If a read returns nothing after two different',
|
|
108
|
+
'ranges, say what you looked for and stop.',
|
|
109
|
+
].join('\n'),
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'attachments',
|
|
113
|
+
order: 5,
|
|
114
|
+
content: [
|
|
115
|
+
'ATTACHMENTS',
|
|
116
|
+
'This agent takes no attachments. If the operator attaches a file, say you',
|
|
117
|
+
'cannot read it here and point at the time-tracking screens.',
|
|
118
|
+
].join('\n'),
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'mutationPolicy',
|
|
122
|
+
order: 6,
|
|
123
|
+
content: [
|
|
124
|
+
'MUTATION POLICY',
|
|
125
|
+
'staff.log_time, staff.start_timer and staff.stop_timer are mutations. The',
|
|
126
|
+
'runtime short-circuits each call into an approval card; the write happens',
|
|
127
|
+
'only after the operator confirms it. Do NOT say the time was logged until a',
|
|
128
|
+
'mutation-result-card comes back — say you have prepared it for confirmation.',
|
|
129
|
+
'Never batch several days into one call hoping they slip through as one',
|
|
130
|
+
'approval; log one entry per call so each is reviewable.',
|
|
131
|
+
'If a per-tenant override has downgraded this agent to read-only, the runtime',
|
|
132
|
+
'refuses the call: tell the operator writes are locked for this tenant and',
|
|
133
|
+
'point at /backend/staff/time-tracking/timesheet.',
|
|
134
|
+
].join('\n'),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'responseStyle',
|
|
138
|
+
order: 7,
|
|
139
|
+
content: [
|
|
140
|
+
'RESPONSE STYLE',
|
|
141
|
+
'Answer in hours and minutes, not raw minute counts: 450 minutes is "7h 30m".',
|
|
142
|
+
'Lead with the number the operator asked for, then the breakdown.',
|
|
143
|
+
'When you report missing days, list the dates plainly and offer to log them —',
|
|
144
|
+
'one entry per confirmation.',
|
|
145
|
+
'Keep it short. A timesheet answer is two or three sentences plus a list.',
|
|
146
|
+
].join('\n'),
|
|
147
|
+
},
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
function compilePromptTemplate(template: PromptTemplate): string {
|
|
151
|
+
return template.sections
|
|
152
|
+
.slice()
|
|
153
|
+
.sort((left, right) => left.order - right.order)
|
|
154
|
+
.map((section) => section.content.trim())
|
|
155
|
+
.join('\n\n')
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const promptTemplate: PromptTemplate = {
|
|
159
|
+
id: `${AGENT_ID}.prompt`,
|
|
160
|
+
sections: PROMPT_SECTIONS,
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const agent: AiAgentDefinition = {
|
|
164
|
+
id: AGENT_ID,
|
|
165
|
+
moduleId: MODULE_ID,
|
|
166
|
+
label: 'Time Tracking Assistant',
|
|
167
|
+
description:
|
|
168
|
+
'Logs your time, runs your timer, summarizes what you logged and finds the days you missed. Every write goes through the approval card.',
|
|
169
|
+
systemPrompt: compilePromptTemplate(promptTemplate),
|
|
170
|
+
allowedTools: [...ALLOWED_TOOLS],
|
|
171
|
+
executionMode: 'chat',
|
|
172
|
+
requiredFeatures: [...REQUIRED_FEATURES],
|
|
173
|
+
readOnly: false,
|
|
174
|
+
mutationPolicy: 'confirm-required',
|
|
175
|
+
keywords: ['time tracking', 'timesheet', 'timer', 'hours', 'timesheets'],
|
|
176
|
+
domain: 'staff',
|
|
177
|
+
dataCapabilities: {
|
|
178
|
+
entities: ['staff.staff_time_entry', 'staff.staff_time_project', 'staff.staff_time_report'],
|
|
179
|
+
operations: ['read'],
|
|
180
|
+
},
|
|
181
|
+
suggestions: [
|
|
182
|
+
{ label: 'Summarize my week', prompt: 'Summarize the hours I logged this week, per project.' },
|
|
183
|
+
{ label: 'Find missing days', prompt: 'Which working days this month have no time logged?' },
|
|
184
|
+
],
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const aiAgents: AiAgentDefinition[] = [agent]
|
|
188
|
+
|
|
189
|
+
export default aiAgents
|
|
@@ -0,0 +1,494 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EP-49 — the time-tracking AI tool pack.
|
|
3
|
+
*
|
|
4
|
+
* Six tools, three of them writes. The write path is the platform's approval
|
|
5
|
+
* contract, and the shape of that contract is the one thing worth stating
|
|
6
|
+
* plainly here, because the spec described it inside out:
|
|
7
|
+
*
|
|
8
|
+
* A module tool does NOT call `prepareMutation`. `prepareMutation` is framework
|
|
9
|
+
* code — its only call site is `agent-tools.ts` in `@open-mercato/ai-assistant`,
|
|
10
|
+
* which intercepts the model's call, short-circuits the handler, persists an
|
|
11
|
+
* `AiPendingAction` and returns a preview card. A tool opts into that by
|
|
12
|
+
* declaring `isMutation: true` and a `loadBeforeRecord` resolver that renders the
|
|
13
|
+
* diff; the agent opts in with `mutationPolicy: 'confirm-required'`. The handler
|
|
14
|
+
* runs later, once, from the confirm route, with the stored input. Calling
|
|
15
|
+
* `prepareMutation` from here would be calling the interceptor from inside the
|
|
16
|
+
* thing it intercepts.
|
|
17
|
+
*
|
|
18
|
+
* Every tool is API-backed. `createAiApiOperationRunner` resolves the route from
|
|
19
|
+
* the generated manifest and refuses to run a mutation route whose
|
|
20
|
+
* `requiredFeatures` the tool does not itself declare, so the `staff.timesheets.*`
|
|
21
|
+
* gate on each tool below is checked twice: once by the tool registry before the
|
|
22
|
+
* handler, once by the runner against the route. The route then applies the
|
|
23
|
+
* project-access intersection, the mutation guards, the interceptors and the
|
|
24
|
+
* commands — none of which is reimplemented here.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import { z } from 'zod'
|
|
28
|
+
import { defineApiBackedAiTool } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/api-backed-tool'
|
|
29
|
+
import type {
|
|
30
|
+
AiApiOperationRequest,
|
|
31
|
+
AiToolExecutionContext,
|
|
32
|
+
} from '@open-mercato/ai-assistant/modules/ai_assistant/lib/ai-api-operation-runner'
|
|
33
|
+
import type { AiToolDefinition } from '@open-mercato/ai-assistant/modules/ai_assistant/lib/types'
|
|
34
|
+
import {
|
|
35
|
+
assertTenantScope,
|
|
36
|
+
enumerateDates,
|
|
37
|
+
isWeekend,
|
|
38
|
+
resolveStaffToolScope,
|
|
39
|
+
toIsoDate,
|
|
40
|
+
toMinutes,
|
|
41
|
+
} from './types'
|
|
42
|
+
|
|
43
|
+
const VIEW_FEATURE = 'staff.timesheets.view'
|
|
44
|
+
const MANAGE_OWN_FEATURE = 'staff.timesheets.manage_own'
|
|
45
|
+
const REPORTS_VIEW_FEATURE = 'staff.timesheets.reports.view'
|
|
46
|
+
|
|
47
|
+
const isoDate = z
|
|
48
|
+
.string()
|
|
49
|
+
.regex(/^\d{4}-\d{2}-\d{2}$/, 'Use a yyyy-mm-dd calendar date.')
|
|
50
|
+
|
|
51
|
+
type EntryRow = {
|
|
52
|
+
id?: unknown
|
|
53
|
+
date?: unknown
|
|
54
|
+
durationMinutes?: unknown
|
|
55
|
+
duration_minutes?: unknown
|
|
56
|
+
roundedMinutes?: unknown
|
|
57
|
+
timeProjectId?: unknown
|
|
58
|
+
time_project_id?: unknown
|
|
59
|
+
projectName?: unknown
|
|
60
|
+
taskId?: unknown
|
|
61
|
+
notes?: unknown
|
|
62
|
+
isBillable?: unknown
|
|
63
|
+
is_billable?: unknown
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
type EntriesApiResponse = {
|
|
67
|
+
items?: EntryRow[]
|
|
68
|
+
total?: number
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function readDate(row: EntryRow): string | null {
|
|
72
|
+
return toIsoDate(row.date)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function readMinutes(row: EntryRow): number {
|
|
76
|
+
const rounded = toMinutes(row.roundedMinutes)
|
|
77
|
+
if (rounded > 0) return rounded
|
|
78
|
+
return toMinutes(row.durationMinutes ?? row.duration_minutes)
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function readProjectId(row: EntryRow): string | null {
|
|
82
|
+
const value = row.timeProjectId ?? row.time_project_id
|
|
83
|
+
return typeof value === 'string' && value.trim().length > 0 ? value.trim() : null
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/* ------------------------------------------------------------------ writes */
|
|
87
|
+
|
|
88
|
+
const logTimeInput = z.object({
|
|
89
|
+
date: isoDate.describe('The calendar day the work happened, as yyyy-mm-dd.'),
|
|
90
|
+
durationMinutes: z
|
|
91
|
+
.number()
|
|
92
|
+
.int()
|
|
93
|
+
.min(1)
|
|
94
|
+
.max(1440)
|
|
95
|
+
.describe('How long the work took, in whole minutes (1–1440).'),
|
|
96
|
+
timeProjectId: z.string().uuid().optional().describe('Project the time belongs to. Omit for unassigned time.'),
|
|
97
|
+
taskId: z.string().uuid().optional().describe('Task the time belongs to; the task carries its own project.'),
|
|
98
|
+
notes: z.string().max(2000).optional().describe('What was done. Shown to whoever reviews the timesheet.'),
|
|
99
|
+
isBillable: z.boolean().optional().describe('Override the project default for whether the time is billable.'),
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
type LogTimeInput = z.infer<typeof logTimeInput>
|
|
103
|
+
|
|
104
|
+
const logTimeTool = defineApiBackedAiTool<LogTimeInput, { id?: string }, { recordId: string | null; commandName: string; before: Record<string, unknown>; after: Record<string, unknown> }>({
|
|
105
|
+
name: 'staff.log_time',
|
|
106
|
+
displayName: 'Log time',
|
|
107
|
+
description:
|
|
108
|
+
'Create a time entry for the signed-in user. Mutation tool — the write is held for approval and shown as a preview card before it runs.',
|
|
109
|
+
inputSchema: logTimeInput,
|
|
110
|
+
requiredFeatures: [MANAGE_OWN_FEATURE],
|
|
111
|
+
isMutation: true,
|
|
112
|
+
loadBeforeRecord: async (input, ctx) => {
|
|
113
|
+
const scope = await resolveStaffToolScope(ctx as unknown as AiToolExecutionContext)
|
|
114
|
+
return {
|
|
115
|
+
recordId: `new:${scope.staffMemberId}:${input.date}`,
|
|
116
|
+
entityType: 'staff.staff_time_entry',
|
|
117
|
+
recordVersion: null,
|
|
118
|
+
before: {},
|
|
119
|
+
after: {
|
|
120
|
+
date: input.date,
|
|
121
|
+
durationMinutes: input.durationMinutes,
|
|
122
|
+
timeProjectId: input.timeProjectId ?? null,
|
|
123
|
+
taskId: input.taskId ?? null,
|
|
124
|
+
notes: input.notes ?? null,
|
|
125
|
+
isBillable: input.isBillable ?? null,
|
|
126
|
+
},
|
|
127
|
+
display: {
|
|
128
|
+
fieldLabels: {
|
|
129
|
+
date: 'Date',
|
|
130
|
+
durationMinutes: 'Minutes',
|
|
131
|
+
timeProjectId: 'Project',
|
|
132
|
+
taskId: 'Task',
|
|
133
|
+
notes: 'Notes',
|
|
134
|
+
isBillable: 'Billable',
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
toOperation: async (input, ctx) => {
|
|
140
|
+
const scope = await resolveStaffToolScope(ctx)
|
|
141
|
+
return {
|
|
142
|
+
method: 'POST',
|
|
143
|
+
path: '/staff/timesheets/time-entries',
|
|
144
|
+
body: {
|
|
145
|
+
tenantId: scope.tenantId,
|
|
146
|
+
organizationId: scope.organizationId,
|
|
147
|
+
staffMemberId: scope.staffMemberId,
|
|
148
|
+
date: input.date,
|
|
149
|
+
durationMinutes: input.durationMinutes,
|
|
150
|
+
...(input.timeProjectId ? { timeProjectId: input.timeProjectId } : {}),
|
|
151
|
+
...(input.taskId ? { taskId: input.taskId } : {}),
|
|
152
|
+
...(input.notes ? { notes: input.notes } : {}),
|
|
153
|
+
...(input.isBillable === undefined ? {} : { isBillable: input.isBillable }),
|
|
154
|
+
},
|
|
155
|
+
} satisfies AiApiOperationRequest
|
|
156
|
+
},
|
|
157
|
+
mapResponse: (response, input) => ({
|
|
158
|
+
recordId: typeof response.data?.id === 'string' ? response.data.id : null,
|
|
159
|
+
commandName: 'staff.timesheets.time_entries.create',
|
|
160
|
+
before: {},
|
|
161
|
+
after: {
|
|
162
|
+
date: input.date,
|
|
163
|
+
durationMinutes: input.durationMinutes,
|
|
164
|
+
timeProjectId: input.timeProjectId ?? null,
|
|
165
|
+
taskId: input.taskId ?? null,
|
|
166
|
+
},
|
|
167
|
+
}),
|
|
168
|
+
}) as unknown as AiToolDefinition
|
|
169
|
+
|
|
170
|
+
const startTimerInput = z.object({
|
|
171
|
+
date: isoDate.optional().describe('Day to file the running timer under; defaults to today.'),
|
|
172
|
+
timeProjectId: z.string().uuid().optional().describe('Project to start the timer against.'),
|
|
173
|
+
taskId: z.string().uuid().optional().describe('Task to start the timer against; it carries its own project.'),
|
|
174
|
+
notes: z.string().max(2000).optional().describe('What the timer is for.'),
|
|
175
|
+
})
|
|
176
|
+
|
|
177
|
+
type StartTimerInput = z.infer<typeof startTimerInput>
|
|
178
|
+
|
|
179
|
+
const startTimerTool = defineApiBackedAiTool<StartTimerInput, { id?: string | null }, { recordId: string | null; commandName: string; before: Record<string, unknown>; after: Record<string, unknown> }>({
|
|
180
|
+
name: 'staff.start_timer',
|
|
181
|
+
displayName: 'Start timer',
|
|
182
|
+
description:
|
|
183
|
+
'Start a running timer for the signed-in user. Mutation tool — held for approval before it runs.',
|
|
184
|
+
inputSchema: startTimerInput,
|
|
185
|
+
requiredFeatures: [MANAGE_OWN_FEATURE],
|
|
186
|
+
isMutation: true,
|
|
187
|
+
loadBeforeRecord: async (input, ctx) => {
|
|
188
|
+
const scope = await resolveStaffToolScope(ctx as unknown as AiToolExecutionContext)
|
|
189
|
+
const date = input.date ?? new Date().toISOString().slice(0, 10)
|
|
190
|
+
return {
|
|
191
|
+
recordId: `timer:${scope.staffMemberId}:${date}`,
|
|
192
|
+
entityType: 'staff.staff_time_entry',
|
|
193
|
+
recordVersion: null,
|
|
194
|
+
before: {},
|
|
195
|
+
after: {
|
|
196
|
+
date,
|
|
197
|
+
timeProjectId: input.timeProjectId ?? null,
|
|
198
|
+
taskId: input.taskId ?? null,
|
|
199
|
+
notes: input.notes ?? null,
|
|
200
|
+
},
|
|
201
|
+
display: { fieldLabels: { date: 'Date', timeProjectId: 'Project', taskId: 'Task', notes: 'Notes' } },
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
toOperation: async (input, ctx) => {
|
|
205
|
+
const scope = await resolveStaffToolScope(ctx)
|
|
206
|
+
return {
|
|
207
|
+
method: 'POST',
|
|
208
|
+
path: '/staff/timesheets/time-entries/start-timer',
|
|
209
|
+
body: {
|
|
210
|
+
tenantId: scope.tenantId,
|
|
211
|
+
organizationId: scope.organizationId,
|
|
212
|
+
staffMemberId: scope.staffMemberId,
|
|
213
|
+
date: input.date ?? new Date().toISOString().slice(0, 10),
|
|
214
|
+
...(input.timeProjectId ? { timeProjectId: input.timeProjectId } : {}),
|
|
215
|
+
...(input.taskId ? { taskId: input.taskId } : {}),
|
|
216
|
+
...(input.notes ? { notes: input.notes } : {}),
|
|
217
|
+
},
|
|
218
|
+
} satisfies AiApiOperationRequest
|
|
219
|
+
},
|
|
220
|
+
mapResponse: (response, input) => ({
|
|
221
|
+
recordId: typeof response.data?.id === 'string' ? response.data.id : null,
|
|
222
|
+
commandName: 'staff.timesheets.time_entries.start_timer',
|
|
223
|
+
before: {},
|
|
224
|
+
after: { timeProjectId: input.timeProjectId ?? null, taskId: input.taskId ?? null },
|
|
225
|
+
}),
|
|
226
|
+
}) as unknown as AiToolDefinition
|
|
227
|
+
|
|
228
|
+
const stopTimerInput = z.object({
|
|
229
|
+
timeEntryId: z.string().uuid().describe('The time entry whose running timer should be stopped.'),
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
type StopTimerInput = z.infer<typeof stopTimerInput>
|
|
233
|
+
|
|
234
|
+
const stopTimerTool = defineApiBackedAiTool<StopTimerInput, { durationMinutes?: number }, { recordId: string; commandName: string; before: Record<string, unknown>; after: Record<string, unknown> }>({
|
|
235
|
+
name: 'staff.stop_timer',
|
|
236
|
+
displayName: 'Stop timer',
|
|
237
|
+
description:
|
|
238
|
+
'Stop the running timer on a time entry and freeze its duration. Mutation tool — held for approval before it runs.',
|
|
239
|
+
inputSchema: stopTimerInput,
|
|
240
|
+
requiredFeatures: [MANAGE_OWN_FEATURE],
|
|
241
|
+
isMutation: true,
|
|
242
|
+
loadBeforeRecord: async (input, ctx) => {
|
|
243
|
+
assertTenantScope(ctx as unknown as AiToolExecutionContext)
|
|
244
|
+
return {
|
|
245
|
+
recordId: input.timeEntryId,
|
|
246
|
+
entityType: 'staff.staff_time_entry',
|
|
247
|
+
recordVersion: null,
|
|
248
|
+
before: { timerRunning: true },
|
|
249
|
+
after: { timerRunning: false },
|
|
250
|
+
display: { fieldLabels: { timerRunning: 'Timer running' } },
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
toOperation: async (input, ctx) => {
|
|
254
|
+
assertTenantScope(ctx)
|
|
255
|
+
return {
|
|
256
|
+
method: 'POST',
|
|
257
|
+
path: `/staff/timesheets/time-entries/${input.timeEntryId}/timer-stop`,
|
|
258
|
+
body: {},
|
|
259
|
+
} satisfies AiApiOperationRequest
|
|
260
|
+
},
|
|
261
|
+
mapResponse: (response, input) => ({
|
|
262
|
+
recordId: input.timeEntryId,
|
|
263
|
+
commandName: 'staff.timesheets.time_entries.stop_timer',
|
|
264
|
+
before: { timerRunning: true },
|
|
265
|
+
after: { timerRunning: false, durationMinutes: toMinutes(response.data?.durationMinutes) },
|
|
266
|
+
}),
|
|
267
|
+
}) as unknown as AiToolDefinition
|
|
268
|
+
|
|
269
|
+
/* ------------------------------------------------------------------- reads */
|
|
270
|
+
|
|
271
|
+
const summarizeWeekInput = z.object({
|
|
272
|
+
from: isoDate.describe('First day of the range, yyyy-mm-dd.'),
|
|
273
|
+
to: isoDate.describe('Last day of the range, inclusive, yyyy-mm-dd.'),
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
type SummarizeWeekInput = z.infer<typeof summarizeWeekInput>
|
|
277
|
+
|
|
278
|
+
const summarizeWeekTool = defineApiBackedAiTool<
|
|
279
|
+
SummarizeWeekInput,
|
|
280
|
+
EntriesApiResponse,
|
|
281
|
+
{
|
|
282
|
+
from: string
|
|
283
|
+
to: string
|
|
284
|
+
totalMinutes: number
|
|
285
|
+
entryCount: number
|
|
286
|
+
byDate: Array<{ date: string; minutes: number }>
|
|
287
|
+
byProject: Array<{ timeProjectId: string | null; minutes: number; entryCount: number }>
|
|
288
|
+
}
|
|
289
|
+
>({
|
|
290
|
+
name: 'staff.summarize_week',
|
|
291
|
+
displayName: 'Summarize logged time',
|
|
292
|
+
description:
|
|
293
|
+
'Summarize the signed-in user’s logged time over a date range: totals per day and per project. Read-only. Returns minutes, never money.',
|
|
294
|
+
inputSchema: summarizeWeekInput,
|
|
295
|
+
requiredFeatures: [VIEW_FEATURE],
|
|
296
|
+
toOperation: async (input, ctx) => {
|
|
297
|
+
const scope = await resolveStaffToolScope(ctx)
|
|
298
|
+
return {
|
|
299
|
+
method: 'GET',
|
|
300
|
+
path: '/staff/timesheets/time-entries',
|
|
301
|
+
query: {
|
|
302
|
+
from: input.from,
|
|
303
|
+
to: input.to,
|
|
304
|
+
staffMemberId: scope.staffMemberId,
|
|
305
|
+
page: 1,
|
|
306
|
+
pageSize: 100,
|
|
307
|
+
},
|
|
308
|
+
} satisfies AiApiOperationRequest
|
|
309
|
+
},
|
|
310
|
+
mapResponse: (response, input) => {
|
|
311
|
+
const items = Array.isArray(response.data?.items) ? response.data.items : []
|
|
312
|
+
const byDate = new Map<string, number>()
|
|
313
|
+
const byProject = new Map<string, { minutes: number; entryCount: number }>()
|
|
314
|
+
let totalMinutes = 0
|
|
315
|
+
for (const row of items) {
|
|
316
|
+
const date = readDate(row)
|
|
317
|
+
const minutes = readMinutes(row)
|
|
318
|
+
totalMinutes += minutes
|
|
319
|
+
if (date) byDate.set(date, (byDate.get(date) ?? 0) + minutes)
|
|
320
|
+
const projectKey = readProjectId(row) ?? ''
|
|
321
|
+
const bucket = byProject.get(projectKey) ?? { minutes: 0, entryCount: 0 }
|
|
322
|
+
bucket.minutes += minutes
|
|
323
|
+
bucket.entryCount += 1
|
|
324
|
+
byProject.set(projectKey, bucket)
|
|
325
|
+
}
|
|
326
|
+
return {
|
|
327
|
+
from: input.from,
|
|
328
|
+
to: input.to,
|
|
329
|
+
totalMinutes,
|
|
330
|
+
entryCount: items.length,
|
|
331
|
+
byDate: Array.from(byDate.entries())
|
|
332
|
+
.map(([date, minutes]) => ({ date, minutes }))
|
|
333
|
+
.sort((left, right) => left.date.localeCompare(right.date)),
|
|
334
|
+
byProject: Array.from(byProject.entries()).map(([key, value]) => ({
|
|
335
|
+
timeProjectId: key.length > 0 ? key : null,
|
|
336
|
+
minutes: value.minutes,
|
|
337
|
+
entryCount: value.entryCount,
|
|
338
|
+
})),
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
}) as unknown as AiToolDefinition
|
|
342
|
+
|
|
343
|
+
const findMissingDaysInput = z.object({
|
|
344
|
+
from: isoDate.describe('First day of the range, yyyy-mm-dd.'),
|
|
345
|
+
to: isoDate.describe('Last day of the range, inclusive, yyyy-mm-dd.'),
|
|
346
|
+
includeWeekends: z
|
|
347
|
+
.boolean()
|
|
348
|
+
.optional()
|
|
349
|
+
.describe('Count Saturdays and Sundays as days that need time logged. Defaults to false.'),
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
type FindMissingDaysInput = z.infer<typeof findMissingDaysInput>
|
|
353
|
+
|
|
354
|
+
const findMissingDaysTool = defineApiBackedAiTool<
|
|
355
|
+
FindMissingDaysInput,
|
|
356
|
+
EntriesApiResponse,
|
|
357
|
+
{ from: string; to: string; missingDates: string[]; checkedDayCount: number }
|
|
358
|
+
>({
|
|
359
|
+
name: 'staff.find_missing_days',
|
|
360
|
+
displayName: 'Find days with no logged time',
|
|
361
|
+
description:
|
|
362
|
+
'List the days in a range on which the signed-in user logged no time. Weekends are excluded unless asked for. Read-only.',
|
|
363
|
+
inputSchema: findMissingDaysInput,
|
|
364
|
+
requiredFeatures: [VIEW_FEATURE],
|
|
365
|
+
toOperation: async (input, ctx) => {
|
|
366
|
+
const scope = await resolveStaffToolScope(ctx)
|
|
367
|
+
return {
|
|
368
|
+
method: 'GET',
|
|
369
|
+
path: '/staff/timesheets/time-entries',
|
|
370
|
+
query: {
|
|
371
|
+
from: input.from,
|
|
372
|
+
to: input.to,
|
|
373
|
+
staffMemberId: scope.staffMemberId,
|
|
374
|
+
page: 1,
|
|
375
|
+
pageSize: 100,
|
|
376
|
+
},
|
|
377
|
+
} satisfies AiApiOperationRequest
|
|
378
|
+
},
|
|
379
|
+
mapResponse: (response, input) => {
|
|
380
|
+
const items = Array.isArray(response.data?.items) ? response.data.items : []
|
|
381
|
+
const logged = new Set<string>()
|
|
382
|
+
for (const row of items) {
|
|
383
|
+
const date = readDate(row)
|
|
384
|
+
if (date && readMinutes(row) > 0) logged.add(date)
|
|
385
|
+
}
|
|
386
|
+
const candidates = enumerateDates(input.from, input.to).filter(
|
|
387
|
+
(date) => (input.includeWeekends ?? false) || !isWeekend(date),
|
|
388
|
+
)
|
|
389
|
+
return {
|
|
390
|
+
from: input.from,
|
|
391
|
+
to: input.to,
|
|
392
|
+
missingDates: candidates.filter((date) => !logged.has(date)),
|
|
393
|
+
checkedDayCount: candidates.length,
|
|
394
|
+
}
|
|
395
|
+
},
|
|
396
|
+
}) as unknown as AiToolDefinition
|
|
397
|
+
|
|
398
|
+
const draftClientReportInput = z.object({
|
|
399
|
+
timeProjectIds: z
|
|
400
|
+
.array(z.string().uuid())
|
|
401
|
+
.min(1)
|
|
402
|
+
.max(100)
|
|
403
|
+
.describe('Projects the report covers. They must all belong to the same customer.'),
|
|
404
|
+
periodFrom: isoDate.describe('First day of the reported period, yyyy-mm-dd.'),
|
|
405
|
+
periodTo: isoDate.describe('Last day of the reported period, inclusive, yyyy-mm-dd.'),
|
|
406
|
+
customerId: z.string().uuid().optional().describe('Customer the report is for.'),
|
|
407
|
+
grouping: z
|
|
408
|
+
.string()
|
|
409
|
+
.optional()
|
|
410
|
+
.describe('Report grouping id, e.g. project_task, project_person or project_day.'),
|
|
411
|
+
includeAlreadyReported: z
|
|
412
|
+
.boolean()
|
|
413
|
+
.optional()
|
|
414
|
+
.describe('Include entries already frozen into an earlier report. Defaults to false.'),
|
|
415
|
+
})
|
|
416
|
+
|
|
417
|
+
type DraftClientReportInput = z.infer<typeof draftClientReportInput>
|
|
418
|
+
|
|
419
|
+
type PreviewApiResponse = {
|
|
420
|
+
currencyCode?: unknown
|
|
421
|
+
grouping?: unknown
|
|
422
|
+
projects?: Array<{
|
|
423
|
+
id?: unknown
|
|
424
|
+
name?: unknown
|
|
425
|
+
entryCount?: unknown
|
|
426
|
+
billableMinutes?: unknown
|
|
427
|
+
nonbillableMinutes?: unknown
|
|
428
|
+
}>
|
|
429
|
+
totals?: unknown
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
const draftClientReportTool = defineApiBackedAiTool<
|
|
433
|
+
DraftClientReportInput,
|
|
434
|
+
PreviewApiResponse,
|
|
435
|
+
{
|
|
436
|
+
periodFrom: string
|
|
437
|
+
periodTo: string
|
|
438
|
+
grouping: string | null
|
|
439
|
+
projects: Array<{ id: string | null; name: string | null; billableMinutes: number; nonbillableMinutes: number; entryCount: number }>
|
|
440
|
+
}
|
|
441
|
+
>({
|
|
442
|
+
name: 'staff.draft_client_report',
|
|
443
|
+
displayName: 'Draft a client report',
|
|
444
|
+
description:
|
|
445
|
+
'Preview what a customer report would contain for a set of projects and a period, without creating one. Read-only — no report is written and nothing is locked. Amounts are omitted; ask the reports screen for money.',
|
|
446
|
+
inputSchema: draftClientReportInput,
|
|
447
|
+
requiredFeatures: [REPORTS_VIEW_FEATURE],
|
|
448
|
+
toOperation: async (input, ctx) => {
|
|
449
|
+
assertTenantScope(ctx)
|
|
450
|
+
return {
|
|
451
|
+
method: 'POST',
|
|
452
|
+
path: '/staff/timesheets/reports/preview',
|
|
453
|
+
body: {
|
|
454
|
+
timeProjectIds: input.timeProjectIds,
|
|
455
|
+
periodFrom: input.periodFrom,
|
|
456
|
+
periodTo: input.periodTo,
|
|
457
|
+
periodKind: 'custom',
|
|
458
|
+
...(input.customerId ? { customerId: input.customerId } : {}),
|
|
459
|
+
...(input.grouping ? { grouping: input.grouping } : {}),
|
|
460
|
+
includeAlreadyReported: input.includeAlreadyReported ?? false,
|
|
461
|
+
showRates: false,
|
|
462
|
+
},
|
|
463
|
+
} satisfies AiApiOperationRequest
|
|
464
|
+
},
|
|
465
|
+
/**
|
|
466
|
+
* The preview response carries rates and amounts when the caller holds
|
|
467
|
+
* `staff.timesheets.rates.view`. The tool asks for `showRates: false` and then
|
|
468
|
+
* projects only the minute columns, so an agent transcript never becomes a
|
|
469
|
+
* second, ungated copy of the customer's rate card.
|
|
470
|
+
*/
|
|
471
|
+
mapResponse: (response, input) => ({
|
|
472
|
+
periodFrom: input.periodFrom,
|
|
473
|
+
periodTo: input.periodTo,
|
|
474
|
+
grouping: typeof response.data?.grouping === 'string' ? response.data.grouping : null,
|
|
475
|
+
projects: (response.data?.projects ?? []).map((project) => ({
|
|
476
|
+
id: typeof project.id === 'string' ? project.id : null,
|
|
477
|
+
name: typeof project.name === 'string' ? project.name : null,
|
|
478
|
+
billableMinutes: toMinutes(project.billableMinutes),
|
|
479
|
+
nonbillableMinutes: toMinutes(project.nonbillableMinutes),
|
|
480
|
+
entryCount: toMinutes(project.entryCount),
|
|
481
|
+
})),
|
|
482
|
+
}),
|
|
483
|
+
}) as unknown as AiToolDefinition
|
|
484
|
+
|
|
485
|
+
export const timeTrackingAiTools: AiToolDefinition[] = [
|
|
486
|
+
logTimeTool,
|
|
487
|
+
startTimerTool,
|
|
488
|
+
stopTimerTool,
|
|
489
|
+
summarizeWeekTool,
|
|
490
|
+
findMissingDaysTool,
|
|
491
|
+
draftClientReportTool,
|
|
492
|
+
]
|
|
493
|
+
|
|
494
|
+
export default timeTrackingAiTools
|