@agent-native/core 0.152.1 → 0.153.1
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 +1 -1
- package/corpus/templates/analytics/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/analytics/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/analytics/.agents/skills/data-querying/SKILL.md +6 -4
- package/corpus/templates/analytics/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/analytics/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/analytics/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/analytics/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/analytics/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/analytics/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/analytics/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/analytics/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/analytics/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/analytics/actions/data-source-status.ts +4 -1
- package/corpus/templates/analytics/actions/migrate-first-party-analytics-to-bigquery.ts +2 -2
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +7 -2
- package/corpus/templates/analytics/app/components/layout/NewDashboardDialog.tsx +7 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +30 -32
- package/corpus/templates/analytics/app/components/layout/layout-route-policy.ts +10 -0
- package/corpus/templates/analytics/app/global.css +5 -1
- package/corpus/templates/analytics/app/lib/data-source-status.ts +3 -3
- package/corpus/templates/analytics/app/lib/resource-access.ts +6 -1
- package/corpus/templates/analytics/app/pages/DataSources.tsx +79 -51
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +1 -0
- package/corpus/templates/analytics/app/pages/analyses/AnalysisDetail.tsx +1 -0
- package/corpus/templates/analytics/changelog/2026-08-12-analytics-sidebar-ask-toggle-and-compact-rail.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-12-data-source-statuses-now-distinguish-workspace-access-from-c.md +6 -0
- package/corpus/templates/analytics/server/jobs/analytics-bigquery-backfill.ts +559 -147
- package/corpus/templates/analytics/server/lib/first-party-analytics-backend.ts +79 -5
- package/corpus/templates/analytics/server/plugins/db.ts +84 -0
- package/corpus/templates/assets/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/assets/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/assets/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/assets/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/assets/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/assets/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/assets/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/assets/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/assets/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/assets/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/assets/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/assets/app/components/asset/AssetPreviewDialog.tsx +13 -5
- package/corpus/templates/assets/app/lib/asset-urls.ts +13 -0
- package/corpus/templates/assets/app/routes/asset.$id.tsx +16 -6
- package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +1 -0
- package/corpus/templates/assets/app/routes/library.tsx +336 -78
- package/corpus/templates/assets/shared/api.ts +1 -1
- package/corpus/templates/brain/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/corpus/templates/brain/.agents/skills/brain/SKILL.md +8 -6
- package/corpus/templates/brain/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/brain/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/brain/.agents/skills/ingestion-and-connectors/SKILL.md +7 -0
- package/corpus/templates/brain/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/brain/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/brain/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/brain/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/brain/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/brain/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/brain/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/brain/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/brain/AGENTS.md +2 -1
- package/corpus/templates/brain/actions/ask-brain.ts +19 -16
- package/corpus/templates/brain/actions/create-source.ts +11 -2
- package/corpus/templates/brain/actions/import-markdown-files.ts +237 -0
- package/corpus/templates/brain/actions/resanitize-captures.ts +3 -1
- package/corpus/templates/brain/actions/test-slack-connection.ts +12 -3
- package/corpus/templates/brain/actions/update-source.ts +10 -1
- package/corpus/templates/brain/app/components/brain/Surface.tsx +1 -11
- package/corpus/templates/brain/app/i18n-data.ts +111 -0
- package/corpus/templates/brain/app/lib/brain.ts +23 -1
- package/corpus/templates/brain/app/routes/knowledge.tsx +0 -2
- package/corpus/templates/brain/app/routes/ops.tsx +0 -2
- package/corpus/templates/brain/app/routes/review.tsx +0 -2
- package/corpus/templates/brain/app/routes/search.tsx +0 -2
- package/corpus/templates/brain/app/routes/sources.tsx +354 -6
- package/corpus/templates/brain/server/lib/brain-response-guard.ts +63 -1
- package/corpus/templates/brain/server/lib/brain.ts +9 -6
- package/corpus/templates/brain/server/lib/connectors.ts +20 -6
- package/corpus/templates/brain/server/lib/search.ts +9 -1
- package/corpus/templates/brain/server/lib/source-credentials.ts +95 -57
- package/corpus/templates/brain/server/plugins/agent-chat.ts +5 -2
- package/corpus/templates/brain/server/plugins/auth.ts +2 -0
- package/corpus/templates/calendar/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/calendar/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/calendar/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/calendar/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/calendar/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/calendar/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/calendar/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/calendar/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/calendar/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/calendar/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/calendar/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/calendar/app/components/calendar/DayView.tsx +3 -2
- package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +3 -2
- package/corpus/templates/calendar/app/lib/event-layout.ts +16 -35
- package/corpus/templates/calendar/app/pages/BookingLinksPage.tsx +1 -0
- package/corpus/templates/chat/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/corpus/templates/chat/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/chat/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/chat/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/chat/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/chat/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/chat/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/chat/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/chat/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/chat/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/chat/AGENTS.md +4 -5
- package/corpus/templates/clips/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/clips/.agents/skills/meetings/SKILL.md +1 -1
- package/corpus/templates/clips/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/clips/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/clips/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/clips/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/clips/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/clips/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/clips/actions/add-comment.ts +1 -2
- package/corpus/templates/clips/actions/delete-comment.ts +2 -0
- package/corpus/templates/clips/actions/get-recording-insights.ts +9 -8
- package/corpus/templates/clips/actions/get-recording-player-data.ts +4 -1
- package/corpus/templates/clips/actions/react-to-comment.ts +1 -1
- package/corpus/templates/clips/actions/react-to-recording.ts +1 -1
- package/corpus/templates/clips/actions/reply-to-comment.ts +1 -1
- package/corpus/templates/clips/actions/resolve-comment.ts +1 -2
- package/corpus/templates/clips/actions/update-comment.ts +1 -1
- package/corpus/templates/clips/app/components/editor/editor-layout.tsx +1 -0
- package/corpus/templates/clips/app/components/editor/thumbnail-picker.tsx +59 -16
- package/corpus/templates/clips/app/components/meetings/share-meeting-dialog.tsx +27 -44
- package/corpus/templates/clips/app/components/player/comments-panel.tsx +88 -39
- package/corpus/templates/clips/app/components/player/share-dialog.tsx +84 -41
- package/corpus/templates/clips/app/components/player/timestamped-comment-button.tsx +3 -1
- package/corpus/templates/clips/app/components/player/video-player.tsx +1 -1
- package/corpus/templates/clips/app/components/sharing/share-ui.tsx +20 -7
- package/corpus/templates/clips/app/i18n/en-US.ts +2 -1
- package/corpus/templates/clips/app/lib/public-meeting.ts +1 -1
- package/corpus/templates/clips/app/lib/thumbnail-capture.ts +71 -0
- package/corpus/templates/clips/app/lib/thumbnail-picker-state.ts +93 -0
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +1 -1
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +25 -19
- package/corpus/templates/clips/app/routes/share.$shareId.tsx +8 -0
- package/corpus/templates/clips/changelog/2026-07-23-meeting-recording-meters-and-dismissed-prompts.md +1 -1
- package/corpus/templates/clips/changelog/2026-08-11-clips-asks-to-take-notes-again-when-you-join-an-adhoc-zoom-o.md +6 -0
- package/corpus/templates/clips/changelog/2026-08-12-viewers-are-read-only-and-commenters-can-comment.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +1 -1
- package/corpus/templates/clips/desktop/src/styles.css +10 -2
- package/corpus/templates/clips/desktop/src-tauri/src/adhoc_meetings_watcher.rs +166 -14
- package/corpus/templates/clips/desktop/src-tauri/src/call_activity.rs +146 -0
- package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +2 -2
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +1 -0
- package/corpus/templates/clips/desktop/src-tauri/src/silence_detector.rs +2 -122
- package/corpus/templates/clips/desktop/src-tauri/src/util.rs +1 -1
- package/corpus/templates/clips/server/lib/recording-page-access.ts +6 -1
- package/corpus/templates/clips/server/routes/api/public-recording.get.ts +5 -0
- package/corpus/templates/clips/shared/share-meta.ts +19 -3
- package/corpus/templates/content/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/content/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/content/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/content/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/content/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/content/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/content/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/content/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/content/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/content/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/content/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/content/actions/_database-utils.ts +10 -0
- package/corpus/templates/content/actions/add-comment.ts +1 -1
- package/corpus/templates/content/actions/attach-content-database-source.ts +158 -61
- package/corpus/templates/content/actions/create-document.ts +1 -0
- package/corpus/templates/content/actions/delete-comment.ts +1 -1
- package/corpus/templates/content/actions/get-document.ts +9 -1
- package/corpus/templates/content/actions/import-content-source.ts +8 -0
- package/corpus/templates/content/actions/list-documents.ts +10 -1
- package/corpus/templates/content/actions/update-comment.ts +1 -1
- package/corpus/templates/content/actions/update-document.ts +11 -0
- package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +52 -29
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +13 -8
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +62 -2
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +163 -53
- package/corpus/templates/content/app/components/editor/database/TimelineView.tsx +16 -0
- package/corpus/templates/content/app/components/editor/database/settings.tsx +22 -13
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +7 -7
- package/corpus/templates/content/app/hooks/use-documents.ts +2 -0
- package/corpus/templates/content/app/i18n-data.ts +10 -0
- package/corpus/templates/content/app/root.tsx +1 -21
- package/corpus/templates/content/changelog/2026-08-05-connect-sources-from-add-column.md +6 -0
- package/corpus/templates/content/changelog/2026-08-12-viewers-are-read-only-and-commenters-can-comment.md +6 -0
- package/corpus/templates/content/shared/api.ts +7 -1
- package/corpus/templates/crm/.agents/skills/actions/SKILL.md +146 -0
- package/corpus/templates/crm/.agents/skills/actions/references/action-fields.md +136 -0
- package/corpus/templates/crm/.agents/skills/actions/references/examples.md +94 -0
- package/corpus/templates/crm/.agents/skills/actions/references/provider-apis.md +95 -0
- package/corpus/templates/crm/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/crm/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/crm/.agents/skills/delegate-to-agent/SKILL.md +289 -0
- package/corpus/templates/crm/.agents/skills/frontend-design/SKILL.md +296 -0
- package/corpus/templates/crm/.agents/skills/frontend-design/references/visual-direction.md +99 -0
- package/corpus/templates/crm/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/crm/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/crm/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/crm/.agents/skills/security/SKILL.md +324 -0
- package/corpus/templates/crm/.agents/skills/self-modifying-code/SKILL.md +123 -0
- package/corpus/templates/crm/.agents/skills/shadcn-ui/SKILL.md +123 -0
- package/corpus/templates/crm/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/crm/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/crm/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/crm/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/crm/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/design/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/design/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/design/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/design/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/design/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/design/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/design/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/design/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/design/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/design/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/design/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/design/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/design/actions/index-design-system-with-builder.ts +16 -2
- package/corpus/templates/design/app/components/design-system/ProductionDesignSystemShowcase.tsx +6 -18
- package/corpus/templates/design/app/i18n/en-US.ts +1 -1
- package/corpus/templates/design/app/i18n-data.ts +40 -0
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +153 -131
- package/corpus/templates/design/app/pages/DesignSystems.tsx +7 -61
- package/corpus/templates/design/app/pages/Present.tsx +8 -2
- package/corpus/templates/design/app/pages/Templates.tsx +1 -0
- package/corpus/templates/design/app/pages/design-editor/tool-state.ts +4 -1
- package/corpus/templates/design/app/pages/design-editor/types.ts +6 -1
- package/corpus/templates/design/changelog/2026-08-12-viewers-are-read-only-and-commenters-can-comment.md +6 -0
- package/corpus/templates/dispatch/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/dispatch/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/dispatch/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/dispatch/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/dispatch/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/dispatch/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/dispatch/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/dispatch/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/dispatch/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/dispatch/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/dispatch/actions/apply-workspace-connection-setup.ts +97 -15
- package/corpus/templates/dispatch/actions/connection-permissions.ts +77 -0
- package/corpus/templates/dispatch/actions/delete-workspace-connection.ts +12 -2
- package/corpus/templates/dispatch/actions/list-workspace-user-groups.ts +19 -0
- package/corpus/templates/dispatch/actions/plan-workspace-connection-setup.ts +9 -2
- package/corpus/templates/dispatch/actions/set-workspace-connection-grant.ts +21 -2
- package/corpus/templates/dispatch/actions/upsert-workspace-connection.ts +66 -1
- package/corpus/templates/dispatch/actions/upsert-workspace-user-group.ts +27 -0
- package/corpus/templates/dispatch/app/chat-first-pages.ts +84 -0
- package/corpus/templates/dispatch/app/i18n-data.ts +3989 -3527
- package/corpus/templates/dispatch/app/routes/integrations.tsx +1568 -685
- package/corpus/templates/dispatch/app/routes/settings.tsx +14 -9
- package/corpus/templates/dispatch/changelog/2026-08-12-search-and-pin-workspace-apps-from-the-app-catalog.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-12-workspace-integration-access-now-shows-exactly-which-apps-ca.md +6 -0
- package/corpus/templates/dispatch/server/lib/app-roles.ts +5 -0
- package/corpus/templates/dispatch/shared/app-roles.ts +1 -0
- package/corpus/templates/factory/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/corpus/templates/factory/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/factory/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/factory/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/factory/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/factory/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/factory/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/factory/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/factory/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/factory/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/factory/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/factory/AGENTS.md +10 -1
- package/corpus/templates/factory/README.md +18 -7
- package/corpus/templates/factory/actions/list-triage-items.ts +10 -4
- package/corpus/templates/factory/actions/poll-github-sources.ts +53 -14
- package/corpus/templates/factory/actions/poll-sentry-errors.ts +31 -13
- package/corpus/templates/factory/actions/poll-slack-channel.ts +41 -5
- package/corpus/templates/factory/actions/provider-api-catalog.ts +13 -0
- package/corpus/templates/factory/actions/provider-api-docs.ts +11 -0
- package/corpus/templates/factory/actions/provider-api-request.ts +17 -0
- package/corpus/templates/factory/actions/save-triage-config.ts +87 -38
- package/corpus/templates/factory/app/components/factory/FactoryAuditView.tsx +14 -12
- package/corpus/templates/factory/app/components/factory/FactoryCanvas.tsx +60 -77
- package/corpus/templates/factory/app/components/factory/FactoryInspector.tsx +66 -125
- package/corpus/templates/factory/app/components/layout/Header.tsx +1 -0
- package/corpus/templates/factory/app/components/layout/Layout.tsx +8 -3
- package/corpus/templates/factory/app/components/layout/Sidebar.tsx +9 -5
- package/corpus/templates/factory/app/components/ui/input.tsx +15 -1
- package/corpus/templates/factory/app/components/ui/popover.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/switch.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/textarea.tsx +20 -1
- package/corpus/templates/factory/app/hooks/use-navigation-state.ts +5 -3
- package/corpus/templates/factory/app/i18n/en-US.ts +17 -0
- package/corpus/templates/factory/app/routes/_index.tsx +5 -87
- package/corpus/templates/factory/app/routes/chat.$threadId.tsx +1 -1
- package/corpus/templates/factory/app/routes/chat.tsx +91 -0
- package/corpus/templates/factory/app/routes/factory.tsx +554 -430
- package/corpus/templates/factory/app/routes/settings.tsx +1 -1
- package/corpus/templates/factory/server/connectors/credentials.ts +25 -0
- package/corpus/templates/factory/server/lib/provider-api.ts +34 -0
- package/corpus/templates/factory/server/plugins/agent-chat.ts +15 -3
- package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +96 -24
- package/corpus/templates/factory/server/triage/review-state.ts +33 -0
- package/corpus/templates/factory/server/triage/slack-poller.ts +1 -0
- package/corpus/templates/forms/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/forms/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/forms/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/forms/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/forms/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/forms/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/forms/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/forms/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/forms/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/forms/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/forms/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +1 -0
- package/corpus/templates/forms/shared/types.ts +1 -1
- package/corpus/templates/macros/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/macros/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/macros/.agents/skills/delegate-to-agent/SKILL.md +289 -0
- package/corpus/templates/macros/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/macros/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/macros/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/macros/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/macros/.agents/skills/self-modifying-code/SKILL.md +123 -0
- package/corpus/templates/macros/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/macros/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/macros/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/macros/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/macros/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/macros/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/mail/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/mail/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/mail/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/mail/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/mail/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/mail/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/mail/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/mail/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/mail/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/mail/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/mail/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/mail/actions/send-email.ts +9 -0
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +4 -4
- package/corpus/templates/mail/changelog/2026-08-12-agent-sent-messages-appear-immediately.md +6 -0
- package/corpus/templates/plan/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/corpus/templates/plan/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/plan/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/plan/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/plan/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/plan/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/plan/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/plan/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/plan/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/plan/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/plan/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/plan/actions/delete-plan-comment.ts +6 -0
- package/corpus/templates/plan/actions/reply-to-plan-comment.ts +7 -1
- package/corpus/templates/plan/actions/resolve-plan-comment.ts +7 -1
- package/corpus/templates/plan/actions/update-visual-plan.ts +6 -0
- package/corpus/templates/plan/app/hooks/use-plans.ts +1 -1
- package/corpus/templates/plan/app/pages/PlansPage.tsx +51 -23
- package/corpus/templates/plan/changelog/2026-08-12-viewers-are-read-only-and-commenters-can-comment.md +6 -0
- package/corpus/templates/plan/server/plans.ts +2 -2
- package/corpus/templates/plan/shared/types.ts +1 -1
- package/corpus/templates/slides/.agents/skills/adding-a-feature/SKILL.md +208 -0
- package/corpus/templates/slides/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +6 -0
- package/corpus/templates/slides/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/slides/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/slides/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/slides/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/slides/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/slides/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/slides/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/slides/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/slides/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/slides/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/slides/AGENTS.md +4 -0
- package/corpus/templates/slides/actions/add-slide-comment.ts +1 -1
- package/corpus/templates/slides/actions/delete-slide-comment.ts +1 -1
- package/corpus/templates/slides/actions/get-layout-overflows.ts +67 -2
- package/corpus/templates/slides/actions/update-slide-comment.ts +1 -1
- package/corpus/templates/slides/actions/view-screen.ts +76 -26
- package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +30 -8
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +2 -1
- package/corpus/templates/slides/app/components/editor/AlignmentGuides.tsx +75 -0
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +81 -81
- package/corpus/templates/slides/app/components/editor/ShareDialog.tsx +28 -25
- package/corpus/templates/slides/app/components/editor/SlideContextToolbar.tsx +175 -10
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +256 -69
- package/corpus/templates/slides/app/components/editor/SlideOverflowWarning.tsx +1 -1
- package/corpus/templates/slides/app/components/editor/canvas-interactions/slides-canvas-adapter.ts +3 -3
- package/corpus/templates/slides/app/components/editor/slide-object-interactions.ts +218 -0
- package/corpus/templates/slides/app/context/DeckContext.tsx +56 -30
- package/corpus/templates/slides/app/hooks/use-deck-role.ts +13 -5
- package/corpus/templates/slides/app/hooks/use-design-systems.ts +1 -1
- package/corpus/templates/slides/app/i18n/en-US.ts +6 -2
- package/corpus/templates/slides/app/lib/create-deck-generation.ts +1 -0
- package/corpus/templates/slides/app/lib/pending-deck-changes.ts +32 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +85 -4
- package/corpus/templates/slides/app/pages/Index.tsx +65 -66
- package/corpus/templates/slides/changelog/2026-08-12-viewers-are-read-only-and-commenters-can-comment.md +6 -0
- package/corpus/templates/tasks/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/corpus/templates/tasks/.agents/skills/context-awareness/SKILL.md +206 -0
- package/corpus/templates/tasks/.agents/skills/frontend-design/SKILL.md +73 -80
- package/corpus/templates/tasks/.agents/skills/portability/SKILL.md +107 -0
- package/corpus/templates/tasks/.agents/skills/secrets/SKILL.md +339 -0
- package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/corpus/templates/tasks/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/corpus/templates/tasks/.agents/skills/sharing/SKILL.md +1 -0
- package/corpus/templates/tasks/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/corpus/templates/tasks/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/corpus/templates/tasks/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/corpus/templates/tasks/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/corpus/templates/tasks/app/components/custom-fields/FieldsPage.tsx +1 -4
- package/corpus/templates/tasks/app/components/inbox/InboxList.tsx +0 -1
- package/corpus/templates/tasks/app/components/inbox/InboxListPage.tsx +0 -1
- package/corpus/templates/tasks/app/components/shared/ListViewHeader.tsx +0 -3
- package/corpus/templates/tasks/app/components/shared/PageHeader.tsx +1 -4
- package/corpus/templates/tasks/app/components/tasks/TaskList.tsx +0 -1
- package/corpus/templates/tasks/app/components/tasks/TaskListPage.tsx +0 -1
- package/dist/agent/engine/ai-sdk-engine.js +5 -0
- package/dist/agent/engine/anthropic-engine.js +8 -0
- package/dist/agent/engine/registry.js +24 -19
- package/dist/agent/engine/translate-anthropic.js +16 -1
- package/dist/agent/production-agent.d.ts +8 -0
- package/dist/agent/production-agent.js +25 -2
- package/dist/agent/run-manager.js +13 -3
- package/dist/automations/service.d.ts +2 -0
- package/dist/automations/service.js +5 -1
- package/dist/chat-threads/schema.d.ts +2 -2
- package/dist/cli/changelog.js +21 -4
- package/dist/cli/create.d.ts +12 -1
- package/dist/cli/create.js +99 -11
- package/dist/cli/index.js +6 -6
- package/dist/cli/process.d.ts +7 -0
- package/dist/cli/process.js +12 -0
- package/dist/cli/workspace-skill-policy.d.ts +15 -0
- package/dist/cli/workspace-skill-policy.js +62 -0
- package/dist/cli/workspacify.js +36 -0
- package/dist/client/AgentPanel.d.ts +14 -2
- package/dist/client/AgentPanel.js +44 -26
- package/dist/client/AssistantChat.js +90 -182
- package/dist/client/FeedbackButton.js +15 -2
- package/dist/client/RouteTransitionIndicator.d.ts +14 -2
- package/dist/client/RouteTransitionIndicator.js +16 -5
- package/dist/client/agent-page/AgentTabsPage.js +19 -6
- package/dist/client/app-config.d.ts +3 -0
- package/dist/client/app-config.js +6 -0
- package/dist/client/app-providers.js +2 -1
- package/dist/client/changelog/Changelog.d.ts +2 -1
- package/dist/client/changelog/Changelog.js +7 -5
- package/dist/client/chat/markdown-renderer.d.ts +3 -1
- package/dist/client/chat/markdown-renderer.js +24 -24
- package/dist/client/chat/message-components.d.ts +23 -0
- package/dist/client/chat/message-components.js +27 -44
- package/dist/client/chat/tool-call-display.d.ts +2 -2
- package/dist/client/chat/tool-call-display.js +6 -3
- package/dist/client/chat-first/app-open-actions.d.ts +28 -0
- package/dist/client/chat-first/app-open-actions.js +25 -0
- package/dist/client/chat-first/index.d.ts +1 -0
- package/dist/client/chat-first/index.js +1 -0
- package/dist/client/chat-first/primary-nav.d.ts +2 -1
- package/dist/client/chat-first/primary-nav.js +12 -5
- package/dist/client/conversation/use-near-bottom-autoscroll.d.ts +14 -0
- package/dist/client/conversation/use-near-bottom-autoscroll.js +14 -0
- package/dist/client/error-format.js +32 -3
- package/dist/client/extensions/EmbeddedExtension.js +1 -0
- package/dist/client/extensions/ExtensionViewer.js +3 -1
- package/dist/client/extensions/InlineExtensionFrame.js +1 -0
- package/dist/client/extensions/iframe-bridge.d.ts +3 -2
- package/dist/client/extensions/iframe-bridge.js +4 -2
- package/dist/client/i18n.js +28 -5
- package/dist/client/integrations/IntegrationConnectionChoice.d.ts +11 -0
- package/dist/client/integrations/IntegrationConnectionChoice.js +6 -0
- package/dist/client/integrations/IntegrationGrid.d.ts +23 -0
- package/dist/client/integrations/IntegrationGrid.js +12 -0
- package/dist/client/integrations/IntegrationsPanel.js +92 -26
- package/dist/client/integrations/index.d.ts +2 -0
- package/dist/client/integrations/index.js +2 -0
- package/dist/client/onboarding/FirstRunOnboarding.d.ts +3 -1
- package/dist/client/onboarding/FirstRunOnboarding.js +26 -16
- package/dist/client/onboarding/first-run-enabled.js +1 -5
- package/dist/client/onboarding/first-run-startup-gate.d.ts +5 -0
- package/dist/client/onboarding/first-run-startup-gate.js +51 -0
- package/dist/client/onboarding/first-run-status.d.ts +7 -0
- package/dist/client/onboarding/first-run-status.js +26 -0
- package/dist/client/onboarding/index.d.ts +3 -0
- package/dist/client/onboarding/index.js +3 -0
- package/dist/client/onboarding/use-onboarding.d.ts +1 -0
- package/dist/client/onboarding/use-onboarding.js +13 -11
- package/dist/client/org/TeamPage.js +174 -28
- package/dist/client/org/WorkspaceNotice.js +7 -4
- package/dist/client/resources/McpConnectionSuggestion.js +29 -72
- package/dist/client/resources/McpIntegrationDialog.d.ts +3 -1
- package/dist/client/resources/McpIntegrationDialog.js +176 -51
- package/dist/client/resources/index.d.ts +1 -0
- package/dist/client/resources/index.js +1 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts +8 -0
- package/dist/client/resources/mcp-integration-catalog.js +28 -0
- package/dist/client/settings/ExtensionsSettingsContent.js +2 -2
- package/dist/client/settings/SettingsPanel.d.ts +6 -0
- package/dist/client/settings/SettingsPanel.js +21 -8
- package/dist/client/settings/SettingsRow.d.ts +3 -1
- package/dist/client/settings/SettingsRow.js +4 -2
- package/dist/client/settings/SettingsSkeleton.js +5 -3
- package/dist/client/settings/SettingsTabsPage.js +2 -2
- package/dist/client/settings/UsageSection.d.ts +4 -1
- package/dist/client/settings/UsageSection.js +187 -93
- package/dist/client/settings/agent-settings-search.js +6 -2
- package/dist/client/setup-connections/useBuilderConnectCardController.d.ts +1 -1
- package/dist/client/setup-connections/useBuilderConnectCardController.js +2 -2
- package/dist/client/sharing/ShareButton.d.ts +4 -2
- package/dist/client/sharing/ShareButton.js +26 -14
- package/dist/client/sharing/ShareDialog.d.ts +1 -1
- package/dist/client/sharing/ShareDialog.js +17 -11
- package/dist/client/sharing/useShareButtonController.d.ts +2 -1
- package/dist/client/sharing/useShareButtonController.js +8 -0
- package/dist/client/sharing/useShareDialogController.d.ts +1 -1
- package/dist/client/sharing/useShareDialogController.js +2 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/config.d.ts +13 -0
- package/dist/config.js +53 -0
- package/dist/dashboard-storage/schema.d.ts +2 -2
- package/dist/data-programs/schema.d.ts +2 -2
- package/dist/extensions/actions.js +2 -1
- package/dist/extensions/html-shell.d.ts +2 -2
- package/dist/extensions/routes.js +4 -1
- package/dist/extensions/schema.d.ts +2 -2
- package/dist/file-upload/pre-upload-attachments.js +1 -1
- package/dist/framework-tools.js +3 -0
- package/dist/history/types.d.ts +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/jobs/background-automation-runner.d.ts +1 -0
- package/dist/jobs/background-automation-runner.js +4 -2
- package/dist/jobs/frontmatter.d.ts +4 -0
- package/dist/jobs/frontmatter.js +16 -0
- package/dist/jobs/run-history.js +1 -1
- package/dist/jobs/tools.js +9 -5
- package/dist/localization/default-messages.d.ts +27 -0
- package/dist/localization/default-messages.js +28 -1
- package/dist/notifications/routes.d.ts +6 -6
- package/dist/onboarding/plugin.js +17 -2
- package/dist/org/context.js +16 -0
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +12 -12
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/review/actions/create-review-comment.js +1 -1
- package/dist/review/actions/delete-review-comment.js +4 -1
- package/dist/review/actions/list-review-comments.js +4 -2
- package/dist/review/actions/reply-review-comment.js +1 -1
- package/dist/review/types.d.ts +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-discovery.js +29 -0
- package/dist/server/agent-chat/plugin-options.d.ts +7 -0
- package/dist/server/agent-chat-plugin.d.ts +2 -0
- package/dist/server/agent-chat-plugin.js +12 -4
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/auth.js +18 -4
- package/dist/server/better-auth-instance.js +8 -1
- package/dist/server/builder-browser.js +31 -0
- package/dist/server/magic-link-attribution.d.ts +21 -0
- package/dist/server/magic-link-attribution.js +115 -0
- package/dist/server/onboarding-html.js +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/server/workspace-provider-oauth.js +38 -26
- package/dist/setup-connections/index.d.ts +1 -1
- package/dist/setup-connections/index.js +1 -1
- package/dist/shared/first-run-onboarding.d.ts +6 -0
- package/dist/shared/first-run-onboarding.js +6 -0
- package/dist/sharing/access.d.ts +1 -1
- package/dist/sharing/access.js +4 -1
- package/dist/sharing/actions/share-resource.d.ts +1 -1
- package/dist/sharing/actions/share-resource.js +2 -2
- package/dist/sharing/registry.d.ts +2 -2
- package/dist/sharing/schema.d.ts +5 -5
- package/dist/sharing/schema.js +9 -6
- package/dist/styles/agent-native.css +21 -0
- package/dist/styles/chat-history-list.css +1 -1
- package/dist/templates/chat/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/dist/templates/chat/.agents/skills/context-awareness/SKILL.md +206 -0
- package/dist/templates/chat/.agents/skills/frontend-design/SKILL.md +73 -80
- package/dist/templates/chat/.agents/skills/portability/SKILL.md +107 -0
- package/dist/templates/chat/.agents/skills/secrets/SKILL.md +339 -0
- package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/dist/templates/chat/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/dist/templates/chat/.agents/skills/sharing/SKILL.md +1 -0
- package/dist/templates/chat/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/dist/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/dist/templates/chat/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/dist/templates/chat/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/dist/templates/chat/AGENTS.md +4 -5
- package/dist/templates/default/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/dist/templates/default/.agents/skills/context-awareness/SKILL.md +206 -0
- package/dist/templates/default/.agents/skills/frontend-design/SKILL.md +73 -80
- package/dist/templates/default/.agents/skills/portability/SKILL.md +107 -0
- package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/dist/templates/default/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/dist/templates/default/.agents/skills/sharing/SKILL.md +233 -0
- package/dist/templates/default/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/dist/templates/default/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/dist/templates/default/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/dist/templates/default/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/dist/templates/default/AGENTS.md +17 -2
- package/dist/templates/default/agent-native.config.ts +6 -0
- package/dist/templates/default/app/i18n/ar-SA.ts +2 -0
- package/dist/templates/default/app/i18n/de-DE.ts +2 -0
- package/dist/templates/default/app/i18n/en-US.ts +3 -1
- package/dist/templates/default/app/i18n/es-ES.ts +2 -0
- package/dist/templates/default/app/i18n/fr-FR.ts +2 -0
- package/dist/templates/default/app/i18n/hi-IN.ts +2 -0
- package/dist/templates/default/app/i18n/ja-JP.ts +2 -0
- package/dist/templates/default/app/i18n/ko-KR.ts +2 -0
- package/dist/templates/default/app/i18n/pt-BR.ts +2 -0
- package/dist/templates/default/app/i18n/zh-CN.ts +2 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +2 -0
- package/dist/templates/headless/.agents/skills/delegate-to-agent/SKILL.md +289 -0
- package/dist/templates/headless/.agents/skills/security/SKILL.md +324 -0
- package/dist/templates/headless/.agents/skills/storing-data/SKILL.md +178 -0
- package/dist/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/dist/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +73 -80
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/dist/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/dist/templates/workspace-core/.agents/skills/sharing/SKILL.md +1 -0
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/dist/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +3 -2
- package/dist/templates/workspace-core/AGENTS.md +9 -3
- package/dist/templates/workspace-root/AGENTS.md +26 -1
- package/dist/templates/workspace-root/agent-native.config.ts +8 -0
- package/dist/triggers/actions.js +2 -2
- package/dist/usage/actions/get-usage-alerts.d.ts +5 -0
- package/dist/usage/actions/get-usage-alerts.js +16 -0
- package/dist/usage/actions/get-usage-metrics.d.ts +7 -0
- package/dist/usage/actions/get-usage-metrics.js +26 -0
- package/dist/usage/actions/manage-usage-alert.d.ts +14 -0
- package/dist/usage/actions/manage-usage-alert.js +48 -0
- package/dist/usage/alerts-store.d.ts +78 -0
- package/dist/usage/alerts-store.js +592 -0
- package/dist/usage/metrics-store.d.ts +95 -0
- package/dist/usage/metrics-store.js +386 -0
- package/dist/usage/store.js +10 -0
- package/dist/vite/action-types-plugin.js +28 -0
- package/dist/vite/agent-native-config-loader.d.ts +6 -0
- package/dist/vite/agent-native-config-loader.js +54 -2
- package/dist/vite/client.js +11 -5
- package/dist/workspace-connections/actions/bulk-update-workspace-user-groups.d.ts +6 -0
- package/dist/workspace-connections/actions/bulk-update-workspace-user-groups.js +24 -0
- package/dist/workspace-connections/actions/delete-workspace-user-group.d.ts +7 -0
- package/dist/workspace-connections/actions/delete-workspace-user-group.js +29 -0
- package/dist/workspace-connections/actions/list-workspace-user-groups.d.ts +2 -0
- package/dist/workspace-connections/actions/list-workspace-user-groups.js +13 -0
- package/dist/workspace-connections/actions/upsert-workspace-user-group.d.ts +6 -0
- package/dist/workspace-connections/actions/upsert-workspace-user-group.js +22 -0
- package/dist/workspace-connections/credential-key-aliases.d.ts +3 -0
- package/dist/workspace-connections/credential-key-aliases.js +31 -0
- package/dist/workspace-connections/credentials.js +1 -25
- package/dist/workspace-connections/groups.d.ts +32 -0
- package/dist/workspace-connections/groups.js +288 -0
- package/dist/workspace-connections/index.d.ts +3 -1
- package/dist/workspace-connections/index.js +3 -1
- package/dist/workspace-connections/store.d.ts +9 -0
- package/dist/workspace-connections/store.js +68 -8
- package/docs/content/components.mdx +2 -2
- package/docs/content/sharing.mdx +2 -1
- package/package.json +10 -2
- package/src/templates/chat/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/src/templates/chat/.agents/skills/context-awareness/SKILL.md +206 -0
- package/src/templates/chat/.agents/skills/frontend-design/SKILL.md +73 -80
- package/src/templates/chat/.agents/skills/portability/SKILL.md +107 -0
- package/src/templates/chat/.agents/skills/secrets/SKILL.md +339 -0
- package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/src/templates/chat/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/src/templates/chat/.agents/skills/sharing/SKILL.md +1 -0
- package/src/templates/chat/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/src/templates/chat/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/src/templates/chat/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/src/templates/chat/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/src/templates/chat/AGENTS.md +4 -5
- package/src/templates/default/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/src/templates/default/.agents/skills/context-awareness/SKILL.md +206 -0
- package/src/templates/default/.agents/skills/frontend-design/SKILL.md +73 -80
- package/src/templates/default/.agents/skills/portability/SKILL.md +107 -0
- package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/src/templates/default/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/src/templates/default/.agents/skills/sharing/SKILL.md +233 -0
- package/src/templates/default/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/src/templates/default/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/src/templates/default/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/src/templates/default/.agents/skills/workspace-conventions/SKILL.md +93 -0
- package/src/templates/default/AGENTS.md +17 -2
- package/src/templates/default/agent-native.config.ts +6 -0
- package/src/templates/default/app/i18n/ar-SA.ts +2 -0
- package/src/templates/default/app/i18n/de-DE.ts +2 -0
- package/src/templates/default/app/i18n/en-US.ts +3 -1
- package/src/templates/default/app/i18n/es-ES.ts +2 -0
- package/src/templates/default/app/i18n/fr-FR.ts +2 -0
- package/src/templates/default/app/i18n/hi-IN.ts +2 -0
- package/src/templates/default/app/i18n/ja-JP.ts +2 -0
- package/src/templates/default/app/i18n/ko-KR.ts +2 -0
- package/src/templates/default/app/i18n/pt-BR.ts +2 -0
- package/src/templates/default/app/i18n/zh-CN.ts +2 -0
- package/src/templates/default/app/i18n/zh-TW.ts +2 -0
- package/src/templates/headless/.agents/skills/delegate-to-agent/SKILL.md +289 -0
- package/src/templates/headless/.agents/skills/security/SKILL.md +324 -0
- package/src/templates/headless/.agents/skills/storing-data/SKILL.md +178 -0
- package/src/templates/workspace-core/.agents/skills/adding-a-feature/SKILL.md +3 -2
- package/src/templates/workspace-core/.agents/skills/frontend-design/SKILL.md +73 -80
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +3 -3
- package/src/templates/workspace-core/.agents/skills/shadcn-ui/SKILL.md +1 -1
- package/src/templates/workspace-core/.agents/skills/sharing/SKILL.md +1 -0
- package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +116 -44
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +9 -3
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/spreadsheet-source.md +148 -0
- package/src/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +3 -2
- package/src/templates/workspace-core/AGENTS.md +9 -3
- package/src/templates/workspace-root/AGENTS.md +26 -1
- package/src/templates/workspace-root/agent-native.config.ts +8 -0
- package/corpus/templates/analytics/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/analytics/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/analytics/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/assets/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/assets/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/assets/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/assets/.agents/skills/real-time-collab/SKILL.md +0 -392
- package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/brain/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/brain/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/brain/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/calendar/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/calendar/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/calendar/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/chat/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/chat/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/chat/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/clips/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/clips/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/clips/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/content/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/content/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/content/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/crm/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/crm/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/design/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/design/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/design/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/dispatch/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/dispatch/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/dispatch/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/factory/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/factory/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/factory/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/factory/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/forms/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/forms/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/forms/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/macros/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/mail/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/mail/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/mail/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/plan/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/plan/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/plan/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/slides/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/slides/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/slides/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/corpus/templates/tasks/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/corpus/templates/tasks/.agents/skills/create-skill/SKILL.md +0 -195
- package/corpus/templates/tasks/.agents/skills/feature-flags/SKILL.md +0 -169
- package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/dist/templates/chat/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/dist/templates/chat/.agents/skills/create-skill/SKILL.md +0 -195
- package/dist/templates/chat/.agents/skills/feature-flags/SKILL.md +0 -169
- package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/dist/templates/default/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/dist/templates/default/.agents/skills/create-skill/SKILL.md +0 -195
- package/dist/templates/default/.agents/skills/feature-flags/SKILL.md +0 -169
- package/dist/templates/default/.agents/skills/integration-webhooks/SKILL.md +0 -364
- package/dist/templates/default/.agents/skills/internationalization/SKILL.md +0 -82
- package/dist/templates/default/.agents/skills/onboarding/SKILL.md +0 -56
- package/dist/templates/default/.agents/skills/real-time-collab/SKILL.md +0 -392
- package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/dist/templates/headless/.agents/skills/feature-flags/SKILL.md +0 -169
- package/dist/templates/headless/.agents/skills/integration-webhooks/SKILL.md +0 -364
- package/dist/templates/headless/.agents/skills/turn-into-app/SKILL.md +0 -402
- package/dist/templates/headless/.agents/skills/turn-into-app/agents/openai.yaml +0 -4
- package/dist/templates/headless/.agents/skills/turn-into-app/references/fresh-project.md +0 -90
- package/dist/templates/headless/.agents/skills/turn-into-skill/SKILL.md +0 -112
- package/dist/templates/headless/.agents/skills/turn-into-skill/agents/openai.yaml +0 -4
- package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +0 -411
- package/dist/templates/workspace-core/.agents/skills/adding-workspace-apps/SKILL.md +0 -107
- package/dist/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +0 -176
- package/dist/templates/workspace-core/.agents/skills/agent-page/SKILL.md +0 -63
- package/dist/templates/workspace-core/.agents/skills/audit-log/SKILL.md +0 -96
- package/dist/templates/workspace-core/.agents/skills/authentication/SKILL.md +0 -295
- package/dist/templates/workspace-core/.agents/skills/automations/SKILL.md +0 -242
- package/dist/templates/workspace-core/.agents/skills/browser-sessions/SKILL.md +0 -131
- package/dist/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/dist/templates/workspace-core/.agents/skills/changelog/SKILL.md +0 -114
- package/dist/templates/workspace-core/.agents/skills/client-methods/SKILL.md +0 -115
- package/dist/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +0 -62
- package/dist/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +0 -87
- package/dist/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +0 -139
- package/dist/templates/workspace-core/.agents/skills/context-xray/SKILL.md +0 -72
- package/dist/templates/workspace-core/.agents/skills/create-skill/SKILL.md +0 -195
- package/dist/templates/workspace-core/.agents/skills/data-programs/SKILL.md +0 -128
- package/dist/templates/workspace-core/.agents/skills/extension-points/SKILL.md +0 -219
- package/dist/templates/workspace-core/.agents/skills/extensions/SKILL.md +0 -533
- package/dist/templates/workspace-core/.agents/skills/extensions/references/api.md +0 -340
- package/dist/templates/workspace-core/.agents/skills/extensions/references/examples.md +0 -259
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +0 -547
- package/dist/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +0 -157
- package/dist/templates/workspace-core/.agents/skills/feature-flags/SKILL.md +0 -169
- package/dist/templates/workspace-core/.agents/skills/generative-ui/SKILL.md +0 -117
- package/dist/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +0 -170
- package/dist/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +0 -364
- package/dist/templates/workspace-core/.agents/skills/internationalization/SKILL.md +0 -82
- package/dist/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +0 -52
- package/dist/templates/workspace-core/.agents/skills/native-navigation/SKILL.md +0 -67
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +0 -329
- package/dist/templates/workspace-core/.agents/skills/onboarding/SKILL.md +0 -56
- package/dist/templates/workspace-core/.agents/skills/performance/SKILL.md +0 -299
- package/dist/templates/workspace-core/.agents/skills/qa/SKILL.md +0 -333
- package/dist/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +0 -392
- package/dist/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +0 -74
- package/dist/templates/workspace-core/.agents/skills/reliable-mutations/SKILL.md +0 -70
- package/dist/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +0 -84
- package/dist/templates/workspace-core/.agents/skills/tracking/SKILL.md +0 -278
- package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/dist/templates/workspace-core/.agents/skills/visual-answer/SKILL.md +0 -101
- package/dist/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +0 -222
- package/dist/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +0 -363
- package/src/templates/chat/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/src/templates/chat/.agents/skills/create-skill/SKILL.md +0 -195
- package/src/templates/chat/.agents/skills/feature-flags/SKILL.md +0 -169
- package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/src/templates/default/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/src/templates/default/.agents/skills/create-skill/SKILL.md +0 -195
- package/src/templates/default/.agents/skills/feature-flags/SKILL.md +0 -169
- package/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +0 -364
- package/src/templates/default/.agents/skills/internationalization/SKILL.md +0 -82
- package/src/templates/default/.agents/skills/onboarding/SKILL.md +0 -56
- package/src/templates/default/.agents/skills/real-time-collab/SKILL.md +0 -392
- package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/src/templates/headless/.agents/skills/feature-flags/SKILL.md +0 -169
- package/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +0 -364
- package/src/templates/headless/.agents/skills/turn-into-app/SKILL.md +0 -402
- package/src/templates/headless/.agents/skills/turn-into-app/agents/openai.yaml +0 -4
- package/src/templates/headless/.agents/skills/turn-into-app/references/fresh-project.md +0 -90
- package/src/templates/headless/.agents/skills/turn-into-skill/SKILL.md +0 -112
- package/src/templates/headless/.agents/skills/turn-into-skill/agents/openai.yaml +0 -4
- package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +0 -411
- package/src/templates/workspace-core/.agents/skills/adding-workspace-apps/SKILL.md +0 -107
- package/src/templates/workspace-core/.agents/skills/address-feedback/SKILL.md +0 -176
- package/src/templates/workspace-core/.agents/skills/agent-page/SKILL.md +0 -63
- package/src/templates/workspace-core/.agents/skills/audit-log/SKILL.md +0 -96
- package/src/templates/workspace-core/.agents/skills/authentication/SKILL.md +0 -295
- package/src/templates/workspace-core/.agents/skills/automations/SKILL.md +0 -242
- package/src/templates/workspace-core/.agents/skills/browser-sessions/SKILL.md +0 -131
- package/src/templates/workspace-core/.agents/skills/capture-learnings/SKILL.md +0 -89
- package/src/templates/workspace-core/.agents/skills/changelog/SKILL.md +0 -114
- package/src/templates/workspace-core/.agents/skills/client-methods/SKILL.md +0 -115
- package/src/templates/workspace-core/.agents/skills/client-methods/references/legacy-client-fetch-audit-2026-06-03.md +0 -62
- package/src/templates/workspace-core/.agents/skills/client-side-routing/SKILL.md +0 -87
- package/src/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +0 -139
- package/src/templates/workspace-core/.agents/skills/context-xray/SKILL.md +0 -72
- package/src/templates/workspace-core/.agents/skills/create-skill/SKILL.md +0 -195
- package/src/templates/workspace-core/.agents/skills/data-programs/SKILL.md +0 -128
- package/src/templates/workspace-core/.agents/skills/extension-points/SKILL.md +0 -219
- package/src/templates/workspace-core/.agents/skills/extensions/SKILL.md +0 -533
- package/src/templates/workspace-core/.agents/skills/extensions/references/api.md +0 -340
- package/src/templates/workspace-core/.agents/skills/extensions/references/examples.md +0 -259
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +0 -547
- package/src/templates/workspace-core/.agents/skills/external-agents/references/mcp-apps-embedding.md +0 -157
- package/src/templates/workspace-core/.agents/skills/feature-flags/SKILL.md +0 -169
- package/src/templates/workspace-core/.agents/skills/generative-ui/SKILL.md +0 -117
- package/src/templates/workspace-core/.agents/skills/harness-agents/SKILL.md +0 -170
- package/src/templates/workspace-core/.agents/skills/integration-webhooks/SKILL.md +0 -364
- package/src/templates/workspace-core/.agents/skills/internationalization/SKILL.md +0 -82
- package/src/templates/workspace-core/.agents/skills/mvp-followup/SKILL.md +0 -52
- package/src/templates/workspace-core/.agents/skills/native-navigation/SKILL.md +0 -67
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +0 -329
- package/src/templates/workspace-core/.agents/skills/onboarding/SKILL.md +0 -56
- package/src/templates/workspace-core/.agents/skills/performance/SKILL.md +0 -299
- package/src/templates/workspace-core/.agents/skills/qa/SKILL.md +0 -333
- package/src/templates/workspace-core/.agents/skills/real-time-collab/SKILL.md +0 -392
- package/src/templates/workspace-core/.agents/skills/recurring-jobs/SKILL.md +0 -74
- package/src/templates/workspace-core/.agents/skills/reliable-mutations/SKILL.md +0 -70
- package/src/templates/workspace-core/.agents/skills/server-plugins/SKILL.md +0 -84
- package/src/templates/workspace-core/.agents/skills/tracking/SKILL.md +0 -278
- package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +0 -127
- package/src/templates/workspace-core/.agents/skills/visual-answer/SKILL.md +0 -101
- package/src/templates/workspace-core/.agents/skills/voice-transcription/SKILL.md +0 -222
- package/src/templates/workspace-core/.agents/skills/writing-agent-instructions/SKILL.md +0 -363
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
import { getDbExec, intType, isPostgres } from "../db/client.js";
|
|
2
|
+
import { ensureColumnExists, ensureIndexExists, ensureTableExists, } from "../db/ddl-guard.js";
|
|
3
|
+
import { deleteNotification, notifyWithDelivery, } from "../notifications/index.js";
|
|
4
|
+
import { ForbiddenError } from "../sharing/access.js";
|
|
5
|
+
import { builderCreditsFromCostCents } from "./store.js";
|
|
6
|
+
const DAY_MS = 86_400_000;
|
|
7
|
+
const DEFAULT_DAILY_USD = 100;
|
|
8
|
+
export const USAGE_ALERT_DEFAULT_DAILY_USD = DEFAULT_DAILY_USD;
|
|
9
|
+
export const USAGE_ALERT_UNIT_SCALE = {
|
|
10
|
+
usd: 100,
|
|
11
|
+
"builder-credits": 1,
|
|
12
|
+
tokens: 1,
|
|
13
|
+
};
|
|
14
|
+
let initPromise;
|
|
15
|
+
let evaluationTail = Promise.resolve();
|
|
16
|
+
function normalizeEmail(value) {
|
|
17
|
+
const email = value.trim().toLowerCase();
|
|
18
|
+
if (!email)
|
|
19
|
+
throw new Error("Usage alerts require an authenticated user.");
|
|
20
|
+
return email;
|
|
21
|
+
}
|
|
22
|
+
function numberField(row, key) {
|
|
23
|
+
return Number(row[key] ?? 0) || 0;
|
|
24
|
+
}
|
|
25
|
+
function stringField(row, key) {
|
|
26
|
+
return String(row[key] ?? "");
|
|
27
|
+
}
|
|
28
|
+
function nullableNumberField(row, key) {
|
|
29
|
+
if (row[key] == null)
|
|
30
|
+
return null;
|
|
31
|
+
return numberField(row, key);
|
|
32
|
+
}
|
|
33
|
+
function booleanField(row, key) {
|
|
34
|
+
return row[key] === true || numberField(row, key) === 1;
|
|
35
|
+
}
|
|
36
|
+
function normalizedAppId(value) {
|
|
37
|
+
const appId = value?.trim().toLowerCase();
|
|
38
|
+
return appId || null;
|
|
39
|
+
}
|
|
40
|
+
function appAliases(value) {
|
|
41
|
+
if (!value)
|
|
42
|
+
return [];
|
|
43
|
+
const normalized = value
|
|
44
|
+
.trim()
|
|
45
|
+
.toLowerCase()
|
|
46
|
+
.replace(/^agent-native-/, "");
|
|
47
|
+
if (!normalized)
|
|
48
|
+
return [];
|
|
49
|
+
return [...new Set([normalized, `agent-native-${normalized}`])];
|
|
50
|
+
}
|
|
51
|
+
function windowForPeriod(period, timestamp = Date.now()) {
|
|
52
|
+
const date = new Date(timestamp);
|
|
53
|
+
if (period === "month") {
|
|
54
|
+
const start = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1);
|
|
55
|
+
return {
|
|
56
|
+
start,
|
|
57
|
+
end: Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + 1, 1),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const start = Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
|
|
61
|
+
return { start, end: start + DAY_MS };
|
|
62
|
+
}
|
|
63
|
+
function defaultLimit(unit) {
|
|
64
|
+
if (unit === "usd")
|
|
65
|
+
return DEFAULT_DAILY_USD;
|
|
66
|
+
if (unit === "builder-credits") {
|
|
67
|
+
return builderCreditsFromCostCents(DEFAULT_DAILY_USD * 100);
|
|
68
|
+
}
|
|
69
|
+
return 0;
|
|
70
|
+
}
|
|
71
|
+
function defaultRuleId(partition) {
|
|
72
|
+
const principal = partition.scope === "workspace"
|
|
73
|
+
? `org:${partition.orgId}`
|
|
74
|
+
: `user:${partition.ownerEmail}`;
|
|
75
|
+
return `usage-alert:${partition.scope}:${principal}:all:default`;
|
|
76
|
+
}
|
|
77
|
+
function ruleIdFor(partition, appId, unit, period) {
|
|
78
|
+
const principal = partition.scope === "workspace"
|
|
79
|
+
? `org:${partition.orgId}`
|
|
80
|
+
: `user:${partition.ownerEmail}`;
|
|
81
|
+
return `usage-alert:${partition.scope}:${principal}:${appId ?? "all"}:${unit}:${period}`;
|
|
82
|
+
}
|
|
83
|
+
async function ensureTables() {
|
|
84
|
+
if (!initPromise) {
|
|
85
|
+
initPromise = (async () => {
|
|
86
|
+
const db = getDbExec();
|
|
87
|
+
const tableSql = `CREATE TABLE IF NOT EXISTS usage_alert_rules (
|
|
88
|
+
id TEXT PRIMARY KEY,
|
|
89
|
+
scope TEXT NOT NULL,
|
|
90
|
+
owner_email TEXT NOT NULL,
|
|
91
|
+
org_id TEXT,
|
|
92
|
+
app_id TEXT,
|
|
93
|
+
unit TEXT NOT NULL,
|
|
94
|
+
period TEXT NOT NULL,
|
|
95
|
+
limit_value ${intType()} NOT NULL,
|
|
96
|
+
channels TEXT NOT NULL,
|
|
97
|
+
enabled ${intType()} NOT NULL DEFAULT 1,
|
|
98
|
+
is_default ${intType()} NOT NULL DEFAULT 0,
|
|
99
|
+
dismissed_window_start ${intType()},
|
|
100
|
+
created_at ${intType()} NOT NULL,
|
|
101
|
+
updated_at ${intType()} NOT NULL
|
|
102
|
+
)`;
|
|
103
|
+
const eventsSql = `CREATE TABLE IF NOT EXISTS usage_alert_events (
|
|
104
|
+
id TEXT PRIMARY KEY,
|
|
105
|
+
rule_id TEXT NOT NULL,
|
|
106
|
+
window_start ${intType()} NOT NULL,
|
|
107
|
+
notification_id TEXT,
|
|
108
|
+
created_at ${intType()} NOT NULL
|
|
109
|
+
)`;
|
|
110
|
+
const indexes = [
|
|
111
|
+
{
|
|
112
|
+
name: "idx_usage_alert_rules_owner",
|
|
113
|
+
sql: "CREATE INDEX IF NOT EXISTS idx_usage_alert_rules_owner ON usage_alert_rules(owner_email, org_id, scope)",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "idx_usage_alert_events_rule_window",
|
|
117
|
+
sql: "CREATE UNIQUE INDEX IF NOT EXISTS idx_usage_alert_events_rule_window ON usage_alert_events(rule_id, window_start)",
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
if (isPostgres()) {
|
|
121
|
+
await ensureTableExists("usage_alert_rules", tableSql);
|
|
122
|
+
await ensureTableExists("usage_alert_events", eventsSql);
|
|
123
|
+
await ensureColumnExists("usage_alert_rules", "is_default", `ALTER TABLE usage_alert_rules ADD COLUMN is_default ${intType()} NOT NULL DEFAULT 0`);
|
|
124
|
+
await ensureColumnExists("usage_alert_events", "notification_id", "ALTER TABLE usage_alert_events ADD COLUMN notification_id TEXT");
|
|
125
|
+
for (const index of indexes) {
|
|
126
|
+
await ensureIndexExists(index.name, index.sql);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
await db.execute(tableSql);
|
|
131
|
+
await db.execute(eventsSql);
|
|
132
|
+
const eventColumns = await db.execute("PRAGMA table_info(usage_alert_events)");
|
|
133
|
+
const hasNotificationId = eventColumns.rows.some((row) => String(row.name) === "notification_id");
|
|
134
|
+
if (!hasNotificationId) {
|
|
135
|
+
await db.execute("ALTER TABLE usage_alert_events ADD COLUMN notification_id TEXT");
|
|
136
|
+
}
|
|
137
|
+
for (const index of indexes)
|
|
138
|
+
await db.execute(index.sql);
|
|
139
|
+
}
|
|
140
|
+
})().catch((error) => {
|
|
141
|
+
initPromise = undefined;
|
|
142
|
+
throw error;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
await initPromise;
|
|
146
|
+
}
|
|
147
|
+
async function resolveScope(scope, access) {
|
|
148
|
+
const ownerEmail = normalizeEmail(access.ownerEmail);
|
|
149
|
+
const orgId = access.orgId?.trim() || null;
|
|
150
|
+
let role = null;
|
|
151
|
+
if (orgId) {
|
|
152
|
+
const result = await getDbExec().execute({
|
|
153
|
+
sql: `SELECT role FROM org_members WHERE org_id = ? AND LOWER(email) = ? LIMIT 1`,
|
|
154
|
+
args: [orgId, ownerEmail],
|
|
155
|
+
});
|
|
156
|
+
const candidate = result.rows[0]?.role;
|
|
157
|
+
role = typeof candidate === "string" ? candidate : null;
|
|
158
|
+
}
|
|
159
|
+
const canManage = scope === "user" || role === "owner" || role === "admin";
|
|
160
|
+
if (scope === "workspace" && !canManage) {
|
|
161
|
+
throw new ForbiddenError("Only organization owners and admins can manage workspace usage alerts.");
|
|
162
|
+
}
|
|
163
|
+
if (scope === "workspace" && !orgId) {
|
|
164
|
+
throw new ForbiddenError("Workspace usage alerts require an active organization.");
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
scope,
|
|
168
|
+
ownerEmail,
|
|
169
|
+
orgId: scope === "workspace" ? orgId : null,
|
|
170
|
+
canManage,
|
|
171
|
+
partitionSql: scope === "workspace" ? "org_id = ?" : "LOWER(owner_email) = ?",
|
|
172
|
+
partitionArgs: scope === "workspace" ? [orgId] : [ownerEmail],
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
async function usageTotals(appId, partition, period) {
|
|
176
|
+
const window = windowForPeriod(period);
|
|
177
|
+
const aliases = appAliases(appId);
|
|
178
|
+
const appClause = aliases.length
|
|
179
|
+
? ` AND LOWER(COALESCE(app, '')) IN (${aliases.map(() => "?").join(", ")})`
|
|
180
|
+
: "";
|
|
181
|
+
const result = await getDbExec().execute({
|
|
182
|
+
sql: `SELECT COALESCE(SUM(cost_cents_x100), 0) AS cost_x100,
|
|
183
|
+
COALESCE(SUM(input_tokens), 0) + COALESCE(SUM(output_tokens), 0) +
|
|
184
|
+
COALESCE(SUM(cache_read_tokens), 0) + COALESCE(SUM(cache_write_tokens), 0) AS tokens
|
|
185
|
+
FROM token_usage
|
|
186
|
+
WHERE ${partition.scope === "workspace" ? "org_id = ?" : "LOWER(owner_email) = ?"}
|
|
187
|
+
AND created_at >= ?${appClause}`,
|
|
188
|
+
args: [
|
|
189
|
+
...(partition.scope === "workspace"
|
|
190
|
+
? [partition.orgId]
|
|
191
|
+
: [partition.ownerEmail]),
|
|
192
|
+
window.start,
|
|
193
|
+
...aliases,
|
|
194
|
+
],
|
|
195
|
+
});
|
|
196
|
+
const row = (result.rows[0] ?? {});
|
|
197
|
+
return {
|
|
198
|
+
costCents: numberField(row, "cost_x100") / 100,
|
|
199
|
+
tokens: numberField(row, "tokens"),
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function valueForUnit(totals, unit) {
|
|
203
|
+
if (unit === "tokens")
|
|
204
|
+
return totals.tokens;
|
|
205
|
+
if (unit === "builder-credits")
|
|
206
|
+
return builderCreditsFromCostCents(totals.costCents);
|
|
207
|
+
return totals.costCents / 100;
|
|
208
|
+
}
|
|
209
|
+
function usageStatus(current, limit, enabled, dismissedWindowStart, windowStart) {
|
|
210
|
+
if (dismissedWindowStart === windowStart)
|
|
211
|
+
return "dismissed";
|
|
212
|
+
if (!enabled || limit <= 0)
|
|
213
|
+
return "ok";
|
|
214
|
+
return current >= limit ? "triggered" : "ok";
|
|
215
|
+
}
|
|
216
|
+
function parseChannels(value) {
|
|
217
|
+
if (typeof value !== "string") {
|
|
218
|
+
throw new Error("Usage alert channels are unreadable.");
|
|
219
|
+
}
|
|
220
|
+
let parsed;
|
|
221
|
+
try {
|
|
222
|
+
parsed = JSON.parse(value);
|
|
223
|
+
}
|
|
224
|
+
catch {
|
|
225
|
+
throw new Error("Usage alert channels are unreadable.");
|
|
226
|
+
}
|
|
227
|
+
if (!Array.isArray(parsed)) {
|
|
228
|
+
throw new Error("Usage alert channels are unreadable.");
|
|
229
|
+
}
|
|
230
|
+
const channels = parsed.filter((channel) => channel === "in-app" || channel === "email");
|
|
231
|
+
if (channels.length === 0) {
|
|
232
|
+
throw new Error("Usage alert channels are unreadable.");
|
|
233
|
+
}
|
|
234
|
+
return [...new Set(channels)];
|
|
235
|
+
}
|
|
236
|
+
async function storedRows(partition, appId) {
|
|
237
|
+
const aliases = appAliases(appId);
|
|
238
|
+
const appClause = aliases.length
|
|
239
|
+
? ` AND (app_id IS NULL OR LOWER(app_id) IN (${aliases.map(() => "?").join(", ")}))`
|
|
240
|
+
: "";
|
|
241
|
+
const result = await getDbExec().execute({
|
|
242
|
+
sql: `SELECT id, scope, owner_email, org_id, app_id, unit, period,
|
|
243
|
+
limit_value, channels, enabled, is_default, dismissed_window_start,
|
|
244
|
+
created_at, updated_at
|
|
245
|
+
FROM usage_alert_rules
|
|
246
|
+
WHERE scope = ? AND ${partition.partitionSql}${appClause}
|
|
247
|
+
ORDER BY CASE WHEN app_id IS NULL THEN 0 ELSE 1 END, updated_at DESC`,
|
|
248
|
+
args: [partition.scope, ...partition.partitionArgs, ...aliases],
|
|
249
|
+
});
|
|
250
|
+
return result.rows;
|
|
251
|
+
}
|
|
252
|
+
async function ensureDefaultRule(partition) {
|
|
253
|
+
const now = Date.now();
|
|
254
|
+
await getDbExec().execute({
|
|
255
|
+
sql: `INSERT INTO usage_alert_rules (
|
|
256
|
+
id, scope, owner_email, org_id, app_id, unit, period, limit_value,
|
|
257
|
+
channels, enabled, is_default, dismissed_window_start, created_at, updated_at
|
|
258
|
+
) VALUES (?, ?, ?, ?, NULL, 'usd', 'day', ?, ?, 1, 1, NULL, ?, ?)
|
|
259
|
+
ON CONFLICT (id) DO NOTHING`,
|
|
260
|
+
args: [
|
|
261
|
+
defaultRuleId(partition),
|
|
262
|
+
partition.scope,
|
|
263
|
+
partition.ownerEmail,
|
|
264
|
+
partition.orgId,
|
|
265
|
+
DEFAULT_DAILY_USD * USAGE_ALERT_UNIT_SCALE.usd,
|
|
266
|
+
JSON.stringify(["in-app", "email"]),
|
|
267
|
+
now,
|
|
268
|
+
now,
|
|
269
|
+
],
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
async function clearExpiredDismissal(row, partition) {
|
|
273
|
+
const dismissedWindowStart = nullableNumberField(row, "dismissed_window_start");
|
|
274
|
+
if (dismissedWindowStart == null)
|
|
275
|
+
return;
|
|
276
|
+
const period = stringField(row, "period");
|
|
277
|
+
const window = windowForPeriod(period);
|
|
278
|
+
if (dismissedWindowStart === window.start)
|
|
279
|
+
return;
|
|
280
|
+
await getDbExec().execute({
|
|
281
|
+
sql: `UPDATE usage_alert_rules
|
|
282
|
+
SET dismissed_window_start = NULL
|
|
283
|
+
WHERE id = ? AND scope = ? AND ${partition.partitionSql}`,
|
|
284
|
+
args: [stringField(row, "id"), partition.scope, ...partition.partitionArgs],
|
|
285
|
+
});
|
|
286
|
+
row.dismissed_window_start = null;
|
|
287
|
+
}
|
|
288
|
+
async function rowToRule(row, partition) {
|
|
289
|
+
const appId = row.app_id == null ? null : String(row.app_id);
|
|
290
|
+
const unit = stringField(row, "unit");
|
|
291
|
+
const period = stringField(row, "period");
|
|
292
|
+
const window = windowForPeriod(period);
|
|
293
|
+
const totals = await usageTotals(appId, partition, period);
|
|
294
|
+
const current = valueForUnit(totals, unit);
|
|
295
|
+
const limit = numberField(row, "limit_value") / USAGE_ALERT_UNIT_SCALE[unit];
|
|
296
|
+
const dismissedWindowStart = nullableNumberField(row, "dismissed_window_start");
|
|
297
|
+
return {
|
|
298
|
+
id: stringField(row, "id"),
|
|
299
|
+
appId,
|
|
300
|
+
scope: partition.scope,
|
|
301
|
+
unit,
|
|
302
|
+
period,
|
|
303
|
+
limit,
|
|
304
|
+
channels: parseChannels(row.channels),
|
|
305
|
+
enabled: booleanField(row, "enabled"),
|
|
306
|
+
isDefault: booleanField(row, "is_default"),
|
|
307
|
+
status: usageStatus(current, limit, booleanField(row, "enabled"), dismissedWindowStart, window.start),
|
|
308
|
+
current,
|
|
309
|
+
percent: limit > 0 ? Math.round((current / limit) * 100) : 0,
|
|
310
|
+
windowStart: window.start,
|
|
311
|
+
windowEnd: window.end,
|
|
312
|
+
dismissedAt: dismissedWindowStart == null ? null : dismissedWindowStart,
|
|
313
|
+
updatedAt: numberField(row, "updated_at"),
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function currentSummary(rule) {
|
|
317
|
+
if (!rule)
|
|
318
|
+
return null;
|
|
319
|
+
return {
|
|
320
|
+
status: rule.status,
|
|
321
|
+
current: rule.current,
|
|
322
|
+
limit: rule.limit,
|
|
323
|
+
percent: rule.percent,
|
|
324
|
+
windowStart: rule.windowStart,
|
|
325
|
+
windowEnd: rule.windowEnd,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
export async function listUsageAlerts(input, access) {
|
|
329
|
+
await ensureTables();
|
|
330
|
+
const scope = input.scope ?? "user";
|
|
331
|
+
const appId = normalizedAppId(input.appId);
|
|
332
|
+
const partition = await resolveScope(scope, access);
|
|
333
|
+
await ensureDefaultRule(partition);
|
|
334
|
+
const rows = await storedRows(partition, appId);
|
|
335
|
+
for (const row of rows)
|
|
336
|
+
await clearExpiredDismissal(row, partition);
|
|
337
|
+
const rules = await Promise.all(rows.map((row) => rowToRule(row, partition)));
|
|
338
|
+
return rules;
|
|
339
|
+
}
|
|
340
|
+
async function requireRule(ruleId, scope, partition) {
|
|
341
|
+
const result = await getDbExec().execute({
|
|
342
|
+
sql: `SELECT id, scope, owner_email, org_id, app_id, unit, period,
|
|
343
|
+
limit_value, channels, enabled, is_default, dismissed_window_start,
|
|
344
|
+
created_at, updated_at
|
|
345
|
+
FROM usage_alert_rules
|
|
346
|
+
WHERE id = ? AND scope = ? AND ${partition.partitionSql} LIMIT 1`,
|
|
347
|
+
args: [ruleId, scope, ...partition.partitionArgs],
|
|
348
|
+
});
|
|
349
|
+
const row = result.rows[0];
|
|
350
|
+
if (!row)
|
|
351
|
+
throw new Error("Usage alert rule was not found.");
|
|
352
|
+
return row;
|
|
353
|
+
}
|
|
354
|
+
async function persistRule(input, partition) {
|
|
355
|
+
const appId = normalizedAppId(input.appId);
|
|
356
|
+
const existing = input.ruleId
|
|
357
|
+
? await requireRule(input.ruleId, partition.scope, partition)
|
|
358
|
+
: null;
|
|
359
|
+
const unit = (input.unit ??
|
|
360
|
+
(existing ? stringField(existing, "unit") : "usd"));
|
|
361
|
+
const period = (input.period ??
|
|
362
|
+
(existing ? stringField(existing, "period") : "day"));
|
|
363
|
+
const currentLimit = existing
|
|
364
|
+
? numberField(existing, "limit_value") /
|
|
365
|
+
USAGE_ALERT_UNIT_SCALE[unit]
|
|
366
|
+
: defaultLimit(unit);
|
|
367
|
+
const limit = input.limit ?? currentLimit;
|
|
368
|
+
const channels = input.channels ??
|
|
369
|
+
(existing ? parseChannels(existing.channels) : ["in-app", "email"]);
|
|
370
|
+
if (!(unit in USAGE_ALERT_UNIT_SCALE))
|
|
371
|
+
throw new Error("Unknown alert unit.");
|
|
372
|
+
if (period !== "day" && period !== "month") {
|
|
373
|
+
throw new Error("Unknown alert period.");
|
|
374
|
+
}
|
|
375
|
+
if (!Number.isFinite(limit) || limit <= 0) {
|
|
376
|
+
throw new Error("Usage alert limit must be greater than zero.");
|
|
377
|
+
}
|
|
378
|
+
if (channels.length === 0) {
|
|
379
|
+
throw new Error("Choose at least one usage alert delivery channel.");
|
|
380
|
+
}
|
|
381
|
+
const id = input.ruleId ?? ruleIdFor(partition, appId, unit, period);
|
|
382
|
+
const isDefault = Boolean(existing && booleanField(existing, "is_default") && appId === null);
|
|
383
|
+
const now = Date.now();
|
|
384
|
+
const storedLimit = Math.round(limit * USAGE_ALERT_UNIT_SCALE[unit]);
|
|
385
|
+
await getDbExec().execute({
|
|
386
|
+
sql: `INSERT INTO usage_alert_rules (
|
|
387
|
+
id, scope, owner_email, org_id, app_id, unit, period, limit_value,
|
|
388
|
+
channels, enabled, is_default, dismissed_window_start, created_at, updated_at
|
|
389
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, ?, ?)
|
|
390
|
+
ON CONFLICT (id) DO UPDATE SET
|
|
391
|
+
app_id = excluded.app_id,
|
|
392
|
+
unit = excluded.unit,
|
|
393
|
+
period = excluded.period,
|
|
394
|
+
limit_value = excluded.limit_value,
|
|
395
|
+
channels = excluded.channels,
|
|
396
|
+
enabled = excluded.enabled,
|
|
397
|
+
is_default = excluded.is_default,
|
|
398
|
+
dismissed_window_start = NULL,
|
|
399
|
+
updated_at = excluded.updated_at`,
|
|
400
|
+
args: [
|
|
401
|
+
id,
|
|
402
|
+
partition.scope,
|
|
403
|
+
partition.ownerEmail,
|
|
404
|
+
partition.orgId,
|
|
405
|
+
appId,
|
|
406
|
+
unit,
|
|
407
|
+
period,
|
|
408
|
+
storedLimit,
|
|
409
|
+
JSON.stringify(channels),
|
|
410
|
+
(input.enabled ?? (existing ? booleanField(existing, "enabled") : true))
|
|
411
|
+
? 1
|
|
412
|
+
: 0,
|
|
413
|
+
isDefault ? 1 : 0,
|
|
414
|
+
now,
|
|
415
|
+
now,
|
|
416
|
+
],
|
|
417
|
+
});
|
|
418
|
+
const rule = await rowToRule(await requireRule(id, partition.scope, partition), partition);
|
|
419
|
+
const listed = await listUsageAlerts({ scope: partition.scope, appId }, { ownerEmail: partition.ownerEmail, orgId: partition.orgId });
|
|
420
|
+
return { rule, rules: listed, current: currentSummary(rule) };
|
|
421
|
+
}
|
|
422
|
+
export async function saveUsageAlert(input, access) {
|
|
423
|
+
await ensureTables();
|
|
424
|
+
const partition = await resolveScope(input.scope ?? "user", access);
|
|
425
|
+
return persistRule(input, partition);
|
|
426
|
+
}
|
|
427
|
+
export async function setUsageAlertEnabled(ruleId, scope, enabled, access) {
|
|
428
|
+
await ensureTables();
|
|
429
|
+
const partition = await resolveScope(scope, access);
|
|
430
|
+
const existing = await requireRule(ruleId, scope, partition);
|
|
431
|
+
return persistRule({
|
|
432
|
+
scope,
|
|
433
|
+
ruleId,
|
|
434
|
+
appId: existing.app_id == null ? null : String(existing.app_id),
|
|
435
|
+
unit: stringField(existing, "unit"),
|
|
436
|
+
period: stringField(existing, "period"),
|
|
437
|
+
limit: numberField(existing, "limit_value") /
|
|
438
|
+
USAGE_ALERT_UNIT_SCALE[stringField(existing, "unit")],
|
|
439
|
+
channels: parseChannels(existing.channels),
|
|
440
|
+
enabled,
|
|
441
|
+
}, partition);
|
|
442
|
+
}
|
|
443
|
+
export async function dismissUsageAlert(ruleId, scope, access) {
|
|
444
|
+
await ensureTables();
|
|
445
|
+
const partition = await resolveScope(scope, access);
|
|
446
|
+
const existing = await requireRule(ruleId, scope, partition);
|
|
447
|
+
const window = windowForPeriod(stringField(existing, "period"));
|
|
448
|
+
const eventResult = await getDbExec().execute({
|
|
449
|
+
sql: `SELECT notification_id FROM usage_alert_events
|
|
450
|
+
WHERE rule_id = ? AND window_start = ? LIMIT 1`,
|
|
451
|
+
args: [ruleId, window.start],
|
|
452
|
+
});
|
|
453
|
+
const notificationId = eventResult.rows[0]?.notification_id;
|
|
454
|
+
await getDbExec().execute({
|
|
455
|
+
sql: `UPDATE usage_alert_rules
|
|
456
|
+
SET dismissed_window_start = ?, updated_at = ?
|
|
457
|
+
WHERE id = ? AND scope = ? AND ${partition.partitionSql}`,
|
|
458
|
+
args: [window.start, Date.now(), ruleId, scope, ...partition.partitionArgs],
|
|
459
|
+
});
|
|
460
|
+
if (typeof notificationId === "string" && notificationId) {
|
|
461
|
+
await deleteNotification(notificationId, partition.ownerEmail);
|
|
462
|
+
}
|
|
463
|
+
const rule = await rowToRule(await requireRule(ruleId, scope, partition), partition);
|
|
464
|
+
const listed = await listUsageAlerts({
|
|
465
|
+
scope,
|
|
466
|
+
appId: existing.app_id == null ? null : String(existing.app_id),
|
|
467
|
+
}, access);
|
|
468
|
+
return { rule, rules: listed, current: currentSummary(rule) };
|
|
469
|
+
}
|
|
470
|
+
function shouldEvaluate(record) {
|
|
471
|
+
const activity = record.inputTokens +
|
|
472
|
+
record.outputTokens +
|
|
473
|
+
(record.cacheReadTokens ?? 0) +
|
|
474
|
+
(record.cacheWriteTokens ?? 0) +
|
|
475
|
+
(record.costCentsX100 ?? 0);
|
|
476
|
+
return Boolean(record.ownerEmail && activity > 0);
|
|
477
|
+
}
|
|
478
|
+
function evaluationPartition(scope, record) {
|
|
479
|
+
const ownerEmail = normalizeEmail(record.ownerEmail);
|
|
480
|
+
const orgId = record.orgId?.trim() || null;
|
|
481
|
+
return {
|
|
482
|
+
scope,
|
|
483
|
+
ownerEmail,
|
|
484
|
+
orgId: scope === "workspace" ? orgId : null,
|
|
485
|
+
canManage: true,
|
|
486
|
+
partitionSql: scope === "workspace" ? "org_id = ?" : "LOWER(owner_email) = ?",
|
|
487
|
+
partitionArgs: scope === "workspace" ? [orgId] : [ownerEmail],
|
|
488
|
+
};
|
|
489
|
+
}
|
|
490
|
+
function alertValueLabel(value, unit) {
|
|
491
|
+
if (unit === "usd") {
|
|
492
|
+
return value.toLocaleString(undefined, {
|
|
493
|
+
style: "currency",
|
|
494
|
+
currency: "USD",
|
|
495
|
+
maximumFractionDigits: 2,
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
const suffix = unit === "builder-credits" ? "Builder credits" : "tokens";
|
|
499
|
+
return `${value.toLocaleString(undefined, { maximumFractionDigits: unit === "tokens" ? 0 : 2 })} ${suffix}`;
|
|
500
|
+
}
|
|
501
|
+
async function matchingEvaluationRows(record) {
|
|
502
|
+
await ensureTables();
|
|
503
|
+
const partitions = [evaluationPartition("user", record)];
|
|
504
|
+
if (record.orgId?.trim()) {
|
|
505
|
+
partitions.push(evaluationPartition("workspace", record));
|
|
506
|
+
}
|
|
507
|
+
const matches = [];
|
|
508
|
+
const appId = normalizedAppId(record.app);
|
|
509
|
+
for (const partition of partitions) {
|
|
510
|
+
await ensureDefaultRule(partition);
|
|
511
|
+
const rows = await storedRows(partition, appId);
|
|
512
|
+
for (const row of rows) {
|
|
513
|
+
await clearExpiredDismissal(row, partition);
|
|
514
|
+
if (booleanField(row, "enabled"))
|
|
515
|
+
matches.push({ row, partition });
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
return matches;
|
|
519
|
+
}
|
|
520
|
+
async function evaluateUsageAlerts(record) {
|
|
521
|
+
const matches = await matchingEvaluationRows(record);
|
|
522
|
+
for (const { row, partition } of matches) {
|
|
523
|
+
const appId = row.app_id == null ? null : String(row.app_id);
|
|
524
|
+
const unit = stringField(row, "unit");
|
|
525
|
+
const period = stringField(row, "period");
|
|
526
|
+
const window = windowForPeriod(period);
|
|
527
|
+
const totals = await usageTotals(appId, partition, period);
|
|
528
|
+
const current = valueForUnit(totals, unit);
|
|
529
|
+
const limit = numberField(row, "limit_value") / USAGE_ALERT_UNIT_SCALE[unit];
|
|
530
|
+
const dismissedWindowStart = nullableNumberField(row, "dismissed_window_start");
|
|
531
|
+
if (dismissedWindowStart === window.start ||
|
|
532
|
+
!booleanField(row, "enabled") ||
|
|
533
|
+
limit <= 0 ||
|
|
534
|
+
current < limit) {
|
|
535
|
+
continue;
|
|
536
|
+
}
|
|
537
|
+
const ruleId = stringField(row, "id");
|
|
538
|
+
const eventId = `${ruleId}:${window.start}`;
|
|
539
|
+
const inserted = await getDbExec().execute({
|
|
540
|
+
sql: `INSERT INTO usage_alert_events (id, rule_id, window_start, notification_id, created_at)
|
|
541
|
+
VALUES (?, ?, ?, NULL, ?)
|
|
542
|
+
ON CONFLICT (rule_id, window_start) DO NOTHING`,
|
|
543
|
+
args: [eventId, ruleId, window.start, Date.now()],
|
|
544
|
+
});
|
|
545
|
+
if (Number(inserted.rowsAffected ?? 0) !== 1)
|
|
546
|
+
continue;
|
|
547
|
+
const channels = parseChannels(row.channels);
|
|
548
|
+
const deliveryChannels = [
|
|
549
|
+
...new Set(channels.map((channel) => (channel === "in-app" ? "inbox" : "email"))),
|
|
550
|
+
];
|
|
551
|
+
if (deliveryChannels.length === 0)
|
|
552
|
+
continue;
|
|
553
|
+
const owner = normalizeEmail(stringField(row, "owner_email"));
|
|
554
|
+
const target = appId ? ` for ${appId}` : " across all apps";
|
|
555
|
+
const delivery = await notifyWithDelivery({
|
|
556
|
+
severity: "warning",
|
|
557
|
+
title: "Usage limit reached",
|
|
558
|
+
body: `${alertValueLabel(current, unit)} of ${alertValueLabel(limit, unit)} used${target} this ${period}.`,
|
|
559
|
+
metadata: {
|
|
560
|
+
usageAlertRuleId: ruleId,
|
|
561
|
+
appId,
|
|
562
|
+
period,
|
|
563
|
+
windowStart: window.start,
|
|
564
|
+
},
|
|
565
|
+
channels: deliveryChannels,
|
|
566
|
+
}, { owner });
|
|
567
|
+
const notificationId = delivery.notification?.id;
|
|
568
|
+
if (notificationId) {
|
|
569
|
+
await getDbExec().execute({
|
|
570
|
+
sql: `UPDATE usage_alert_events SET notification_id = ?
|
|
571
|
+
WHERE rule_id = ? AND window_start = ?`,
|
|
572
|
+
args: [notificationId, ruleId, window.start],
|
|
573
|
+
});
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
export function enqueueUsageAlertEvaluation(record) {
|
|
578
|
+
if (!shouldEvaluate(record))
|
|
579
|
+
return;
|
|
580
|
+
evaluationTail = evaluationTail
|
|
581
|
+
.then(() => evaluateUsageAlerts(record))
|
|
582
|
+
.catch((error) => {
|
|
583
|
+
console.error("[usage-alerts] evaluation failed:", error);
|
|
584
|
+
});
|
|
585
|
+
}
|
|
586
|
+
export function _resetUsageAlertStoreForTests() {
|
|
587
|
+
initPromise = undefined;
|
|
588
|
+
evaluationTail = Promise.resolve();
|
|
589
|
+
}
|
|
590
|
+
export async function _waitForUsageAlertEvaluationsForTests() {
|
|
591
|
+
await evaluationTail;
|
|
592
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type UsageBillingMode } from "./store.js";
|
|
2
|
+
export type UsageMetricsScope = "me" | "workspace";
|
|
3
|
+
export interface UsageMetricBucket {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
costCents: number;
|
|
7
|
+
calls: number;
|
|
8
|
+
inputTokens: number;
|
|
9
|
+
outputTokens: number;
|
|
10
|
+
cacheReadTokens: number;
|
|
11
|
+
cacheWriteTokens: number;
|
|
12
|
+
activeUsers: number;
|
|
13
|
+
lastActiveAt: number | null;
|
|
14
|
+
}
|
|
15
|
+
export interface UsageDailyMetric {
|
|
16
|
+
date: string;
|
|
17
|
+
costCents: number;
|
|
18
|
+
calls: number;
|
|
19
|
+
tokens: number;
|
|
20
|
+
}
|
|
21
|
+
export interface UsageRecentMetric {
|
|
22
|
+
id: number;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
ownerEmail: string;
|
|
25
|
+
app: string;
|
|
26
|
+
label: string;
|
|
27
|
+
model: string;
|
|
28
|
+
inputTokens: number;
|
|
29
|
+
outputTokens: number;
|
|
30
|
+
cacheReadTokens: number;
|
|
31
|
+
cacheWriteTokens: number;
|
|
32
|
+
costCents: number;
|
|
33
|
+
prompt: string | null;
|
|
34
|
+
promptSource: "thread" | "thread-preview" | "not-captured" | "unavailable";
|
|
35
|
+
threadId: string | null;
|
|
36
|
+
}
|
|
37
|
+
export interface UsageUserOption {
|
|
38
|
+
email: string;
|
|
39
|
+
role: string | null;
|
|
40
|
+
}
|
|
41
|
+
export interface UsageMetricsAccess {
|
|
42
|
+
viewerEmail: string;
|
|
43
|
+
orgId: string | null;
|
|
44
|
+
role: string | null;
|
|
45
|
+
canViewWorkspace: boolean;
|
|
46
|
+
totalUsers: number;
|
|
47
|
+
}
|
|
48
|
+
export interface AppUsageMetrics {
|
|
49
|
+
billing: UsageBillingMode;
|
|
50
|
+
app: string;
|
|
51
|
+
appKey: string;
|
|
52
|
+
viewScope: UsageMetricsScope;
|
|
53
|
+
selectedUserEmail: string | null;
|
|
54
|
+
availableUsers: UsageUserOption[];
|
|
55
|
+
sinceMs: number;
|
|
56
|
+
sinceDays: number;
|
|
57
|
+
generatedAt: number;
|
|
58
|
+
access: UsageMetricsAccess;
|
|
59
|
+
totals: {
|
|
60
|
+
costCents: number;
|
|
61
|
+
calls: number;
|
|
62
|
+
inputTokens: number;
|
|
63
|
+
outputTokens: number;
|
|
64
|
+
cacheReadTokens: number;
|
|
65
|
+
cacheWriteTokens: number;
|
|
66
|
+
activeUsers: number;
|
|
67
|
+
};
|
|
68
|
+
currentDay: {
|
|
69
|
+
costCents: number;
|
|
70
|
+
credits: number;
|
|
71
|
+
calls: number;
|
|
72
|
+
tokens: number;
|
|
73
|
+
};
|
|
74
|
+
byLabel: UsageMetricBucket[];
|
|
75
|
+
byModel: UsageMetricBucket[];
|
|
76
|
+
daily: UsageDailyMetric[];
|
|
77
|
+
recent: UsageRecentMetric[];
|
|
78
|
+
}
|
|
79
|
+
export interface UsageMetricsAccessInput {
|
|
80
|
+
ownerEmail: string;
|
|
81
|
+
orgId?: string | null;
|
|
82
|
+
app: string;
|
|
83
|
+
}
|
|
84
|
+
interface QueryScope {
|
|
85
|
+
where: string;
|
|
86
|
+
args: unknown[];
|
|
87
|
+
}
|
|
88
|
+
export declare function normalizeUsageAppKey(value: string): string;
|
|
89
|
+
export declare function usageAppScope(app: string): QueryScope;
|
|
90
|
+
export declare function listAppUsageMetrics(input: {
|
|
91
|
+
sinceDays?: number;
|
|
92
|
+
scope?: UsageMetricsScope;
|
|
93
|
+
userEmail?: string | null;
|
|
94
|
+
}, accessInput: UsageMetricsAccessInput): Promise<AppUsageMetrics>;
|
|
95
|
+
export {};
|