@aitne/daemon 0.1.7 → 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 -1480
- 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/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,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `appendMorningRoutineJournalEntry` — assemble the one-block English
|
|
3
|
+
* audit-trail entry for `agent/journal.md` from **structured sources
|
|
4
|
+
* only** (agent_actions rows + daily/<yesterday>.md frontmatter
|
|
5
|
+
* deterministic fs read) and append it to the journal file.
|
|
6
|
+
*
|
|
7
|
+
* Spec: `docs/design/appendices/morning-routine-optimization.md`
|
|
8
|
+
* §"Daemon-side modules to add" → agent-journal-appender (⑥). Phase 2
|
|
9
|
+
* ships this module unwired; the orchestrator wires it after both
|
|
10
|
+
* stages finish and before the parent audit row is emitted.
|
|
11
|
+
*
|
|
12
|
+
* Output shape (matches today's Step 9 byte-for-byte so `pnpm audit`
|
|
13
|
+
* keeps parsing it):
|
|
14
|
+
*
|
|
15
|
+
* ## 2026-05-15 morning routine
|
|
16
|
+
* - Day-type: weekday
|
|
17
|
+
* - Journal: daily/2026-05-14.md (42 lines, 3 projects referenced)
|
|
18
|
+
* - Inbox: 4 files triaged, 4 moved to scratch, 1 DM-confirmations sent
|
|
19
|
+
* - Checks from routines/morning.md: (none)
|
|
20
|
+
* - Anomalies / skipped steps: (none)
|
|
21
|
+
*
|
|
22
|
+
* Initial-flow / Stage-B-failed branches surface the rev1 variant:
|
|
23
|
+
*
|
|
24
|
+
* - Journal synthesis: skipped (no prior-day data)
|
|
25
|
+
*
|
|
26
|
+
* No LLM final-text parsing anywhere — every field is sourced from a
|
|
27
|
+
* structured channel: `agent_actions.metadata` (written by Stage A via
|
|
28
|
+
* `PATCH /api/agent-actions/self`), `agent_actions.result` (terminal
|
|
29
|
+
* state for each stage), and `daily/<date>.md` frontmatter (fs read).
|
|
30
|
+
*/
|
|
31
|
+
import type Database from "better-sqlite3";
|
|
32
|
+
import type { AgentWriteTracker } from "../../safety/agent-write-tracker.js";
|
|
33
|
+
import { type AgentDayWindowUtc } from "./journal-skeleton-builder.js";
|
|
34
|
+
/** Action types Stage A and Stage B insert into `agent_actions`. */
|
|
35
|
+
export declare const STAGE_A_ACTION_TYPE = "routine.morning_routine_today";
|
|
36
|
+
export declare const STAGE_B_ACTION_TYPE = "routine.morning_routine_journal";
|
|
37
|
+
/** Stage row shape used by the composer. Subset of `agent_actions`. */
|
|
38
|
+
export interface StageActionRow {
|
|
39
|
+
result: "success" | "failed" | "partial" | "skipped" | "in_progress";
|
|
40
|
+
/** Parsed JSON. `{}` when the column was NULL or non-object. */
|
|
41
|
+
metadata: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export interface AgentJournalAppenderDeps {
|
|
44
|
+
db: Database.Database;
|
|
45
|
+
contextDir: string;
|
|
46
|
+
writeTracker?: Pick<AgentWriteTracker, "markWriting" | "unmark">;
|
|
47
|
+
onIndexableContextChange?: (relativePath: string) => void;
|
|
48
|
+
}
|
|
49
|
+
export interface AgentJournalAppenderArgs {
|
|
50
|
+
/** Routine's correlation id — used as `event_id` to find both stage rows. */
|
|
51
|
+
correlationId: string;
|
|
52
|
+
/** Today's agent-day, used in the `## YYYY-MM-DD morning routine` H2. */
|
|
53
|
+
morningDateStr: string;
|
|
54
|
+
/** Yesterday's agent-day, used as the `daily/<yesterday>.md` filename. */
|
|
55
|
+
yesterdayDateStr: string;
|
|
56
|
+
/**
|
|
57
|
+
* Yesterday's agent-day UTC window. Used to aggregate the agent-action
|
|
58
|
+
* breakdown into the `- Actions: ...` footprint line. The agent-action
|
|
59
|
+
* summary used to live in the user-facing `daily/<date>.md` `## Actions`
|
|
60
|
+
* section, but was moved here as part of the user-diary refocus: the
|
|
61
|
+
* user-side journal no longer carries agent telemetry, while the
|
|
62
|
+
* agent-side footprint (`agent/journal.md`) gains a single inline
|
|
63
|
+
* summary line so the breakdown remains discoverable to operators
|
|
64
|
+
* running `pnpm audit`. The orchestrator owns the timezone /
|
|
65
|
+
* dayBoundaryHour math; passing the window in keeps this module pure
|
|
66
|
+
* of config plumbing.
|
|
67
|
+
*
|
|
68
|
+
* **Required.** A silent omission would render the Actions line as
|
|
69
|
+
* `(none)` — indistinguishable from a legitimate zero-action day —
|
|
70
|
+
* masking a wiring bug for an entire 24h cycle until the next
|
|
71
|
+
* morning routine. Making the field required closes that hole at
|
|
72
|
+
* compile time. Tests that don't care about the Actions line can
|
|
73
|
+
* pass `EMPTY_AGENT_DAY_WINDOW_FOR_TESTS` and the aggregation will
|
|
74
|
+
* deterministically return zero rows.
|
|
75
|
+
*/
|
|
76
|
+
agentDayWindow: AgentDayWindowUtc;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A degenerate UTC window for tests that exercise non-Actions-line
|
|
80
|
+
* branches of the appender. Aggregating `agent_actions` rows over a
|
|
81
|
+
* zero-width window deterministically returns zero rows, so the
|
|
82
|
+
* `- Actions: (none)` rendering is identical to the "no actions
|
|
83
|
+
* yesterday" production case.
|
|
84
|
+
*
|
|
85
|
+
* Exported instead of inlined in each test so a future change to the
|
|
86
|
+
* window shape (e.g. ISO string vs SQLite datetime) updates one
|
|
87
|
+
* constant rather than ~10 test fixtures.
|
|
88
|
+
*/
|
|
89
|
+
export declare const EMPTY_AGENT_DAY_WINDOW_FOR_TESTS: AgentDayWindowUtc;
|
|
90
|
+
export type AgentJournalAppenderResult = {
|
|
91
|
+
ok: true;
|
|
92
|
+
entryText: string;
|
|
93
|
+
} | {
|
|
94
|
+
ok: false;
|
|
95
|
+
reason: "stage_a_row_missing";
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Load Stage A + Stage B `agent_actions` rows by `event_id`. Returns
|
|
99
|
+
* `null` for either side that has no row yet — the composer surfaces
|
|
100
|
+
* that as "skipped" / `(none)` lines rather than throwing.
|
|
101
|
+
*
|
|
102
|
+
* Exported for testing so seeded-DB fixtures can verify the row binding
|
|
103
|
+
* without exercising the fs side of the appender.
|
|
104
|
+
*/
|
|
105
|
+
export declare function loadMorningRoutineActionRows(db: Database.Database, correlationId: string): {
|
|
106
|
+
stageA: StageActionRow | null;
|
|
107
|
+
stageB: StageActionRow | null;
|
|
108
|
+
};
|
|
109
|
+
/** Action-breakdown facts used to render the `- Actions: ...` footprint line. */
|
|
110
|
+
export interface ActionsSummaryInput {
|
|
111
|
+
/** Total `agent_actions` rows in yesterday's agent-day window. */
|
|
112
|
+
totalActions: number;
|
|
113
|
+
/**
|
|
114
|
+
* `agent_actions` rows grouped by `action_type`, ordered by count
|
|
115
|
+
* desc then action_type asc. The composer caps the inline rendering
|
|
116
|
+
* at `ACTIONS_TOP_N` types so the line stays single-line readable
|
|
117
|
+
* even for a busy day.
|
|
118
|
+
*/
|
|
119
|
+
actionsByType: ReadonlyArray<{
|
|
120
|
+
actionType: string;
|
|
121
|
+
count: number;
|
|
122
|
+
}>;
|
|
123
|
+
}
|
|
124
|
+
/** Inputs the pure composer needs. Mirrors what `appendMorningRoutineJournalEntry` collects. */
|
|
125
|
+
export interface JournalEntryComposeInputs {
|
|
126
|
+
morningDateStr: string;
|
|
127
|
+
yesterdayDateStr: string;
|
|
128
|
+
stageA: StageActionRow;
|
|
129
|
+
stageB: StageActionRow | null;
|
|
130
|
+
/** `null` when `daily/<yesterdayDateStr>.md` does not exist on disk. */
|
|
131
|
+
dailyJournalContent: string | null;
|
|
132
|
+
/**
|
|
133
|
+
* Yesterday's agent-action breakdown for the `- Actions: ...`
|
|
134
|
+
* footprint line. Sourced from `gatherJournalSkeletonFacts` against
|
|
135
|
+
* the agent-day window. Optional so unit tests focusing on the
|
|
136
|
+
* other composer fields don't have to thread the summary through;
|
|
137
|
+
* an absent value renders as `(none)` (semantically correct — no
|
|
138
|
+
* breakdown supplied means no actions to report). The end-to-end
|
|
139
|
+
* `appendMorningRoutineJournalEntry` always populates it from the
|
|
140
|
+
* SQLite aggregation.
|
|
141
|
+
*/
|
|
142
|
+
actionsSummary?: ActionsSummaryInput;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Pure composer — every output byte is a deterministic function of the
|
|
146
|
+
* inputs. Exposed for unit tests so the prose can be pinned without
|
|
147
|
+
* the fs / DB harness.
|
|
148
|
+
*/
|
|
149
|
+
export declare function composeMorningRoutineJournalEntry(inputs: JournalEntryComposeInputs): string;
|
|
150
|
+
/**
|
|
151
|
+
* Append the composed entry to `agent/journal.md`. Mirrors the write
|
|
152
|
+
* chokepoint that `PATCH /api/context/agent/journal?mode=append_to_file`
|
|
153
|
+
* exposes to the agent: snapshot the existing file into
|
|
154
|
+
* `md_file_snapshots`, write the new content atomically, then notify
|
|
155
|
+
* the write tracker + indexer so observers don't tag the write as a
|
|
156
|
+
* user-actor change.
|
|
157
|
+
*/
|
|
158
|
+
export declare function appendMorningRoutineJournalEntry(deps: AgentJournalAppenderDeps, args: AgentJournalAppenderArgs): AgentJournalAppenderResult;
|
|
159
|
+
/**
|
|
160
|
+
* Append a new top-level block (delimited by H2 heading) to the
|
|
161
|
+
* journal. When the file does not yet exist, seed it with the
|
|
162
|
+
* `# Agent journal` H1 + the entry. Otherwise trim trailing whitespace
|
|
163
|
+
* and join with a blank line.
|
|
164
|
+
*
|
|
165
|
+
* Retry idempotency: if `original` already contains a block whose H2
|
|
166
|
+
* heading matches `block`'s first line verbatim (i.e. the morning
|
|
167
|
+
* routine for this date emitted earlier in this run / a prior retry
|
|
168
|
+
* attempt), the existing block is replaced from its H2 to the start of
|
|
169
|
+
* the next H2 (or EOF) rather than producing a duplicate. This matches
|
|
170
|
+
* the dispatcher's retry chain semantics where Stage A re-fires on
|
|
171
|
+
* today.md health failure and the orchestrator re-invokes ⑥ — without
|
|
172
|
+
* this guard `pnpm audit` would see two entries for the same date.
|
|
173
|
+
* The replacement uses the LAST matching H2 occurrence so a legacy
|
|
174
|
+
* entry for the same date in deep history is preserved (defence-in-
|
|
175
|
+
* depth — re-running multiple weeks later still replaces only the
|
|
176
|
+
* most-recent attempt).
|
|
177
|
+
*
|
|
178
|
+
* Exposed for testing so the fresh-file / existing-file / retry
|
|
179
|
+
* branches can be pinned without the full appendMorningRoutineJournalEntry
|
|
180
|
+
* harness.
|
|
181
|
+
*/
|
|
182
|
+
export declare function appendBlockToJournal(original: string | null, block: string): string;
|
|
183
|
+
export interface DailyJournalStats {
|
|
184
|
+
bodyLineCount: number;
|
|
185
|
+
projectsCount: number;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Pull body-line count + projects-array length from a `daily/<date>.md`
|
|
189
|
+
* body. Tolerant of both flow-style (`projects: [a, b, c]`) and list
|
|
190
|
+
* form (`projects:\n - a\n - b`); placeholder `projects: []` and
|
|
191
|
+
* absent field both count as zero. Body excludes the YAML frontmatter
|
|
192
|
+
* block.
|
|
193
|
+
*
|
|
194
|
+
* Exposed for testing so the parsing branches stay pinnable.
|
|
195
|
+
*/
|
|
196
|
+
export declare function inspectDailyJournal(content: string): DailyJournalStats;
|
|
197
|
+
//# sourceMappingURL=agent-journal-appender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-journal-appender.d.ts","sourceRoot":"","sources":["../../../src/core/morning/agent-journal-appender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,+BAA+B,CAAC;AAOvC,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AACnE,eAAO,MAAM,mBAAmB,oCAAoC,CAAC;AAErE,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAC;IACrE,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,QAAQ,CAAC,QAAQ,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,QAAQ,CAAC,CAAC;IACjE,wBAAwB,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3D;AAED,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,aAAa,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,cAAc,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,cAAc,EAAE,iBAAiB,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gCAAgC,EAAE,iBAG9C,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAClC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,CAAC;AAEjD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,aAAa,EAAE,MAAM,GACpB;IAAE,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,cAAc,GAAG,IAAI,CAAA;CAAE,CAkClE;AAED,iFAAiF;AACjF,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,aAAa,EAAE,aAAa,CAAC;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrE;AAED,gGAAgG;AAChG,MAAM,WAAW,yBAAyB;IACxC,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,cAAc,GAAG,IAAI,CAAC;IAC9B,wEAAwE;IACxE,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,mBAAmB,CAAC;CACtC;AAOD;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,yBAAyB,GAChC,MAAM,CAuBR;AAyBD;;;;;;;GAOG;AACH,wBAAgB,gCAAgC,CAC9C,IAAI,EAAE,wBAAwB,EAC9B,IAAI,EAAE,wBAAwB,GAC7B,0BAA0B,CAgD5B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,GAAG,IAAI,EACvB,KAAK,EAAE,MAAM,GACZ,MAAM,CAWR;AA6ID,MAAM,WAAW,iBAAiB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAKtE"}
|
|
@@ -0,0 +1,458 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `appendMorningRoutineJournalEntry` — assemble the one-block English
|
|
3
|
+
* audit-trail entry for `agent/journal.md` from **structured sources
|
|
4
|
+
* only** (agent_actions rows + daily/<yesterday>.md frontmatter
|
|
5
|
+
* deterministic fs read) and append it to the journal file.
|
|
6
|
+
*
|
|
7
|
+
* Spec: `docs/design/appendices/morning-routine-optimization.md`
|
|
8
|
+
* §"Daemon-side modules to add" → agent-journal-appender (⑥). Phase 2
|
|
9
|
+
* ships this module unwired; the orchestrator wires it after both
|
|
10
|
+
* stages finish and before the parent audit row is emitted.
|
|
11
|
+
*
|
|
12
|
+
* Output shape (matches today's Step 9 byte-for-byte so `pnpm audit`
|
|
13
|
+
* keeps parsing it):
|
|
14
|
+
*
|
|
15
|
+
* ## 2026-05-15 morning routine
|
|
16
|
+
* - Day-type: weekday
|
|
17
|
+
* - Journal: daily/2026-05-14.md (42 lines, 3 projects referenced)
|
|
18
|
+
* - Inbox: 4 files triaged, 4 moved to scratch, 1 DM-confirmations sent
|
|
19
|
+
* - Checks from routines/morning.md: (none)
|
|
20
|
+
* - Anomalies / skipped steps: (none)
|
|
21
|
+
*
|
|
22
|
+
* Initial-flow / Stage-B-failed branches surface the rev1 variant:
|
|
23
|
+
*
|
|
24
|
+
* - Journal synthesis: skipped (no prior-day data)
|
|
25
|
+
*
|
|
26
|
+
* No LLM final-text parsing anywhere — every field is sourced from a
|
|
27
|
+
* structured channel: `agent_actions.metadata` (written by Stage A via
|
|
28
|
+
* `PATCH /api/agent-actions/self`), `agent_actions.result` (terminal
|
|
29
|
+
* state for each stage), and `daily/<date>.md` frontmatter (fs read).
|
|
30
|
+
*/
|
|
31
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
32
|
+
import { join } from "node:path";
|
|
33
|
+
import { writeFileAtomically } from "../atomic-write.js";
|
|
34
|
+
import { CONTEXT_RELATIVE_PATHS, dailyJournalPath } from "../context-paths.js";
|
|
35
|
+
import { createLogger } from "../../logging.js";
|
|
36
|
+
import { gatherJournalSkeletonFacts, } from "./journal-skeleton-builder.js";
|
|
37
|
+
/** Cap on action_type breakdown bullets in the inline summary line. */
|
|
38
|
+
const ACTIONS_TOP_N = 5;
|
|
39
|
+
const logger = createLogger("morning-journal-appender");
|
|
40
|
+
/** Action types Stage A and Stage B insert into `agent_actions`. */
|
|
41
|
+
export const STAGE_A_ACTION_TYPE = "routine.morning_routine_today";
|
|
42
|
+
export const STAGE_B_ACTION_TYPE = "routine.morning_routine_journal";
|
|
43
|
+
/**
|
|
44
|
+
* A degenerate UTC window for tests that exercise non-Actions-line
|
|
45
|
+
* branches of the appender. Aggregating `agent_actions` rows over a
|
|
46
|
+
* zero-width window deterministically returns zero rows, so the
|
|
47
|
+
* `- Actions: (none)` rendering is identical to the "no actions
|
|
48
|
+
* yesterday" production case.
|
|
49
|
+
*
|
|
50
|
+
* Exported instead of inlined in each test so a future change to the
|
|
51
|
+
* window shape (e.g. ISO string vs SQLite datetime) updates one
|
|
52
|
+
* constant rather than ~10 test fixtures.
|
|
53
|
+
*/
|
|
54
|
+
export const EMPTY_AGENT_DAY_WINDOW_FOR_TESTS = {
|
|
55
|
+
startUtc: "2000-01-01 00:00:00",
|
|
56
|
+
endUtc: "2000-01-01 00:00:00",
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Load Stage A + Stage B `agent_actions` rows by `event_id`. Returns
|
|
60
|
+
* `null` for either side that has no row yet — the composer surfaces
|
|
61
|
+
* that as "skipped" / `(none)` lines rather than throwing.
|
|
62
|
+
*
|
|
63
|
+
* Exported for testing so seeded-DB fixtures can verify the row binding
|
|
64
|
+
* without exercising the fs side of the appender.
|
|
65
|
+
*/
|
|
66
|
+
export function loadMorningRoutineActionRows(db, correlationId) {
|
|
67
|
+
const rows = db
|
|
68
|
+
.prepare(`SELECT action_type AS actionType,
|
|
69
|
+
result AS result,
|
|
70
|
+
metadata AS metadata
|
|
71
|
+
FROM agent_actions
|
|
72
|
+
WHERE event_id = ?
|
|
73
|
+
AND action_type IN (?, ?)
|
|
74
|
+
ORDER BY id ASC`)
|
|
75
|
+
.all(correlationId, STAGE_A_ACTION_TYPE, STAGE_B_ACTION_TYPE);
|
|
76
|
+
let stageA = null;
|
|
77
|
+
let stageB = null;
|
|
78
|
+
for (const row of rows) {
|
|
79
|
+
const parsed = {
|
|
80
|
+
result: row.result,
|
|
81
|
+
metadata: parseJsonObject(row.metadata),
|
|
82
|
+
};
|
|
83
|
+
if (row.actionType === STAGE_A_ACTION_TYPE) {
|
|
84
|
+
// Most recent insert wins on a retry — `ORDER BY id ASC` + naive
|
|
85
|
+
// overwrite gives the latest row's metadata, which is what the
|
|
86
|
+
// retry chain produces (each attempt INSERTs a fresh row).
|
|
87
|
+
stageA = parsed;
|
|
88
|
+
}
|
|
89
|
+
else if (row.actionType === STAGE_B_ACTION_TYPE) {
|
|
90
|
+
stageB = parsed;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return { stageA, stageB };
|
|
94
|
+
}
|
|
95
|
+
const EMPTY_ACTIONS_SUMMARY = {
|
|
96
|
+
totalActions: 0,
|
|
97
|
+
actionsByType: [],
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Pure composer — every output byte is a deterministic function of the
|
|
101
|
+
* inputs. Exposed for unit tests so the prose can be pinned without
|
|
102
|
+
* the fs / DB harness.
|
|
103
|
+
*/
|
|
104
|
+
export function composeMorningRoutineJournalEntry(inputs) {
|
|
105
|
+
const metadata = inputs.stageA.metadata;
|
|
106
|
+
const dayType = readDayType(metadata);
|
|
107
|
+
const inbox = readInboxStats(metadata);
|
|
108
|
+
const checks = readMorningChecks(metadata);
|
|
109
|
+
const anomalies = readAnomalies(metadata);
|
|
110
|
+
const journalLine = formatJournalLine(inputs.yesterdayDateStr, inputs.stageB, inputs.dailyJournalContent);
|
|
111
|
+
const lines = [];
|
|
112
|
+
lines.push(`## ${inputs.morningDateStr} morning routine`);
|
|
113
|
+
lines.push(`- Day-type: ${dayType}`);
|
|
114
|
+
lines.push(`- ${journalLine}`);
|
|
115
|
+
lines.push(`- Inbox: ${inbox.triaged} files triaged, ${inbox.movedToScratch} moved to scratch, ${inbox.dmConfirmsSent} DM-confirmations sent`);
|
|
116
|
+
lines.push(`- Actions: ${formatActionsLine(inputs.actionsSummary ?? EMPTY_ACTIONS_SUMMARY)}`);
|
|
117
|
+
lines.push(`- Checks from routines/morning.md: ${checks}`);
|
|
118
|
+
lines.push(`- Anomalies / skipped steps: ${anomalies}`);
|
|
119
|
+
return lines.join("\n");
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Render the agent-action breakdown into a single inline footprint
|
|
123
|
+
* value. Examples:
|
|
124
|
+
*
|
|
125
|
+
* - 0 actions → `(none)`
|
|
126
|
+
* - 1 single type → `1 total (curl: 1)`
|
|
127
|
+
* - busy day → `23 total (curl: 12, web_fetch: 7, sqlite_read: 4)`
|
|
128
|
+
*
|
|
129
|
+
* The breakdown is capped at `ACTIONS_TOP_N` types so a 30-action-type
|
|
130
|
+
* day stays on one line; the remainder collapses into `+N more`.
|
|
131
|
+
* Ordering is the caller's responsibility (the upstream
|
|
132
|
+
* `gatherJournalSkeletonFacts` query sorts by count desc then
|
|
133
|
+
* action_type asc); the composer renders verbatim.
|
|
134
|
+
*/
|
|
135
|
+
function formatActionsLine(summary) {
|
|
136
|
+
if (summary.totalActions === 0)
|
|
137
|
+
return "(none)";
|
|
138
|
+
const top = summary.actionsByType.slice(0, ACTIONS_TOP_N);
|
|
139
|
+
const more = summary.actionsByType.length - top.length;
|
|
140
|
+
const breakdown = top.map((row) => `${row.actionType}: ${row.count}`).join(", ");
|
|
141
|
+
const suffix = more > 0 ? `, +${more} more` : "";
|
|
142
|
+
return `${summary.totalActions} total (${breakdown}${suffix})`;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Append the composed entry to `agent/journal.md`. Mirrors the write
|
|
146
|
+
* chokepoint that `PATCH /api/context/agent/journal?mode=append_to_file`
|
|
147
|
+
* exposes to the agent: snapshot the existing file into
|
|
148
|
+
* `md_file_snapshots`, write the new content atomically, then notify
|
|
149
|
+
* the write tracker + indexer so observers don't tag the write as a
|
|
150
|
+
* user-actor change.
|
|
151
|
+
*/
|
|
152
|
+
export function appendMorningRoutineJournalEntry(deps, args) {
|
|
153
|
+
const { stageA, stageB } = loadMorningRoutineActionRows(deps.db, args.correlationId);
|
|
154
|
+
if (stageA === null) {
|
|
155
|
+
return { ok: false, reason: "stage_a_row_missing" };
|
|
156
|
+
}
|
|
157
|
+
const dailyPath = join(deps.contextDir, dailyJournalPath(args.yesterdayDateStr));
|
|
158
|
+
const dailyContent = existsSync(dailyPath) ? readFileSync(dailyPath, "utf-8") : null;
|
|
159
|
+
// Reuse the skeleton builder's aggregation for the agent-action
|
|
160
|
+
// breakdown. The query is cheap (two indexed reads against
|
|
161
|
+
// `agent_actions`) and re-running it here keeps the appender
|
|
162
|
+
// self-contained — the orchestrator doesn't have to thread the
|
|
163
|
+
// skeleton facts through the Stage A/B lifecycle just to surface
|
|
164
|
+
// them in the journal footprint.
|
|
165
|
+
const facts = gatherJournalSkeletonFacts(deps.db, args.agentDayWindow);
|
|
166
|
+
const actionsSummary = {
|
|
167
|
+
totalActions: facts.totalActions,
|
|
168
|
+
actionsByType: facts.actionsByType,
|
|
169
|
+
};
|
|
170
|
+
const entryText = composeMorningRoutineJournalEntry({
|
|
171
|
+
morningDateStr: args.morningDateStr,
|
|
172
|
+
yesterdayDateStr: args.yesterdayDateStr,
|
|
173
|
+
stageA,
|
|
174
|
+
stageB,
|
|
175
|
+
dailyJournalContent: dailyContent,
|
|
176
|
+
actionsSummary,
|
|
177
|
+
});
|
|
178
|
+
const journalRelative = CONTEXT_RELATIVE_PATHS.agent.journal;
|
|
179
|
+
const journalAbs = join(deps.contextDir, journalRelative);
|
|
180
|
+
const original = existsSync(journalAbs) ? readFileSync(journalAbs, "utf-8") : null;
|
|
181
|
+
const next = appendBlockToJournal(original, entryText);
|
|
182
|
+
if (original !== null) {
|
|
183
|
+
saveSnapshot(deps.db, journalRelative.replace(/\.md$/, ""), original, "morning_routine_appender");
|
|
184
|
+
}
|
|
185
|
+
// Mark before the rename so FS-watch consumers attribute the resulting
|
|
186
|
+
// event to the agent. Roll back on failure (C2).
|
|
187
|
+
deps.writeTracker?.markWriting(journalAbs, next);
|
|
188
|
+
try {
|
|
189
|
+
writeFileAtomically(journalAbs, next);
|
|
190
|
+
}
|
|
191
|
+
catch (writeErr) {
|
|
192
|
+
deps.writeTracker?.unmark(journalAbs);
|
|
193
|
+
throw writeErr;
|
|
194
|
+
}
|
|
195
|
+
deps.onIndexableContextChange?.(journalRelative);
|
|
196
|
+
return { ok: true, entryText };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Append a new top-level block (delimited by H2 heading) to the
|
|
200
|
+
* journal. When the file does not yet exist, seed it with the
|
|
201
|
+
* `# Agent journal` H1 + the entry. Otherwise trim trailing whitespace
|
|
202
|
+
* and join with a blank line.
|
|
203
|
+
*
|
|
204
|
+
* Retry idempotency: if `original` already contains a block whose H2
|
|
205
|
+
* heading matches `block`'s first line verbatim (i.e. the morning
|
|
206
|
+
* routine for this date emitted earlier in this run / a prior retry
|
|
207
|
+
* attempt), the existing block is replaced from its H2 to the start of
|
|
208
|
+
* the next H2 (or EOF) rather than producing a duplicate. This matches
|
|
209
|
+
* the dispatcher's retry chain semantics where Stage A re-fires on
|
|
210
|
+
* today.md health failure and the orchestrator re-invokes ⑥ — without
|
|
211
|
+
* this guard `pnpm audit` would see two entries for the same date.
|
|
212
|
+
* The replacement uses the LAST matching H2 occurrence so a legacy
|
|
213
|
+
* entry for the same date in deep history is preserved (defence-in-
|
|
214
|
+
* depth — re-running multiple weeks later still replaces only the
|
|
215
|
+
* most-recent attempt).
|
|
216
|
+
*
|
|
217
|
+
* Exposed for testing so the fresh-file / existing-file / retry
|
|
218
|
+
* branches can be pinned without the full appendMorningRoutineJournalEntry
|
|
219
|
+
* harness.
|
|
220
|
+
*/
|
|
221
|
+
export function appendBlockToJournal(original, block) {
|
|
222
|
+
if (original === null) {
|
|
223
|
+
return `# Agent journal\n\n${block}\n`;
|
|
224
|
+
}
|
|
225
|
+
const trimmed = original.replace(/\n+$/, "");
|
|
226
|
+
const headerLine = block.split("\n", 1)[0];
|
|
227
|
+
const replaced = replaceLastBlockMatchingHeader(trimmed, headerLine, block);
|
|
228
|
+
if (replaced !== null) {
|
|
229
|
+
return `${replaced}\n`;
|
|
230
|
+
}
|
|
231
|
+
return `${trimmed}\n\n${block}\n`;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Locate the last occurrence of `headerLine` as an H2 boundary in
|
|
235
|
+
* `body`, and replace from that H2 to the start of the next H2 (or
|
|
236
|
+
* EOF) with `block`. Returns `null` when no matching H2 is found.
|
|
237
|
+
*
|
|
238
|
+
* `headerLine` must be the exact H2 line (e.g.
|
|
239
|
+
* `## 2026-05-15 morning routine`). The match anchors on line
|
|
240
|
+
* boundaries to avoid clipping a substring inside an unrelated H2 or
|
|
241
|
+
* a body bullet.
|
|
242
|
+
*/
|
|
243
|
+
function replaceLastBlockMatchingHeader(body, headerLine, block) {
|
|
244
|
+
// CRLF-tolerant — agent/journal.md is daemon-appended but operators
|
|
245
|
+
// do hand-edit (cf. `pnpm audit` workflow), and a single CRLF leak
|
|
246
|
+
// would silently fail the `===` header match and append a duplicate
|
|
247
|
+
// block on retry instead of replacing. Same uniform policy as
|
|
248
|
+
// handoff-parser + extractUserTasksFromYesterday.
|
|
249
|
+
const lines = body.split(/\r?\n/);
|
|
250
|
+
let lastMatch = -1;
|
|
251
|
+
for (let i = 0; i < lines.length; i++) {
|
|
252
|
+
if (lines[i] === headerLine)
|
|
253
|
+
lastMatch = i;
|
|
254
|
+
}
|
|
255
|
+
if (lastMatch < 0)
|
|
256
|
+
return null;
|
|
257
|
+
let nextH2 = lines.length;
|
|
258
|
+
for (let i = lastMatch + 1; i < lines.length; i++) {
|
|
259
|
+
if (lines[i].startsWith("## ") && !lines[i].startsWith("### ")) {
|
|
260
|
+
nextH2 = i;
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const head = lines.slice(0, lastMatch).join("\n").replace(/\n+$/, "");
|
|
265
|
+
const tail = nextH2 >= lines.length ? "" : lines.slice(nextH2).join("\n");
|
|
266
|
+
const middle = tail.length === 0 ? block : `${block}\n\n${tail.replace(/^\n+/, "")}`;
|
|
267
|
+
// `head` is empty only when the matching H2 was at line 0 with no
|
|
268
|
+
// preceding `# Agent journal` header — a shape `appendBlockToJournal`
|
|
269
|
+
// never produces (the fresh-file branch always seeds the H1). Kept as
|
|
270
|
+
// a defensive no-leading-blank-line guard for hand-edited journals.
|
|
271
|
+
/* c8 ignore next */
|
|
272
|
+
return head.length === 0 ? middle : `${head}\n\n${middle}`;
|
|
273
|
+
}
|
|
274
|
+
// ── Composer helpers ────────────────────────────────────────────────
|
|
275
|
+
function readDayType(metadata) {
|
|
276
|
+
const value = metadata.dayType;
|
|
277
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
278
|
+
return value.trim();
|
|
279
|
+
}
|
|
280
|
+
return "unknown";
|
|
281
|
+
}
|
|
282
|
+
function readInboxStats(metadata) {
|
|
283
|
+
const raw = metadata.inboxStats;
|
|
284
|
+
if (raw !== null && typeof raw === "object" && !Array.isArray(raw)) {
|
|
285
|
+
const obj = raw;
|
|
286
|
+
return {
|
|
287
|
+
triaged: readNonNegativeInt(obj.triaged),
|
|
288
|
+
movedToScratch: readNonNegativeInt(obj.movedToScratch),
|
|
289
|
+
dmConfirmsSent: readNonNegativeInt(obj.dmConfirmsSent),
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
return { triaged: 0, movedToScratch: 0, dmConfirmsSent: 0 };
|
|
293
|
+
}
|
|
294
|
+
function readNonNegativeInt(value) {
|
|
295
|
+
if (typeof value !== "number")
|
|
296
|
+
return 0;
|
|
297
|
+
if (!Number.isFinite(value))
|
|
298
|
+
return 0;
|
|
299
|
+
if (value < 0)
|
|
300
|
+
return 0;
|
|
301
|
+
return Math.trunc(value);
|
|
302
|
+
}
|
|
303
|
+
function readMorningChecks(metadata) {
|
|
304
|
+
const arr = readStringArray(metadata.morningChecks);
|
|
305
|
+
return arr.length === 0 ? "(none)" : arr.join(", ");
|
|
306
|
+
}
|
|
307
|
+
function readAnomalies(metadata) {
|
|
308
|
+
const arr = readStringArray(metadata.anomalies);
|
|
309
|
+
return arr.length === 0 ? "(none)" : arr.join("; ");
|
|
310
|
+
}
|
|
311
|
+
function readStringArray(value) {
|
|
312
|
+
if (!Array.isArray(value))
|
|
313
|
+
return [];
|
|
314
|
+
const out = [];
|
|
315
|
+
for (const entry of value) {
|
|
316
|
+
if (typeof entry !== "string")
|
|
317
|
+
continue;
|
|
318
|
+
const trimmed = entry.trim();
|
|
319
|
+
if (trimmed.length === 0)
|
|
320
|
+
continue;
|
|
321
|
+
out.push(trimmed);
|
|
322
|
+
}
|
|
323
|
+
return out;
|
|
324
|
+
}
|
|
325
|
+
function formatJournalLine(yesterdayDateStr, stageB, dailyContent) {
|
|
326
|
+
if (dailyContent !== null) {
|
|
327
|
+
if (stageB !== null && stageB.result !== "success") {
|
|
328
|
+
return `Journal synthesis: skipped (Stage B ${stageB.result})`;
|
|
329
|
+
}
|
|
330
|
+
const stats = inspectDailyJournal(dailyContent);
|
|
331
|
+
return `Journal: daily/${yesterdayDateStr}.md (${stats.bodyLineCount} lines, ${stats.projectsCount} projects referenced)`;
|
|
332
|
+
}
|
|
333
|
+
// dailyContent === null
|
|
334
|
+
//
|
|
335
|
+
// Disambiguate the missing-file branch by Stage B state so the audit
|
|
336
|
+
// trail surfaces real anomalies instead of masking them as "no prior
|
|
337
|
+
// day". Three sub-cases:
|
|
338
|
+
// 1. Stage B was skipped (`stageB === null`) — first-run initial
|
|
339
|
+
// variant. Rendering "no prior-day data" is correct.
|
|
340
|
+
// 2. Stage B ran and failed (`result !== 'success'`) — render the
|
|
341
|
+
// terminal state. Matches the dailyContent-present-but-failed
|
|
342
|
+
// branch above so the audit log uses one consistent shape per
|
|
343
|
+
// Stage B outcome.
|
|
344
|
+
// 3. Stage B ran and succeeded but the file is not on disk — a real
|
|
345
|
+
// anomaly (atomic PUT lost, fs race, or the appender ran before
|
|
346
|
+
// the PUT settled). Surface explicitly so `pnpm audit` can
|
|
347
|
+
// filter on it; the original "no prior-day data" string silently
|
|
348
|
+
// masked this as a benign first-run condition.
|
|
349
|
+
if (stageB === null) {
|
|
350
|
+
return "Journal synthesis: skipped (no prior-day data)";
|
|
351
|
+
}
|
|
352
|
+
if (stageB.result !== "success") {
|
|
353
|
+
return `Journal synthesis: skipped (Stage B ${stageB.result})`;
|
|
354
|
+
}
|
|
355
|
+
return "Journal synthesis: skipped (Stage B success but daily file missing)";
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Pull body-line count + projects-array length from a `daily/<date>.md`
|
|
359
|
+
* body. Tolerant of both flow-style (`projects: [a, b, c]`) and list
|
|
360
|
+
* form (`projects:\n - a\n - b`); placeholder `projects: []` and
|
|
361
|
+
* absent field both count as zero. Body excludes the YAML frontmatter
|
|
362
|
+
* block.
|
|
363
|
+
*
|
|
364
|
+
* Exposed for testing so the parsing branches stay pinnable.
|
|
365
|
+
*/
|
|
366
|
+
export function inspectDailyJournal(content) {
|
|
367
|
+
const body = stripFrontmatter(content);
|
|
368
|
+
const bodyLineCount = countBodyLines(body);
|
|
369
|
+
const projectsCount = countProjectsField(content);
|
|
370
|
+
return { bodyLineCount, projectsCount };
|
|
371
|
+
}
|
|
372
|
+
function stripFrontmatter(content) {
|
|
373
|
+
if (!content.startsWith("---"))
|
|
374
|
+
return content;
|
|
375
|
+
const lines = content.split("\n");
|
|
376
|
+
if (lines[0].trim() !== "---")
|
|
377
|
+
return content;
|
|
378
|
+
for (let i = 1; i < lines.length; i++) {
|
|
379
|
+
if (lines[i].trim() === "---") {
|
|
380
|
+
return lines.slice(i + 1).join("\n");
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return content;
|
|
384
|
+
}
|
|
385
|
+
function countBodyLines(body) {
|
|
386
|
+
if (body.length === 0)
|
|
387
|
+
return 0;
|
|
388
|
+
// Drop a single trailing newline so `"foo\n"` counts as 1 line, not 2.
|
|
389
|
+
const trimmed = body.endsWith("\n") ? body.slice(0, -1) : body;
|
|
390
|
+
if (trimmed.length === 0)
|
|
391
|
+
return 0;
|
|
392
|
+
return trimmed.split("\n").length;
|
|
393
|
+
}
|
|
394
|
+
function countProjectsField(content) {
|
|
395
|
+
const lines = content.split("\n");
|
|
396
|
+
// Locate the frontmatter block — only count projects: inside it.
|
|
397
|
+
if (lines[0]?.trim() !== "---")
|
|
398
|
+
return 0;
|
|
399
|
+
let close = -1;
|
|
400
|
+
for (let i = 1; i < lines.length; i++) {
|
|
401
|
+
if (lines[i].trim() === "---") {
|
|
402
|
+
close = i;
|
|
403
|
+
break;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
if (close < 0)
|
|
407
|
+
return 0;
|
|
408
|
+
for (let i = 1; i < close; i++) {
|
|
409
|
+
const line = lines[i];
|
|
410
|
+
if (!line.startsWith("projects:"))
|
|
411
|
+
continue;
|
|
412
|
+
const rest = line.slice("projects:".length).trim();
|
|
413
|
+
if (rest === "" || rest === "[]") {
|
|
414
|
+
// List form (or empty placeholder). Walk indented `- ` lines.
|
|
415
|
+
let count = 0;
|
|
416
|
+
for (let j = i + 1; j < close; j++) {
|
|
417
|
+
const next = lines[j];
|
|
418
|
+
if (!next.startsWith(" ") && !next.startsWith("\t"))
|
|
419
|
+
break;
|
|
420
|
+
if (/^\s+-\s+\S/.test(next))
|
|
421
|
+
count += 1;
|
|
422
|
+
}
|
|
423
|
+
return count;
|
|
424
|
+
}
|
|
425
|
+
if (rest.startsWith("[") && rest.endsWith("]")) {
|
|
426
|
+
const inner = rest.slice(1, -1).trim();
|
|
427
|
+
if (inner.length === 0)
|
|
428
|
+
return 0;
|
|
429
|
+
return inner.split(",").filter((s) => s.trim().length > 0).length;
|
|
430
|
+
}
|
|
431
|
+
return 0;
|
|
432
|
+
}
|
|
433
|
+
return 0;
|
|
434
|
+
}
|
|
435
|
+
function parseJsonObject(raw) {
|
|
436
|
+
if (raw === null)
|
|
437
|
+
return {};
|
|
438
|
+
try {
|
|
439
|
+
const parsed = JSON.parse(raw);
|
|
440
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
441
|
+
return {};
|
|
442
|
+
}
|
|
443
|
+
return parsed;
|
|
444
|
+
}
|
|
445
|
+
catch (err) {
|
|
446
|
+
logger.warn({ err }, "agent_actions.metadata is not valid JSON; treating as empty");
|
|
447
|
+
return {};
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
function saveSnapshot(db, filePath, content, trigger) {
|
|
451
|
+
try {
|
|
452
|
+
db.prepare("INSERT INTO md_file_snapshots (file_path, content, trigger, session_id) VALUES (?, ?, ?, ?)").run(filePath, content, trigger, null);
|
|
453
|
+
}
|
|
454
|
+
catch (err) {
|
|
455
|
+
logger.warn({ err, filePath, trigger }, "Failed to save md_file_snapshots row");
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
//# sourceMappingURL=agent-journal-appender.js.map
|