@aitne/daemon 0.1.6 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/dashboard-adapter.d.ts +18 -2
- package/dist/adapters/dashboard-adapter.d.ts.map +1 -1
- package/dist/adapters/dashboard-adapter.js +101 -51
- package/dist/adapters/dashboard-adapter.js.map +1 -1
- package/dist/adapters/discord.d.ts +8 -0
- package/dist/adapters/discord.d.ts.map +1 -1
- package/dist/adapters/discord.js +100 -21
- package/dist/adapters/discord.js.map +1 -1
- package/dist/adapters/message-hub.d.ts.map +1 -1
- package/dist/adapters/message-hub.js +7 -1
- package/dist/adapters/message-hub.js.map +1 -1
- package/dist/adapters/notification-manager.d.ts +102 -2
- package/dist/adapters/notification-manager.d.ts.map +1 -1
- package/dist/adapters/notification-manager.js +228 -8
- package/dist/adapters/notification-manager.js.map +1 -1
- package/dist/adapters/outbound-text.d.ts +16 -0
- package/dist/adapters/outbound-text.d.ts.map +1 -1
- package/dist/adapters/outbound-text.js +118 -1
- package/dist/adapters/outbound-text.js.map +1 -1
- package/dist/adapters/primary-platform-resolver.d.ts +69 -0
- package/dist/adapters/primary-platform-resolver.d.ts.map +1 -0
- package/dist/adapters/primary-platform-resolver.js +55 -0
- package/dist/adapters/primary-platform-resolver.js.map +1 -0
- package/dist/adapters/slack-adapter.d.ts +28 -0
- package/dist/adapters/slack-adapter.d.ts.map +1 -1
- package/dist/adapters/slack-adapter.js +134 -35
- package/dist/adapters/slack-adapter.js.map +1 -1
- package/dist/adapters/telegram-adapter.d.ts +7 -1
- package/dist/adapters/telegram-adapter.d.ts.map +1 -1
- package/dist/adapters/telegram-adapter.js +49 -18
- package/dist/adapters/telegram-adapter.js.map +1 -1
- package/dist/adapters/whatsapp-adapter.d.ts +33 -0
- package/dist/adapters/whatsapp-adapter.d.ts.map +1 -1
- package/dist/adapters/whatsapp-adapter.js +84 -0
- package/dist/adapters/whatsapp-adapter.js.map +1 -1
- package/dist/api/directory-picker.d.ts.map +1 -1
- package/dist/api/directory-picker.js +14 -0
- package/dist/api/directory-picker.js.map +1 -1
- package/dist/api/env-writer.d.ts.map +1 -1
- package/dist/api/env-writer.js +6 -1
- package/dist/api/env-writer.js.map +1 -1
- package/dist/api/helpers/agent-errors.d.ts +2600 -0
- package/dist/api/helpers/agent-errors.d.ts.map +1 -0
- package/dist/api/helpers/agent-errors.js +2506 -0
- package/dist/api/helpers/agent-errors.js.map +1 -0
- package/dist/api/integration-route-gate.d.ts.map +1 -1
- package/dist/api/integration-route-gate.js +10 -3
- package/dist/api/integration-route-gate.js.map +1 -1
- package/dist/api/routes/agent-schedule-plan-match.d.ts +5 -0
- package/dist/api/routes/agent-schedule-plan-match.d.ts.map +1 -0
- package/dist/api/routes/agent-schedule-plan-match.js +101 -0
- package/dist/api/routes/agent-schedule-plan-match.js.map +1 -0
- package/dist/api/routes/agent-schedule.d.ts +4 -0
- package/dist/api/routes/agent-schedule.d.ts.map +1 -0
- package/dist/api/routes/agent-schedule.js +750 -0
- package/dist/api/routes/agent-schedule.js.map +1 -0
- package/dist/api/routes/agent.d.ts.map +1 -1
- package/dist/api/routes/agent.js +209 -366
- package/dist/api/routes/agent.js.map +1 -1
- package/dist/api/routes/apple-calendar.d.ts.map +1 -1
- package/dist/api/routes/apple-calendar.js +109 -27
- package/dist/api/routes/apple-calendar.js.map +1 -1
- package/dist/api/routes/attachments.d.ts.map +1 -1
- package/dist/api/routes/attachments.js +113 -21
- package/dist/api/routes/attachments.js.map +1 -1
- package/dist/api/routes/backends.d.ts.map +1 -1
- package/dist/api/routes/backends.js +100 -4
- package/dist/api/routes/backends.js.map +1 -1
- package/dist/api/routes/books.d.ts.map +1 -1
- package/dist/api/routes/books.js +58 -18
- package/dist/api/routes/books.js.map +1 -1
- package/dist/api/routes/calendar.d.ts +3 -2
- package/dist/api/routes/calendar.d.ts.map +1 -1
- package/dist/api/routes/calendar.js +330 -55
- package/dist/api/routes/calendar.js.map +1 -1
- package/dist/api/routes/commands.d.ts.map +1 -1
- package/dist/api/routes/commands.js +20 -1
- package/dist/api/routes/commands.js.map +1 -1
- package/dist/api/routes/context/index.d.ts +33 -0
- package/dist/api/routes/context/index.d.ts.map +1 -0
- package/dist/api/routes/context/index.js +193 -0
- package/dist/api/routes/context/index.js.map +1 -0
- package/dist/api/routes/context/locks.d.ts +4 -0
- package/dist/api/routes/context/locks.d.ts.map +1 -0
- package/dist/api/routes/context/locks.js +136 -0
- package/dist/api/routes/context/locks.js.map +1 -0
- package/dist/api/routes/context/path-resolve.d.ts +15 -0
- package/dist/api/routes/context/path-resolve.d.ts.map +1 -0
- package/dist/api/routes/context/path-resolve.js +109 -0
- package/dist/api/routes/context/path-resolve.js.map +1 -0
- package/dist/api/routes/context/permissions.d.ts +35 -0
- package/dist/api/routes/context/permissions.d.ts.map +1 -0
- package/dist/api/routes/context/permissions.js +192 -0
- package/dist/api/routes/context/permissions.js.map +1 -0
- package/dist/api/routes/context/read.d.ts +4 -0
- package/dist/api/routes/context/read.d.ts.map +1 -0
- package/dist/api/routes/context/read.js +295 -0
- package/dist/api/routes/context/read.js.map +1 -0
- package/dist/api/routes/context/repair.d.ts +4 -0
- package/dist/api/routes/context/repair.d.ts.map +1 -0
- package/dist/api/routes/context/repair.js +114 -0
- package/dist/api/routes/context/repair.js.map +1 -0
- package/dist/api/routes/context/snapshots.d.ts +4 -0
- package/dist/api/routes/context/snapshots.d.ts.map +1 -0
- package/dist/api/routes/context/snapshots.js +177 -0
- package/dist/api/routes/context/snapshots.js.map +1 -0
- package/dist/api/routes/context/write.d.ts +4 -0
- package/dist/api/routes/context/write.d.ts.map +1 -0
- package/dist/api/routes/context/write.js +570 -0
- package/dist/api/routes/context/write.js.map +1 -0
- package/dist/api/routes/context.d.ts +2 -43
- package/dist/api/routes/context.d.ts.map +1 -1
- package/dist/api/routes/context.js +415 -558
- package/dist/api/routes/context.js.map +1 -1
- package/dist/api/routes/dashboard/config.d.ts +4 -0
- package/dist/api/routes/dashboard/config.d.ts.map +1 -0
- package/dist/api/routes/dashboard/config.js +499 -0
- package/dist/api/routes/dashboard/config.js.map +1 -0
- package/dist/api/routes/dashboard/conversations.d.ts +4 -0
- package/dist/api/routes/dashboard/conversations.d.ts.map +1 -0
- package/dist/api/routes/dashboard/conversations.js +309 -0
- package/dist/api/routes/dashboard/conversations.js.map +1 -0
- package/dist/api/routes/dashboard/cost-approvals.d.ts +29 -0
- package/dist/api/routes/dashboard/cost-approvals.d.ts.map +1 -0
- package/dist/api/routes/dashboard/cost-approvals.js +259 -0
- package/dist/api/routes/dashboard/cost-approvals.js.map +1 -0
- package/dist/api/routes/dashboard/index.d.ts +27 -0
- package/dist/api/routes/dashboard/index.d.ts.map +1 -0
- package/dist/api/routes/dashboard/index.js +47 -0
- package/dist/api/routes/dashboard/index.js.map +1 -0
- package/dist/api/routes/dashboard/messaging.d.ts +4 -0
- package/dist/api/routes/dashboard/messaging.d.ts.map +1 -0
- package/dist/api/routes/dashboard/messaging.js +351 -0
- package/dist/api/routes/dashboard/messaging.js.map +1 -0
- package/dist/api/routes/dashboard/notifications.d.ts +4 -0
- package/dist/api/routes/dashboard/notifications.d.ts.map +1 -0
- package/dist/api/routes/dashboard/notifications.js +109 -0
- package/dist/api/routes/dashboard/notifications.js.map +1 -0
- package/dist/api/routes/dashboard/oauth-google.d.ts +4 -0
- package/dist/api/routes/dashboard/oauth-google.d.ts.map +1 -0
- package/dist/api/routes/dashboard/oauth-google.js +293 -0
- package/dist/api/routes/dashboard/oauth-google.js.map +1 -0
- package/dist/api/routes/dashboard/schedule-readonly.d.ts +4 -0
- package/dist/api/routes/dashboard/schedule-readonly.d.ts.map +1 -0
- package/dist/api/routes/dashboard/schedule-readonly.js +46 -0
- package/dist/api/routes/dashboard/schedule-readonly.js.map +1 -0
- package/dist/api/routes/dashboard/secrets.d.ts +24 -0
- package/dist/api/routes/dashboard/secrets.d.ts.map +1 -0
- package/dist/api/routes/dashboard/secrets.js +307 -0
- package/dist/api/routes/dashboard/secrets.js.map +1 -0
- package/dist/api/routes/dashboard/snapshots.d.ts +4 -0
- package/dist/api/routes/dashboard/snapshots.d.ts.map +1 -0
- package/dist/api/routes/dashboard/snapshots.js +33 -0
- package/dist/api/routes/dashboard/snapshots.js.map +1 -0
- package/dist/api/routes/dashboard.d.ts.map +1 -1
- package/dist/api/routes/dashboard.js +20 -12
- package/dist/api/routes/dashboard.js.map +1 -1
- package/dist/api/routes/delegated.d.ts +5 -4
- package/dist/api/routes/delegated.d.ts.map +1 -1
- package/dist/api/routes/delegated.js +6 -5
- package/dist/api/routes/delegated.js.map +1 -1
- package/dist/api/routes/docs.d.ts.map +1 -1
- package/dist/api/routes/docs.js +72 -9
- package/dist/api/routes/docs.js.map +1 -1
- package/dist/api/routes/entities.d.ts.map +1 -1
- package/dist/api/routes/entities.js +112 -43
- package/dist/api/routes/entities.js.map +1 -1
- package/dist/api/routes/fs.d.ts.map +1 -1
- package/dist/api/routes/fs.js +27 -12
- package/dist/api/routes/fs.js.map +1 -1
- package/dist/api/routes/git-templates.d.ts.map +1 -1
- package/dist/api/routes/git-templates.js +107 -27
- package/dist/api/routes/git-templates.js.map +1 -1
- package/dist/api/routes/git.d.ts.map +1 -1
- package/dist/api/routes/git.js +55 -11
- package/dist/api/routes/git.js.map +1 -1
- package/dist/api/routes/github.d.ts.map +1 -1
- package/dist/api/routes/github.js +110 -17
- package/dist/api/routes/github.js.map +1 -1
- package/dist/api/routes/integrations/crud-patch.d.ts +17 -0
- package/dist/api/routes/integrations/crud-patch.d.ts.map +1 -0
- package/dist/api/routes/integrations/crud-patch.js +600 -0
- package/dist/api/routes/integrations/crud-patch.js.map +1 -0
- package/dist/api/routes/integrations/crud.d.ts +16 -0
- package/dist/api/routes/integrations/crud.d.ts.map +1 -0
- package/dist/api/routes/integrations/crud.js +158 -0
- package/dist/api/routes/integrations/crud.js.map +1 -0
- package/dist/api/routes/integrations/exec.d.ts +23 -0
- package/dist/api/routes/integrations/exec.d.ts.map +1 -0
- package/dist/api/routes/integrations/exec.js +356 -0
- package/dist/api/routes/integrations/exec.js.map +1 -0
- package/dist/api/routes/integrations/index.d.ts +62 -0
- package/dist/api/routes/integrations/index.d.ts.map +1 -0
- package/dist/api/routes/integrations/index.js +70 -0
- package/dist/api/routes/integrations/index.js.map +1 -0
- package/dist/api/routes/integrations/integrations/crud.d.ts +16 -0
- package/dist/api/routes/integrations/integrations/crud.d.ts.map +1 -0
- package/dist/api/routes/integrations/integrations/crud.js +158 -0
- package/dist/api/routes/integrations/integrations/crud.js.map +1 -0
- package/dist/api/routes/integrations/integrations/index.d.ts +55 -0
- package/dist/api/routes/integrations/integrations/index.d.ts.map +1 -0
- package/dist/api/routes/integrations/integrations/index.js +65 -0
- package/dist/api/routes/integrations/integrations/index.js.map +1 -0
- package/dist/api/routes/integrations/integrations/invoke.d.ts +38 -0
- package/dist/api/routes/integrations/integrations/invoke.d.ts.map +1 -0
- package/dist/api/routes/integrations/integrations/invoke.js +320 -0
- package/dist/api/routes/integrations/integrations/invoke.js.map +1 -0
- package/dist/api/routes/integrations/integrations/probe.d.ts +21 -0
- package/dist/api/routes/integrations/integrations/probe.d.ts.map +1 -0
- package/dist/api/routes/integrations/integrations/probe.js +247 -0
- package/dist/api/routes/integrations/integrations/probe.js.map +1 -0
- package/dist/api/routes/integrations/invoke.d.ts +38 -0
- package/dist/api/routes/integrations/invoke.d.ts.map +1 -0
- package/dist/api/routes/integrations/invoke.js +320 -0
- package/dist/api/routes/integrations/invoke.js.map +1 -0
- package/dist/api/routes/integrations/probe.d.ts +21 -0
- package/dist/api/routes/integrations/probe.d.ts.map +1 -0
- package/dist/api/routes/integrations/probe.js +247 -0
- package/dist/api/routes/integrations/probe.js.map +1 -0
- package/dist/api/routes/integrations.d.ts.map +1 -1
- package/dist/api/routes/integrations.js +65 -13
- package/dist/api/routes/integrations.js.map +1 -1
- package/dist/api/routes/knowledge.d.ts.map +1 -1
- package/dist/api/routes/knowledge.js +13 -2
- package/dist/api/routes/knowledge.js.map +1 -1
- package/dist/api/routes/mail/_pa_wip_mail/app-password.d.ts +4 -0
- package/dist/api/routes/mail/_pa_wip_mail/app-password.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/app-password.js +192 -0
- package/dist/api/routes/mail/_pa_wip_mail/app-password.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/body-helpers.d.ts +55 -0
- package/dist/api/routes/mail/_pa_wip_mail/body-helpers.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/body-helpers.js +91 -0
- package/dist/api/routes/mail/_pa_wip_mail/body-helpers.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/dependencies.d.ts +36 -0
- package/dist/api/routes/mail/_pa_wip_mail/dependencies.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/dependencies.js +2 -0
- package/dist/api/routes/mail/_pa_wip_mail/dependencies.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/gating.d.ts +45 -0
- package/dist/api/routes/mail/_pa_wip_mail/gating.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/gating.js +98 -0
- package/dist/api/routes/mail/_pa_wip_mail/gating.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/accounts.d.ts +4 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/accounts.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/accounts.js +289 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/accounts.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/app-password.d.ts +4 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/app-password.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/app-password.js +192 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/app-password.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/body-helpers.d.ts +55 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/body-helpers.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/body-helpers.js +91 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/body-helpers.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/dependencies.d.ts +36 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/dependencies.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/dependencies.js +2 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/dependencies.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/drafts.d.ts +5 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/drafts.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/drafts.js +139 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/drafts.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/gating.d.ts +45 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/gating.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/gating.js +98 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/gating.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/index.d.ts +18 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/index.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/index.js +40 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/index.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/messages.d.ts +15 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/messages.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/messages.js +239 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/messages.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/outlook-config.d.ts +4 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/outlook-config.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/outlook-config.js +73 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/outlook-config.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/provider-resolver.d.ts +64 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/provider-resolver.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/provider-resolver.js +286 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/provider-resolver.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/providers.d.ts +4 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/providers.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/providers.js +73 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/providers.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/tags-folders.d.ts +5 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/tags-folders.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/tags-folders.js +35 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/tags-folders.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/validators.d.ts +23 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/validators.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/validators.js +131 -0
- package/dist/api/routes/mail/_pa_wip_mail/mail/validators.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/provider-resolver.d.ts +64 -0
- package/dist/api/routes/mail/_pa_wip_mail/provider-resolver.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/provider-resolver.js +286 -0
- package/dist/api/routes/mail/_pa_wip_mail/provider-resolver.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/search-health.d.ts +4 -0
- package/dist/api/routes/mail/_pa_wip_mail/search-health.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/search-health.js +131 -0
- package/dist/api/routes/mail/_pa_wip_mail/search-health.js.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/validators.d.ts +23 -0
- package/dist/api/routes/mail/_pa_wip_mail/validators.d.ts.map +1 -0
- package/dist/api/routes/mail/_pa_wip_mail/validators.js +131 -0
- package/dist/api/routes/mail/_pa_wip_mail/validators.js.map +1 -0
- package/dist/api/routes/mail/accounts.d.ts +4 -0
- package/dist/api/routes/mail/accounts.d.ts.map +1 -0
- package/dist/api/routes/mail/accounts.js +289 -0
- package/dist/api/routes/mail/accounts.js.map +1 -0
- package/dist/api/routes/mail/app-password.d.ts +4 -0
- package/dist/api/routes/mail/app-password.d.ts.map +1 -0
- package/dist/api/routes/mail/app-password.js +192 -0
- package/dist/api/routes/mail/app-password.js.map +1 -0
- package/dist/api/routes/mail/body-helpers.d.ts +56 -0
- package/dist/api/routes/mail/body-helpers.d.ts.map +1 -0
- package/dist/api/routes/mail/body-helpers.js +91 -0
- package/dist/api/routes/mail/body-helpers.js.map +1 -0
- package/dist/api/routes/mail/dependencies.d.ts +36 -0
- package/dist/api/routes/mail/dependencies.d.ts.map +1 -0
- package/dist/api/routes/mail/dependencies.js +2 -0
- package/dist/api/routes/mail/dependencies.js.map +1 -0
- package/dist/api/routes/mail/drafts.d.ts +5 -0
- package/dist/api/routes/mail/drafts.d.ts.map +1 -0
- package/dist/api/routes/mail/drafts.js +139 -0
- package/dist/api/routes/mail/drafts.js.map +1 -0
- package/dist/api/routes/mail/gating.d.ts +45 -0
- package/dist/api/routes/mail/gating.d.ts.map +1 -0
- package/dist/api/routes/mail/gating.js +99 -0
- package/dist/api/routes/mail/gating.js.map +1 -0
- package/dist/api/routes/mail/index.d.ts +18 -0
- package/dist/api/routes/mail/index.d.ts.map +1 -0
- package/dist/api/routes/mail/index.js +40 -0
- package/dist/api/routes/mail/index.js.map +1 -0
- package/dist/api/routes/mail/messages.d.ts +15 -0
- package/dist/api/routes/mail/messages.d.ts.map +1 -0
- package/dist/api/routes/mail/messages.js +239 -0
- package/dist/api/routes/mail/messages.js.map +1 -0
- package/dist/api/routes/mail/outlook-config.d.ts +4 -0
- package/dist/api/routes/mail/outlook-config.d.ts.map +1 -0
- package/dist/api/routes/mail/outlook-config.js +73 -0
- package/dist/api/routes/mail/outlook-config.js.map +1 -0
- package/dist/api/routes/mail/provider-resolver.d.ts +64 -0
- package/dist/api/routes/mail/provider-resolver.d.ts.map +1 -0
- package/dist/api/routes/mail/provider-resolver.js +286 -0
- package/dist/api/routes/mail/provider-resolver.js.map +1 -0
- package/dist/api/routes/mail/providers.d.ts +4 -0
- package/dist/api/routes/mail/providers.d.ts.map +1 -0
- package/dist/api/routes/mail/providers.js +73 -0
- package/dist/api/routes/mail/providers.js.map +1 -0
- package/dist/api/routes/mail/search-health.d.ts +4 -0
- package/dist/api/routes/mail/search-health.d.ts.map +1 -0
- package/dist/api/routes/mail/search-health.js +131 -0
- package/dist/api/routes/mail/search-health.js.map +1 -0
- package/dist/api/routes/mail/tags-folders.d.ts +5 -0
- package/dist/api/routes/mail/tags-folders.d.ts.map +1 -0
- package/dist/api/routes/mail/tags-folders.js +35 -0
- package/dist/api/routes/mail/tags-folders.js.map +1 -0
- package/dist/api/routes/mail/validators.d.ts +23 -0
- package/dist/api/routes/mail/validators.d.ts.map +1 -0
- package/dist/api/routes/mail/validators.js +131 -0
- package/dist/api/routes/mail/validators.js.map +1 -0
- package/dist/api/routes/mail.d.ts.map +1 -1
- package/dist/api/routes/mail.js +259 -67
- package/dist/api/routes/mail.js.map +1 -1
- package/dist/api/routes/managed-tasks.d.ts.map +1 -1
- package/dist/api/routes/managed-tasks.js +142 -54
- package/dist/api/routes/managed-tasks.js.map +1 -1
- package/dist/api/routes/mcp.d.ts.map +1 -1
- package/dist/api/routes/mcp.js +115 -47
- package/dist/api/routes/mcp.js.map +1 -1
- package/dist/api/routes/metrics.d.ts +1 -1
- package/dist/api/routes/metrics.js +2 -2
- package/dist/api/routes/notion.d.ts.map +1 -1
- package/dist/api/routes/notion.js +230 -54
- package/dist/api/routes/notion.js.map +1 -1
- package/dist/api/routes/observations.d.ts.map +1 -1
- package/dist/api/routes/observations.js +40 -169
- package/dist/api/routes/observations.js.map +1 -1
- package/dist/api/routes/obsidian.d.ts.map +1 -1
- package/dist/api/routes/obsidian.js +193 -32
- package/dist/api/routes/obsidian.js.map +1 -1
- package/dist/api/routes/profile-questions.d.ts.map +1 -1
- package/dist/api/routes/profile-questions.js +19 -3
- package/dist/api/routes/profile-questions.js.map +1 -1
- package/dist/api/routes/receipts.d.ts.map +1 -1
- package/dist/api/routes/receipts.js +64 -24
- package/dist/api/routes/receipts.js.map +1 -1
- package/dist/api/routes/recurring-schedules.d.ts.map +1 -1
- package/dist/api/routes/recurring-schedules.js +243 -13
- package/dist/api/routes/recurring-schedules.js.map +1 -1
- package/dist/api/routes/repositories.d.ts.map +1 -1
- package/dist/api/routes/repositories.js +278 -104
- package/dist/api/routes/repositories.js.map +1 -1
- package/dist/api/routes/schedule-model-resolver.d.ts +153 -0
- package/dist/api/routes/schedule-model-resolver.d.ts.map +1 -0
- package/dist/api/routes/schedule-model-resolver.js +282 -0
- package/dist/api/routes/schedule-model-resolver.js.map +1 -0
- package/dist/api/routes/schedule-options.d.ts +25 -0
- package/dist/api/routes/schedule-options.d.ts.map +1 -0
- package/dist/api/routes/schedule-options.js +77 -0
- package/dist/api/routes/schedule-options.js.map +1 -0
- package/dist/api/routes/schedule-validation.d.ts +146 -0
- package/dist/api/routes/schedule-validation.d.ts.map +1 -0
- package/dist/api/routes/schedule-validation.js +153 -0
- package/dist/api/routes/schedule-validation.js.map +1 -0
- package/dist/api/routes/setup.d.ts.map +1 -1
- package/dist/api/routes/setup.js +100 -26
- package/dist/api/routes/setup.js.map +1 -1
- package/dist/api/routes/skills.d.ts.map +1 -1
- package/dist/api/routes/skills.js +81 -30
- package/dist/api/routes/skills.js.map +1 -1
- package/dist/api/routes/sot-bindings.d.ts.map +1 -1
- package/dist/api/routes/sot-bindings.js +46 -11
- package/dist/api/routes/sot-bindings.js.map +1 -1
- package/dist/api/routes/sse.d.ts.map +1 -1
- package/dist/api/routes/sse.js +6 -1
- package/dist/api/routes/sse.js.map +1 -1
- package/dist/api/routes/system.d.ts.map +1 -1
- package/dist/api/routes/system.js +15 -2
- package/dist/api/routes/system.js.map +1 -1
- package/dist/api/routes/travel-bookings.d.ts.map +1 -1
- package/dist/api/routes/travel-bookings.js +26 -9
- package/dist/api/routes/travel-bookings.js.map +1 -1
- package/dist/api/routes/travel-time.d.ts.map +1 -1
- package/dist/api/routes/travel-time.js +50 -10
- package/dist/api/routes/travel-time.js.map +1 -1
- package/dist/api/routes/wiki.d.ts.map +1 -1
- package/dist/api/routes/wiki.js +49 -8
- package/dist/api/routes/wiki.js.map +1 -1
- package/dist/api/server.d.ts +15 -3
- package/dist/api/server.d.ts.map +1 -1
- package/dist/api/server.js +32 -10
- package/dist/api/server.js.map +1 -1
- package/dist/bootstrap/adapters.d.ts.map +1 -1
- package/dist/bootstrap/adapters.js +7 -4
- package/dist/bootstrap/adapters.js.map +1 -1
- package/dist/bootstrap/api.d.ts +205 -0
- package/dist/bootstrap/api.d.ts.map +1 -0
- package/dist/bootstrap/api.js +443 -0
- package/dist/bootstrap/api.js.map +1 -0
- package/dist/bootstrap/db.d.ts +119 -0
- package/dist/bootstrap/db.d.ts.map +1 -0
- package/dist/bootstrap/db.js +294 -0
- package/dist/bootstrap/db.js.map +1 -0
- package/dist/bootstrap/event-pipeline.d.ts +308 -0
- package/dist/bootstrap/event-pipeline.d.ts.map +1 -0
- package/dist/bootstrap/event-pipeline.js +704 -0
- package/dist/bootstrap/event-pipeline.js.map +1 -0
- package/dist/bootstrap/observers.d.ts +148 -0
- package/dist/bootstrap/observers.d.ts.map +1 -0
- package/dist/bootstrap/observers.js +558 -0
- package/dist/bootstrap/observers.js.map +1 -0
- package/dist/bootstrap/schedule-helpers.d.ts +122 -0
- package/dist/bootstrap/schedule-helpers.d.ts.map +1 -1
- package/dist/bootstrap/schedule-helpers.js +202 -4
- package/dist/bootstrap/schedule-helpers.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +20 -3
- package/dist/config.js.map +1 -1
- package/dist/core/abort-utils.d.ts +14 -0
- package/dist/core/abort-utils.d.ts.map +1 -0
- package/dist/core/abort-utils.js +36 -0
- package/dist/core/abort-utils.js.map +1 -0
- package/dist/core/agent-core.d.ts +22 -3
- package/dist/core/agent-core.d.ts.map +1 -1
- package/dist/core/agent-core.js +3 -1
- package/dist/core/agent-core.js.map +1 -1
- package/dist/core/backends/auth-health-monitor.js +2 -3
- package/dist/core/backends/auth-health-monitor.js.map +1 -1
- package/dist/core/backends/backend-router.d.ts +11 -1
- package/dist/core/backends/backend-router.d.ts.map +1 -1
- package/dist/core/backends/backend-router.js +97 -2
- package/dist/core/backends/backend-router.js.map +1 -1
- package/dist/core/backends/claude-code-core.d.ts +51 -0
- package/dist/core/backends/claude-code-core.d.ts.map +1 -1
- package/dist/core/backends/claude-code-core.js +134 -11
- package/dist/core/backends/claude-code-core.js.map +1 -1
- package/dist/core/backends/claude-tool-collection.js +1 -1
- package/dist/core/backends/codex-core.d.ts +13 -1
- package/dist/core/backends/codex-core.d.ts.map +1 -1
- package/dist/core/backends/codex-core.js +436 -22
- package/dist/core/backends/codex-core.js.map +1 -1
- package/dist/core/backends/gemini-cli-core.d.ts +5 -1
- package/dist/core/backends/gemini-cli-core.d.ts.map +1 -1
- package/dist/core/backends/gemini-cli-core.js +298 -15
- package/dist/core/backends/gemini-cli-core.js.map +1 -1
- package/dist/core/backends/install-methods.d.ts.map +1 -1
- package/dist/core/backends/install-methods.js +22 -0
- package/dist/core/backends/install-methods.js.map +1 -1
- package/dist/core/backends/model-registry.d.ts +9 -4
- package/dist/core/backends/model-registry.d.ts.map +1 -1
- package/dist/core/backends/model-registry.js +153 -23
- package/dist/core/backends/model-registry.js.map +1 -1
- package/dist/core/backends/native-skill-discovery-probe.d.ts +80 -0
- package/dist/core/backends/native-skill-discovery-probe.d.ts.map +1 -0
- package/dist/core/backends/native-skill-discovery-probe.js +175 -0
- package/dist/core/backends/native-skill-discovery-probe.js.map +1 -0
- package/dist/core/backends/opencode-basic-auth-fetch.d.ts +27 -0
- package/dist/core/backends/opencode-basic-auth-fetch.d.ts.map +1 -0
- package/dist/core/backends/opencode-basic-auth-fetch.js +40 -0
- package/dist/core/backends/opencode-basic-auth-fetch.js.map +1 -0
- package/dist/core/backends/opencode-config-builder.d.ts +86 -0
- package/dist/core/backends/opencode-config-builder.d.ts.map +1 -0
- package/dist/core/backends/opencode-config-builder.js +172 -0
- package/dist/core/backends/opencode-config-builder.js.map +1 -0
- package/dist/core/backends/opencode-core.d.ts +316 -0
- package/dist/core/backends/opencode-core.d.ts.map +1 -0
- package/dist/core/backends/opencode-core.js +1502 -0
- package/dist/core/backends/opencode-core.js.map +1 -0
- package/dist/core/backends/opencode-event-mapper.d.ts +133 -0
- package/dist/core/backends/opencode-event-mapper.d.ts.map +1 -0
- package/dist/core/backends/opencode-event-mapper.js +198 -0
- package/dist/core/backends/opencode-event-mapper.js.map +1 -0
- package/dist/core/backends/opencode-mcp.d.ts +82 -0
- package/dist/core/backends/opencode-mcp.d.ts.map +1 -0
- package/dist/core/backends/opencode-mcp.js +165 -0
- package/dist/core/backends/opencode-mcp.js.map +1 -0
- package/dist/core/backends/opencode-server-manager.d.ts +114 -0
- package/dist/core/backends/opencode-server-manager.d.ts.map +1 -0
- package/dist/core/backends/opencode-server-manager.js +222 -0
- package/dist/core/backends/opencode-server-manager.js.map +1 -0
- package/dist/core/backends/opencode-types.d.ts +46 -0
- package/dist/core/backends/opencode-types.d.ts.map +1 -0
- package/dist/core/backends/opencode-types.js +14 -0
- package/dist/core/backends/opencode-types.js.map +1 -0
- package/dist/core/backends/plan-presets.d.ts +18 -5
- package/dist/core/backends/plan-presets.d.ts.map +1 -1
- package/dist/core/backends/plan-presets.js +144 -23
- package/dist/core/backends/plan-presets.js.map +1 -1
- package/dist/core/backends/process-config-cascade.d.ts +35 -0
- package/dist/core/backends/process-config-cascade.d.ts.map +1 -1
- package/dist/core/backends/process-config-cascade.js +35 -1
- package/dist/core/backends/process-config-cascade.js.map +1 -1
- package/dist/core/backends/prompt-utils.d.ts.map +1 -1
- package/dist/core/backends/prompt-utils.js +0 -2
- package/dist/core/backends/prompt-utils.js.map +1 -1
- package/dist/core/backends/quota-reset-hints.d.ts +44 -0
- package/dist/core/backends/quota-reset-hints.d.ts.map +1 -0
- package/dist/core/backends/quota-reset-hints.js +117 -0
- package/dist/core/backends/quota-reset-hints.js.map +1 -0
- package/dist/core/bang-commands/commands-close.d.ts +24 -0
- package/dist/core/bang-commands/commands-close.d.ts.map +1 -0
- package/dist/core/bang-commands/commands-close.js +24 -0
- package/dist/core/bang-commands/commands-close.js.map +1 -0
- package/dist/core/bang-commands/commands-cost.d.ts.map +1 -1
- package/dist/core/bang-commands/commands-cost.js +13 -0
- package/dist/core/bang-commands/commands-cost.js.map +1 -1
- package/dist/core/bang-commands/commands-help.d.ts.map +1 -1
- package/dist/core/bang-commands/commands-help.js +44 -5
- package/dist/core/bang-commands/commands-help.js.map +1 -1
- package/dist/core/bang-commands/commands-report.d.ts.map +1 -1
- package/dist/core/bang-commands/commands-report.js +1 -0
- package/dist/core/bang-commands/commands-report.js.map +1 -1
- package/dist/core/bang-commands/commands-stop-start.d.ts.map +1 -1
- package/dist/core/bang-commands/commands-stop-start.js +2 -0
- package/dist/core/bang-commands/commands-stop-start.js.map +1 -1
- package/dist/core/bang-commands/commands-wiki.d.ts.map +1 -1
- package/dist/core/bang-commands/commands-wiki.js +12 -1
- package/dist/core/bang-commands/commands-wiki.js.map +1 -1
- package/dist/core/bang-commands/format-utils.d.ts +13 -1
- package/dist/core/bang-commands/format-utils.d.ts.map +1 -1
- package/dist/core/bang-commands/format-utils.js +21 -2
- package/dist/core/bang-commands/format-utils.js.map +1 -1
- package/dist/core/bang-commands/index.d.ts +1 -0
- package/dist/core/bang-commands/index.d.ts.map +1 -1
- package/dist/core/bang-commands/index.js +3 -0
- package/dist/core/bang-commands/index.js.map +1 -1
- package/dist/core/bang-commands/registry.d.ts +50 -0
- package/dist/core/bang-commands/registry.d.ts.map +1 -1
- package/dist/core/bang-commands/registry.js +164 -19
- package/dist/core/bang-commands/registry.js.map +1 -1
- package/dist/core/channel-timeline.d.ts +18 -1
- package/dist/core/channel-timeline.d.ts.map +1 -1
- package/dist/core/channel-timeline.js +44 -0
- package/dist/core/channel-timeline.js.map +1 -1
- package/dist/core/context/activity-view-runner.js +9 -1
- package/dist/core/context/activity-view-runner.js.map +1 -1
- package/dist/core/context/default-schedules-runner.js +44 -4
- package/dist/core/context/default-schedules-runner.js.map +1 -1
- package/dist/core/context/domain-index-runner.js +9 -1
- package/dist/core/context/domain-index-runner.js.map +1 -1
- package/dist/core/context/entity-source-rename.d.ts.map +1 -1
- package/dist/core/context/entity-source-rename.js +9 -1
- package/dist/core/context/entity-source-rename.js.map +1 -1
- package/dist/core/context/policy-index-runner.js +9 -1
- package/dist/core/context/policy-index-runner.js.map +1 -1
- package/dist/core/context/reconciler-runner.js +9 -1
- package/dist/core/context/reconciler-runner.js.map +1 -1
- package/dist/core/context-builder.d.ts +97 -2
- package/dist/core/context-builder.d.ts.map +1 -1
- package/dist/core/context-builder.js +303 -30
- package/dist/core/context-builder.js.map +1 -1
- package/dist/core/context-frontmatter.d.ts +6 -0
- package/dist/core/context-frontmatter.d.ts.map +1 -1
- package/dist/core/context-frontmatter.js +120 -8
- package/dist/core/context-frontmatter.js.map +1 -1
- package/dist/core/context-health.js +21 -9
- package/dist/core/context-health.js.map +1 -1
- package/dist/core/context-validation/_pa_wip_context_validation/index.d.ts +19 -0
- package/dist/core/context-validation/_pa_wip_context_validation/index.d.ts.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/index.js +19 -0
- package/dist/core/context-validation/_pa_wip_context_validation/index.js.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/prepare-write.d.ts +94 -0
- package/dist/core/context-validation/_pa_wip_context_validation/prepare-write.d.ts.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/prepare-write.js +130 -0
- package/dist/core/context-validation/_pa_wip_context_validation/prepare-write.js.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/routine-rulebook.d.ts +60 -0
- package/dist/core/context-validation/_pa_wip_context_validation/routine-rulebook.d.ts.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/routine-rulebook.js +156 -0
- package/dist/core/context-validation/_pa_wip_context_validation/routine-rulebook.js.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/section.d.ts +41 -0
- package/dist/core/context-validation/_pa_wip_context_validation/section.d.ts.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/section.js +82 -0
- package/dist/core/context-validation/_pa_wip_context_validation/section.js.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/snapshot-debounce.d.ts +52 -0
- package/dist/core/context-validation/_pa_wip_context_validation/snapshot-debounce.d.ts.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/snapshot-debounce.js +110 -0
- package/dist/core/context-validation/_pa_wip_context_validation/snapshot-debounce.js.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/today.d.ts +85 -0
- package/dist/core/context-validation/_pa_wip_context_validation/today.d.ts.map +1 -0
- package/dist/core/context-validation/_pa_wip_context_validation/today.js +162 -0
- package/dist/core/context-validation/_pa_wip_context_validation/today.js.map +1 -0
- package/dist/core/context-validation/index.d.ts +19 -0
- package/dist/core/context-validation/index.d.ts.map +1 -0
- package/dist/core/context-validation/index.js +19 -0
- package/dist/core/context-validation/index.js.map +1 -0
- package/dist/core/context-validation/prepare-write.d.ts +95 -0
- package/dist/core/context-validation/prepare-write.d.ts.map +1 -0
- package/dist/core/context-validation/prepare-write.js +135 -0
- package/dist/core/context-validation/prepare-write.js.map +1 -0
- package/dist/core/context-validation/routine-rulebook.d.ts +60 -0
- package/dist/core/context-validation/routine-rulebook.d.ts.map +1 -0
- package/dist/core/context-validation/routine-rulebook.js +156 -0
- package/dist/core/context-validation/routine-rulebook.js.map +1 -0
- package/dist/core/context-validation/section.d.ts +41 -0
- package/dist/core/context-validation/section.d.ts.map +1 -0
- package/dist/core/context-validation/section.js +82 -0
- package/dist/core/context-validation/section.js.map +1 -0
- package/dist/core/context-validation/snapshot-debounce.d.ts +52 -0
- package/dist/core/context-validation/snapshot-debounce.d.ts.map +1 -0
- package/dist/core/context-validation/snapshot-debounce.js +110 -0
- package/dist/core/context-validation/snapshot-debounce.js.map +1 -0
- package/dist/core/context-validation/today.d.ts +85 -0
- package/dist/core/context-validation/today.d.ts.map +1 -0
- package/dist/core/context-validation/today.js +168 -0
- package/dist/core/context-validation/today.js.map +1 -0
- package/dist/core/daemon-api-cli.d.ts +6 -5
- package/dist/core/daemon-api-cli.d.ts.map +1 -1
- package/dist/core/daemon-api-cli.js +73 -32
- package/dist/core/daemon-api-cli.js.map +1 -1
- package/dist/core/dispatcher-error-handling.d.ts +13 -0
- package/dist/core/dispatcher-error-handling.d.ts.map +1 -1
- package/dist/core/dispatcher-error-handling.js +69 -0
- package/dist/core/dispatcher-error-handling.js.map +1 -1
- package/dist/core/dispatcher-hourly-check.d.ts +73 -1
- package/dist/core/dispatcher-hourly-check.d.ts.map +1 -1
- package/dist/core/dispatcher-hourly-check.js +249 -151
- package/dist/core/dispatcher-hourly-check.js.map +1 -1
- package/dist/core/dispatcher-message-handler.d.ts +11 -1
- package/dist/core/dispatcher-message-handler.d.ts.map +1 -1
- package/dist/core/dispatcher-message-handler.js +165 -47
- package/dist/core/dispatcher-message-handler.js.map +1 -1
- package/dist/core/dispatcher-morning-routine.d.ts +38 -30
- package/dist/core/dispatcher-morning-routine.d.ts.map +1 -1
- package/dist/core/dispatcher-morning-routine.js +162 -104
- package/dist/core/dispatcher-morning-routine.js.map +1 -1
- package/dist/core/dispatcher-prompt.d.ts +4 -1
- package/dist/core/dispatcher-prompt.d.ts.map +1 -1
- package/dist/core/dispatcher-prompt.js +18 -2
- package/dist/core/dispatcher-prompt.js.map +1 -1
- package/dist/core/dispatcher-repository-helpers.d.ts.map +1 -1
- package/dist/core/dispatcher-repository-helpers.js +5 -1
- package/dist/core/dispatcher-repository-helpers.js.map +1 -1
- package/dist/core/dispatcher-result-processor.d.ts.map +1 -1
- package/dist/core/dispatcher-result-processor.js +9 -4
- package/dist/core/dispatcher-result-processor.js.map +1 -1
- package/dist/core/dispatcher-scheduled-tasks.d.ts +1 -1
- package/dist/core/dispatcher-scheduled-tasks.d.ts.map +1 -1
- package/dist/core/dispatcher-scheduled-tasks.js +79 -16
- package/dist/core/dispatcher-scheduled-tasks.js.map +1 -1
- package/dist/core/dispatcher-types.d.ts +84 -12
- package/dist/core/dispatcher-types.d.ts.map +1 -1
- package/dist/core/dispatcher-types.js.map +1 -1
- package/dist/core/dispatcher.d.ts +50 -1
- package/dist/core/dispatcher.d.ts.map +1 -1
- package/dist/core/dispatcher.js +143 -8
- package/dist/core/dispatcher.js.map +1 -1
- package/dist/core/dm-freshness-metrics.d.ts +6 -5
- package/dist/core/dm-freshness-metrics.d.ts.map +1 -1
- package/dist/core/dm-freshness-metrics.js +7 -6
- package/dist/core/dm-freshness-metrics.js.map +1 -1
- package/dist/core/evening-review-verify.d.ts +164 -0
- package/dist/core/evening-review-verify.d.ts.map +1 -0
- package/dist/core/evening-review-verify.js +637 -0
- package/dist/core/evening-review-verify.js.map +1 -0
- package/dist/core/fetch-window-prompt-loader.d.ts +47 -0
- package/dist/core/fetch-window-prompt-loader.d.ts.map +1 -0
- package/dist/core/fetch-window-prompt-loader.js +72 -0
- package/dist/core/fetch-window-prompt-loader.js.map +1 -0
- package/dist/core/management-md.d.ts.map +1 -1
- package/dist/core/management-md.js +23 -9
- package/dist/core/management-md.js.map +1 -1
- package/dist/core/management-registry.d.ts +13 -21
- package/dist/core/management-registry.d.ts.map +1 -1
- package/dist/core/management-registry.js +27 -48
- package/dist/core/management-registry.js.map +1 -1
- package/dist/core/metrics.d.ts +88 -1
- package/dist/core/metrics.d.ts.map +1 -1
- package/dist/core/metrics.js +78 -2
- package/dist/core/metrics.js.map +1 -1
- package/dist/core/morning/agent-journal-appender.d.ts +197 -0
- package/dist/core/morning/agent-journal-appender.d.ts.map +1 -0
- package/dist/core/morning/agent-journal-appender.js +458 -0
- package/dist/core/morning/agent-journal-appender.js.map +1 -0
- package/dist/core/morning/handoff-parser.d.ts +45 -0
- package/dist/core/morning/handoff-parser.d.ts.map +1 -0
- package/dist/core/morning/handoff-parser.js +117 -0
- package/dist/core/morning/handoff-parser.js.map +1 -0
- package/dist/core/morning/journal-skeleton-builder.d.ts +157 -0
- package/dist/core/morning/journal-skeleton-builder.d.ts.map +1 -0
- package/dist/core/morning/journal-skeleton-builder.js +303 -0
- package/dist/core/morning/journal-skeleton-builder.js.map +1 -0
- package/dist/core/morning/orchestrator.d.ts +312 -0
- package/dist/core/morning/orchestrator.d.ts.map +1 -0
- package/dist/core/morning/orchestrator.js +827 -0
- package/dist/core/morning/orchestrator.js.map +1 -0
- package/dist/core/morning/parent-audit-emitter.d.ts +82 -0
- package/dist/core/morning/parent-audit-emitter.d.ts.map +1 -0
- package/dist/core/morning/parent-audit-emitter.js +120 -0
- package/dist/core/morning/parent-audit-emitter.js.map +1 -0
- package/dist/core/morning/roadmap-skeleton-builder.d.ts +159 -0
- package/dist/core/morning/roadmap-skeleton-builder.d.ts.map +1 -0
- package/dist/core/morning/roadmap-skeleton-builder.js +338 -0
- package/dist/core/morning/roadmap-skeleton-builder.js.map +1 -0
- package/dist/core/output-language-policy.js +1 -1
- package/dist/core/output-language-policy.js.map +1 -1
- package/dist/core/policy-files.d.ts +19 -2
- package/dist/core/policy-files.d.ts.map +1 -1
- package/dist/core/policy-files.js +65 -7
- package/dist/core/policy-files.js.map +1 -1
- package/dist/core/pre-pass-freshness.d.ts +28 -0
- package/dist/core/pre-pass-freshness.d.ts.map +1 -0
- package/dist/core/pre-pass-freshness.js +10 -0
- package/dist/core/pre-pass-freshness.js.map +1 -0
- package/dist/core/previous-week-digest.d.ts +130 -0
- package/dist/core/previous-week-digest.d.ts.map +1 -0
- package/dist/core/previous-week-digest.js +257 -0
- package/dist/core/previous-week-digest.js.map +1 -0
- package/dist/core/prompts.js +3 -3
- package/dist/core/prompts.js.map +1 -1
- package/dist/core/quiet-hours-sync.d.ts.map +1 -1
- package/dist/core/quiet-hours-sync.js +7 -0
- package/dist/core/quiet-hours-sync.js.map +1 -1
- package/dist/core/recurrence.d.ts +13 -0
- package/dist/core/recurrence.d.ts.map +1 -1
- package/dist/core/recurrence.js +108 -13
- package/dist/core/recurrence.js.map +1 -1
- package/dist/core/release-assets.d.ts +21 -1
- package/dist/core/release-assets.d.ts.map +1 -1
- package/dist/core/release-assets.js +58 -3
- package/dist/core/release-assets.js.map +1 -1
- package/dist/core/repository-management-docs.d.ts.map +1 -1
- package/dist/core/repository-management-docs.js +14 -4
- package/dist/core/repository-management-docs.js.map +1 -1
- package/dist/core/review-context.d.ts.map +1 -1
- package/dist/core/review-context.js +29 -1
- package/dist/core/review-context.js.map +1 -1
- package/dist/core/roadmap-maintenance.d.ts +213 -0
- package/dist/core/roadmap-maintenance.d.ts.map +1 -0
- package/dist/core/roadmap-maintenance.js +706 -0
- package/dist/core/roadmap-maintenance.js.map +1 -0
- package/dist/core/roadmap-validate.d.ts +5 -0
- package/dist/core/roadmap-validate.d.ts.map +1 -1
- package/dist/core/roadmap-validate.js +6 -69
- package/dist/core/roadmap-validate.js.map +1 -1
- package/dist/core/routine-acquisition-plan.d.ts +43 -7
- package/dist/core/routine-acquisition-plan.d.ts.map +1 -1
- package/dist/core/routine-acquisition-plan.js +99 -8
- package/dist/core/routine-acquisition-plan.js.map +1 -1
- package/dist/core/routine-fetch-window-retry.d.ts +41 -2
- package/dist/core/routine-fetch-window-retry.d.ts.map +1 -1
- package/dist/core/routine-fetch-window-retry.js +91 -8
- package/dist/core/routine-fetch-window-retry.js.map +1 -1
- package/dist/core/routine-fetch-window-runner.d.ts +55 -21
- package/dist/core/routine-fetch-window-runner.d.ts.map +1 -1
- package/dist/core/routine-fetch-window-runner.js +258 -35
- package/dist/core/routine-fetch-window-runner.js.map +1 -1
- package/dist/core/routine-windows.d.ts +17 -13
- package/dist/core/routine-windows.d.ts.map +1 -1
- package/dist/core/routine-windows.js +78 -36
- package/dist/core/routine-windows.js.map +1 -1
- package/dist/core/scheduler.d.ts +121 -37
- package/dist/core/scheduler.d.ts.map +1 -1
- package/dist/core/scheduler.js +359 -80
- package/dist/core/scheduler.js.map +1 -1
- package/dist/core/session-manager.d.ts +25 -6
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +32 -15
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/skeleton.d.ts.map +1 -1
- package/dist/core/skeleton.js +23 -23
- package/dist/core/skeleton.js.map +1 -1
- package/dist/core/skills-compiler.d.ts +275 -25
- package/dist/core/skills-compiler.d.ts.map +1 -1
- package/dist/core/skills-compiler.js +844 -205
- package/dist/core/skills-compiler.js.map +1 -1
- package/dist/core/skills-manifest.d.ts +104 -0
- package/dist/core/skills-manifest.d.ts.map +1 -1
- package/dist/core/skills-manifest.js +350 -39
- package/dist/core/skills-manifest.js.map +1 -1
- package/dist/core/wiki/git-precompile.d.ts +9 -0
- package/dist/core/wiki/git-precompile.d.ts.map +1 -1
- package/dist/core/wiki/git-precompile.js +7 -1
- package/dist/core/wiki/git-precompile.js.map +1 -1
- package/dist/core/workdir.d.ts +30 -1
- package/dist/core/workdir.d.ts.map +1 -1
- package/dist/core/workdir.js +140 -15
- package/dist/core/workdir.js.map +1 -1
- package/dist/db/entities-store.d.ts +5 -5
- package/dist/db/entities-store.js +5 -5
- package/dist/db/hourly-check-signals.d.ts.map +1 -1
- package/dist/db/hourly-check-signals.js +121 -35
- package/dist/db/hourly-check-signals.js.map +1 -1
- package/dist/db/observations.d.ts +1 -1
- package/dist/db/observations.js +1 -1
- package/dist/db/observations.js.map +1 -1
- package/dist/db/recurring-schedules.d.ts +32 -1
- package/dist/db/recurring-schedules.d.ts.map +1 -1
- package/dist/db/recurring-schedules.js +29 -10
- package/dist/db/recurring-schedules.js.map +1 -1
- package/dist/db/repositories-store.d.ts +2 -1
- package/dist/db/repositories-store.d.ts.map +1 -1
- package/dist/db/repositories-store.js +38 -3
- package/dist/db/repositories-store.js.map +1 -1
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +157 -51
- package/dist/db/schema.js.map +1 -1
- package/dist/db/wiki-store.d.ts.map +1 -1
- package/dist/db/wiki-store.js +3 -0
- package/dist/db/wiki-store.js.map +1 -1
- package/dist/index.js +308 -1473
- package/dist/index.js.map +1 -1
- package/dist/messaging/magic-phrase.d.ts +16 -0
- package/dist/messaging/magic-phrase.d.ts.map +1 -1
- package/dist/messaging/magic-phrase.js +53 -0
- package/dist/messaging/magic-phrase.js.map +1 -1
- package/dist/messaging/owner-channels.d.ts +24 -0
- package/dist/messaging/owner-channels.d.ts.map +1 -1
- package/dist/messaging/owner-channels.js +38 -0
- package/dist/messaging/owner-channels.js.map +1 -1
- package/dist/messaging/setup-welcome-dm.d.ts +30 -0
- package/dist/messaging/setup-welcome-dm.d.ts.map +1 -0
- package/dist/messaging/setup-welcome-dm.js +86 -0
- package/dist/messaging/setup-welcome-dm.js.map +1 -0
- package/dist/observers/calendar-poller.d.ts +2 -0
- package/dist/observers/calendar-poller.d.ts.map +1 -1
- package/dist/observers/calendar-poller.js +76 -54
- package/dist/observers/calendar-poller.js.map +1 -1
- package/dist/observers/delegated-sync-worker.d.ts +62 -0
- package/dist/observers/delegated-sync-worker.d.ts.map +1 -1
- package/dist/observers/delegated-sync-worker.js +128 -1
- package/dist/observers/delegated-sync-worker.js.map +1 -1
- package/dist/observers/git-watcher.d.ts +22 -0
- package/dist/observers/git-watcher.d.ts.map +1 -1
- package/dist/observers/git-watcher.js +31 -7
- package/dist/observers/git-watcher.js.map +1 -1
- package/dist/observers/imminent-event-scheduler.d.ts +2 -0
- package/dist/observers/imminent-event-scheduler.d.ts.map +1 -1
- package/dist/observers/imminent-event-scheduler.js +29 -0
- package/dist/observers/imminent-event-scheduler.js.map +1 -1
- package/dist/observers/notion-poller.d.ts +2 -0
- package/dist/observers/notion-poller.d.ts.map +1 -1
- package/dist/observers/notion-poller.js +44 -6
- package/dist/observers/notion-poller.js.map +1 -1
- package/dist/observers/poll-guard.d.ts +63 -0
- package/dist/observers/poll-guard.d.ts.map +1 -0
- package/dist/observers/poll-guard.js +89 -0
- package/dist/observers/poll-guard.js.map +1 -0
- package/dist/safety/absolute-block-audit.d.ts +17 -0
- package/dist/safety/absolute-block-audit.d.ts.map +1 -1
- package/dist/safety/absolute-block-audit.js +28 -2
- package/dist/safety/absolute-block-audit.js.map +1 -1
- package/dist/safety/agent-write-tracker.d.ts +42 -1
- package/dist/safety/agent-write-tracker.d.ts.map +1 -1
- package/dist/safety/agent-write-tracker.js +81 -1
- package/dist/safety/agent-write-tracker.js.map +1 -1
- package/dist/safety/always-disallowed.d.ts +34 -0
- package/dist/safety/always-disallowed.d.ts.map +1 -1
- package/dist/safety/always-disallowed.js +114 -7
- package/dist/safety/always-disallowed.js.map +1 -1
- package/dist/safety/audit.d.ts +20 -0
- package/dist/safety/audit.d.ts.map +1 -1
- package/dist/safety/audit.js +126 -0
- package/dist/safety/audit.js.map +1 -1
- package/dist/safety/risk-classifier.d.ts +17 -1
- package/dist/safety/risk-classifier.d.ts.map +1 -1
- package/dist/safety/risk-classifier.js +75 -7
- package/dist/safety/risk-classifier.js.map +1 -1
- package/dist/safety/subprocess-block-scanner.d.ts +89 -0
- package/dist/safety/subprocess-block-scanner.d.ts.map +1 -0
- package/dist/safety/subprocess-block-scanner.js +177 -0
- package/dist/safety/subprocess-block-scanner.js.map +1 -0
- package/dist/scheduler/hourly-check-gate.d.ts +23 -9
- package/dist/scheduler/hourly-check-gate.d.ts.map +1 -1
- package/dist/scheduler/hourly-check-gate.js +11 -6
- package/dist/scheduler/hourly-check-gate.js.map +1 -1
- package/dist/secrets/backend-api-key-env.d.ts.map +1 -1
- package/dist/secrets/backend-api-key-env.js +1 -0
- package/dist/secrets/backend-api-key-env.js.map +1 -1
- package/dist/services/delegated-backend-invoker.d.ts.map +1 -1
- package/dist/services/delegated-backend-invoker.js +8 -1
- package/dist/services/delegated-backend-invoker.js.map +1 -1
- package/dist/services/delegated-invoker-audit.d.ts.map +1 -1
- package/dist/services/delegated-invoker-audit.js +5 -1
- package/dist/services/delegated-invoker-audit.js.map +1 -1
- package/dist/services/delegated-proxy-config.d.ts +3 -2
- package/dist/services/delegated-proxy-config.d.ts.map +1 -1
- package/dist/services/delegated-proxy-config.js.map +1 -1
- package/dist/services/integrations/extract-write-item-id.d.ts +5 -2
- package/dist/services/integrations/extract-write-item-id.d.ts.map +1 -1
- package/dist/services/integrations/extract-write-item-id.js.map +1 -1
- package/dist/services/mcp/generators/index.d.ts +1 -0
- package/dist/services/mcp/generators/index.d.ts.map +1 -1
- package/dist/services/mcp/generators/index.js +3 -0
- package/dist/services/mcp/generators/index.js.map +1 -1
- package/dist/services/mcp/sdk-observations-server.d.ts +60 -0
- package/dist/services/mcp/sdk-observations-server.d.ts.map +1 -0
- package/dist/services/mcp/sdk-observations-server.js +161 -0
- package/dist/services/mcp/sdk-observations-server.js.map +1 -0
- package/dist/services/mcp/session-materializer.d.ts.map +1 -1
- package/dist/services/mcp/session-materializer.js +13 -9
- package/dist/services/mcp/session-materializer.js.map +1 -1
- package/dist/services/mcp/types.d.ts +1 -0
- package/dist/services/mcp/types.d.ts.map +1 -1
- package/dist/services/notion.d.ts +19 -1
- package/dist/services/notion.d.ts.map +1 -1
- package/dist/services/notion.js +41 -2
- package/dist/services/notion.js.map +1 -1
- package/dist/services/observations-batch.d.ts +100 -0
- package/dist/services/observations-batch.d.ts.map +1 -0
- package/dist/services/observations-batch.js +258 -0
- package/dist/services/observations-batch.js.map +1 -0
- package/dist/services/voice/transcriber.d.ts +23 -0
- package/dist/services/voice/transcriber.d.ts.map +1 -1
- package/dist/services/voice/transcriber.js +55 -0
- package/dist/services/voice/transcriber.js.map +1 -1
- package/dist/settings/runtime-settings.d.ts +9 -6
- package/dist/settings/runtime-settings.d.ts.map +1 -1
- package/dist/settings/runtime-settings.js +50 -17
- package/dist/settings/runtime-settings.js.map +1 -1
- package/package.json +3 -2
- package/dist/api/delegated-proxy-helper.d.ts +0 -33
- package/dist/api/delegated-proxy-helper.d.ts.map +0 -1
- package/dist/api/delegated-proxy-helper.js +0 -54
- package/dist/api/delegated-proxy-helper.js.map +0 -1
- package/dist/core/roadmap-merge.d.ts +0 -7
- package/dist/core/roadmap-merge.d.ts.map +0 -1
- package/dist/core/roadmap-merge.js +0 -187
- package/dist/core/roadmap-merge.js.map +0 -1
- package/dist/db/test-schemas.d.ts +0 -23
- package/dist/db/test-schemas.d.ts.map +0 -1
- package/dist/db/test-schemas.js +0 -111
- package/dist/db/test-schemas.js.map +0 -1
|
@@ -0,0 +1,827 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `MorningRoutinePipelineOrchestrator` — Phase 5 of
|
|
3
|
+
* `docs/design/appendices/morning-routine-optimization.md`. Replaces the
|
|
4
|
+
* single monolithic medium-tier session that today's
|
|
5
|
+
* `MorningRoutineRunner.executeMorningRoutine` runs with a daemon-
|
|
6
|
+
* orchestrated pipeline:
|
|
7
|
+
*
|
|
8
|
+
* ① rotateDayFiles (owned by MorningRoutineRunner)
|
|
9
|
+
* ② HandoffParser (this module)
|
|
10
|
+
* ③ JournalSkeletonBuilder (this module)
|
|
11
|
+
* ④ Pre-pass fan-out (owned by MorningRoutineRunner)
|
|
12
|
+
* ⑤A Stage A: today.md synthesis [medium] (this module) ─┐ Promise.all
|
|
13
|
+
* ⑤B Stage B: daily journal author [lite] (this module) ─┘
|
|
14
|
+
* ⑥ AgentJournalAppender (Phase 6 — left to MorningRoutineRunner)
|
|
15
|
+
* ⑥b parent audit row emit (this module)
|
|
16
|
+
* ⑦ diagnoseTodayMdState (owned by MorningRoutineRunner)
|
|
17
|
+
* ⑧ Post-morning catchups + roadmap_refresh (owned by MorningRoutineRunner)
|
|
18
|
+
*
|
|
19
|
+
* The orchestrator owns only ②③⑤A∥⑤B⑥b. ① and ④ are upstream of `run()`;
|
|
20
|
+
* ⑥, ⑦, ⑧ stay with the runner so the existing today.md health check /
|
|
21
|
+
* retry chain / catchups continue to work unchanged on both legacy and
|
|
22
|
+
* V2 paths.
|
|
23
|
+
*
|
|
24
|
+
* Stage event design:
|
|
25
|
+
* - Stage A event.type = `routine.morning_routine_today` so its
|
|
26
|
+
* `agent_actions` row lands with `action_type='routine.morning_routine_today'`
|
|
27
|
+
* (the audit logger derives action_type from `event.type`). Stage A's
|
|
28
|
+
* `routine` field stays `"morning_routine"` so ContextBuilder's
|
|
29
|
+
* existing heavy-context branch fires (yesterday.md / roadmap.md /
|
|
30
|
+
* active_projects / calendar_events_7d).
|
|
31
|
+
* - Stage B event.type = `routine.morning_routine_journal`. Stage B's
|
|
32
|
+
* `routine` field is `"morning_routine_journal"` so ContextBuilder
|
|
33
|
+
* fires the minimal Stage-B branch added in Phase 5 (calendar_events_7d
|
|
34
|
+
* for wikilink resolution; no yesterday / roadmap / projects).
|
|
35
|
+
* - Both stage events share `correlationId` with the parent
|
|
36
|
+
* `routine.morning_routine` envelope — `loadMorningRoutineActionRows`
|
|
37
|
+
* and `emitMorningRoutineParentAuditRow` use that as `event_id` to
|
|
38
|
+
* correlate.
|
|
39
|
+
*
|
|
40
|
+
* Today.md write-lock: Stage A inherits the lockId set on the parent
|
|
41
|
+
* event by `MorningRoutineRunner` (the lock is acquired before this
|
|
42
|
+
* runs and released after); Stage B does not write to today.md and
|
|
43
|
+
* does not receive the lockId.
|
|
44
|
+
*
|
|
45
|
+
* Retry semantics (rev2 — `morning-routine-optimization.md`
|
|
46
|
+
* §"Pipeline-level invariants"):
|
|
47
|
+
* - The retry chain is gated on today.md health; only Stage A regen
|
|
48
|
+
* is what fixes a missing / wrong-date today.md. On retry,
|
|
49
|
+
* `inputs.isRetry` is true and Stage B is NOT re-fired. Phase 5
|
|
50
|
+
* simplification: if Stage B succeeded on attempt 1, its
|
|
51
|
+
* `daily/<yesterday>.md` is already on disk and re-firing would
|
|
52
|
+
* hit the 200/PATCH-Agent-revision path, producing a second
|
|
53
|
+
* journal entry on every retry; if Stage B failed on attempt 1,
|
|
54
|
+
* re-firing would still risk that duplication once the next
|
|
55
|
+
* scheduled write succeeds. The trade-off is documented in design
|
|
56
|
+
* §"Retry semantics" — Phase 6 may revisit if structured Stage B
|
|
57
|
+
* result tracking justifies the work.
|
|
58
|
+
*
|
|
59
|
+
* Pre-pass skip on retry: not enforced here because `MorningRoutineRunner`
|
|
60
|
+
* already short-circuits the pre-pass when `isRetry === true`. The
|
|
61
|
+
* pre-pass result lives on the parent event's `event.data.fetchReportBlock`
|
|
62
|
+
* and is forwarded into the Stage A event unchanged (Stage B does not
|
|
63
|
+
* consume it).
|
|
64
|
+
*/
|
|
65
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
66
|
+
import { join } from "node:path";
|
|
67
|
+
import { EventPriority, getAgentDayBoundsUtc, getAgentDayDateStr, } from "@aitne/shared";
|
|
68
|
+
import { getContextDir } from "../../config.js";
|
|
69
|
+
import { parseHandoff } from "./handoff-parser.js";
|
|
70
|
+
import { buildJournalSkeleton, gatherJournalSkeletonFacts, } from "./journal-skeleton-builder.js";
|
|
71
|
+
import { buildRoadmapSkeleton, gatherRoadmapSkeletonFacts, } from "./roadmap-skeleton-builder.js";
|
|
72
|
+
import { emitMorningRoutineParentAuditRow, } from "./parent-audit-emitter.js";
|
|
73
|
+
import { appendMorningRoutineJournalEntry, STAGE_A_ACTION_TYPE, STAGE_B_ACTION_TYPE, } from "./agent-journal-appender.js";
|
|
74
|
+
import { createLogger } from "../../logging.js";
|
|
75
|
+
const logger = createLogger("morning-pipeline-orchestrator");
|
|
76
|
+
const STAGE_A_PROCESS_KEY = "routine.morning_routine_today";
|
|
77
|
+
const STAGE_B_PROCESS_KEY = "routine.morning_routine_journal";
|
|
78
|
+
/**
|
|
79
|
+
* The `routine` slug carried on each stage's RoutineEvent. Stage A reuses
|
|
80
|
+
* the legacy `"morning_routine"` value so the heavy ContextBuilder branch
|
|
81
|
+
* (yesterday.md / roadmap.md / active_projects / calendar_events_7d)
|
|
82
|
+
* continues to fire unchanged — the Phase 5 split is about dispatch
|
|
83
|
+
* shape, not Stage A's context inputs. Stage B's
|
|
84
|
+
* `"morning_routine_journal"` slug routes into the minimal branch added
|
|
85
|
+
* to ContextBuilder for Phase 5.
|
|
86
|
+
*/
|
|
87
|
+
const STAGE_A_ROUTINE_SLUG = "morning_routine";
|
|
88
|
+
const STAGE_B_ROUTINE_SLUG = "morning_routine_journal";
|
|
89
|
+
export class MorningRoutinePipelineOrchestrator {
|
|
90
|
+
deps;
|
|
91
|
+
constructor(deps) {
|
|
92
|
+
this.deps = deps;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Drive ②③⑤A∥⑤B. The caller (`MorningRoutineRunner`) is responsible
|
|
96
|
+
* for invoking ⑦ (today.md health diagnose) and ⑥b (parent audit
|
|
97
|
+
* emit, via `emitParentAuditRow`) afterwards.
|
|
98
|
+
*
|
|
99
|
+
* Errors:
|
|
100
|
+
* - Stage A throw → re-thrown so the runner's outer try/finally
|
|
101
|
+
* (lock release + flag reset) still fires, and the runner's
|
|
102
|
+
* `diagnoseTodayMdState` post-check catches the missing today.md
|
|
103
|
+
* and schedules a retry the same way legacy failures do.
|
|
104
|
+
* - Stage B throw → logged + folded into `stageBResult=null`. Does
|
|
105
|
+
* NOT propagate; Stage B failure is independent of today.md
|
|
106
|
+
* health (the day still opens, the journal is best-effort).
|
|
107
|
+
*/
|
|
108
|
+
async run(inputs) {
|
|
109
|
+
const startedAt = new Date();
|
|
110
|
+
const parentEvent = inputs.parentEvent;
|
|
111
|
+
const correlationId = parentEvent.correlationId;
|
|
112
|
+
// ② HandoffParser — read yesterday.md, parse `## Handoff`, render the
|
|
113
|
+
// `<handoff_parsed>` XML block. Fail-soft per design §"Data-flow
|
|
114
|
+
// principle": when parsing returns null (no file, malformed section)
|
|
115
|
+
// the orchestrator omits the block and Stage A's task-flow falls
|
|
116
|
+
// back to reading `<yesterday>` raw — one extra Stage A turn at most.
|
|
117
|
+
const handoffParsedBlock = this.buildHandoffParsedBlock();
|
|
118
|
+
// ③ JournalSkeletonBuilder — deterministic frontmatter +
|
|
119
|
+
// pre-aggregated facts for yesterday's daily journal. Skipped on
|
|
120
|
+
// retry per `morning-routine-optimization.md` rev4
|
|
121
|
+
// §"Pipeline-level invariants → Retry semantics": Stage B is not
|
|
122
|
+
// re-fired on retry (its prior-attempt PUT is preserved to avoid
|
|
123
|
+
// double-authoring the daily file), so building the skeleton would
|
|
124
|
+
// do work with no consumer. The builder itself remains idempotent
|
|
125
|
+
// — re-enabling Stage B on retry would require no skeleton change.
|
|
126
|
+
const stageBInputs = inputs.isRetry
|
|
127
|
+
? null
|
|
128
|
+
: this.buildStageBInputs();
|
|
129
|
+
// morning-routine-optimization.md Phase 7 — daemon-prepared roadmap
|
|
130
|
+
// skeleton for the first-run (no-yesterday) branch. The legacy
|
|
131
|
+
// `routine.morning_routine_initial` high-tier session paid for an
|
|
132
|
+
// Opus turn to generate this from scratch; the medium-tier Stage A
|
|
133
|
+
// can spot-edit a deterministic skeleton into roadmap.md via the
|
|
134
|
+
// same `roadmap` skill PATCH paths the recurring branch uses. Only
|
|
135
|
+
// emitted on the first-run branch (yesterday.md absent) — the
|
|
136
|
+
// recurring branch leaves the block off and Stage A reads the
|
|
137
|
+
// truncated `<roadmap>` ContextBuilder injects as usual.
|
|
138
|
+
const roadmapSkeletonBlock = this.buildRoadmapSkeletonBlock();
|
|
139
|
+
// ⑤A + ⑤B — Promise.allSettled so a Stage B throw does not abort
|
|
140
|
+
// Stage A. (Promise.all would; Stage A's result is what gates the
|
|
141
|
+
// morning routine's success, so we always want to surface it.)
|
|
142
|
+
const stageAEvent = this.composeStageAEvent(parentEvent, correlationId, handoffParsedBlock, roadmapSkeletonBlock);
|
|
143
|
+
const stageBEvent = stageBInputs === null
|
|
144
|
+
? null
|
|
145
|
+
: this.composeStageBEvent(parentEvent, correlationId, stageBInputs.block);
|
|
146
|
+
// morning-routine-optimization.md Phase 6 — pre-insert the
|
|
147
|
+
// `result='in_progress'` sentinel for Stage A so the agent's
|
|
148
|
+
// `PATCH /api/agent-actions/self` resolves to a real row during the
|
|
149
|
+
// run. The eventual `logAction` call from `persistStageAuditRows`
|
|
150
|
+
// settles the same row (UPSERT path in `audit.ts.logAction`),
|
|
151
|
+
// preserving the metadata column the agent wrote. Stage B does NOT
|
|
152
|
+
// call PATCH self (it has no `agent-actions` skill in its policy
|
|
153
|
+
// set), so it gets no pre-insert.
|
|
154
|
+
this.preInsertStageAInProgressRow(correlationId);
|
|
155
|
+
const [stageA, stageB] = await Promise.allSettled([
|
|
156
|
+
this.runStageA(stageAEvent, inputs.requestedTier),
|
|
157
|
+
stageBEvent === null
|
|
158
|
+
? Promise.resolve(null)
|
|
159
|
+
: this.runStageB(stageBEvent),
|
|
160
|
+
]);
|
|
161
|
+
// Land Stage A / Stage B `agent_actions` rows BEFORE deciding whether
|
|
162
|
+
// to re-throw on Stage A failure. The rows are what
|
|
163
|
+
// `parent-audit-emitter.readStageSummaries` reads via SQL, what the
|
|
164
|
+
// autonomous-cost-cap SUM aggregates over, and what
|
|
165
|
+
// `agent-journal-appender` (Phase 6) will template-fill from. Without
|
|
166
|
+
// this call the orchestrator's parent-audit emit silently degrades to
|
|
167
|
+
// `stage_a_row_missing` in production and Stage B's cost is dropped
|
|
168
|
+
// from the budget tracker.
|
|
169
|
+
//
|
|
170
|
+
// We deliberately call this even when Stage A failed: Stage B's
|
|
171
|
+
// result may exist and its row is still meaningful (parent-audit emit
|
|
172
|
+
// won't fire on this attempt because Stage A failed, but a retry's
|
|
173
|
+
// emit will read Stage B's prior-attempt row).
|
|
174
|
+
//
|
|
175
|
+
// `processResult` is the unique writer of `agent_actions` for routine
|
|
176
|
+
// sessions; calling it per stage with the stage's RoutineEvent makes
|
|
177
|
+
// each row land with `action_type=<stage process key>` (the audit
|
|
178
|
+
// logger derives action_type from `event.type`). Routine events are
|
|
179
|
+
// silent-by-default in `shouldNotify`, so no user-facing notify side
|
|
180
|
+
// effect fires.
|
|
181
|
+
const stageBResultIfFulfilled = stageB.status === "fulfilled" ? stageB.value : null;
|
|
182
|
+
await this.persistStageAuditRows(stageA.status === "fulfilled" ? stageA.value : null, stageAEvent, stageBResultIfFulfilled, stageBEvent);
|
|
183
|
+
if (stageA.status === "rejected") {
|
|
184
|
+
// Re-throw so the runner's existing finally / retry path fires.
|
|
185
|
+
// Log enough context that the operator can confirm the V2 path
|
|
186
|
+
// was active when the throw happened — the runner-side log will
|
|
187
|
+
// also fire from its own catch.
|
|
188
|
+
logger.error({
|
|
189
|
+
err: stageA.reason,
|
|
190
|
+
correlationId,
|
|
191
|
+
stageB: stageB.status,
|
|
192
|
+
}, "Stage A threw — propagating to MorningRoutineRunner");
|
|
193
|
+
throw stageA.reason;
|
|
194
|
+
}
|
|
195
|
+
if (stageB.status === "rejected") {
|
|
196
|
+
logger.warn({ err: stageB.reason, correlationId }, "Stage B threw — folding into stageBResult=null; today.md health gates parent audit independently");
|
|
197
|
+
}
|
|
198
|
+
return {
|
|
199
|
+
stageAResult: stageA.value,
|
|
200
|
+
stageBResult: stageBResultIfFulfilled,
|
|
201
|
+
startedAt,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Write per-stage `agent_actions` rows via `processResult`. Each stage
|
|
206
|
+
* is processed against its OWN `RoutineEvent` (carrying the stage's
|
|
207
|
+
* process-key event type), so the row's `action_type` lands as
|
|
208
|
+
* `routine.morning_routine_today` / `routine.morning_routine_journal`
|
|
209
|
+
* — exactly what `parent-audit-emitter.readStageSummaries` and the
|
|
210
|
+
* Phase 6 `agent-journal-appender` will read.
|
|
211
|
+
*
|
|
212
|
+
* Failures inside `processResult` (e.g. a notify hook misbehaving) do
|
|
213
|
+
* NOT propagate — losing audit rows is bad, but blocking the entire
|
|
214
|
+
* morning routine on a downstream telemetry hiccup is worse. In
|
|
215
|
+
* practice `audit.logAction` already swallows its own DB errors with
|
|
216
|
+
* an internal logger.error, so the catch here is a defence-in-depth
|
|
217
|
+
* guard against non-audit hooks (notify side effects we don't expect
|
|
218
|
+
* for routine events but might land later).
|
|
219
|
+
*
|
|
220
|
+
* Tail-risk acknowledgement: if a stage row truly fails to land
|
|
221
|
+
* (audit's internal try/catch swallowed a real SQLite error AND
|
|
222
|
+
* `processResult`'s notification path threw too), the parent-audit
|
|
223
|
+
* emitter will return `stage_a_row_missing` and the pre-routine gate
|
|
224
|
+
* stays unfired for the day — that day's hourly_check / evening_review
|
|
225
|
+
* are skipped with `morning_routine_pending_for_today`, but
|
|
226
|
+
* `MAX_RETRIES`-bounded `scheduleMorningRetry` does NOT loop on this
|
|
227
|
+
* shape because today.md health is independent. The day's automation
|
|
228
|
+
* degrades silently for that day; it does not infinite-loop.
|
|
229
|
+
*/
|
|
230
|
+
async persistStageAuditRows(stageAResult, stageAEvent, stageBResult, stageBEvent) {
|
|
231
|
+
const tasks = [];
|
|
232
|
+
if (stageAResult !== null) {
|
|
233
|
+
tasks.push(this.deps.resultProcessor
|
|
234
|
+
.processResult(stageAResult, stageAEvent)
|
|
235
|
+
.catch((err) => {
|
|
236
|
+
logger.warn({ err, correlationId: stageAEvent.correlationId }, "Stage A processResult failed — audit row may be missing");
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
if (stageBResult !== null && stageBEvent !== null) {
|
|
240
|
+
tasks.push(this.deps.resultProcessor
|
|
241
|
+
.processResult(stageBResult, stageBEvent)
|
|
242
|
+
.catch((err) => {
|
|
243
|
+
logger.warn({ err, correlationId: stageBEvent.correlationId }, "Stage B processResult failed — audit row may be missing");
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
if (tasks.length > 0) {
|
|
247
|
+
await Promise.all(tasks);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* ⑥b parent audit emit — the row keyed `action_type='routine.morning_routine'`
|
|
252
|
+
* that `morningRoutineRanToday` in `schedule-helpers.ts` SELECTs on.
|
|
253
|
+
* Called by `MorningRoutineRunner` AFTER its `diagnoseTodayMdState`
|
|
254
|
+
* verdict so the today.md health gate is enforced; gated also on
|
|
255
|
+
* Stage A success (Stage B success is recorded in `detail` but does
|
|
256
|
+
* NOT block — the day still "opened" if today.md is good).
|
|
257
|
+
*
|
|
258
|
+
* Reads agent_actions rows by correlationId to get authoritative
|
|
259
|
+
* `cost_usd` / `num_turns` / `result` for each stage — handles the
|
|
260
|
+
* case where one stage's `AgentResult` is in memory and the other
|
|
261
|
+
* is null (Stage B was skipped on retry) without an
|
|
262
|
+
* impedance-mismatch shim.
|
|
263
|
+
*/
|
|
264
|
+
emitParentAuditRow(args) {
|
|
265
|
+
const stages = this.readStageSummaries(args.correlationId);
|
|
266
|
+
return emitMorningRoutineParentAuditRow(this.deps.db, {
|
|
267
|
+
correlationId: args.correlationId,
|
|
268
|
+
stageA: stages.stageA,
|
|
269
|
+
stageB: stages.stageB,
|
|
270
|
+
todayMdHealth: args.todayMdHealth,
|
|
271
|
+
startedAt: args.startedAt,
|
|
272
|
+
completedAt: new Date(),
|
|
273
|
+
...(args.backend ? { backend: args.backend } : {}),
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* morning-routine-optimization.md Phase 6 — ⑥ AgentJournalAppender.
|
|
278
|
+
* Assembles the one-paragraph English audit-trail entry for
|
|
279
|
+
* `agent/journal.md` from `agent_actions` rows (stage results +
|
|
280
|
+
* the metadata column Stage A wrote via `PATCH /api/agent-actions/self`)
|
|
281
|
+
* plus `daily/<yesterday>.md` frontmatter. No LLM final-text parsing.
|
|
282
|
+
*
|
|
283
|
+
* Called by `MorningRoutineRunner` AFTER both stage rows have settled
|
|
284
|
+
* (so `loadMorningRoutineActionRows` sees terminal `result` + the
|
|
285
|
+
* agent-supplied metadata) and BEFORE `emitParentAuditRow` so the
|
|
286
|
+
* journal block is on disk by the time the pre-routine gate fires.
|
|
287
|
+
*
|
|
288
|
+
* Returns the appender's structured outcome so the runner can log the
|
|
289
|
+
* skip reason (e.g. `stage_a_row_missing` when the Stage A audit row
|
|
290
|
+
* never landed) without grepping the file. Returns `null` when the
|
|
291
|
+
* orchestrator was constructed without the deps the appender needs
|
|
292
|
+
* (Phase 5-only test fixtures) — caller treats `null` as a no-op.
|
|
293
|
+
*/
|
|
294
|
+
appendAgentJournalEntry(args) {
|
|
295
|
+
const contextDir = getContextDir(this.deps.config, this.deps.db);
|
|
296
|
+
const now = new Date();
|
|
297
|
+
const yesterdayNow = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
|
298
|
+
const morningDateStr = getAgentDayDateStr(this.deps.config.timezone || undefined, this.deps.config.dayBoundaryHour, now);
|
|
299
|
+
const yesterdayDateStr = getAgentDayDateStr(this.deps.config.timezone || undefined, this.deps.config.dayBoundaryHour, yesterdayNow);
|
|
300
|
+
// Yesterday's agent-day UTC window — same shape `buildStageBInputs`
|
|
301
|
+
// derives for the skeleton facts. The appender uses it to aggregate
|
|
302
|
+
// the agent-action breakdown into the `agent/journal.md` footprint
|
|
303
|
+
// line. Recomputed here (rather than threaded from `buildStageBInputs`)
|
|
304
|
+
// because Stage B is dispatched async and the orchestrator does not
|
|
305
|
+
// retain its inputs between phases.
|
|
306
|
+
const bounds = getAgentDayBoundsUtc(this.deps.config.timezone || undefined, this.deps.config.dayBoundaryHour, yesterdayNow);
|
|
307
|
+
const agentDayWindow = { startUtc: bounds.start, endUtc: bounds.end };
|
|
308
|
+
return appendMorningRoutineJournalEntry({
|
|
309
|
+
db: this.deps.db,
|
|
310
|
+
contextDir,
|
|
311
|
+
...(this.deps.writeTracker
|
|
312
|
+
? { writeTracker: this.deps.writeTracker }
|
|
313
|
+
: {}),
|
|
314
|
+
}, {
|
|
315
|
+
correlationId: args.correlationId,
|
|
316
|
+
morningDateStr,
|
|
317
|
+
yesterdayDateStr,
|
|
318
|
+
agentDayWindow,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
// ── ⑥ pre-insert in_progress row for Stage A ────────────────────────
|
|
322
|
+
preInsertStageAInProgressRow(correlationId) {
|
|
323
|
+
if (this.deps.audit === undefined)
|
|
324
|
+
return;
|
|
325
|
+
this.deps.audit.insertInProgressRow({
|
|
326
|
+
correlationId,
|
|
327
|
+
actionType: STAGE_A_ACTION_TYPE,
|
|
328
|
+
// Morning routine fires from cron — never reactive.
|
|
329
|
+
trigger: "autonomous",
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
// ── ② HandoffParser plumbing ─────────────────────────────────────────
|
|
333
|
+
buildHandoffParsedBlock() {
|
|
334
|
+
const contextDir = getContextDir(this.deps.config, this.deps.db);
|
|
335
|
+
const yesterdayPath = join(contextDir, "yesterday.md");
|
|
336
|
+
if (!existsSync(yesterdayPath))
|
|
337
|
+
return null;
|
|
338
|
+
let body;
|
|
339
|
+
try {
|
|
340
|
+
body = readFileSync(yesterdayPath, "utf-8");
|
|
341
|
+
}
|
|
342
|
+
catch (err) {
|
|
343
|
+
logger.warn({ err, yesterdayPath }, "yesterday.md read failed — falling back to in-task handoff parse");
|
|
344
|
+
return null;
|
|
345
|
+
}
|
|
346
|
+
const parsed = parseHandoff(body);
|
|
347
|
+
if (parsed === null)
|
|
348
|
+
return null;
|
|
349
|
+
return renderHandoffParsedBlock(parsed);
|
|
350
|
+
}
|
|
351
|
+
// ── ③ JournalSkeletonBuilder plumbing ────────────────────────────────
|
|
352
|
+
buildStageBInputs() {
|
|
353
|
+
const contextDir = getContextDir(this.deps.config, this.deps.db);
|
|
354
|
+
// First-run skip: when yesterday.md is absent, there is no prior
|
|
355
|
+
// agent-day to author a journal about. Firing Stage B anyway would
|
|
356
|
+
// produce a phantom `daily/<yesterday>.md` with `calendar_events: 0`
|
|
357
|
+
// / `messages_handled: 0` / `## Tasks: (none)` for a date the user
|
|
358
|
+
// wasn't using the agent — and `daily/<date>.md` is user-facing in
|
|
359
|
+
// the vault, so the phantom entry is a real correctness issue, not
|
|
360
|
+
// just internal noise. Aligns with §5.9 Step 5's "Skipped when no
|
|
361
|
+
// yesterday.md (initial variant)" entry in the design's per-stage
|
|
362
|
+
// responsibility matrix. The downstream `agent-journal-appender`
|
|
363
|
+
// renders the daemon-emitted `Journal synthesis: skipped (no
|
|
364
|
+
// prior-day data)` line whenever `daily/<yesterday>.md` is absent on
|
|
365
|
+
// disk, so the audit-trail entry stays correct without Stage B.
|
|
366
|
+
const yesterdayPath = join(contextDir, "yesterday.md");
|
|
367
|
+
if (!existsSync(yesterdayPath))
|
|
368
|
+
return null;
|
|
369
|
+
// Yesterday's agent-day window = today's window shifted by -24h.
|
|
370
|
+
// `getAgentDayBoundsUtc(now=<24h ago>)` yields the correct
|
|
371
|
+
// `[start, end)` even across the 04:00 boundary / DST transitions
|
|
372
|
+
// because the helper recomputes the offset at the boundary instant.
|
|
373
|
+
const now = new Date();
|
|
374
|
+
const yesterdayNow = new Date(now.getTime() - 24 * 60 * 60 * 1000);
|
|
375
|
+
// `getAgentDayBoundsUtc` returns `{start, end}` shaped strings;
|
|
376
|
+
// `gatherJournalSkeletonFacts` consumes `{startUtc, endUtc}`. Adapt
|
|
377
|
+
// here at the call site so the helper's shared shape stays stable
|
|
378
|
+
// across other callers (`buildYesterdaySqliteContext` etc.).
|
|
379
|
+
const bounds = getAgentDayBoundsUtc(this.deps.config.timezone || undefined, this.deps.config.dayBoundaryHour, yesterdayNow);
|
|
380
|
+
const window = { startUtc: bounds.start, endUtc: bounds.end };
|
|
381
|
+
const dateStr = getAgentDayDateStr(this.deps.config.timezone || undefined, this.deps.config.dayBoundaryHour, yesterdayNow);
|
|
382
|
+
// Today's agent-day — lands in the skeleton's `updated:` frontmatter
|
|
383
|
+
// field. Computed from `now` (not `yesterdayNow`) so a 04:00 run on
|
|
384
|
+
// 2026-05-15 stamps `updated: 2026-05-15` while the journal's `date:`
|
|
385
|
+
// stays `2026-05-14`.
|
|
386
|
+
const updatedDateStr = getAgentDayDateStr(this.deps.config.timezone || undefined, this.deps.config.dayBoundaryHour, now);
|
|
387
|
+
const weekday = new Date(`${dateStr}T00:00:00Z`).toLocaleDateString("en-US", {
|
|
388
|
+
weekday: "long",
|
|
389
|
+
timeZone: "UTC",
|
|
390
|
+
});
|
|
391
|
+
const yesterdayMd = readFileSync(yesterdayPath, "utf-8");
|
|
392
|
+
const facts = gatherJournalSkeletonFacts(this.deps.db, window);
|
|
393
|
+
const calendarEvents = this.readYesterdayCalendarEvents(window);
|
|
394
|
+
const skeleton = buildJournalSkeleton({
|
|
395
|
+
dateStr,
|
|
396
|
+
weekday,
|
|
397
|
+
updatedDateStr,
|
|
398
|
+
yesterdayMd,
|
|
399
|
+
calendarEvents,
|
|
400
|
+
...(this.deps.config.timezone
|
|
401
|
+
? { timezone: this.deps.config.timezone }
|
|
402
|
+
: {}),
|
|
403
|
+
}, facts);
|
|
404
|
+
return {
|
|
405
|
+
block: `<journal_skeleton>\n${skeleton}\n</journal_skeleton>`,
|
|
406
|
+
yesterdayDateStr: dateStr,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
readYesterdayCalendarEvents(window) {
|
|
410
|
+
// Calendar events stored in `observations` or `calendar_events` are
|
|
411
|
+
// schema-fluid across direct / delegated / native modes. Phase 2's
|
|
412
|
+
// skeleton builder is contract-tested against this shape; for Phase
|
|
413
|
+
// 5 wiring we read the agent-day window from `observations` rows
|
|
414
|
+
// tagged with a calendar source_prefix. Missing rows yield an empty
|
|
415
|
+
// array — the skeleton renders `- (none)` in that case.
|
|
416
|
+
const rows = this.deps.db
|
|
417
|
+
.prepare(`SELECT payload AS payload
|
|
418
|
+
FROM observations
|
|
419
|
+
WHERE (source LIKE 'google_calendar:%'
|
|
420
|
+
OR source LIKE 'outlook_calendar:%')
|
|
421
|
+
AND observed_at >= ?
|
|
422
|
+
AND observed_at < ?
|
|
423
|
+
ORDER BY observed_at ASC`)
|
|
424
|
+
.all(window.startUtc, window.endUtc);
|
|
425
|
+
const out = [];
|
|
426
|
+
const timezone = this.deps.config.timezone || undefined;
|
|
427
|
+
for (const row of rows) {
|
|
428
|
+
const event = parseCalendarPayload(row.payload, timezone);
|
|
429
|
+
if (event !== null)
|
|
430
|
+
out.push(event);
|
|
431
|
+
}
|
|
432
|
+
return out;
|
|
433
|
+
}
|
|
434
|
+
// ── ⑤A Stage A dispatch ──────────────────────────────────────────────
|
|
435
|
+
composeStageAEvent(parent, correlationId, handoffParsedBlock, roadmapSkeletonBlock) {
|
|
436
|
+
const data = {
|
|
437
|
+
...parent.data,
|
|
438
|
+
morningPipelineStage: "today",
|
|
439
|
+
};
|
|
440
|
+
if (handoffParsedBlock !== null) {
|
|
441
|
+
data.handoffParsedBlock = handoffParsedBlock;
|
|
442
|
+
}
|
|
443
|
+
if (roadmapSkeletonBlock !== null) {
|
|
444
|
+
// Picked up by `ContextBuilder.build` on the `morning_routine`
|
|
445
|
+
// branch; injected as the `<roadmap_skeleton>` block alongside
|
|
446
|
+
// the truncated `<roadmap>` so Stage A can detect the placeholder
|
|
447
|
+
// wizard skeleton and fully populate roadmap.md from the
|
|
448
|
+
// daemon-prepared facts on the first-run day.
|
|
449
|
+
data.roadmapSkeletonBlock = roadmapSkeletonBlock;
|
|
450
|
+
}
|
|
451
|
+
return {
|
|
452
|
+
type: STAGE_A_PROCESS_KEY,
|
|
453
|
+
source: parent.source,
|
|
454
|
+
priority: parent.priority ?? EventPriority.HIGH,
|
|
455
|
+
timestamp: parent.timestamp,
|
|
456
|
+
correlationId,
|
|
457
|
+
data,
|
|
458
|
+
routine: STAGE_A_ROUTINE_SLUG,
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
// ── Phase 7 — Roadmap skeleton plumbing (first-run branch only) ──────
|
|
462
|
+
/**
|
|
463
|
+
* Compose the `<roadmap_skeleton>` block injected into Stage A's
|
|
464
|
+
* prompt on the **first-run** (no-yesterday) branch. Returns `null`
|
|
465
|
+
* on the recurring branch (yesterday.md present); the recurring
|
|
466
|
+
* branch reads the live truncated `<roadmap>` ContextBuilder
|
|
467
|
+
* already injects.
|
|
468
|
+
*
|
|
469
|
+
* Why gate on `yesterday.md`: the first-run signal lines up with
|
|
470
|
+
* the variant collapse documented in §5 ("variant collapse") — the
|
|
471
|
+
* setup wizard produces a placeholder roadmap.md and rotateDayFiles
|
|
472
|
+
* has not yet emitted yesterday.md. Both gates fire from the same
|
|
473
|
+
* fs predicate so Stage A's first-run branch never sees a mismatch.
|
|
474
|
+
*
|
|
475
|
+
* Errors are swallowed: a malformed projects file or a missing
|
|
476
|
+
* travel_bookings table degrades to "Stage A sees an empty
|
|
477
|
+
* section" rather than failing the whole stage. The variant
|
|
478
|
+
* collapse depends on Stage A still landing roadmap.md in this
|
|
479
|
+
* case (it can fall back to reading `<management_rules>` and
|
|
480
|
+
* `<active_projects>` inline); shipping a broken skeleton block
|
|
481
|
+
* would be worse than no skeleton block at all.
|
|
482
|
+
*/
|
|
483
|
+
buildRoadmapSkeletonBlock() {
|
|
484
|
+
const contextDir = getContextDir(this.deps.config, this.deps.db);
|
|
485
|
+
const yesterdayPath = join(contextDir, "yesterday.md");
|
|
486
|
+
if (existsSync(yesterdayPath))
|
|
487
|
+
return null; // recurring branch
|
|
488
|
+
try {
|
|
489
|
+
const now = new Date();
|
|
490
|
+
const todayDateStr = getAgentDayDateStr(this.deps.config.timezone || undefined, this.deps.config.dayBoundaryHour, now);
|
|
491
|
+
const calendarEvents = this.readForwardCalendarEvents(now);
|
|
492
|
+
const facts = gatherRoadmapSkeletonFacts(this.deps.db, contextDir, todayDateStr);
|
|
493
|
+
const skeleton = buildRoadmapSkeleton({
|
|
494
|
+
todayDateStr,
|
|
495
|
+
calendarEvents,
|
|
496
|
+
...(this.deps.config.timezone
|
|
497
|
+
? { timezone: this.deps.config.timezone }
|
|
498
|
+
: {}),
|
|
499
|
+
}, facts);
|
|
500
|
+
return `<roadmap_skeleton>\n${skeleton}\n</roadmap_skeleton>`;
|
|
501
|
+
}
|
|
502
|
+
catch (err) {
|
|
503
|
+
logger.warn({ err }, "Roadmap skeleton build threw — Stage A will run without <roadmap_skeleton>");
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Read forward-looking calendar events from the observations table
|
|
509
|
+
* for the next 7 days (matching the design's "Annual Goals from
|
|
510
|
+
* management rules, Quarterly Focus from active projects +
|
|
511
|
+
* calendar, Preparation Timeline from travel_bookings + calendar"
|
|
512
|
+
* window).
|
|
513
|
+
*
|
|
514
|
+
* Filtering note (pre-Phase-7-rev2 bug fix): the SQL filter does
|
|
515
|
+
* NOT use `observed_at` as a window bound. `observed_at` is the
|
|
516
|
+
* recording timestamp (CURRENT_TIMESTAMP at INSERT) — for a
|
|
517
|
+
* forward-looking window every relevant row was inserted BEFORE
|
|
518
|
+
* `now` (the just-completed pre-pass, an observer poll yesterday,
|
|
519
|
+
* etc.), so an `observed_at >= now` predicate would exclude every
|
|
520
|
+
* row. Instead we pull pending calendar observations and let JS
|
|
521
|
+
* filter on the parsed event start time extracted from
|
|
522
|
+
* `payload.raw.start`. The `consumed_at IS NULL` predicate scopes
|
|
523
|
+
* the read to rows the next Stage A turn has not yet consumed —
|
|
524
|
+
* exactly the set the pre-pass just landed for this morning's run.
|
|
525
|
+
* The `LIMIT 500` clamp guards against an unexpectedly large
|
|
526
|
+
* pending backlog blowing up Stage A's prompt budget; 500 is well
|
|
527
|
+
* above any realistic seven-day window the routine
|
|
528
|
+
* `cal_morning_7d` pre-pass would emit.
|
|
529
|
+
*
|
|
530
|
+
* Returns `[]` when no provider has pushed observations yet — the
|
|
531
|
+
* skeleton renders an explicit placeholder line.
|
|
532
|
+
*/
|
|
533
|
+
readForwardCalendarEvents(now) {
|
|
534
|
+
let rows;
|
|
535
|
+
try {
|
|
536
|
+
rows = this.deps.db
|
|
537
|
+
.prepare(`SELECT payload AS payload
|
|
538
|
+
FROM observations
|
|
539
|
+
WHERE (source LIKE 'google_calendar:%'
|
|
540
|
+
OR source LIKE 'outlook_calendar:%')
|
|
541
|
+
AND consumed_at IS NULL
|
|
542
|
+
ORDER BY observed_at DESC
|
|
543
|
+
LIMIT 500`)
|
|
544
|
+
.all();
|
|
545
|
+
}
|
|
546
|
+
catch {
|
|
547
|
+
return [];
|
|
548
|
+
}
|
|
549
|
+
const startMs = now.getTime();
|
|
550
|
+
const endMs = startMs + 7 * 24 * 60 * 60 * 1000;
|
|
551
|
+
const out = [];
|
|
552
|
+
for (const row of rows) {
|
|
553
|
+
const event = parseForwardCalendarPayload(row.payload, this.deps.config.timezone || undefined);
|
|
554
|
+
if (event === null)
|
|
555
|
+
continue;
|
|
556
|
+
if (event.startMs < startMs)
|
|
557
|
+
continue;
|
|
558
|
+
if (event.startMs >= endMs)
|
|
559
|
+
continue;
|
|
560
|
+
out.push({ date: event.date, title: event.title });
|
|
561
|
+
}
|
|
562
|
+
// Stable ascending order so the skeleton output is deterministic
|
|
563
|
+
// regardless of the SQL-side `ORDER BY observed_at DESC` (which is
|
|
564
|
+
// tuned for the LIMIT clamp, not the rendering order).
|
|
565
|
+
out.sort((a, b) => {
|
|
566
|
+
if (a.date !== b.date)
|
|
567
|
+
return a.date.localeCompare(b.date);
|
|
568
|
+
return a.title.localeCompare(b.title);
|
|
569
|
+
});
|
|
570
|
+
return out;
|
|
571
|
+
}
|
|
572
|
+
async runStageA(event, requestedTier) {
|
|
573
|
+
const context = await this.deps.contextBuilder.build(event);
|
|
574
|
+
const binding = this.deps.agentRouter.resolveBinding(event, {
|
|
575
|
+
processKey: STAGE_A_PROCESS_KEY,
|
|
576
|
+
...(requestedTier ? { requestedTier } : {}),
|
|
577
|
+
});
|
|
578
|
+
const reassemblePrompt = (bid) => this.deps.prompt.assemble(event.type, STAGE_A_PROCESS_KEY, bid);
|
|
579
|
+
const prompt = reassemblePrompt(binding.main.backendId);
|
|
580
|
+
return this.deps.errorRouter.executeWithRetry(() => this.deps.agentRouter.execute({
|
|
581
|
+
prompt,
|
|
582
|
+
context,
|
|
583
|
+
event,
|
|
584
|
+
processKey: STAGE_A_PROCESS_KEY,
|
|
585
|
+
preResolvedBinding: binding,
|
|
586
|
+
reassemblePrompt,
|
|
587
|
+
...(requestedTier ? { requestedTier } : {}),
|
|
588
|
+
}), event);
|
|
589
|
+
}
|
|
590
|
+
// ── ⑤B Stage B dispatch ──────────────────────────────────────────────
|
|
591
|
+
composeStageBEvent(parent, correlationId, journalSkeletonBlock) {
|
|
592
|
+
// Stage B does NOT inherit the parent's `todayWriteLockId` or
|
|
593
|
+
// `fetchReportBlock`. The lock gates today.md only (Stage B never
|
|
594
|
+
// touches it); the fetch report describes data Stage A consumes
|
|
595
|
+
// (pending observations from mail / notion / calendar pre-pass)
|
|
596
|
+
// that Stage B has no skill bundle to read. Stripping them keeps
|
|
597
|
+
// Stage B's prompt minimal so the lite-tier cold-start floor holds.
|
|
598
|
+
const stripped = {};
|
|
599
|
+
for (const [key, value] of Object.entries(parent.data ?? {})) {
|
|
600
|
+
if (key === "todayWriteLockId")
|
|
601
|
+
continue;
|
|
602
|
+
if (key === "fetchReportBlock")
|
|
603
|
+
continue;
|
|
604
|
+
if (key === "acquisitionPlanBlock")
|
|
605
|
+
continue;
|
|
606
|
+
stripped[key] = value;
|
|
607
|
+
}
|
|
608
|
+
stripped.morningPipelineStage = "journal";
|
|
609
|
+
stripped.journalSkeletonBlock = journalSkeletonBlock;
|
|
610
|
+
return {
|
|
611
|
+
type: STAGE_B_PROCESS_KEY,
|
|
612
|
+
source: parent.source,
|
|
613
|
+
priority: parent.priority ?? EventPriority.HIGH,
|
|
614
|
+
timestamp: parent.timestamp,
|
|
615
|
+
correlationId,
|
|
616
|
+
data: stripped,
|
|
617
|
+
routine: STAGE_B_ROUTINE_SLUG,
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
async runStageB(event) {
|
|
621
|
+
const context = await this.deps.contextBuilder.build(event);
|
|
622
|
+
const binding = this.deps.agentRouter.resolveBinding(event, {
|
|
623
|
+
processKey: STAGE_B_PROCESS_KEY,
|
|
624
|
+
});
|
|
625
|
+
const reassemblePrompt = (bid) => this.deps.prompt.assemble(event.type, STAGE_B_PROCESS_KEY, bid);
|
|
626
|
+
const prompt = reassemblePrompt(binding.main.backendId);
|
|
627
|
+
return this.deps.errorRouter.executeWithRetry(() => this.deps.agentRouter.execute({
|
|
628
|
+
prompt,
|
|
629
|
+
context,
|
|
630
|
+
event,
|
|
631
|
+
processKey: STAGE_B_PROCESS_KEY,
|
|
632
|
+
preResolvedBinding: binding,
|
|
633
|
+
reassemblePrompt,
|
|
634
|
+
}), event);
|
|
635
|
+
}
|
|
636
|
+
// ── ⑥b helpers — read DB-side stage summaries for parent-audit ──────
|
|
637
|
+
readStageSummaries(correlationId) {
|
|
638
|
+
// We use the auditor's authoritative agent_actions rows (cost / turns /
|
|
639
|
+
// result) rather than the in-memory `AgentResult` so retry attempts
|
|
640
|
+
// and partial-failure paths report the same shape regardless of which
|
|
641
|
+
// branch produced them.
|
|
642
|
+
const rows = this.deps.db
|
|
643
|
+
.prepare(`SELECT action_type AS actionType,
|
|
644
|
+
cost_usd AS cost_usd,
|
|
645
|
+
num_turns AS num_turns,
|
|
646
|
+
result AS result
|
|
647
|
+
FROM agent_actions
|
|
648
|
+
WHERE event_id = ?
|
|
649
|
+
AND action_type IN (?, ?)
|
|
650
|
+
ORDER BY id ASC`)
|
|
651
|
+
.all(correlationId, STAGE_A_ACTION_TYPE, STAGE_B_ACTION_TYPE);
|
|
652
|
+
let stageA = null;
|
|
653
|
+
let stageB = null;
|
|
654
|
+
for (const row of rows) {
|
|
655
|
+
// Latest row wins on retry — agent_actions inserts append a fresh
|
|
656
|
+
// row per attempt; the most-recent row is the one the gate should
|
|
657
|
+
// attribute. `loadMorningRoutineActionRows` follows the same rule.
|
|
658
|
+
const summary = {
|
|
659
|
+
cost_usd: row.cost_usd,
|
|
660
|
+
num_turns: row.num_turns,
|
|
661
|
+
result: row.result,
|
|
662
|
+
};
|
|
663
|
+
if (row.actionType === STAGE_A_ACTION_TYPE)
|
|
664
|
+
stageA = summary;
|
|
665
|
+
else if (row.actionType === STAGE_B_ACTION_TYPE)
|
|
666
|
+
stageB = summary;
|
|
667
|
+
}
|
|
668
|
+
return { stageA, stageB };
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
// ── module-level helpers ────────────────────────────────────────────────
|
|
672
|
+
function renderHandoffParsedBlock(parsed) {
|
|
673
|
+
// XML over JSON: the rest of the daemon's prompt-injection payloads
|
|
674
|
+
// (`<fetch_report>`, `<acquisition-plan>`, `<integration_modes>`) use
|
|
675
|
+
// XML-style tags; keep the same shape so Stage A's task-flow can read
|
|
676
|
+
// them with one consistent extractor.
|
|
677
|
+
const lines = ["<handoff_parsed>"];
|
|
678
|
+
lines.push(" <tomorrow>");
|
|
679
|
+
if (parsed.tomorrow.length === 0) {
|
|
680
|
+
lines.push(" <item>(none)</item>");
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
for (const item of parsed.tomorrow) {
|
|
684
|
+
lines.push(` <item>${escapeXml(item)}</item>`);
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
lines.push(" </tomorrow>");
|
|
688
|
+
lines.push(" <later>");
|
|
689
|
+
if (parsed.later.length === 0) {
|
|
690
|
+
lines.push(" <item>(none)</item>");
|
|
691
|
+
}
|
|
692
|
+
else {
|
|
693
|
+
for (const item of parsed.later) {
|
|
694
|
+
lines.push(` <item>${escapeXml(item)}</item>`);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
lines.push(" </later>");
|
|
698
|
+
lines.push("</handoff_parsed>");
|
|
699
|
+
return lines.join("\n");
|
|
700
|
+
}
|
|
701
|
+
function escapeXml(value) {
|
|
702
|
+
return value
|
|
703
|
+
.replace(/&/g, "&")
|
|
704
|
+
.replace(/</g, "<")
|
|
705
|
+
.replace(/>/g, ">");
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Walk a calendar observation payload and lift the load-bearing fields
|
|
709
|
+
* (`start`, `title`, `allDay`) into a uniform struct. Canonical
|
|
710
|
+
* `raw.*` keys win over legacy top-level keys; whichever provides the
|
|
711
|
+
* value first is taken so a writer that emits both does not produce
|
|
712
|
+
* inconsistent reads.
|
|
713
|
+
*/
|
|
714
|
+
function extractCalendarPayloadParts(parsed) {
|
|
715
|
+
const title = pickString(parsed.raw?.title)
|
|
716
|
+
?? pickString(parsed.raw?.summary)
|
|
717
|
+
?? pickString(parsed.title)
|
|
718
|
+
?? pickString(parsed.summary)
|
|
719
|
+
?? "";
|
|
720
|
+
const isAllDay = parsed.raw?.allDay === true
|
|
721
|
+
|| parsed.raw?.all_day === true
|
|
722
|
+
|| parsed.allDay === true
|
|
723
|
+
|| parsed.all_day === true;
|
|
724
|
+
const startRaw = pickString(parsed.raw?.start)
|
|
725
|
+
?? pickString(parsed.startTime)
|
|
726
|
+
?? pickString(parsed.start_time)
|
|
727
|
+
?? pickString(parsed.start);
|
|
728
|
+
if (startRaw === null)
|
|
729
|
+
return { startMs: null, title, isAllDay };
|
|
730
|
+
const ms = Date.parse(startRaw);
|
|
731
|
+
if (!Number.isFinite(ms))
|
|
732
|
+
return { startMs: null, title, isAllDay };
|
|
733
|
+
return { startMs: ms, title, isAllDay };
|
|
734
|
+
}
|
|
735
|
+
function safeParseCalendarShape(raw) {
|
|
736
|
+
if (raw === null)
|
|
737
|
+
return null;
|
|
738
|
+
try {
|
|
739
|
+
return JSON.parse(raw);
|
|
740
|
+
}
|
|
741
|
+
catch {
|
|
742
|
+
return null;
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Phase 7 — extract `{date, title}` from a calendar observation payload
|
|
747
|
+
* for the roadmap skeleton. Differs from `parseCalendarPayload` (which
|
|
748
|
+
* emits `{time HH:MM, title}` for the daily journal skeleton): the
|
|
749
|
+
* roadmap skeleton renders calendar events as date bullets, not time
|
|
750
|
+
* bullets, because the look-ahead window is 7 days forward and per-
|
|
751
|
+
* minute granularity is irrelevant for Quarterly Focus / Preparation
|
|
752
|
+
* Timeline hints.
|
|
753
|
+
*
|
|
754
|
+
* Returns `null` when the payload has no parseable start time. Title-
|
|
755
|
+
* only payloads are intentionally dropped — a calendar bullet without a
|
|
756
|
+
* date is noise for a forward-window skeleton.
|
|
757
|
+
*/
|
|
758
|
+
function parseForwardCalendarPayload(raw, timezone) {
|
|
759
|
+
const parsed = safeParseCalendarShape(raw);
|
|
760
|
+
if (parsed === null)
|
|
761
|
+
return null;
|
|
762
|
+
const parts = extractCalendarPayloadParts(parsed);
|
|
763
|
+
if (parts.startMs === null)
|
|
764
|
+
return null;
|
|
765
|
+
// Render the date in the operator's timezone so the skeleton's bullet
|
|
766
|
+
// dates line up with `<calendar_events_7d>` (which renders in the same
|
|
767
|
+
// tz). All-day events stored with a trailing 00:00 UTC suffix could
|
|
768
|
+
// otherwise drift by one day for east-of-UTC operators.
|
|
769
|
+
const formatter = new Intl.DateTimeFormat("en-CA", {
|
|
770
|
+
timeZone: timezone ?? "UTC",
|
|
771
|
+
year: "numeric",
|
|
772
|
+
month: "2-digit",
|
|
773
|
+
day: "2-digit",
|
|
774
|
+
});
|
|
775
|
+
const date = formatter.format(new Date(parts.startMs));
|
|
776
|
+
return { date, title: parts.title, startMs: parts.startMs };
|
|
777
|
+
}
|
|
778
|
+
function parseCalendarPayload(raw, timezone) {
|
|
779
|
+
const parsed = safeParseCalendarShape(raw);
|
|
780
|
+
if (parsed === null)
|
|
781
|
+
return null;
|
|
782
|
+
const parts = extractCalendarPayloadParts(parsed);
|
|
783
|
+
if (parts.isAllDay) {
|
|
784
|
+
return { time: null, title: parts.title };
|
|
785
|
+
}
|
|
786
|
+
if (parts.startMs === null) {
|
|
787
|
+
return { time: null, title: parts.title };
|
|
788
|
+
}
|
|
789
|
+
// Render `HH:MM` in the operator's local timezone — matches
|
|
790
|
+
// `SkeletonCalendarEvent.time`'s "HH:MM local start time" contract,
|
|
791
|
+
// the DM-section bullet's tz-aware rendering inside the skeleton
|
|
792
|
+
// builder, and ContextBuilder's `<calendar_events_7d>` block. The
|
|
793
|
+
// pre-fix UTC slice (`getUTCHours`/`Minutes`) would render a 10:00
|
|
794
|
+
// local standup for a UTC-7 operator as `17:00` in the `## Schedule`
|
|
795
|
+
// scratch input that Stage B then uses to author the daily journal.
|
|
796
|
+
if (typeof timezone === "string" && timezone.length > 0) {
|
|
797
|
+
try {
|
|
798
|
+
const fmt = new Intl.DateTimeFormat("en-GB", {
|
|
799
|
+
hour: "2-digit",
|
|
800
|
+
minute: "2-digit",
|
|
801
|
+
hourCycle: "h23",
|
|
802
|
+
timeZone: timezone,
|
|
803
|
+
});
|
|
804
|
+
return { time: fmt.format(new Date(parts.startMs)), title: parts.title };
|
|
805
|
+
}
|
|
806
|
+
catch {
|
|
807
|
+
// Fall through to UTC slice on a bad TZ name (Intl throws
|
|
808
|
+
// RangeError). Still better than throwing past the pure helper.
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
const date = new Date(parts.startMs);
|
|
812
|
+
const hh = String(date.getUTCHours()).padStart(2, "0");
|
|
813
|
+
const mm = String(date.getUTCMinutes()).padStart(2, "0");
|
|
814
|
+
return { time: `${hh}:${mm}`, title: parts.title };
|
|
815
|
+
}
|
|
816
|
+
function pickString(value) {
|
|
817
|
+
if (typeof value !== "string")
|
|
818
|
+
return null;
|
|
819
|
+
if (value.length === 0)
|
|
820
|
+
return null;
|
|
821
|
+
return value;
|
|
822
|
+
}
|
|
823
|
+
// Re-export the action-type constants so dispatcher / runner can
|
|
824
|
+
// continue to import them from one path even after Phase 6 moves
|
|
825
|
+
// more responsibilities into the orchestrator.
|
|
826
|
+
export { STAGE_A_PROCESS_KEY, STAGE_B_PROCESS_KEY, STAGE_A_ROUTINE_SLUG, STAGE_B_ROUTINE_SLUG, };
|
|
827
|
+
//# sourceMappingURL=orchestrator.js.map
|