@agent-native/core 0.130.2 → 0.131.3
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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +79 -0
- package/corpus/core/docs/content/agent-surfaces.mdx +4 -4
- package/corpus/core/docs/content/automations.mdx +61 -12
- package/corpus/core/docs/content/deployment.mdx +11 -4
- package/corpus/core/docs/content/extensions.mdx +39 -33
- package/corpus/core/docs/content/recurring-jobs.mdx +41 -19
- package/corpus/core/docs/content/template-dispatch-operations.mdx +19 -7
- package/corpus/core/package.json +3 -1
- package/corpus/core/src/a2a/types.ts +6 -0
- package/corpus/core/src/action.ts +68 -0
- package/corpus/core/src/agent/engine/builder-engine.ts +8 -4
- package/corpus/core/src/agent/production-agent.ts +175 -100
- package/corpus/core/src/agent/tool-search.ts +36 -0
- package/corpus/core/src/automations/service.ts +506 -0
- package/corpus/core/src/browser-context/index.ts +392 -0
- package/corpus/core/src/client/AgentPanel.tsx +2 -1
- package/corpus/core/src/client/FeedbackButton.tsx +37 -4
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +21 -0
- package/corpus/core/src/client/agent-chat.ts +31 -3
- package/corpus/core/src/client/agent-page/AgentJobsTab.tsx +438 -310
- package/corpus/core/src/client/agent-page/AgentTabsPage.tsx +4 -4
- package/corpus/core/src/client/agent-page/use-jobs.ts +7 -0
- package/corpus/core/src/client/analytics-session.ts +13 -0
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +67 -0
- package/corpus/core/src/client/settings/AutomationsSection.tsx +27 -499
- package/corpus/core/src/client/settings/SettingsPanel.tsx +32 -11
- package/corpus/core/src/client/settings/index.ts +2 -0
- package/corpus/core/src/client/use-agent-chat.ts +35 -3
- package/corpus/core/src/client/use-chat-threads.ts +8 -25
- package/corpus/core/src/deploy/build.ts +2 -0
- package/corpus/core/src/deploy/workspace-deploy.ts +2 -0
- package/corpus/core/src/extensions/actions.ts +115 -3
- package/corpus/core/src/extensions/fetch-tool.ts +11 -0
- package/corpus/core/src/extensions/routes.ts +16 -1
- package/corpus/core/src/extensions/web-content.ts +96 -1
- package/corpus/core/src/integrations/computer-supervision.ts +33 -1
- package/corpus/core/src/integrations/index.ts +6 -0
- package/corpus/core/src/integrations/integration-durable-dispatch-config.ts +10 -0
- package/corpus/core/src/integrations/integration-durable-dispatch.ts +4 -0
- package/corpus/core/src/integrations/plugin.ts +94 -41
- package/corpus/core/src/integrations/remote-browser-actions.ts +621 -0
- package/corpus/core/src/jobs/actions/list-recurring-jobs.ts +5 -7
- package/corpus/core/src/jobs/actions/manage-recurring-job.ts +3 -7
- package/corpus/core/src/jobs/background-automation-runner.ts +437 -0
- package/corpus/core/src/jobs/frontmatter.ts +308 -0
- package/corpus/core/src/jobs/scheduler.ts +89 -598
- package/corpus/core/src/jobs/tools.ts +22 -3
- package/corpus/core/src/localization/default-messages.ts +45 -45
- package/corpus/core/src/mcp-client/index.ts +6 -0
- package/corpus/core/src/notifications/actions.ts +5 -0
- package/corpus/core/src/progress/actions.ts +5 -0
- package/corpus/core/src/provider-api/actions/github-repo-files.ts +11 -0
- package/corpus/core/src/provider-api/actions/provider-api.ts +13 -0
- package/corpus/core/src/server/action-discovery.ts +7 -0
- package/corpus/core/src/server/agent-capabilities.ts +43 -8
- package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +63 -1
- package/corpus/core/src/server/agent-chat/browser-team-tools.ts +126 -3
- package/corpus/core/src/server/agent-chat/framework-prompts.ts +7 -11
- package/corpus/core/src/server/agent-chat/plugin-options.ts +3 -3
- package/corpus/core/src/server/agent-chat/script-entries.ts +52 -1
- package/corpus/core/src/server/agent-chat-plugin.ts +25 -5
- package/corpus/core/src/server/attribution.ts +22 -0
- package/corpus/core/src/server/auth.ts +20 -6
- package/corpus/core/src/server/better-auth-instance.ts +10 -2
- package/corpus/core/src/server/core-routes-plugin.ts +10 -1
- package/corpus/core/src/server/csrf.ts +25 -0
- package/corpus/core/src/server/google-oauth.ts +21 -1
- package/corpus/core/src/server/onboarding-html.ts +18 -0
- package/corpus/core/src/server/prompts/framework-core-compact.ts +3 -3
- package/corpus/core/src/server/prompts/framework-core.ts +3 -3
- package/corpus/core/src/server/prompts/shared-rules.ts +3 -3
- package/corpus/core/src/settings/index.ts +1 -0
- package/corpus/core/src/shared/analytics-anonymous-id.ts +35 -0
- package/corpus/core/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +26 -0
- package/corpus/core/src/templates/default/app/i18n/de-DE.ts +28 -0
- package/corpus/core/src/templates/default/app/i18n/en-US.ts +27 -0
- package/corpus/core/src/templates/default/app/i18n/es-ES.ts +28 -0
- package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +28 -0
- package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +25 -0
- package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +27 -0
- package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +27 -0
- package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +27 -0
- package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +24 -0
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +24 -0
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +10 -7
- package/corpus/core/src/templates/workspace-core/.agents/skills/automations/SKILL.md +53 -8
- package/corpus/core/src/templates/workspace-core/.agents/skills/browser-sessions/SKILL.md +131 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +13 -4
- package/corpus/core/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +23 -15
- package/corpus/core/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +33 -18
- package/corpus/core/src/tracking/providers.ts +1 -0
- package/corpus/core/src/tracking/registry.ts +2 -1
- package/corpus/core/src/tracking/types.ts +1 -0
- package/corpus/core/src/triggers/actions/list-automations.ts +43 -44
- package/corpus/core/src/triggers/actions/manage-automation.ts +17 -48
- package/corpus/core/src/triggers/actions.ts +218 -127
- package/corpus/core/src/triggers/dispatcher.ts +181 -367
- package/corpus/core/src/triggers/routes.ts +84 -27
- package/corpus/core/src/triggers/types.ts +9 -23
- package/corpus/templates/analytics/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/analytics/AGENTS.md +5 -0
- package/corpus/templates/analytics/actions/hubspot-deals.ts +1 -0
- package/corpus/templates/analytics/actions/hubspot-records.ts +1 -0
- package/corpus/templates/analytics/actions/install-dashboard-template.ts +13 -4
- package/corpus/templates/analytics/actions/rename-dashboard.ts +8 -3
- package/corpus/templates/analytics/actions/restore-dashboard-revision.ts +8 -3
- package/corpus/templates/analytics/actions/update-dashboard.ts +22 -5
- package/corpus/templates/analytics/app/components/dashboard/DashboardPanelSkeleton.tsx +7 -1
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +1 -82
- package/corpus/templates/analytics/app/components/layout/NewDashboardDialog.tsx +4 -4
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +23 -13
- package/corpus/templates/analytics/app/global.css +21 -0
- package/corpus/templates/analytics/app/i18n-data.ts +165 -101
- package/corpus/templates/analytics/app/lib/custom-block-promotion.ts +62 -0
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +17 -2
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/PanelEditorDialog.tsx +3 -1
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +77 -12
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/dashboard-save-queue.ts +34 -0
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +42 -26
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/types.ts +15 -0
- package/corpus/templates/analytics/app/pages/analyses/AnalysisDetail.tsx +1 -1
- package/corpus/templates/analytics/changelog/2026-07-29-chat-history-now-closes-smoothly-and-stays-ready-when-you-re.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-chat-history-stays-visible-when-you-return-to-the-dashboard.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-custom-dashboard-blocks-now-identify-one-off-agent-patches-a.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-dashboard-chart-deletions-now-save-in-order-so-removed-rows-.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-dashboard-chart-loaders-are-easier-to-see-and-animate-more-s.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-plan-mode-can-now-query-connected-analytics-sources-while-ke.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-plan-mode-can-use-clips-as-read-only-prompt-context.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-29-signup-entry-pages-now-show-the-first-page-viewed-before-eac.md +6 -0
- package/corpus/templates/analytics/seeds/dashboards/agent-native-templates-first-party.json +26 -1
- package/corpus/templates/analytics/server/lib/agent-chat-plan-mode.ts +0 -33
- package/corpus/templates/analytics/server/lib/analytics-connector-catalog.ts +2 -0
- package/corpus/templates/analytics/server/lib/canonical-first-party-dashboard-repair.ts +13 -3
- package/corpus/templates/analytics/server/lib/dashboard-catalog.ts +9 -1
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +44 -1
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +96 -16
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +18 -27
- package/corpus/templates/analytics/server/plugins/core-routes.ts +1 -0
- package/corpus/templates/assets/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +4 -8
- package/corpus/templates/assets/changelog/2026-07-29-chat-history-now-closes-smoothly-and-stays-ready-when-you-re.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-29-chat-history-stays-visible-when-you-return-to-the-workspace.md +6 -0
- package/corpus/templates/assets/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/brain/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +3 -7
- package/corpus/templates/brain/app/root.tsx +0 -3
- package/corpus/templates/brain/changelog/2026-07-29-chat-history-now-closes-smoothly-and-stays-ready-when-you-re.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-29-chat-history-stays-visible-when-you-return-to-ask-brain.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-29-extensions-are-no-longer-shown-as-a-default-command-menu-des.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/calendar/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/calendar/.agents/skills/event-management/SKILL.md +25 -5
- package/corpus/templates/calendar/AGENTS.md +5 -0
- package/corpus/templates/calendar/actions/create-event.ts +43 -13
- package/corpus/templates/calendar/actions/event-action-helpers.ts +131 -1
- package/corpus/templates/calendar/actions/get-event.ts +1 -0
- package/corpus/templates/calendar/actions/manage-event-draft.ts +65 -2
- package/corpus/templates/calendar/app/components/calendar/CreateEventDialog.tsx +438 -258
- package/corpus/templates/calendar/app/components/calendar/DayView.tsx +19 -3
- package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +7 -3
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +14 -19
- package/corpus/templates/calendar/app/components/calendar/MonthView.tsx +24 -0
- package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +15 -2
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +1 -5
- package/corpus/templates/calendar/app/hooks/use-events.ts +51 -5
- package/corpus/templates/calendar/app/i18n-data.ts +50 -0
- package/corpus/templates/calendar/app/lib/all-day-layout.ts +9 -2
- package/corpus/templates/calendar/app/lib/event-form-initialization.ts +4 -8
- package/corpus/templates/calendar/app/lib/event-form-utils.ts +43 -8
- package/corpus/templates/calendar/app/lib/location-suggestions.ts +36 -0
- package/corpus/templates/calendar/app/lib/out-of-office.ts +87 -1
- package/corpus/templates/calendar/app/pages/CalendarView.tsx +82 -20
- package/corpus/templates/calendar/changelog/2026-07-26-out-of-office-events-now-default-to-full-days-with-a-ready.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-29-recent-calendar-locations-now-appear-as-address-suggestions-.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-29-unnamed-events-now-use-a-title-placeholder.md +6 -0
- package/corpus/templates/calendar/server/lib/find-time.ts +29 -5
- package/corpus/templates/calendar/server/lib/google-calendar.ts +2 -0
- package/corpus/templates/calendar/server/lib/ical-fetcher.ts +1 -0
- package/corpus/templates/calendar/shared/api.ts +4 -0
- package/corpus/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +1 -5
- package/corpus/templates/chat/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/clips/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/clips/app/components/library/library-layout.tsx +1 -5
- package/corpus/templates/clips/changelog/2026-07-29-fixed-system-audio-recordings-picking-up-your-microphone-in-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-29-the-desktop-camera-preview-now-closes-after-a-recording-fin.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +14 -15
- package/corpus/templates/clips/desktop/src/lib/bubble-session.ts +11 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +9 -4
- package/corpus/templates/clips/desktop/src/lib/transcription-capture.ts +11 -0
- package/corpus/templates/clips/server/jobs/transactional-emails.ts +47 -23
- package/corpus/templates/clips/server/lib/transactional-email-store.ts +16 -6
- package/corpus/templates/content/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/content/.agents/skills/content-product-development/SKILL.md +103 -0
- package/corpus/templates/content/.agents/skills/content-product-development/references/verification.md +57 -0
- package/corpus/templates/content/AGENTS.md +2 -0
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +1 -6
- package/corpus/templates/content/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/content/docs/product/README.md +115 -0
- package/corpus/templates/content/docs/product/architecture.md +98 -0
- package/corpus/templates/content/docs/product/capabilities/content.access.page-database.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.access.row-private.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.access.safe-aggregate.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.access.visibility-closure.md +79 -0
- package/corpus/templates/content/docs/product/capabilities/content.action.button.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.agent.action-parity.md +73 -0
- package/corpus/templates/content/docs/product/capabilities/content.agent.audience-safe.md +91 -0
- package/corpus/templates/content/docs/product/capabilities/content.agent.automation.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.agent.expression-authoring.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.agent.presence.md +103 -0
- package/corpus/templates/content/docs/product/capabilities/content.agent.resource-consent.md +90 -0
- package/corpus/templates/content/docs/product/capabilities/content.agent.skill-catalog.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.api.cms.md +70 -0
- package/corpus/templates/content/docs/product/capabilities/content.author.code.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.author.document-editor.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.author.footnotes.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.author.math.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.author.media.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.author.mermaid.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.automation.scheduled.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.capture.enrich.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.command.fabric.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.comment.page-owned.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.diff.ai-assist.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.diff.filtered-review.md +79 -0
- package/corpus/templates/content/docs/product/capabilities/content.diff.in-place.md +80 -0
- package/corpus/templates/content/docs/product/capabilities/content.discussion.page.md +80 -0
- package/corpus/templates/content/docs/product/capabilities/content.embed.host-grant.md +70 -0
- package/corpus/templates/content/docs/product/capabilities/content.embed.mcp-app.md +69 -0
- package/corpus/templates/content/docs/product/capabilities/content.embed.surface.md +74 -0
- package/corpus/templates/content/docs/product/capabilities/content.event.committed.md +85 -0
- package/corpus/templates/content/docs/product/capabilities/content.expression.cached-result.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.expression.catalog.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.expression.language.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.feedback.signal.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.form.shared-engine.md +72 -0
- package/corpus/templates/content/docs/product/capabilities/content.history.queryable.md +79 -0
- package/corpus/templates/content/docs/product/capabilities/content.home.global.md +80 -0
- package/corpus/templates/content/docs/product/capabilities/content.job.durable.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.knowledge.graph.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.knowledge.links.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.knowledge.search.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.layout.responsive.md +80 -0
- package/corpus/templates/content/docs/product/capabilities/content.navigation.sidebar.md +86 -0
- package/corpus/templates/content/docs/product/capabilities/content.notification.source.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.object.block.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.object.blocks-field.md +79 -0
- package/corpus/templates/content/docs/product/capabilities/content.object.database.md +92 -0
- package/corpus/templates/content/docs/product/capabilities/content.object.multi-membership.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.object.page.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.object.reference.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.object.transclusion.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.organization.teams.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.portability.pdf-export.md +78 -0
- package/corpus/templates/content/docs/product/capabilities/content.portability.roundtrip.md +154 -0
- package/corpus/templates/content/docs/product/capabilities/content.portability.source-representation.md +70 -0
- package/corpus/templates/content/docs/product/capabilities/content.portability.vault-export.md +80 -0
- package/corpus/templates/content/docs/product/capabilities/content.presentation.mode.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.preset.catalog.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.property.actor.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.property.catalog.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.property.constraints.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.property.guarded-change.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.property.location.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.property.typed.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.publish.public.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.publish.reading.md +74 -0
- package/corpus/templates/content/docs/product/capabilities/content.query.object.md +114 -0
- package/corpus/templates/content/docs/product/capabilities/content.reader.documents.md +69 -0
- package/corpus/templates/content/docs/product/capabilities/content.reader.surface.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.relationship.edge.md +183 -0
- package/corpus/templates/content/docs/product/capabilities/content.renderer.artifact-block.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.renderer.custom-block.md +81 -0
- package/corpus/templates/content/docs/product/capabilities/content.renderer.graph.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.renderer.typed.md +92 -0
- package/corpus/templates/content/docs/product/capabilities/content.research.annotation.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.research.citation.md +70 -0
- package/corpus/templates/content/docs/product/capabilities/content.review.code.md +67 -0
- package/corpus/templates/content/docs/product/capabilities/content.revision.suggestions.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.rule.deterministic.md +79 -0
- package/corpus/templates/content/docs/product/capabilities/content.schedule.constraints.md +81 -0
- package/corpus/templates/content/docs/product/capabilities/content.security.private-vault.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.share.views.md +140 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.adapters.md +154 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.builder-codec.md +70 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.catalog.md +149 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.file-folder.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.local-bridge.md +156 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.local-project.md +70 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.page-link.md +70 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.row-union.md +69 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.spaces-files.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.source.sync-policy.md +161 -0
- package/corpus/templates/content/docs/product/capabilities/content.system.dependencies.md +80 -0
- package/corpus/templates/content/docs/product/capabilities/content.system.my-tasks.md +75 -0
- package/corpus/templates/content/docs/product/capabilities/content.system.project-status.md +77 -0
- package/corpus/templates/content/docs/product/capabilities/content.system.research-workspace.md +80 -0
- package/corpus/templates/content/docs/product/capabilities/content.system.task-project.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.template.governance.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.template.graph.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.template.item-body.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.template.update.md +71 -0
- package/corpus/templates/content/docs/product/capabilities/content.time.types.md +85 -0
- package/corpus/templates/content/docs/product/capabilities/content.version.branching.md +151 -0
- package/corpus/templates/content/docs/product/capabilities/content.version.field-history.md +103 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.canvas.md +94 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.chart.md +91 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.dynamic-create.md +137 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.fast-capture.md +82 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.graph.md +95 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.grouping-aggregation.md +83 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.map.md +77 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.personal-state.md +99 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.pivot.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.query.md +106 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.renderer-conformance.md +77 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.scale.md +77 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.source-query.md +159 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.timeline.md +86 -0
- package/corpus/templates/content/docs/product/capabilities/content.view.tree.md +77 -0
- package/corpus/templates/content/docs/product/capabilities/content.workspace.multi-scope.md +80 -0
- package/corpus/templates/content/docs/product/capabilities/content.workspace.session-restore.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.workspace.view-instance.md +76 -0
- package/corpus/templates/content/docs/product/capabilities/content.workspace.working-set.md +77 -0
- package/corpus/templates/content/docs/product/chapters/content.chapter.capture-research.md +20 -0
- package/corpus/templates/content/docs/product/chapters/content.chapter.connected-sources.md +20 -0
- package/corpus/templates/content/docs/product/chapters/content.chapter.consensus.md +19 -0
- package/corpus/templates/content/docs/product/chapters/content.chapter.durable-home.md +21 -0
- package/corpus/templates/content/docs/product/chapters/content.chapter.publishing-portability.md +21 -0
- package/corpus/templates/content/docs/product/chapters/content.chapter.working-systems.md +27 -0
- package/corpus/templates/content/docs/product/encyclopedia.md +559 -0
- package/corpus/templates/content/docs/product/features/content.feature.bring-your-local-work.md +39 -0
- package/corpus/templates/content/docs/product/features/content.feature.build-living-dashboards.md +34 -0
- package/corpus/templates/content/docs/product/features/content.feature.build-new-surfaces.md +33 -0
- package/corpus/templates/content/docs/product/features/content.feature.capture-into-action.md +34 -0
- package/corpus/templates/content/docs/product/features/content.feature.cite-what-you-found.md +34 -0
- package/corpus/templates/content/docs/product/features/content.feature.collaborate-in-context.md +59 -0
- package/corpus/templates/content/docs/product/features/content.feature.collect-structured-input.md +38 -0
- package/corpus/templates/content/docs/product/features/content.feature.connect-your-sources.md +38 -0
- package/corpus/templates/content/docs/product/features/content.feature.data-that-keeps-itself-right.md +45 -0
- package/corpus/templates/content/docs/product/features/content.feature.durable-foundations.md +48 -0
- package/corpus/templates/content/docs/product/features/content.feature.evolve-systems-safely.md +38 -0
- package/corpus/templates/content/docs/product/features/content.feature.explore-alternatives-safely.md +39 -0
- package/corpus/templates/content/docs/product/features/content.feature.find-your-place-again.md +40 -0
- package/corpus/templates/content/docs/product/features/content.feature.keep-your-private-vault-private.md +39 -0
- package/corpus/templates/content/docs/product/features/content.feature.living-references.md +38 -0
- package/corpus/templates/content/docs/product/features/content.feature.make-the-workspace-yours.md +40 -0
- package/corpus/templates/content/docs/product/features/content.feature.move-without-starting-over.md +38 -0
- package/corpus/templates/content/docs/product/features/content.feature.plan-work-across-time.md +39 -0
- package/corpus/templates/content/docs/product/features/content.feature.publish-with-confidence.md +43 -0
- package/corpus/templates/content/docs/product/features/content.feature.put-your-organizations-know-how-to-work.md +38 -0
- package/corpus/templates/content/docs/product/features/content.feature.read-and-annotate-anything.md +38 -0
- package/corpus/templates/content/docs/product/features/content.feature.review-changes-in-place.md +39 -0
- package/corpus/templates/content/docs/product/features/content.feature.run-projects-your-way.md +44 -0
- package/corpus/templates/content/docs/product/features/content.feature.see-your-information-your-way.md +44 -0
- package/corpus/templates/content/docs/product/features/content.feature.share-how-your-organization-works.md +38 -0
- package/corpus/templates/content/docs/product/features/content.feature.sketch-connections-keep-whats-true.md +39 -0
- package/corpus/templates/content/docs/product/features/content.feature.take-the-whole-vault-with-you.md +39 -0
- package/corpus/templates/content/docs/product/features/content.feature.trust-your-connected-sources.md +40 -0
- package/corpus/templates/content/docs/product/features/content.feature.understand-what-your-data-says.md +39 -0
- package/corpus/templates/content/docs/product/features/content.feature.when-this-happens-that-follows.md +43 -0
- package/corpus/templates/content/docs/product/features/content.feature.work-across-every-workspace.md +37 -0
- package/corpus/templates/content/docs/product/features/content.feature.work-on-content-inside-another-application.md +37 -0
- package/corpus/templates/content/docs/product/roadmap.md +878 -0
- package/corpus/templates/crm/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/crm/app/components/layout/CrmSidebar.tsx +1 -7
- package/corpus/templates/crm/app/i18n/en-US.ts +4 -0
- package/corpus/templates/crm/app/routes/settings.tsx +33 -8
- package/corpus/templates/crm/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/design/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +133 -63
- package/corpus/templates/design/.generated/bridge/embedded-wheel.generated.ts +19 -2
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +51 -14
- package/corpus/templates/design/app/components/design/DesignExtensionsPanel.tsx +41 -26
- package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +22 -4
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +216 -116
- package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +21 -2
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +5 -1
- package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbenchLoader.tsx +10 -2
- package/corpus/templates/design/app/components/design/code-workbench/code-workbench-shell.ts +2 -0
- package/corpus/templates/design/app/components/design/code-workbench/explorer/ExplorerView.tsx +60 -55
- package/corpus/templates/design/app/components/design/design-canvas/content-size-report.ts +88 -2
- package/corpus/templates/design/app/components/design/multi-screen/board-surface-html.ts +3 -2
- package/corpus/templates/design/app/components/design/types.ts +4 -0
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +1 -5
- package/corpus/templates/design/app/pages/design-editor/clipboard-layer-source.ts +28 -0
- package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +117 -0
- package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +3 -1
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +120 -74
- package/corpus/templates/design/app/pages/design-editor/pending-structure-verification.ts +11 -0
- package/corpus/templates/design/app/pages/design-editor/react-semantic-handoff.ts +2 -0
- package/corpus/templates/design/app/pages/design-editor/source-location.ts +1 -1
- package/corpus/templates/design/changelog/2026-07-29-copy-rendered-ui-between-live-local-apps-and-design-files-wh.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-design-boards-stay-dark-and-viewport-height-content-keeps-it.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-design-frames-no-longer-grow-continuously-when-their-content.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-the-code-panel-and-apply-design-update-control-now-use-clear.md +6 -0
- package/corpus/templates/design/changelog/2026-07-29-the-tools-panel-now-keeps-extension-creation-and-discovery-h.md +6 -0
- package/corpus/templates/design/shared/source-mode.ts +7 -1
- package/corpus/templates/dispatch/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +171 -0
- package/corpus/templates/dispatch/app/routes/browser-chat.tsx +4 -0
- package/corpus/templates/dispatch/app/routes/browser-connect.tsx +4 -0
- package/corpus/templates/dispatch/changelog/2026-07-29-browser-chat-can-securely-connect-the-agent-native-chrome-ex.md +6 -0
- package/corpus/templates/forms/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +1 -6
- package/corpus/templates/forms/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/macros/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +1 -5
- package/corpus/templates/macros/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/mail/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +1 -9
- package/corpus/templates/mail/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/plan/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +3 -7
- package/corpus/templates/plan/app/pages/PlansPage.tsx +2 -2
- package/corpus/templates/plan/changelog/2026-07-29-chat-history-now-closes-smoothly-and-stays-ready-when-you-re.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-29-chat-history-stays-visible-when-you-return-to-ask-plan.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-29-fixed-plan-pages-crashing-when-recent-activity-is-unavailabl.md +6 -0
- package/corpus/templates/plan/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/slides/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/slides/.agents/skills/analytics-data-for-decks/SKILL.md +48 -0
- package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +60 -4
- package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +20 -0
- package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +30 -1
- package/corpus/templates/slides/.agents/skills/slide-images/SKILL.md +3 -1
- package/corpus/templates/slides/AGENTS.md +25 -24
- package/corpus/templates/slides/actions/check-image-gen.ts +8 -2
- package/corpus/templates/slides/actions/create-deck.ts +4 -12
- package/corpus/templates/slides/actions/export-pptx.ts +25 -3
- package/corpus/templates/slides/actions/generate-image-api.ts +4 -2
- package/corpus/templates/slides/actions/generate-slides-ai.ts +1 -1
- package/corpus/templates/slides/actions/get-deck-reference-context.ts +136 -0
- package/corpus/templates/slides/actions/get-workspace-defaults.ts +55 -0
- package/corpus/templates/slides/actions/image-gen-status.ts +10 -1
- package/corpus/templates/slides/actions/import-file.ts +53 -38
- package/corpus/templates/slides/actions/list-decks.ts +2 -0
- package/corpus/templates/slides/actions/patch-deck.ts +2 -0
- package/corpus/templates/slides/actions/set-workspace-defaults.ts +50 -0
- package/corpus/templates/slides/actions/view-screen.ts +6 -0
- package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +1 -1
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +67 -3
- package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +40 -8
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +33 -8
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +6 -2
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +114 -128
- package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +74 -9
- package/corpus/templates/slides/app/components/editor/ImageGenPanel.tsx +1 -1
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +1193 -267
- package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +302 -102
- package/corpus/templates/slides/app/components/editor/rich-text-selection.ts +270 -0
- package/corpus/templates/slides/app/components/editor/slide-escape-arbiter.ts +34 -0
- package/corpus/templates/slides/app/components/editor/slide-object-interactions.ts +368 -0
- package/corpus/templates/slides/app/components/editor/slide-presence.ts +13 -0
- package/corpus/templates/slides/app/components/layout/AgentWorkIndicator.tsx +23 -3
- package/corpus/templates/slides/app/components/layout/Layout.tsx +39 -6
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +1 -6
- package/corpus/templates/slides/app/components/layout/layout-route-policy.ts +23 -0
- package/corpus/templates/slides/app/components/visual-editor/DrawOverlay.tsx +0 -2
- package/corpus/templates/slides/app/context/DeckContext.tsx +2 -0
- package/corpus/templates/slides/app/global.css +60 -0
- package/corpus/templates/slides/app/hooks/use-agent-generating.ts +76 -5
- package/corpus/templates/slides/app/hooks/use-workspace-defaults.ts +26 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +39 -3
- package/corpus/templates/slides/app/lib/generation-state.ts +13 -3
- package/corpus/templates/slides/app/lib/slide-image-replacement.ts +27 -6
- package/corpus/templates/slides/app/lib/text-tool-shortcut.ts +62 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +197 -83
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +95 -0
- package/corpus/templates/slides/app/pages/Index.tsx +348 -53
- package/corpus/templates/slides/changelog/2026-07-28-pick-an-existing-deck-as-a-style-reference-when-creating-a-n.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-ai-editing-status-is-now-quieter-and-only-shows-slide-presen.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-design-systems-and-reference-decks-are-easier-to-choose-toge.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-generated-decks-now-receive-a-concise-relevant-title-before-.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-google-slides-exports-can-connect-your-google-account-direct.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-new-deck-prompts-reuse-empty-chats.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-new-deck-setup-now-stays-in-the-editor-with-closable-style-a.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-selected-words-and-text-runs-can-now-be-styled-independently.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-slide-annotation-tools-are-clearer-and-escape-now-exits-anno.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-slide-editing-now-opens-with-the-app-navigation-collapsed-fo.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-slide-editing-stays-visually-clean-on-hover-without-a-canvas.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-slides-now-appear-one-by-one-while-ai-builds-a-deck-with-ste.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-text-boxes-now-select-move-duplicate-resize-and-style-like-a.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-29-untitled-decks-now-use-a-clearer-this-deck-label-in-the-agen.md +6 -0
- package/corpus/templates/slides/server/handlers/google-docs-auth.ts +4 -2
- package/corpus/templates/slides/server/handlers/image-providers/builder.ts +305 -0
- package/corpus/templates/slides/server/handlers/image-providers/index.ts +6 -3
- package/corpus/templates/slides/server/plugins/agent-chat.ts +1 -0
- package/corpus/templates/slides/server/workspace-defaults.ts +169 -0
- package/corpus/templates/tasks/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +31 -8
- package/corpus/templates/tasks/app/i18n/en-US.ts +7 -0
- package/corpus/templates/tasks/app/routes/settings.tsx +25 -2
- package/corpus/templates/tasks/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +15 -0
- package/corpus/toolkit/README.md +2 -2
- package/corpus/toolkit/package.json +1 -1
- package/corpus/toolkit/src/app-shell/sidebar-footer-actions.tsx +0 -3
- package/corpus/toolkit/src/chat-history.css +1 -0
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +35 -14
- package/corpus/toolkit/src/composer/PromptComposer.tsx +6 -0
- package/corpus/toolkit/src/composer/TiptapComposer.tsx +11 -3
- package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +64 -11
- package/dist/a2a/types.d.ts +6 -0
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/action.d.ts +57 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js +9 -0
- package/dist/action.js.map +1 -1
- package/dist/agent/engine/builder-engine.js +6 -4
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/production-agent.d.ts +11 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +131 -90
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/tool-search.d.ts +4 -0
- package/dist/agent/tool-search.d.ts.map +1 -1
- package/dist/agent/tool-search.js +30 -0
- package/dist/agent/tool-search.js.map +1 -1
- package/dist/automations/service.d.ts +85 -0
- package/dist/automations/service.d.ts.map +1 -0
- package/dist/automations/service.js +332 -0
- package/dist/automations/service.js.map +1 -0
- package/dist/browser-context/index.d.ts +579 -0
- package/dist/browser-context/index.d.ts.map +1 -0
- package/dist/browser-context/index.js +331 -0
- package/dist/browser-context/index.js.map +1 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/FeedbackButton.d.ts +6 -2
- package/dist/client/FeedbackButton.d.ts.map +1 -1
- package/dist/client/FeedbackButton.js +20 -3
- package/dist/client/FeedbackButton.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +19 -2
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/agent-chat.d.ts +15 -0
- package/dist/client/agent-chat.d.ts.map +1 -1
- package/dist/client/agent-chat.js +13 -3
- package/dist/client/agent-chat.js.map +1 -1
- package/dist/client/agent-page/AgentJobsTab.d.ts +1 -0
- package/dist/client/agent-page/AgentJobsTab.d.ts.map +1 -1
- package/dist/client/agent-page/AgentJobsTab.js +186 -98
- package/dist/client/agent-page/AgentJobsTab.js.map +1 -1
- package/dist/client/agent-page/AgentTabsPage.js +4 -4
- package/dist/client/agent-page/AgentTabsPage.js.map +1 -1
- package/dist/client/agent-page/use-jobs.d.ts +7 -0
- package/dist/client/agent-page/use-jobs.d.ts.map +1 -1
- package/dist/client/agent-page/use-jobs.js.map +1 -1
- package/dist/client/analytics-session.d.ts.map +1 -1
- package/dist/client/analytics-session.js +13 -0
- package/dist/client/analytics-session.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +29 -6
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/settings/AutomationsSection.d.ts +0 -9
- package/dist/client/settings/AutomationsSection.d.ts.map +1 -1
- package/dist/client/settings/AutomationsSection.js +9 -168
- package/dist/client/settings/AutomationsSection.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts +9 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +19 -11
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/index.d.ts +1 -1
- package/dist/client/settings/index.d.ts.map +1 -1
- package/dist/client/settings/index.js +1 -1
- package/dist/client/settings/index.js.map +1 -1
- package/dist/client/use-agent-chat.d.ts.map +1 -1
- package/dist/client/use-agent-chat.js +20 -3
- package/dist/client/use-agent-chat.js.map +1 -1
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +4 -17
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +2 -1
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/workspace-deploy.d.ts.map +1 -1
- package/dist/deploy/workspace-deploy.js +2 -1
- package/dist/deploy/workspace-deploy.js.map +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +82 -6
- package/dist/extensions/actions.js.map +1 -1
- package/dist/extensions/fetch-tool.d.ts.map +1 -1
- package/dist/extensions/fetch-tool.js +11 -0
- package/dist/extensions/fetch-tool.js.map +1 -1
- package/dist/extensions/routes.d.ts +5 -1
- package/dist/extensions/routes.d.ts.map +1 -1
- package/dist/extensions/routes.js +7 -1
- package/dist/extensions/routes.js.map +1 -1
- package/dist/extensions/web-content.d.ts +1 -0
- package/dist/extensions/web-content.d.ts.map +1 -1
- package/dist/extensions/web-content.js +82 -1
- package/dist/extensions/web-content.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/integrations/computer-supervision.d.ts.map +1 -1
- package/dist/integrations/computer-supervision.js +22 -1
- package/dist/integrations/computer-supervision.js.map +1 -1
- package/dist/integrations/index.d.ts +3 -2
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +3 -2
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/integration-durable-dispatch-config.d.ts +2 -0
- package/dist/integrations/integration-durable-dispatch-config.d.ts.map +1 -1
- package/dist/integrations/integration-durable-dispatch-config.js +4 -0
- package/dist/integrations/integration-durable-dispatch-config.js.map +1 -1
- package/dist/integrations/integration-durable-dispatch.d.ts +2 -2
- package/dist/integrations/integration-durable-dispatch.d.ts.map +1 -1
- package/dist/integrations/integration-durable-dispatch.js +2 -2
- package/dist/integrations/integration-durable-dispatch.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +84 -39
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/remote-browser-actions.d.ts +7 -0
- package/dist/integrations/remote-browser-actions.d.ts.map +1 -0
- package/dist/integrations/remote-browser-actions.js +482 -0
- package/dist/integrations/remote-browser-actions.js.map +1 -0
- package/dist/jobs/actions/list-recurring-jobs.d.ts.map +1 -1
- package/dist/jobs/actions/list-recurring-jobs.js +4 -6
- package/dist/jobs/actions/list-recurring-jobs.js.map +1 -1
- package/dist/jobs/actions/manage-recurring-job.js +3 -6
- package/dist/jobs/actions/manage-recurring-job.js.map +1 -1
- package/dist/jobs/background-automation-runner.d.ts +76 -0
- package/dist/jobs/background-automation-runner.d.ts.map +1 -0
- package/dist/jobs/background-automation-runner.js +288 -0
- package/dist/jobs/background-automation-runner.js.map +1 -0
- package/dist/jobs/frontmatter.d.ts +63 -0
- package/dist/jobs/frontmatter.d.ts.map +1 -0
- package/dist/jobs/frontmatter.js +216 -0
- package/dist/jobs/frontmatter.js.map +1 -0
- package/dist/jobs/scheduler.d.ts +6 -60
- package/dist/jobs/scheduler.d.ts.map +1 -1
- package/dist/jobs/scheduler.js +67 -484
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/jobs/tools.d.ts.map +1 -1
- package/dist/jobs/tools.js +24 -3
- package/dist/jobs/tools.js.map +1 -1
- package/dist/localization/default-messages.d.ts +28 -33
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +34 -39
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/mcp/screen-memory-stdio.d.ts.map +1 -1
- package/dist/mcp-client/index.d.ts.map +1 -1
- package/dist/mcp-client/index.js +4 -0
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/notifications/actions.d.ts.map +1 -1
- package/dist/notifications/actions.js +5 -0
- package/dist/notifications/actions.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/progress/actions.d.ts.map +1 -1
- package/dist/progress/actions.js +5 -0
- package/dist/progress/actions.js.map +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
- package/dist/provider-api/actions/github-repo-files.d.ts.map +1 -1
- package/dist/provider-api/actions/github-repo-files.js +9 -0
- package/dist/provider-api/actions/github-repo-files.js.map +1 -1
- package/dist/provider-api/actions/provider-api.d.ts +16 -16
- package/dist/provider-api/actions/provider-api.d.ts.map +1 -1
- package/dist/provider-api/actions/provider-api.js +14 -0
- package/dist/provider-api/actions/provider-api.js.map +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +5 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/agent-capabilities.d.ts.map +1 -1
- package/dist/server/agent-capabilities.js +32 -3
- package/dist/server/agent-capabilities.js.map +1 -1
- package/dist/server/agent-chat/action-filters-a2a.d.ts +17 -1
- package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -1
- package/dist/server/agent-chat/action-filters-a2a.js +50 -1
- package/dist/server/agent-chat/action-filters-a2a.js.map +1 -1
- package/dist/server/agent-chat/browser-team-tools.d.ts.map +1 -1
- package/dist/server/agent-chat/browser-team-tools.js +90 -3
- package/dist/server/agent-chat/browser-team-tools.js.map +1 -1
- package/dist/server/agent-chat/framework-prompts.d.ts.map +1 -1
- package/dist/server/agent-chat/framework-prompts.js +7 -11
- package/dist/server/agent-chat/framework-prompts.js.map +1 -1
- package/dist/server/agent-chat/plugin-options.d.ts +3 -3
- package/dist/server/agent-chat/plugin-options.js.map +1 -1
- package/dist/server/agent-chat/script-entries.d.ts.map +1 -1
- package/dist/server/agent-chat/script-entries.js +43 -1
- package/dist/server/agent-chat/script-entries.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +24 -5
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/attribution.d.ts +6 -0
- package/dist/server/attribution.d.ts.map +1 -1
- package/dist/server/attribution.js +14 -14
- package/dist/server/attribution.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +5 -2
- package/dist/server/auth.js.map +1 -1
- package/dist/server/better-auth-instance.d.ts +2 -1
- package/dist/server/better-auth-instance.d.ts.map +1 -1
- package/dist/server/better-auth-instance.js +6 -3
- package/dist/server/better-auth-instance.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts +7 -0
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +3 -1
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/csrf.d.ts.map +1 -1
- package/dist/server/csrf.js +25 -0
- package/dist/server/csrf.js.map +1 -1
- package/dist/server/google-oauth.d.ts +3 -0
- package/dist/server/google-oauth.d.ts.map +1 -1
- package/dist/server/google-oauth.js +12 -1
- package/dist/server/google-oauth.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +18 -0
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/prompts/framework-core-compact.js +3 -3
- package/dist/server/prompts/framework-core-compact.js.map +1 -1
- package/dist/server/prompts/framework-core.js +3 -3
- package/dist/server/prompts/framework-core.js.map +1 -1
- package/dist/server/prompts/shared-rules.js +3 -3
- package/dist/server/prompts/shared-rules.js.map +1 -1
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.d.ts.map +1 -1
- package/dist/settings/index.js +1 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/shared/analytics-anonymous-id.d.ts +12 -0
- package/dist/shared/analytics-anonymous-id.d.ts.map +1 -0
- package/dist/shared/analytics-anonymous-id.js +29 -0
- package/dist/shared/analytics-anonymous-id.js.map +1 -0
- package/dist/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +1 -5
- package/dist/templates/chat/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/dist/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/dist/templates/default/app/i18n/ar-SA.ts +26 -0
- package/dist/templates/default/app/i18n/de-DE.ts +28 -0
- package/dist/templates/default/app/i18n/en-US.ts +27 -0
- package/dist/templates/default/app/i18n/es-ES.ts +28 -0
- package/dist/templates/default/app/i18n/fr-FR.ts +28 -0
- package/dist/templates/default/app/i18n/hi-IN.ts +25 -0
- package/dist/templates/default/app/i18n/ja-JP.ts +27 -0
- package/dist/templates/default/app/i18n/ko-KR.ts +27 -0
- package/dist/templates/default/app/i18n/pt-BR.ts +27 -0
- package/dist/templates/default/app/i18n/zh-CN.ts +24 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +24 -0
- package/dist/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/dist/templates/workspace-core/.agents/skills/agent-page/SKILL.md +10 -7
- package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +53 -8
- package/dist/templates/workspace-core/.agents/skills/browser-sessions/SKILL.md +131 -0
- package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +13 -4
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +23 -15
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +33 -18
- package/dist/tracking/providers.d.ts.map +1 -1
- package/dist/tracking/providers.js +1 -0
- package/dist/tracking/providers.js.map +1 -1
- package/dist/tracking/registry.d.ts +1 -0
- package/dist/tracking/registry.d.ts.map +1 -1
- package/dist/tracking/registry.js +1 -0
- package/dist/tracking/registry.js.map +1 -1
- package/dist/tracking/types.d.ts +1 -0
- package/dist/tracking/types.d.ts.map +1 -1
- package/dist/tracking/types.js.map +1 -1
- package/dist/triggers/actions/list-automations.d.ts +7 -0
- package/dist/triggers/actions/list-automations.d.ts.map +1 -1
- package/dist/triggers/actions/list-automations.js +29 -41
- package/dist/triggers/actions/list-automations.js.map +1 -1
- package/dist/triggers/actions/manage-automation.js +15 -33
- package/dist/triggers/actions/manage-automation.js.map +1 -1
- package/dist/triggers/actions.d.ts.map +1 -1
- package/dist/triggers/actions.js +184 -95
- package/dist/triggers/actions.js.map +1 -1
- package/dist/triggers/dispatcher.d.ts +3 -9
- package/dist/triggers/dispatcher.d.ts.map +1 -1
- package/dist/triggers/dispatcher.js +134 -304
- package/dist/triggers/dispatcher.js.map +1 -1
- package/dist/triggers/routes.d.ts.map +1 -1
- package/dist/triggers/routes.js +76 -17
- package/dist/triggers/routes.js.map +1 -1
- package/dist/triggers/types.d.ts +4 -23
- package/dist/triggers/types.d.ts.map +1 -1
- package/dist/triggers/types.js.map +1 -1
- package/docs/content/agent-surfaces.mdx +4 -4
- package/docs/content/automations.mdx +61 -12
- package/docs/content/deployment.mdx +11 -4
- package/docs/content/extensions.mdx +39 -33
- package/docs/content/recurring-jobs.mdx +41 -19
- package/docs/content/template-dispatch-operations.mdx +19 -7
- package/package.json +4 -2
- package/src/a2a/types.ts +6 -0
- package/src/action.ts +68 -0
- package/src/agent/engine/builder-engine.ts +8 -4
- package/src/agent/production-agent.ts +175 -100
- package/src/agent/tool-search.ts +36 -0
- package/src/automations/service.ts +506 -0
- package/src/browser-context/index.ts +392 -0
- package/src/client/AgentPanel.tsx +2 -1
- package/src/client/FeedbackButton.tsx +37 -4
- package/src/client/MultiTabAssistantChat.tsx +21 -0
- package/src/client/agent-chat.ts +31 -3
- package/src/client/agent-page/AgentJobsTab.tsx +438 -310
- package/src/client/agent-page/AgentTabsPage.tsx +4 -4
- package/src/client/agent-page/use-jobs.ts +7 -0
- package/src/client/analytics-session.ts +13 -0
- package/src/client/extensions/ExtensionViewer.tsx +67 -0
- package/src/client/settings/AutomationsSection.tsx +27 -499
- package/src/client/settings/SettingsPanel.tsx +32 -11
- package/src/client/settings/index.ts +2 -0
- package/src/client/use-agent-chat.ts +35 -3
- package/src/client/use-chat-threads.ts +8 -25
- package/src/deploy/build.ts +2 -0
- package/src/deploy/workspace-deploy.ts +2 -0
- package/src/extensions/actions.ts +115 -3
- package/src/extensions/fetch-tool.ts +11 -0
- package/src/extensions/routes.ts +16 -1
- package/src/extensions/web-content.ts +96 -1
- package/src/integrations/computer-supervision.ts +33 -1
- package/src/integrations/index.ts +6 -0
- package/src/integrations/integration-durable-dispatch-config.ts +10 -0
- package/src/integrations/integration-durable-dispatch.ts +4 -0
- package/src/integrations/plugin.ts +94 -41
- package/src/integrations/remote-browser-actions.ts +621 -0
- package/src/jobs/actions/list-recurring-jobs.ts +5 -7
- package/src/jobs/actions/manage-recurring-job.ts +3 -7
- package/src/jobs/background-automation-runner.ts +437 -0
- package/src/jobs/frontmatter.ts +308 -0
- package/src/jobs/scheduler.ts +89 -598
- package/src/jobs/tools.ts +22 -3
- package/src/localization/default-messages.ts +45 -45
- package/src/mcp-client/index.ts +6 -0
- package/src/notifications/actions.ts +5 -0
- package/src/progress/actions.ts +5 -0
- package/src/provider-api/actions/github-repo-files.ts +11 -0
- package/src/provider-api/actions/provider-api.ts +13 -0
- package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +4 -4
- package/src/server/action-discovery.ts +7 -0
- package/src/server/agent-capabilities.ts +43 -8
- package/src/server/agent-chat/action-filters-a2a.ts +63 -1
- package/src/server/agent-chat/browser-team-tools.ts +126 -3
- package/src/server/agent-chat/framework-prompts.ts +7 -11
- package/src/server/agent-chat/plugin-options.ts +3 -3
- package/src/server/agent-chat/script-entries.ts +52 -1
- package/src/server/agent-chat-plugin.ts +25 -5
- package/src/server/attribution.ts +22 -0
- package/src/server/auth.ts +20 -6
- package/src/server/better-auth-instance.ts +10 -2
- package/src/server/core-routes-plugin.ts +10 -1
- package/src/server/csrf.ts +25 -0
- package/src/server/google-oauth.ts +21 -1
- package/src/server/onboarding-html.ts +18 -0
- package/src/server/prompts/framework-core-compact.ts +3 -3
- package/src/server/prompts/framework-core.ts +3 -3
- package/src/server/prompts/shared-rules.ts +3 -3
- package/src/settings/index.ts +1 -0
- package/src/shared/analytics-anonymous-id.ts +35 -0
- package/src/templates/chat/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/src/templates/chat/app/components/layout/Sidebar.tsx +1 -5
- package/src/templates/chat/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/src/templates/default/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/src/templates/default/app/i18n/ar-SA.ts +26 -0
- package/src/templates/default/app/i18n/de-DE.ts +28 -0
- package/src/templates/default/app/i18n/en-US.ts +27 -0
- package/src/templates/default/app/i18n/es-ES.ts +28 -0
- package/src/templates/default/app/i18n/fr-FR.ts +28 -0
- package/src/templates/default/app/i18n/hi-IN.ts +25 -0
- package/src/templates/default/app/i18n/ja-JP.ts +27 -0
- package/src/templates/default/app/i18n/ko-KR.ts +27 -0
- package/src/templates/default/app/i18n/pt-BR.ts +27 -0
- package/src/templates/default/app/i18n/zh-CN.ts +24 -0
- package/src/templates/default/app/i18n/zh-TW.ts +24 -0
- package/src/templates/headless/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +5 -0
- package/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +10 -7
- package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +53 -8
- package/src/templates/workspace-core/.agents/skills/browser-sessions/SKILL.md +131 -0
- package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +13 -4
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +23 -15
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +33 -18
- package/src/tracking/providers.ts +1 -0
- package/src/tracking/registry.ts +2 -1
- package/src/tracking/types.ts +1 -0
- package/src/triggers/actions/list-automations.ts +43 -44
- package/src/triggers/actions/manage-automation.ts +17 -48
- package/src/triggers/actions.ts +218 -127
- package/src/triggers/dispatcher.ts +181 -367
- package/src/triggers/routes.ts +84 -27
- package/src/triggers/types.ts +9 -23
|
@@ -2,15 +2,12 @@ import { z } from "zod";
|
|
|
2
2
|
import { defineAction } from "../../action.js";
|
|
3
3
|
import { organizationResourceOwner, resourceDelete, resourceGetByPath, resourcePut, } from "../../resources/store.js";
|
|
4
4
|
import { isValidCron, nextOccurrence } from "../cron.js";
|
|
5
|
+
import { classifyJobResource } from "../frontmatter.js";
|
|
5
6
|
import { buildJobContent, parseJobFrontmatter } from "../scheduler.js";
|
|
6
7
|
import { authorizeJobMutation } from "../tools.js";
|
|
7
8
|
const scopeSchema = z.enum(["personal", "organization"]);
|
|
8
|
-
function hasTriggerFrontmatter(content) {
|
|
9
|
-
const header = content.match(/^---\n([\s\S]*?)\n---/m)?.[1] ?? "";
|
|
10
|
-
return /^triggerType\s*:/m.test(header);
|
|
11
|
-
}
|
|
12
9
|
export default defineAction({
|
|
13
|
-
description: "Enable, pause, or delete one recurring cron job from the Agent
|
|
10
|
+
description: "Enable, pause, or delete one legacy recurring cron job from the Agent Automations page.",
|
|
14
11
|
agentTool: false,
|
|
15
12
|
schema: z.object({
|
|
16
13
|
operation: z.enum(["update", "delete"]),
|
|
@@ -36,7 +33,7 @@ export default defineAction({
|
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
35
|
const { meta, body } = parseJobFrontmatter(resource.content);
|
|
39
|
-
if (
|
|
36
|
+
if (classifyJobResource(resource.content).kind === "automation") {
|
|
40
37
|
throw Object.assign(new Error(`Job "${name}" is an automation.`), {
|
|
41
38
|
statusCode: 400,
|
|
42
39
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manage-recurring-job.js","sourceRoot":"","sources":["../../../src/jobs/actions/manage-recurring-job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,iBAAiB,EACjB,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,mB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AAM,CAAC,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;QAExE,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC3B,MAAM,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACjC,CAAC;QAED,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iCAAiC,CAAC,EAAE;gBAChE,UAAU,EAAE,GAAG;aAChB,CAAC,CAAC;QACL,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3D,IAAI,CAAC,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;QAC7D,CAAC;QACD,MAAM,WAAW,CACf,QAAQ,CAAC,KAAK,EACd,QAAQ,CAAC,IAAI,EACb,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,CAC5B,CAAC;QAEF,OAAO;YACL,IAAI;YACJ,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI;SAC9B,CAAC;IACJ,CAAC;CACF,CAAC,CAAC","sourcesContent":["import { z } from \"zod\";\n\nimport { defineAction } from \"../../action.js\";\nimport {\n organizationResourceOwner,\n resourceDelete,\n resourceGetByPath,\n resourcePut,\n} from \"../../resources/store.js\";\nimport { isValidCron, nextOccurrence } from \"../cron.js\";\nimport { classifyJobResource } from \"../frontmatter.js\";\nimport { buildJobContent, parseJobFrontmatter } from \"../scheduler.js\";\nimport { authorizeJobMutation } from \"../tools.js\";\n\nconst scopeSchema = z.enum([\"personal\", \"organization\"]);\n\nexport default defineAction({\n description:\n \"Enable, pause, or delete one legacy recurring cron job from the Agent Automations page.\",\n agentTool: false,\n schema: z.object({\n operation: z.enum([\"update\", \"delete\"]),\n name: z.string().min(1),\n scope: scopeSchema.default(\"personal\"),\n enabled: z.boolean().optional(),\n }),\n run: async ({ operation, name, scope, enabled }, ctx) => {\n const userEmail = ctx?.userEmail;\n if (!userEmail) throw new Error(\"Not authenticated.\");\n if (scope === \"organization\" && !ctx?.orgId) {\n throw new Error(\"An organization is required for organization jobs.\");\n }\n\n const owner =\n scope === \"organization\"\n ? organizationResourceOwner(ctx.orgId as string)\n : userEmail;\n const path = `jobs/${name}.md`;\n const resource = await resourceGetByPath(owner, path);\n if (!resource) {\n throw Object.assign(new Error(`Job \"${name}\" not found.`), {\n statusCode: 404,\n });\n }\n\n const { meta, body } = parseJobFrontmatter(resource.content);\n if (classifyJobResource(resource.content).kind === \"automation\") {\n throw Object.assign(new Error(`Job \"${name}\" is an automation.`), {\n statusCode: 400,\n });\n }\n const denied = await authorizeJobMutation(resource.owner, meta);\n if (denied) throw Object.assign(new Error(denied), { statusCode: 403 });\n\n if (operation === \"delete\") {\n await resourceDelete(resource.id);\n return { deleted: true, name };\n }\n\n if (enabled === undefined) {\n throw Object.assign(new Error(\"enabled is required for update.\"), {\n statusCode: 400,\n });\n }\n meta.enabled = enabled;\n if (enabled && meta.schedule && isValidCron(meta.schedule)) {\n meta.nextRun = nextOccurrence(meta.schedule).toISOString();\n }\n await resourcePut(\n resource.owner,\n resource.path,\n buildJobContent(meta, body),\n );\n\n return {\n name,\n enabled: meta.enabled,\n nextRun: meta.nextRun ?? null,\n };\n },\n});\n"]}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ActionAutomationContext, ActionCaller } from "../action.js";
|
|
2
|
+
import type { AgentEngine } from "../agent/engine/types.js";
|
|
3
|
+
import { type ActionEntry } from "../agent/production-agent.js";
|
|
4
|
+
import { type AutomationExecutionIdentity } from "../automations/service.js";
|
|
5
|
+
import { type Resource } from "../resources/store.js";
|
|
6
|
+
import { type RequestContext } from "../server/request-context.js";
|
|
7
|
+
import type { JobFrontmatter } from "./frontmatter.js";
|
|
8
|
+
export interface BackgroundAutomationContext {
|
|
9
|
+
name: string;
|
|
10
|
+
meta: JobFrontmatter;
|
|
11
|
+
body: string;
|
|
12
|
+
resource: Resource;
|
|
13
|
+
}
|
|
14
|
+
export interface BackgroundAutomationDeps {
|
|
15
|
+
getActions: (automation?: BackgroundAutomationContext) => Record<string, ActionEntry>;
|
|
16
|
+
getSystemPrompt: (owner: string) => Promise<string>;
|
|
17
|
+
getInitialToolNames?: (automation?: BackgroundAutomationContext) => string[] | undefined;
|
|
18
|
+
engine?: AgentEngine;
|
|
19
|
+
apiKey?: string;
|
|
20
|
+
model?: string;
|
|
21
|
+
appId?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface BackgroundAutomationRunOptions {
|
|
24
|
+
automation: BackgroundAutomationContext;
|
|
25
|
+
ownerEmail: string;
|
|
26
|
+
orgId?: string;
|
|
27
|
+
prompt: string;
|
|
28
|
+
threadTitle: string;
|
|
29
|
+
runIdPrefix: string;
|
|
30
|
+
usageLabel: string;
|
|
31
|
+
usageRefId?: string;
|
|
32
|
+
requestContext?: Omit<RequestContext, "userEmail" | "orgId">;
|
|
33
|
+
actionCaller?: ActionCaller;
|
|
34
|
+
actionAutomation?: ActionAutomationContext;
|
|
35
|
+
}
|
|
36
|
+
export interface BackgroundAutomationRunResult {
|
|
37
|
+
responseText: string;
|
|
38
|
+
runId: string;
|
|
39
|
+
}
|
|
40
|
+
export type AutomationIdentityValidation = {
|
|
41
|
+
ok: true;
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
reason: string;
|
|
45
|
+
};
|
|
46
|
+
export type BackgroundAutomationIdentityResult = {
|
|
47
|
+
ok: true;
|
|
48
|
+
identity: AutomationExecutionIdentity;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
reason: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* A persisted background run must not outlive its execution identity.
|
|
55
|
+
* Organization runs fail closed when membership state cannot be read. A
|
|
56
|
+
* brand-new personal install without auth tables remains a distinct
|
|
57
|
+
* not-applicable case so local/CLI jobs keep working before auth is configured.
|
|
58
|
+
*/
|
|
59
|
+
export declare function validateAutomationRunIdentity(ownerEmail: string, orgId?: string): Promise<AutomationIdentityValidation>;
|
|
60
|
+
export declare function resolveBackgroundAutomationIdentity(automation: BackgroundAutomationContext): Promise<BackgroundAutomationIdentityResult>;
|
|
61
|
+
export declare function isBackgroundAutomationRunActive(meta: Pick<JobFrontmatter, "lastRun" | "lastStatus">, now?: Date): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* A soft-timeout/no-progress checkpoint is a continuation boundary, not a
|
|
64
|
+
* successful finish. Only the last terminal event decides whether an
|
|
65
|
+
* in-invocation resume recovered from the boundary.
|
|
66
|
+
*/
|
|
67
|
+
export declare function backgroundRunCutOffReason(run: {
|
|
68
|
+
events?: readonly {
|
|
69
|
+
event: {
|
|
70
|
+
type: string;
|
|
71
|
+
reason?: string;
|
|
72
|
+
};
|
|
73
|
+
}[];
|
|
74
|
+
}): string | null;
|
|
75
|
+
export declare function runBackgroundAutomation(options: BackgroundAutomationRunOptions, deps: BackgroundAutomationDeps): Promise<BackgroundAutomationRunResult>;
|
|
76
|
+
//# sourceMappingURL=background-automation-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background-automation-runner.d.ts","sourceRoot":"","sources":["../../src/jobs/background-automation-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAM1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAItC,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,2BAA2B,CAA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AAW,6BAA6B;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,4BAA4B,GACpC;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC,MAAM,MAAM,kCAAkC,GAC1C;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,2BAA2B,CAAA;CAAE,GACnD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAElC;;;;;GAKG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,4BAA4B,CAAC,CA0DvC;AAED,wBAAsB,mCAAmC,CACvD,UAAU,EAAE,2BAA2B,GACtC,OAAO,CAAC,kCAAkC,CAAC,CAgC7C;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,YAAY,CAAC,EACpD,GAAG,OAAa,GACf,OAAO,CAQT;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE;IAC7C,MAAM,CAAC,EAAE,SAAS;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,EAAE,CAAC;CAClE,GAAG,MAAM,GAAG,IAAI,CAYhB;AAwBD,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,EACvC,IAAI,EAAE,wBAAwB,GAC7B,OAAO,CAAC,6BAA6B,CAAC,CA2LxC"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { collectFinalResponseTextFromAgentEvents } from "../a2a/response-text.js";
|
|
2
|
+
import { getStoredModelForEngine, normalizeModelForEngine, resolveEngine, } from "../agent/engine/index.js";
|
|
3
|
+
import { actionsToEngineTools, filterInitialEngineTools, getOwnerActiveApiKey, } from "../agent/production-agent.js";
|
|
4
|
+
import { runAgentLoopDirectWithSoftTimeout } from "../agent/run-loop-with-resume.js";
|
|
5
|
+
import { resolveRunSoftTimeoutMs, startRun } from "../agent/run-manager.js";
|
|
6
|
+
import { attachToolSearch } from "../agent/tool-search.js";
|
|
7
|
+
import { resolveAutomationExecutionIdentity, } from "../automations/service.js";
|
|
8
|
+
import { createThread } from "../chat-threads/store.js";
|
|
9
|
+
import { queryOrgMembers } from "../org/context.js";
|
|
10
|
+
import { organizationIdFromResourceOwner, } from "../resources/store.js";
|
|
11
|
+
import { runWithRequestContext, } from "../server/request-context.js";
|
|
12
|
+
const BACKGROUND_RUN_STUCK_MS = 10 * 60_000;
|
|
13
|
+
const BACKGROUND_RUN_HARD_TIMEOUT_MS = 5 * 60_000;
|
|
14
|
+
/**
|
|
15
|
+
* A persisted background run must not outlive its execution identity.
|
|
16
|
+
* Organization runs fail closed when membership state cannot be read. A
|
|
17
|
+
* brand-new personal install without auth tables remains a distinct
|
|
18
|
+
* not-applicable case so local/CLI jobs keep working before auth is configured.
|
|
19
|
+
*/
|
|
20
|
+
export async function validateAutomationRunIdentity(ownerEmail, orgId) {
|
|
21
|
+
if (ownerEmail === "__shared__" ||
|
|
22
|
+
organizationIdFromResourceOwner(ownerEmail)) {
|
|
23
|
+
return { ok: true };
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const { getDbExec } = await import("../db/client.js");
|
|
27
|
+
const userResult = await getDbExec().execute({
|
|
28
|
+
sql: `SELECT 1 FROM "user" WHERE email = ? LIMIT 1`,
|
|
29
|
+
args: [ownerEmail],
|
|
30
|
+
});
|
|
31
|
+
if (!userResult.rows || userResult.rows.length === 0) {
|
|
32
|
+
return { ok: false, reason: `user "${ownerEmail}" no longer exists` };
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
const message = error instanceof Error ? error.message.toLowerCase() : String(error);
|
|
37
|
+
const authTablesAreUnconfigured = !orgId &&
|
|
38
|
+
(message.includes("does not exist") ||
|
|
39
|
+
message.includes("no such table") ||
|
|
40
|
+
message.includes("undefined table"));
|
|
41
|
+
if (authTablesAreUnconfigured)
|
|
42
|
+
return { ok: true };
|
|
43
|
+
return {
|
|
44
|
+
ok: false,
|
|
45
|
+
reason: `could not verify user "${ownerEmail}" for this run`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (!orgId)
|
|
49
|
+
return { ok: true };
|
|
50
|
+
try {
|
|
51
|
+
const memberRows = await queryOrgMembers({
|
|
52
|
+
sql: `SELECT 1 FROM org_members WHERE org_id = ? AND LOWER(email) = LOWER(?) LIMIT 1`,
|
|
53
|
+
args: [orgId, ownerEmail],
|
|
54
|
+
});
|
|
55
|
+
if (memberRows === null) {
|
|
56
|
+
return {
|
|
57
|
+
ok: false,
|
|
58
|
+
reason: `could not verify membership in org "${orgId}"`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (memberRows.length === 0) {
|
|
62
|
+
return {
|
|
63
|
+
ok: false,
|
|
64
|
+
reason: `user "${ownerEmail}" is no longer a member of org "${orgId}"`,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
return { ok: true };
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return {
|
|
71
|
+
ok: false,
|
|
72
|
+
reason: `could not verify membership in org "${orgId}"`,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
export async function resolveBackgroundAutomationIdentity(automation) {
|
|
77
|
+
if (automation.meta.triggerType) {
|
|
78
|
+
try {
|
|
79
|
+
return await resolveAutomationExecutionIdentity(automation.resource.owner, automation.meta);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return {
|
|
83
|
+
ok: false,
|
|
84
|
+
reason: "Could not verify the automation execution identity.",
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
const effectiveRunAs = automation.meta.runAs ?? "creator";
|
|
89
|
+
const userEmail = effectiveRunAs === "creator"
|
|
90
|
+
? automation.meta.createdBy || automation.resource.owner
|
|
91
|
+
: automation.resource.owner;
|
|
92
|
+
const orgId = automation.meta.orgId ?? undefined;
|
|
93
|
+
const validity = await validateAutomationRunIdentity(userEmail, orgId);
|
|
94
|
+
return validity.ok
|
|
95
|
+
? {
|
|
96
|
+
ok: true,
|
|
97
|
+
identity: {
|
|
98
|
+
userEmail,
|
|
99
|
+
orgId,
|
|
100
|
+
eventOwner: userEmail.toLowerCase(),
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
: validity;
|
|
104
|
+
}
|
|
105
|
+
export function isBackgroundAutomationRunActive(meta, now = new Date()) {
|
|
106
|
+
if (meta.lastStatus !== "running")
|
|
107
|
+
return false;
|
|
108
|
+
if (!meta.lastRun)
|
|
109
|
+
return false;
|
|
110
|
+
const startedAt = new Date(meta.lastRun).getTime();
|
|
111
|
+
return (Number.isFinite(startedAt) &&
|
|
112
|
+
now.getTime() - startedAt < BACKGROUND_RUN_STUCK_MS);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* A soft-timeout/no-progress checkpoint is a continuation boundary, not a
|
|
116
|
+
* successful finish. Only the last terminal event decides whether an
|
|
117
|
+
* in-invocation resume recovered from the boundary.
|
|
118
|
+
*/
|
|
119
|
+
export function backgroundRunCutOffReason(run) {
|
|
120
|
+
const events = run.events ?? [];
|
|
121
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
122
|
+
const event = events[i].event;
|
|
123
|
+
if (event.type === "auto_continue") {
|
|
124
|
+
return event.reason === "run_timeout" || event.reason === "no_progress"
|
|
125
|
+
? event.reason
|
|
126
|
+
: null;
|
|
127
|
+
}
|
|
128
|
+
if (event.type === "done" || event.type === "error")
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
function uniqueToolNames(names) {
|
|
134
|
+
return [...new Set(names)];
|
|
135
|
+
}
|
|
136
|
+
function assertRequestedMcpToolsAvailable(automation, actions) {
|
|
137
|
+
const requested = automation.meta.mcpTools ?? [];
|
|
138
|
+
const missing = requested.filter((toolName) => !actions[toolName]);
|
|
139
|
+
if (missing.length > 0) {
|
|
140
|
+
throw new Error(`Configured MCP tools are unavailable in this run: ${missing.join(", ")}. Reconnect the MCP server or update the automation's capability list.`);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
function createRunId(prefix) {
|
|
144
|
+
const safePrefix = prefix.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
145
|
+
return `${safePrefix}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;
|
|
146
|
+
}
|
|
147
|
+
export async function runBackgroundAutomation(options, deps) {
|
|
148
|
+
const { automation, ownerEmail, orgId, prompt, threadTitle, usageLabel } = options;
|
|
149
|
+
return runWithRequestContext({
|
|
150
|
+
...options.requestContext,
|
|
151
|
+
userEmail: ownerEmail,
|
|
152
|
+
orgId,
|
|
153
|
+
}, async () => {
|
|
154
|
+
const baseActions = deps.getActions(automation);
|
|
155
|
+
assertRequestedMcpToolsAvailable(automation, baseActions);
|
|
156
|
+
const configuredInitialTools = deps.getInitialToolNames?.(automation);
|
|
157
|
+
const initialToolNames = configuredInitialTools
|
|
158
|
+
? uniqueToolNames([
|
|
159
|
+
...configuredInitialTools,
|
|
160
|
+
...(automation.meta.mcpTools ?? []),
|
|
161
|
+
])
|
|
162
|
+
: undefined;
|
|
163
|
+
const actions = initialToolNames
|
|
164
|
+
? attachToolSearch({ ...baseActions })
|
|
165
|
+
: baseActions;
|
|
166
|
+
const availableTools = actionsToEngineTools(actions);
|
|
167
|
+
const tools = filterInitialEngineTools(availableTools, initialToolNames);
|
|
168
|
+
const userApiKey = await getOwnerActiveApiKey(ownerEmail);
|
|
169
|
+
const engine = deps.engine ??
|
|
170
|
+
(await resolveEngine({
|
|
171
|
+
apiKey: userApiKey ?? deps.apiKey,
|
|
172
|
+
appId: deps.appId,
|
|
173
|
+
}));
|
|
174
|
+
const modelCandidate = automation.meta.model ??
|
|
175
|
+
deps.model ??
|
|
176
|
+
(await getStoredModelForEngine(engine, { appId: deps.appId })) ??
|
|
177
|
+
engine.defaultModel;
|
|
178
|
+
const model = normalizeModelForEngine(engine, modelCandidate);
|
|
179
|
+
const systemPrompt = await deps.getSystemPrompt(ownerEmail);
|
|
180
|
+
const thread = await createThread(ownerEmail, { title: threadTitle });
|
|
181
|
+
const runId = createRunId(options.runIdPrefix);
|
|
182
|
+
const softTimeoutMs = resolveRunSoftTimeoutMs(undefined, {
|
|
183
|
+
useHostedDefault: true,
|
|
184
|
+
});
|
|
185
|
+
const usageRef = { current: null };
|
|
186
|
+
let responseText = "";
|
|
187
|
+
let hardAbortTimer = null;
|
|
188
|
+
await new Promise((resolve, reject) => {
|
|
189
|
+
const activeRun = startRun(runId, thread.id, async (send, signal) => {
|
|
190
|
+
usageRef.current = await runAgentLoopDirectWithSoftTimeout({
|
|
191
|
+
engine,
|
|
192
|
+
model,
|
|
193
|
+
systemPrompt,
|
|
194
|
+
tools,
|
|
195
|
+
availableTools,
|
|
196
|
+
messages: [
|
|
197
|
+
{
|
|
198
|
+
role: "user",
|
|
199
|
+
content: [{ type: "text", text: prompt }],
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
actions,
|
|
203
|
+
send,
|
|
204
|
+
signal,
|
|
205
|
+
threadId: thread.id,
|
|
206
|
+
ownerEmail,
|
|
207
|
+
orgId,
|
|
208
|
+
actionCaller: options.actionCaller,
|
|
209
|
+
automation: options.actionAutomation,
|
|
210
|
+
runId,
|
|
211
|
+
}, softTimeoutMs);
|
|
212
|
+
}, async (run) => {
|
|
213
|
+
if (hardAbortTimer) {
|
|
214
|
+
clearTimeout(hardAbortTimer);
|
|
215
|
+
hardAbortTimer = null;
|
|
216
|
+
}
|
|
217
|
+
const cutOffReason = backgroundRunCutOffReason(run);
|
|
218
|
+
if (cutOffReason) {
|
|
219
|
+
reject(new Error(`Background automation was cut off before finishing (${cutOffReason})`));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (run.status !== "completed") {
|
|
223
|
+
reject(new Error(`Background automation ended with status: ${run.status}`));
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
responseText = collectFinalResponseTextFromAgentEvents((run.events ?? []).map((entry) => entry.event));
|
|
227
|
+
resolve();
|
|
228
|
+
}, {
|
|
229
|
+
softTimeoutMs,
|
|
230
|
+
dispatchMode: "background",
|
|
231
|
+
model,
|
|
232
|
+
engineName: engine.name,
|
|
233
|
+
});
|
|
234
|
+
hardAbortTimer = setTimeout(() => {
|
|
235
|
+
hardAbortTimer = null;
|
|
236
|
+
if (activeRun.status === "running") {
|
|
237
|
+
activeRun.abort.abort("background_automation_hard_timeout");
|
|
238
|
+
reject(new Error("Background automation timed out after 5 minutes"));
|
|
239
|
+
}
|
|
240
|
+
}, BACKGROUND_RUN_HARD_TIMEOUT_MS);
|
|
241
|
+
}).finally(() => {
|
|
242
|
+
if (hardAbortTimer) {
|
|
243
|
+
clearTimeout(hardAbortTimer);
|
|
244
|
+
hardAbortTimer = null;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
const usage = usageRef.current;
|
|
248
|
+
if (usage &&
|
|
249
|
+
(usage.inputTokens > 0 ||
|
|
250
|
+
usage.outputTokens > 0 ||
|
|
251
|
+
usage.cacheReadTokens > 0 ||
|
|
252
|
+
usage.cacheWriteTokens > 0)) {
|
|
253
|
+
try {
|
|
254
|
+
const { recordUsage } = await import("../usage/store.js");
|
|
255
|
+
await recordUsage({
|
|
256
|
+
ownerEmail,
|
|
257
|
+
inputTokens: usage.inputTokens,
|
|
258
|
+
outputTokens: usage.outputTokens,
|
|
259
|
+
cacheReadTokens: usage.cacheReadTokens,
|
|
260
|
+
cacheWriteTokens: usage.cacheWriteTokens,
|
|
261
|
+
model: usage.model,
|
|
262
|
+
label: usageLabel,
|
|
263
|
+
app: deps.appId,
|
|
264
|
+
refId: options.usageRefId ?? runId,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
// Usage attribution must not break an otherwise successful run.
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (responseText.trim() &&
|
|
272
|
+
automation.meta.deliveryPlatform &&
|
|
273
|
+
automation.meta.deliveryDestination) {
|
|
274
|
+
const { getDefaultAdapter } = await import("../integrations/adapters/index.js");
|
|
275
|
+
const adapter = getDefaultAdapter(automation.meta.deliveryPlatform);
|
|
276
|
+
if (!adapter?.sendMessageToTarget) {
|
|
277
|
+
throw new Error(`Automation delivery is not supported for ${automation.meta.deliveryPlatform}`);
|
|
278
|
+
}
|
|
279
|
+
await adapter.sendMessageToTarget(adapter.formatAgentResponse(responseText), {
|
|
280
|
+
destination: automation.meta.deliveryDestination,
|
|
281
|
+
threadRef: automation.meta.deliveryThreadRef ?? null,
|
|
282
|
+
tenantId: automation.meta.deliveryTenantId,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
return { responseText, runId };
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
//# sourceMappingURL=background-automation-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background-automation-runner.js","sourceRoot":"","sources":["../../src/jobs/background-automation-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,yBAAyB,CAAC;AAElF,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,aAAa,GACd,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,GAGrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AACrF,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OA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EAAE;YACnB,UAAU,CAAC,IAAI,CAAC,gBAAgB;YAChC,UAAU,CAAC,IAAI,CAAC,mBAAmB,EACnC,CAAC;YACD,MAAM,EAAE,iBAAiB,EAAE,GACzB,MAAM,MAAM,CAAC,mCAAmC,CAAC,CAAC;YACpD,MAAM,OAAO,GAAG,iBAAiB,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;YACpE,IAAI,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC;gBAClC,MAAM,IAAI,KAAK,CACb,4CAA4C,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAC/E,CAAC;YACJ,CAAC;YACD,MAAM,OAAO,CAAC,mBAAmB,CAC/B,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,EACzC;gBACE,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,mBAAmB;gBAChD,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,iBAAiB,IAAI,IAAI;gBACpD,QAAQ,EAAE,UAAU,CAAC,IAAI,CAAC,gBAAgB;aAC3C,CACF,CAAC;QACJ,CAAC;QAED,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;IACjC,CAAC,CACF,CAAC;AACJ,CAAC","sourcesContent":["import { collectFinalResponseTextFromAgentEvents } from \"../a2a/response-text.js\";\nimport type { ActionAutomationContext, ActionCaller } from \"../action.js\";\nimport {\n getStoredModelForEngine,\n normalizeModelForEngine,\n resolveEngine,\n} from \"../agent/engine/index.js\";\nimport type { AgentEngine } from \"../agent/engine/types.js\";\nimport {\n actionsToEngineTools,\n filterInitialEngineTools,\n getOwnerActiveApiKey,\n runAgentLoop,\n type ActionEntry,\n} from \"../agent/production-agent.js\";\nimport { runAgentLoopDirectWithSoftTimeout } from \"../agent/run-loop-with-resume.js\";\nimport { resolveRunSoftTimeoutMs, startRun } from \"../agent/run-manager.js\";\nimport { attachToolSearch } from \"../agent/tool-search.js\";\nimport {\n resolveAutomationExecutionIdentity,\n type AutomationExecutionIdentity,\n} from \"../automations/service.js\";\nimport { createThread } from \"../chat-threads/store.js\";\nimport { queryOrgMembers } from \"../org/context.js\";\nimport {\n organizationIdFromResourceOwner,\n type Resource,\n} from \"../resources/store.js\";\nimport {\n runWithRequestContext,\n type RequestContext,\n} from \"../server/request-context.js\";\nimport type { JobFrontmatter } from \"./frontmatter.js\";\n\nconst BACKGROUND_RUN_STUCK_MS = 10 * 60_000;\nconst BACKGROUND_RUN_HARD_TIMEOUT_MS = 5 * 60_000;\n\nexport interface BackgroundAutomationContext {\n name: string;\n meta: JobFrontmatter;\n body: string;\n resource: Resource;\n}\n\nexport interface BackgroundAutomationDeps {\n getActions: (\n automation?: BackgroundAutomationContext,\n ) => Record<string, ActionEntry>;\n getSystemPrompt: (owner: string) => Promise<string>;\n getInitialToolNames?: (\n automation?: BackgroundAutomationContext,\n ) => string[] | undefined;\n engine?: AgentEngine;\n apiKey?: string;\n model?: string;\n appId?: string;\n}\n\nexport interface BackgroundAutomationRunOptions {\n automation: BackgroundAutomationContext;\n ownerEmail: string;\n orgId?: string;\n prompt: string;\n threadTitle: string;\n runIdPrefix: string;\n usageLabel: string;\n usageRefId?: string;\n requestContext?: Omit<RequestContext, \"userEmail\" | \"orgId\">;\n actionCaller?: ActionCaller;\n actionAutomation?: ActionAutomationContext;\n}\n\nexport interface BackgroundAutomationRunResult {\n responseText: string;\n runId: string;\n}\n\nexport type AutomationIdentityValidation =\n | { ok: true }\n | { ok: false; reason: string };\n\nexport type BackgroundAutomationIdentityResult =\n | { ok: true; identity: AutomationExecutionIdentity }\n | { ok: false; reason: string };\n\n/**\n * A persisted background run must not outlive its execution identity.\n * Organization runs fail closed when membership state cannot be read. A\n * brand-new personal install without auth tables remains a distinct\n * not-applicable case so local/CLI jobs keep working before auth is configured.\n */\nexport async function validateAutomationRunIdentity(\n ownerEmail: string,\n orgId?: string,\n): Promise<AutomationIdentityValidation> {\n if (\n ownerEmail === \"__shared__\" ||\n organizationIdFromResourceOwner(ownerEmail)\n ) {\n return { ok: true };\n }\n\n try {\n const { getDbExec } = await import(\"../db/client.js\");\n const userResult = await getDbExec().execute({\n sql: `SELECT 1 FROM \"user\" WHERE email = ? LIMIT 1`,\n args: [ownerEmail],\n });\n if (!userResult.rows || userResult.rows.length === 0) {\n return { ok: false, reason: `user \"${ownerEmail}\" no longer exists` };\n }\n } catch (error) {\n const message =\n error instanceof Error ? error.message.toLowerCase() : String(error);\n const authTablesAreUnconfigured =\n !orgId &&\n (message.includes(\"does not exist\") ||\n message.includes(\"no such table\") ||\n message.includes(\"undefined table\"));\n if (authTablesAreUnconfigured) return { ok: true };\n return {\n ok: false,\n reason: `could not verify user \"${ownerEmail}\" for this run`,\n };\n }\n\n if (!orgId) return { ok: true };\n\n try {\n const memberRows = await queryOrgMembers({\n sql: `SELECT 1 FROM org_members WHERE org_id = ? AND LOWER(email) = LOWER(?) LIMIT 1`,\n args: [orgId, ownerEmail],\n });\n if (memberRows === null) {\n return {\n ok: false,\n reason: `could not verify membership in org \"${orgId}\"`,\n };\n }\n if (memberRows.length === 0) {\n return {\n ok: false,\n reason: `user \"${ownerEmail}\" is no longer a member of org \"${orgId}\"`,\n };\n }\n return { ok: true };\n } catch {\n return {\n ok: false,\n reason: `could not verify membership in org \"${orgId}\"`,\n };\n }\n}\n\nexport async function resolveBackgroundAutomationIdentity(\n automation: BackgroundAutomationContext,\n): Promise<BackgroundAutomationIdentityResult> {\n if (automation.meta.triggerType) {\n try {\n return await resolveAutomationExecutionIdentity(\n automation.resource.owner,\n automation.meta,\n );\n } catch {\n return {\n ok: false,\n reason: \"Could not verify the automation execution identity.\",\n };\n }\n }\n\n const effectiveRunAs = automation.meta.runAs ?? \"creator\";\n const userEmail =\n effectiveRunAs === \"creator\"\n ? automation.meta.createdBy || automation.resource.owner\n : automation.resource.owner;\n const orgId = automation.meta.orgId ?? undefined;\n const validity = await validateAutomationRunIdentity(userEmail, orgId);\n return validity.ok\n ? {\n ok: true,\n identity: {\n userEmail,\n orgId,\n eventOwner: userEmail.toLowerCase(),\n },\n }\n : validity;\n}\n\nexport function isBackgroundAutomationRunActive(\n meta: Pick<JobFrontmatter, \"lastRun\" | \"lastStatus\">,\n now = new Date(),\n): boolean {\n if (meta.lastStatus !== \"running\") return false;\n if (!meta.lastRun) return false;\n const startedAt = new Date(meta.lastRun).getTime();\n return (\n Number.isFinite(startedAt) &&\n now.getTime() - startedAt < BACKGROUND_RUN_STUCK_MS\n );\n}\n\n/**\n * A soft-timeout/no-progress checkpoint is a continuation boundary, not a\n * successful finish. Only the last terminal event decides whether an\n * in-invocation resume recovered from the boundary.\n */\nexport function backgroundRunCutOffReason(run: {\n events?: readonly { event: { type: string; reason?: string } }[];\n}): string | null {\n const events = run.events ?? [];\n for (let i = events.length - 1; i >= 0; i--) {\n const event = events[i].event;\n if (event.type === \"auto_continue\") {\n return event.reason === \"run_timeout\" || event.reason === \"no_progress\"\n ? event.reason\n : null;\n }\n if (event.type === \"done\" || event.type === \"error\") return null;\n }\n return null;\n}\n\nfunction uniqueToolNames(names: readonly string[]): string[] {\n return [...new Set(names)];\n}\n\nfunction assertRequestedMcpToolsAvailable(\n automation: BackgroundAutomationContext,\n actions: Record<string, ActionEntry>,\n): void {\n const requested = automation.meta.mcpTools ?? [];\n const missing = requested.filter((toolName) => !actions[toolName]);\n if (missing.length > 0) {\n throw new Error(\n `Configured MCP tools are unavailable in this run: ${missing.join(\", \")}. Reconnect the MCP server or update the automation's capability list.`,\n );\n }\n}\n\nfunction createRunId(prefix: string): string {\n const safePrefix = prefix.replace(/[^a-zA-Z0-9._-]/g, \"-\");\n return `${safePrefix}-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`;\n}\n\nexport async function runBackgroundAutomation(\n options: BackgroundAutomationRunOptions,\n deps: BackgroundAutomationDeps,\n): Promise<BackgroundAutomationRunResult> {\n const { automation, ownerEmail, orgId, prompt, threadTitle, usageLabel } =\n options;\n\n return runWithRequestContext(\n {\n ...options.requestContext,\n userEmail: ownerEmail,\n orgId,\n },\n async () => {\n const baseActions = deps.getActions(automation);\n assertRequestedMcpToolsAvailable(automation, baseActions);\n\n const configuredInitialTools = deps.getInitialToolNames?.(automation);\n const initialToolNames = configuredInitialTools\n ? uniqueToolNames([\n ...configuredInitialTools,\n ...(automation.meta.mcpTools ?? []),\n ])\n : undefined;\n const actions = initialToolNames\n ? attachToolSearch({ ...baseActions })\n : baseActions;\n const availableTools = actionsToEngineTools(actions);\n const tools = filterInitialEngineTools(availableTools, initialToolNames);\n\n const userApiKey = await getOwnerActiveApiKey(ownerEmail);\n const engine =\n deps.engine ??\n (await resolveEngine({\n apiKey: userApiKey ?? deps.apiKey,\n appId: deps.appId,\n }));\n const modelCandidate =\n automation.meta.model ??\n deps.model ??\n (await getStoredModelForEngine(engine, { appId: deps.appId })) ??\n engine.defaultModel;\n const model = normalizeModelForEngine(engine, modelCandidate);\n const systemPrompt = await deps.getSystemPrompt(ownerEmail);\n const thread = await createThread(ownerEmail, { title: threadTitle });\n const runId = createRunId(options.runIdPrefix);\n const softTimeoutMs = resolveRunSoftTimeoutMs(undefined, {\n useHostedDefault: true,\n });\n\n const usageRef: {\n current: Awaited<ReturnType<typeof runAgentLoop>> | null;\n } = { current: null };\n let responseText = \"\";\n let hardAbortTimer: ReturnType<typeof setTimeout> | null = null;\n\n await new Promise<void>((resolve, reject) => {\n const activeRun = startRun(\n runId,\n thread.id,\n async (send, signal) => {\n usageRef.current = await runAgentLoopDirectWithSoftTimeout(\n {\n engine,\n model,\n systemPrompt,\n tools,\n availableTools,\n messages: [\n {\n role: \"user\",\n content: [{ type: \"text\", text: prompt }],\n },\n ],\n actions,\n send,\n signal,\n threadId: thread.id,\n ownerEmail,\n orgId,\n actionCaller: options.actionCaller,\n automation: options.actionAutomation,\n runId,\n },\n softTimeoutMs,\n );\n },\n async (run) => {\n if (hardAbortTimer) {\n clearTimeout(hardAbortTimer);\n hardAbortTimer = null;\n }\n const cutOffReason = backgroundRunCutOffReason(run);\n if (cutOffReason) {\n reject(\n new Error(\n `Background automation was cut off before finishing (${cutOffReason})`,\n ),\n );\n return;\n }\n if (run.status !== \"completed\") {\n reject(\n new Error(\n `Background automation ended with status: ${run.status}`,\n ),\n );\n return;\n }\n responseText = collectFinalResponseTextFromAgentEvents(\n (run.events ?? []).map((entry) => entry.event),\n );\n resolve();\n },\n {\n softTimeoutMs,\n dispatchMode: \"background\",\n model,\n engineName: engine.name,\n },\n );\n\n hardAbortTimer = setTimeout(() => {\n hardAbortTimer = null;\n if (activeRun.status === \"running\") {\n activeRun.abort.abort(\"background_automation_hard_timeout\");\n reject(\n new Error(\"Background automation timed out after 5 minutes\"),\n );\n }\n }, BACKGROUND_RUN_HARD_TIMEOUT_MS);\n }).finally(() => {\n if (hardAbortTimer) {\n clearTimeout(hardAbortTimer);\n hardAbortTimer = null;\n }\n });\n\n const usage = usageRef.current;\n if (\n usage &&\n (usage.inputTokens > 0 ||\n usage.outputTokens > 0 ||\n usage.cacheReadTokens > 0 ||\n usage.cacheWriteTokens > 0)\n ) {\n try {\n const { recordUsage } = await import(\"../usage/store.js\");\n await recordUsage({\n ownerEmail,\n inputTokens: usage.inputTokens,\n outputTokens: usage.outputTokens,\n cacheReadTokens: usage.cacheReadTokens,\n cacheWriteTokens: usage.cacheWriteTokens,\n model: usage.model,\n label: usageLabel,\n app: deps.appId,\n refId: options.usageRefId ?? runId,\n });\n } catch {\n // Usage attribution must not break an otherwise successful run.\n }\n }\n\n if (\n responseText.trim() &&\n automation.meta.deliveryPlatform &&\n automation.meta.deliveryDestination\n ) {\n const { getDefaultAdapter } =\n await import(\"../integrations/adapters/index.js\");\n const adapter = getDefaultAdapter(automation.meta.deliveryPlatform);\n if (!adapter?.sendMessageToTarget) {\n throw new Error(\n `Automation delivery is not supported for ${automation.meta.deliveryPlatform}`,\n );\n }\n await adapter.sendMessageToTarget(\n adapter.formatAgentResponse(responseText),\n {\n destination: automation.meta.deliveryDestination,\n threadRef: automation.meta.deliveryThreadRef ?? null,\n tenantId: automation.meta.deliveryTenantId,\n },\n );\n }\n\n return { responseText, runId };\n },\n );\n}\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
export type JobLastStatus = "success" | "error" | "running" | "skipped";
|
|
2
|
+
export type JobTriggerType = "schedule" | "event";
|
|
3
|
+
export type JobExecutionMode = "agentic" | "deterministic";
|
|
4
|
+
/**
|
|
5
|
+
* Every persisted field understood by either recurring jobs or automations.
|
|
6
|
+
*
|
|
7
|
+
* Automation-only fields stay optional so legacy recurring jobs can remain
|
|
8
|
+
* distinguishable from explicitly defined schedule automations.
|
|
9
|
+
*/
|
|
10
|
+
export interface JobFrontmatter {
|
|
11
|
+
schedule: string;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
createdBy?: string;
|
|
14
|
+
orgId?: string;
|
|
15
|
+
runAs?: "creator" | "shared";
|
|
16
|
+
lastRun?: string;
|
|
17
|
+
lastStatus?: JobLastStatus;
|
|
18
|
+
lastError?: string;
|
|
19
|
+
nextRun?: string;
|
|
20
|
+
originScopeId?: string;
|
|
21
|
+
deliveryPlatform?: string;
|
|
22
|
+
deliveryDestination?: string;
|
|
23
|
+
deliveryThreadRef?: string;
|
|
24
|
+
deliveryTenantId?: string;
|
|
25
|
+
model?: string;
|
|
26
|
+
/** Explicit MCP tool capabilities available to this background run. */
|
|
27
|
+
mcpTools?: string[];
|
|
28
|
+
/** Present only for resources explicitly defined as automations. */
|
|
29
|
+
triggerType?: JobTriggerType;
|
|
30
|
+
/** For event automations: the event name to subscribe to. */
|
|
31
|
+
event?: string;
|
|
32
|
+
/** Natural-language condition evaluated before dispatch. */
|
|
33
|
+
condition?: string;
|
|
34
|
+
mode?: JobExecutionMode;
|
|
35
|
+
/** Domain tag for filtering in per-template UIs. */
|
|
36
|
+
domain?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Optional application-owned policy id carried into actions by the trusted
|
|
39
|
+
* trigger dispatcher. It is not model-supplied action input.
|
|
40
|
+
*/
|
|
41
|
+
delegatedPolicyId?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface JobResourceClassification {
|
|
44
|
+
kind: "job" | "automation";
|
|
45
|
+
hasExplicitTriggerType: boolean;
|
|
46
|
+
triggerType: JobTriggerType;
|
|
47
|
+
}
|
|
48
|
+
export interface ParsedJobResource {
|
|
49
|
+
meta: JobFrontmatter;
|
|
50
|
+
body: string;
|
|
51
|
+
classification: JobResourceClassification;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Normalize the non-secret MCP capability references persisted with a job.
|
|
55
|
+
* Tool names are opaque framework identifiers; URLs and credentials never
|
|
56
|
+
* belong in job frontmatter.
|
|
57
|
+
*/
|
|
58
|
+
export declare function normalizeJobMcpTools(value: unknown): string[] | undefined;
|
|
59
|
+
export declare function classifyJobFrontmatter(meta: JobFrontmatter): JobResourceClassification;
|
|
60
|
+
export declare function parseJobResource(content: string): ParsedJobResource;
|
|
61
|
+
export declare function classifyJobResource(content: string): JobResourceClassification;
|
|
62
|
+
export declare function buildJobResourceContent(meta: JobFrontmatter, body: string): string;
|
|
63
|
+
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/jobs/frontmatter.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,SAAS,CAAC;AACxE,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,OAAO,CAAC;AAClD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC7B,OAAO,C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