@agent-native/core-corpus 0.229.0 → 0.230.0-nightly-20261117004313
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/onboarding-journeys/SKILL.md +12 -9
- package/corpus/templates/analytics/.agents/skills/session-replay/SKILL.md +47 -0
- package/corpus/templates/analytics/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/analytics/actions/archive-dashboard.ts +32 -5
- package/corpus/templates/analytics/actions/compose-dashboard.ts +102 -8
- package/corpus/templates/analytics/actions/create-dashboard-folder.ts +32 -8
- package/corpus/templates/analytics/actions/create-session-report.ts +84 -0
- package/corpus/templates/analytics/actions/delete-session-report.ts +26 -0
- package/corpus/templates/analytics/actions/get-onboarding-journey.ts +2 -2
- package/corpus/templates/analytics/actions/get-session-report.ts +25 -0
- package/corpus/templates/analytics/actions/hide-analysis.ts +37 -6
- package/corpus/templates/analytics/actions/hide-dashboard.ts +35 -5
- package/corpus/templates/analytics/actions/list-analysis-revisions.ts +3 -1
- package/corpus/templates/analytics/actions/list-dashboard-revisions.ts +1 -0
- package/corpus/templates/analytics/actions/list-session-reports.ts +35 -0
- package/corpus/templates/analytics/actions/mutate-dashboard.ts +67 -1
- package/corpus/templates/analytics/actions/navigate.ts +15 -19
- package/corpus/templates/analytics/actions/rename-analysis.ts +49 -8
- package/corpus/templates/analytics/actions/rename-dashboard.ts +46 -4
- package/corpus/templates/analytics/actions/restore-analysis-revision.ts +47 -7
- package/corpus/templates/analytics/actions/restore-dashboard-revision.ts +53 -13
- package/corpus/templates/analytics/actions/save-analysis.ts +61 -14
- package/corpus/templates/analytics/actions/set-dashboard-folder.ts +46 -7
- package/corpus/templates/analytics/actions/update-dashboard.ts +117 -23
- package/corpus/templates/analytics/actions/update-session-report.ts +45 -0
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +8 -1
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +7 -0
- package/corpus/templates/analytics/app/i18n/en-US.ts +22 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +6 -1
- package/corpus/templates/analytics/app/pages/sessions/SessionReportPage.tsx +326 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionReports.tsx +151 -0
- package/corpus/templates/analytics/app/routes/sessions.reports.$reportId.tsx +10 -0
- package/corpus/templates/analytics/changelog/2026-11-07-sessions-triage-lab-have-the-agent-write-a-report-on-a-sessi.md +6 -0
- package/corpus/templates/analytics/changelog/2026-11-16-connected-mcp-agents-can-now-edit-archive-and-restore-dashbo.md +6 -0
- package/corpus/templates/analytics/scripts/journey-snapshot-plan.ts +42 -0
- package/corpus/templates/analytics/scripts/journey-snapshot.ts +26 -7
- package/corpus/templates/analytics/server/db/index.ts +30 -0
- package/corpus/templates/analytics/server/db/schema.ts +54 -0
- package/corpus/templates/analytics/server/lib/analytics-mcp.ts +10 -1
- package/corpus/templates/analytics/server/lib/bigquery.ts +269 -79
- package/corpus/templates/analytics/server/lib/dashboard-folders-store.ts +36 -32
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +819 -384
- package/corpus/templates/analytics/server/lib/first-party-analytics-backend.ts +7 -0
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +15 -0
- package/corpus/templates/analytics/server/lib/guarded-writes.ts +435 -0
- package/corpus/templates/analytics/server/lib/onboarding-journey.ts +67 -11
- package/corpus/templates/analytics/server/lib/session-replay-agent-context.ts +20 -4
- package/corpus/templates/analytics/server/lib/session-replay.ts +73 -0
- package/corpus/templates/analytics/server/lib/session-report-sharing.ts +35 -0
- package/corpus/templates/analytics/server/lib/session-reports.ts +439 -0
- package/corpus/templates/analytics/server/lib/sessions-triage-lab.ts +6 -2
- package/corpus/templates/analytics/server/lib/write-receipts-migration.ts +21 -0
- package/corpus/templates/analytics/server/plugins/auth.ts +2 -0
- package/corpus/templates/analytics/server/plugins/core-routes.ts +18 -7
- package/corpus/templates/analytics/server/plugins/db.ts +43 -0
- package/corpus/templates/analytics/server/routes/[...page].get.ts +36 -0
- package/corpus/templates/analytics/server/routes/api/session-report-agent-context.json.get.ts +55 -0
- package/corpus/templates/analytics/shared/resource-agent-access.ts +4 -0
- package/corpus/templates/analytics/shared/session-reports.ts +59 -0
- package/corpus/templates/assets/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/brain/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/calendar/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/chat/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/clips/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/clips/actions/add-recording-to-space.ts +9 -0
- package/corpus/templates/clips/actions/archive-recording.ts +6 -0
- package/corpus/templates/clips/actions/delete-recording-permanent.ts +9 -0
- package/corpus/templates/clips/actions/list-recordings.ts +7 -0
- package/corpus/templates/clips/actions/restore-recording.ts +6 -0
- package/corpus/templates/clips/actions/tag-recording.ts +6 -0
- package/corpus/templates/clips/actions/trash-recording.ts +6 -0
- package/corpus/templates/clips/changelog/2026-11-07-agents-connected-to-clips-over-mcp-can-list-your-recordings-.md +6 -0
- package/corpus/templates/clips/changelog/2026-11-07-asking-the-agent-to-make-several-clips-public-now-asks-once-.md +6 -0
- package/corpus/templates/clips/changelog/2026-11-16-agent-frame-requests-on-large-recordings-no-longer-fail.md +6 -0
- package/corpus/templates/clips/server/lib/agent-frame-range.ts +5 -3
- package/corpus/templates/content/.agents/skills/content/SKILL.md +1 -1
- package/corpus/templates/content/.agents/skills/document-editing/SKILL.md +13 -4
- package/corpus/templates/content/.agents/skills/document-editing/references/databases.md +9 -1
- package/corpus/templates/content/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/content/actions/_blocks-field-identity.ts +19 -3
- package/corpus/templates/content/actions/_column-rules.ts +235 -0
- package/corpus/templates/content/actions/_content-database-row-migration.ts +6 -0
- package/corpus/templates/content/actions/_database-block-actions.ts +15 -0
- package/corpus/templates/content/actions/_database-property-setup.ts +11 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +9 -3
- package/corpus/templates/content/actions/_github-source.ts +268 -48
- package/corpus/templates/content/actions/add-database-item.ts +3 -0
- package/corpus/templates/content/actions/configure-document-property.ts +35 -0
- package/corpus/templates/content/actions/delete-content-database.ts +5 -0
- package/corpus/templates/content/actions/delete-document-property.ts +12 -0
- package/corpus/templates/content/actions/list-document-properties.ts +3 -0
- package/corpus/templates/content/actions/materialize-builder-required-fields.ts +16 -3
- package/corpus/templates/content/actions/migrate-content-database-rows.ts +14 -0
- package/corpus/templates/content/actions/mutate-content-database-block.ts +1 -1
- package/corpus/templates/content/actions/patch-database-items.ts +3 -0
- package/corpus/templates/content/actions/remove-database-items.ts +6 -0
- package/corpus/templates/content/actions/restore-content-database.ts +5 -0
- package/corpus/templates/content/actions/set-blocks-field-freeze-rule.ts +146 -0
- package/corpus/templates/content/actions/set-document-property.ts +180 -18
- package/corpus/templates/content/actions/set-image-alt-text.ts +17 -3
- package/corpus/templates/content/actions/transcribe-media.ts +13 -2
- package/corpus/templates/content/actions/update-content-database-view.ts +6 -0
- package/corpus/templates/content/actions/update-database-item.ts +5 -0
- package/corpus/templates/content/actions/update-database-items.ts +13 -1
- package/corpus/templates/content/actions/update-document.ts +70 -17
- package/corpus/templates/content/actions/upsert-database-item-by-key.ts +3 -0
- package/corpus/templates/content/app/components/editor/BlockActionsMenu.tsx +4 -0
- package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +7 -4
- package/corpus/templates/content/app/components/editor/ContentImportDialog.tsx +6 -3
- package/corpus/templates/content/app/components/editor/DocumentBlockFields.tsx +326 -22
- package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +9 -1
- package/corpus/templates/content/app/components/editor/DocumentPagePanel.tsx +16 -3
- package/corpus/templates/content/app/components/editor/DocumentPanelTabs.tsx +5 -2
- package/corpus/templates/content/app/components/editor/DocumentToolbar.tsx +3 -3
- package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +111 -35
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +43 -13
- package/corpus/templates/content/app/components/editor/block-actions.ts +136 -5
- package/corpus/templates/content/app/components/editor/database/ContentTable.tsx +54 -9
- package/corpus/templates/content/app/components/editor/discussion-panel.tsx +236 -167
- package/corpus/templates/content/app/components/editor/extensions/AudioBlock.tsx +4 -2
- package/corpus/templates/content/app/components/editor/extensions/ImageBlock.tsx +4 -2
- package/corpus/templates/content/app/components/editor/extensions/LocalMdxComponentNode.tsx +4 -1
- package/corpus/templates/content/app/components/editor/extensions/NotionExtensions.tsx +898 -197
- package/corpus/templates/content/app/components/editor/extensions/VideoBlock.tsx +3 -1
- package/corpus/templates/content/app/components/editor/useEditorEditable.ts +20 -0
- package/corpus/templates/content/app/global.css +26 -0
- package/corpus/templates/content/app/hooks/content-action-refresh.ts +1 -1
- package/corpus/templates/content/app/hooks/use-document-properties.ts +81 -0
- package/corpus/templates/content/app/i18n-data.ts +15 -0
- package/corpus/templates/content/changelog/2026-11-02-toggle-titles-are-now-page-text-so-you-can-comment-on-them-f.md +6 -0
- package/corpus/templates/content/changelog/2026-11-08-agent-and-script-edits-to-a-collection-page-no-longer-overwrit.md +6 -0
- package/corpus/templates/content/changelog/2026-11-16-an-agent-s-changes-to-a-table-reach-it-within-seconds-while-it-s-open.md +6 -0
- package/corpus/templates/content/parity/matrix.md +1 -0
- package/corpus/templates/content/parity/matrix.ts +25 -0
- package/corpus/templates/content/scripts/seed-perf-database.mjs +16 -15
- package/corpus/templates/content/server/lib/blocks-field-suggestions.ts +7 -0
- package/corpus/templates/content/server/lib/content-import.ts +99 -43
- package/corpus/templates/content/server/live-copy/persist.ts +17 -3
- package/corpus/templates/content/shared/api.ts +4 -0
- package/corpus/templates/content/shared/column-rules.ts +176 -0
- package/corpus/templates/content/shared/database-block-actions.ts +2 -0
- package/corpus/templates/content/shared/import/markdown.ts +32 -6
- package/corpus/templates/content/shared/properties.ts +34 -1
- package/corpus/templates/crm/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/design/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/design/.generated/bridge/interact-tweaks.generated.ts +66 -0
- package/corpus/templates/design/.generated/bridge/native-builtin-metadata.generated.ts +326 -0
- package/corpus/templates/design/.generated/bridge/native-worker-source.generated.ts +6 -0
- package/corpus/templates/design/actions/acknowledge-visual-edit-pending.ts +162 -27
- package/corpus/templates/design/actions/get-visual-edit-pending.ts +34 -1
- package/corpus/templates/design/actions/open-visual-edit.ts +22 -9
- package/corpus/templates/design/actions/publish-visual-edit-pending.ts +16 -1
- package/corpus/templates/design/actions/reset-tweak-source-baseline.ts +58 -0
- package/corpus/templates/design/actions/update-design.ts +4 -3
- package/corpus/templates/design/app/components/design/DesignCanvas.tsx +59 -0
- package/corpus/templates/design/app/components/design/EditPanel.tsx +8 -10
- package/corpus/templates/design/app/components/design/FloatingTweaksPanel.tsx +204 -0
- package/corpus/templates/design/app/components/design/bridge/embedded-wheel.bridge.ts +1 -1
- package/corpus/templates/design/app/components/design/bridge/interact-tweaks.bridge.ts +99 -0
- package/corpus/templates/design/app/components/design/bridge/motion-preview.bridge.ts +1 -1
- package/corpus/templates/design/app/components/design/bridge/nav.bridge.ts +1 -1
- package/corpus/templates/design/app/components/design/bridge/tweak.bridge.ts +2 -1
- package/corpus/templates/design/app/components/design/bridge/zoom.bridge.ts +1 -1
- package/corpus/templates/design/app/components/design/design-canvas/interact-document.ts +43 -8
- package/corpus/templates/design/app/components/design/design-canvas/interact-tweak-set.ts +154 -0
- package/corpus/templates/design/app/components/design/edit-panel/tweak-scope.ts +43 -3
- package/corpus/templates/design/app/components/design/floating-tweaks-layout.ts +91 -0
- package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +8 -3
- package/corpus/templates/design/app/i18n/en-US.ts +6 -0
- package/corpus/templates/design/app/lib/review-agent/review-agent-models.ts +5 -0
- package/corpus/templates/design/app/lib/review-agent/use-review-agent-requests.ts +12 -1
- package/corpus/templates/design/app/pages/design-editor/apply-handoff.ts +149 -0
- package/corpus/templates/design/app/pages/design-editor/commands/apply-pending-visual-styles-with-agent.ts +58 -11
- package/corpus/templates/design/app/pages/design-editor/commands/publish-visual-edit-pending.ts +2 -0
- package/corpus/templates/design/app/pages/design-editor/commands/record-pending-live-structure-edit.ts +9 -0
- package/corpus/templates/design/app/pages/design-editor/commands/redo.ts +12 -7
- package/corpus/templates/design/app/pages/design-editor/commands/undo.ts +12 -8
- package/corpus/templates/design/app/pages/design-editor/design-editor-view.tsx +52 -1
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-canvas-and-screens.ts +32 -9
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-core.ts +6 -3
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-export-and-handoff.ts +199 -85
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-files-and-saving.ts +6 -0
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-history.ts +25 -22
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-modes.ts +6 -1
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-screen-rendering.tsx +11 -0
- package/corpus/templates/design/app/pages/design-editor/domains/use-editor-source-and-sync.ts +30 -13
- package/corpus/templates/design/app/pages/design-editor/domains/use-tweaks.ts +60 -4
- package/corpus/templates/design/app/pages/design-editor/editor-chrome.ts +5 -1
- package/corpus/templates/design/app/pages/design-editor/editor-state.ts +37 -14
- package/corpus/templates/design/app/pages/design-editor/history-cleanup.ts +66 -0
- package/corpus/templates/design/app/pages/design-editor/history.ts +10 -8
- package/corpus/templates/design/app/pages/design-editor/host-chat-state.ts +38 -0
- package/corpus/templates/design/app/pages/design-editor/pending-edits.ts +20 -0
- package/corpus/templates/design/app/pages/design-editor/tweak-handoff.ts +93 -0
- package/corpus/templates/design/app/pages/design-editor/view/right-rail.tsx +4 -0
- package/corpus/templates/design/app/pages/design-editor/view/single-screen-canvas.tsx +7 -0
- package/corpus/templates/design/app/pages/design-editor/view/visual-edit-apply-toolbar.tsx +26 -24
- package/corpus/templates/design/app/pages/design-editor/view/zoom-menu.tsx +6 -0
- package/corpus/templates/design/app/pages/design-editor/visual-edit-publisher-session.ts +72 -0
- package/corpus/templates/design/changelog/2026-11-16-applying-canvas-changes-now-keeps-sent-tweaks-pending-until-.md +6 -0
- package/corpus/templates/design/changelog/2026-11-16-applying-pending-tweaks-preserves-the-remaining-undo-history.md +6 -0
- package/corpus/templates/design/changelog/2026-11-16-dragging-a-dial-or-slider-inside-an-interact-frame-now-saves.md +6 -0
- package/corpus/templates/design/changelog/2026-11-16-fixed-apply-handoffs-for-live-edits-tweak-tokens-and-interac.md +6 -0
- package/corpus/templates/design/changelog/2026-11-16-fixed-the-floating-tweaks-panel-covering-inspector-controls-.md +6 -0
- package/corpus/templates/design/changelog/2026-11-16-floating-tweaks-stay-available-over-the-canvas-while-you-wor.md +6 -0
- package/corpus/templates/design/changelog/2026-11-16-one-tweak-knob-can-now-drive-several-screens-and-interact-ke.md +6 -0
- package/corpus/templates/design/changelog/2026-11-16-pending-visual-edits-stay-queued-until-the-host-starts-apply.md +6 -0
- package/corpus/templates/design/changelog/2026-11-16-review-comments-can-use-the-default-agent-model.md +6 -0
- package/corpus/templates/design/server/db/schema.ts +1 -0
- package/corpus/templates/design/server/plugins/db.ts +5 -0
- package/corpus/templates/design/shared/api.ts +5 -2
- package/corpus/templates/design/shared/tweak-definition-schema.ts +21 -19
- package/corpus/templates/design/shared/view-settings.ts +8 -0
- package/corpus/templates/design/shared/visual-edit-handoff.ts +57 -0
- package/corpus/templates/dispatch/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/forms/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/mail/.agents/skills/email-drafts/SKILL.md +3 -1
- package/corpus/templates/mail/.agents/skills/mail-interaction-parity/references/interaction-matrix.md +3 -1
- package/corpus/templates/mail/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/mail/actions/manage-draft.ts +163 -144
- package/corpus/templates/mail/actions/sync-draft-mailbox.ts +52 -0
- package/corpus/templates/mail/app/hooks/use-compose-state.ts +146 -19
- package/corpus/templates/mail/app/lib/alias-utils.ts +7 -46
- package/corpus/templates/mail/changelog/2026-11-07-gmail-s-copy-of-a-draft-now-matches-mail-s-when-you-and-the.md +6 -0
- package/corpus/templates/mail/server/lib/draft-mailbox-sync.ts +378 -0
- package/corpus/templates/mail/server/lib/gmail-drafts.ts +108 -27
- package/corpus/templates/mail/server/lib/google-auth.ts +11 -0
- package/corpus/templates/mail/server/lib/local-email-drafts.ts +107 -22
- package/corpus/templates/mail/server/lib/saved-draft-ownership.ts +6 -3
- package/corpus/templates/mail/shared/alias-tokens.ts +47 -0
- package/corpus/templates/mail/shared/draft-mailbox.ts +6 -0
- package/corpus/templates/plan/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/corpus/templates/slides/.deploy-tmp/agent-native-provided-plugins.mjs +10 -0
- package/package.json +1 -1
package/corpus/README.md
CHANGED
|
@@ -154,16 +154,19 @@ top-level tree to `journey:capture`; the capture CLI reads top-level `nodes`.
|
|
|
154
154
|
`format: "summary"` for long windows. Pages after the first run up
|
|
155
155
|
to ten at a time. If the aggregate budget or time budget cuts a read,
|
|
156
156
|
`coverage.truncated` and `notes` identify why; read them before interpreting
|
|
157
|
-
counts. When
|
|
158
|
-
`observationWatermark`: call again
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
157
|
+
counts. When a time limit stopped it, a note gives an
|
|
158
|
+
`observationWatermark`: call again within a few minutes with the same
|
|
159
|
+
arguments plus that value. Pages and follow-ups that finished come from the
|
|
160
|
+
query cache (writing to it is best-effort), and the BigQuery jobs that were
|
|
161
|
+
still running keep running, so the next call collects them instead of
|
|
162
|
+
starting over, even a query that needs longer than one call. Each call gets
|
|
163
|
+
further; repeat until the note is gone. A job is collected only within an
|
|
164
|
+
hour of when it started; after that, a call runs the query again. A
|
|
165
|
+
PostgreSQL-backed app has no jobs to collect, so a follow-up that ran out of
|
|
166
|
+
its full 20 seconds gets a note to read a shorter range instead. In
|
|
162
167
|
session mode the watermark pins event time but not receive time, so an event
|
|
163
168
|
that arrives between calls can still change pages; the read then reports
|
|
164
|
-
`may_have_shifted`. A
|
|
165
|
-
note that a follow-up needed more than the 20 seconds one query may run means a
|
|
166
|
-
retry will not finish it; ask for a shorter date range instead. A truncated event sample skips replay reads and
|
|
169
|
+
`may_have_shifted`. A truncated event sample skips replay reads and
|
|
167
170
|
returns `sessionsWithReplay: null` because replay availability is unknown. If
|
|
168
171
|
a read truncates, page boundaries may have shifted,
|
|
169
172
|
or the terminal cohort cannot be covered in one query under the
|
|
@@ -368,7 +371,7 @@ pnpm --filter analytics journey:snapshot --week 2026-10-19 --apps clips,design,s
|
|
|
368
371
|
pnpm --filter analytics journey:snapshot --week 2026-10-19 --apps design --experiment first_run_builder_credits
|
|
369
372
|
```
|
|
370
373
|
|
|
371
|
-
`--week` is a closed UTC Monday week. The query starts the previous day to include sessions already underway. Without `--week`, the CLI selects the last full week. It runs the pinned cost preflight and reads one tree per missing app/week/cohort from deployed Analytics
|
|
374
|
+
`--week` is a closed UTC Monday week. The query starts the previous day to include sessions already underway. Without `--week`, the CLI selects the last full week. It runs the pinned cost preflight and reads one tree per missing app/week/cohort from deployed Analytics. When a time limit stops a read, it calls again with the returned `continueWith.observationWatermark`, up to 8 calls 10 seconds apart, collecting the queries each call left running, and publishes nothing if the read is still stopped after the last one. Complete trees are cached by app, dates, preset, app URL, and authenticated principal. `--dry-run` prints the request without network access. `--refresh` bypasses existing tree, screenshot, and Design caches and should be used only for an intentional refresh.
|
|
372
375
|
|
|
373
376
|
The output lives under `.tmp/onboarding-journey-snapshots/runs/<week>/`: each app with captured session frames has a Design canvas, and each app has a per-app tree cache and screenshot manifests; the shared `summary.md` includes the cohort trees. Each canvas has a 36 screenshot-backed frame ceiling allocated across its cohort bands. Multi-band canvases place independent trees side by side and keep each band's own root denominator. Same-app cohort trees use `app::cohort::step` node keys so the source app and band denominator stay distinct. Canvas cache keys include the experiment and cohort layout so different runs cannot overwrite one another. The optional experiment accepts `first_run_builder_credits` and `first_run_builder_credits_v2`; control and credits share one canvas, and `summary.md` reports per-arm forks and matching-step week-over-week changes from the full Analytics trees, including cohorts with zero screenshot frames. The canvas contains only screenshot-backed cohorts. Clips first output is `recording_ready`.
|
|
374
377
|
|
|
@@ -420,6 +420,53 @@ agent answers about browser recordings in the Analytics template.
|
|
|
420
420
|
remain. Route validation rejects negative/non-numeric `offset`/`fromMs`/
|
|
421
421
|
`toMs` and `fromMs > toMs` with 400.
|
|
422
422
|
|
|
423
|
+
## Reports
|
|
424
|
+
|
|
425
|
+
A report saves what someone found in one session (Sessions triage Lab). The
|
|
426
|
+
session page's Create report asks the agent to write it; the agent saves it
|
|
427
|
+
with `create-session-report`. `get-session-report`, `list-session-reports`
|
|
428
|
+
(optionally by `recordingId`), `update-session-report`,
|
|
429
|
+
`delete-session-report`, and `navigate --reportId` cover the rest.
|
|
430
|
+
|
|
431
|
+
- Write it from the session's evidence only: read
|
|
432
|
+
`get-session-replay-summary` and `get-session-replay-timeline` first. The
|
|
433
|
+
title names what went wrong in one line; the summary says what happened and
|
|
434
|
+
why, citing the moments that show it. Key moments use `atMs`, ms after the
|
|
435
|
+
recording started. Pass `errorIssueId` when the session hit a Monitoring
|
|
436
|
+
issue. Never pass a commit: the report records the one the session reported.
|
|
437
|
+
- `fromMs` is the moment the person asked from, when the session page was
|
|
438
|
+
opened at one (`?atMs=`). Start the report there.
|
|
439
|
+
- A new report opens to the maker's organization when the recording is
|
|
440
|
+
org-visible there, and is private otherwise, so it reaches no one the
|
|
441
|
+
recording doesn't. Sharing is the framework `sharing` system
|
|
442
|
+
(`session-report` type), limited like the recording itself: no public
|
|
443
|
+
links, and people only within the organization. A report opens to its
|
|
444
|
+
organization or to a person only while that whole organization can open
|
|
445
|
+
the recording; otherwise sharing refuses and the report stays with its
|
|
446
|
+
writer. Making it private always works.
|
|
447
|
+
- Anyone but a report's writer reads it only while they can open its
|
|
448
|
+
recording in their active organization, the same rule the Sessions list
|
|
449
|
+
uses: get, list, update, and agent links check it on every read, so the
|
|
450
|
+
recording turning private later never shows the report to someone the
|
|
451
|
+
recording doesn't. Past retention, only the writer still sees it.
|
|
452
|
+
- Share > Send to > Copy agent link makes a report's agent link (`create-agent-resource-link`).
|
|
453
|
+
It lasts a year, and every read checks that its maker is still in the
|
|
454
|
+
report's organization and can still read the report, so deleting the
|
|
455
|
+
report, leaving the organization, or losing access ends it.
|
|
456
|
+
`/api/session-report-agent-context.json?id=<reportId>&agent_access=<token>`
|
|
457
|
+
returns the report and, under `session`, the replay's full agent context
|
|
458
|
+
through a fresh two-hour session link. That session link is stateless: one
|
|
459
|
+
already handed out keeps opening the recording until its two hours end,
|
|
460
|
+
even after the report is deleted or the agent link revoked. A recording past retention or one the
|
|
461
|
+
maker lost gives `session: null` with `sessionUnavailable`, never an empty
|
|
462
|
+
session. `labStateError` means the maker's Lab state couldn't be read, so
|
|
463
|
+
`session` has no `keyMoments` or `build`.
|
|
464
|
+
- The report page's server-rendered HTML advertises that endpoint the same
|
|
465
|
+
way to every visitor, without the token, so a CDN-cached page still works:
|
|
466
|
+
the agent adds `agent_access` from the link it was given.
|
|
467
|
+
- A report has no foreign key to its recording, so its row outlives replay
|
|
468
|
+
retention.
|
|
469
|
+
|
|
423
470
|
## Dev Tools Panel
|
|
424
471
|
|
|
425
472
|
- The `/sessions/:recordingId` replay player has a Dev Tools toggle that opens
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// AUTO-GENERATED by @agent-native/core deploy build
|
|
2
|
+
import { markDefaultPluginProvided } from "@agent-native/core/server/edge";
|
|
3
|
+
|
|
4
|
+
const pluginStems = ["agent-chat","analytics-alert-jobs","analytics-rollup-backfill-jobs","auth","collab","config","content-metrics-collection-jobs","core-routes","creative-context","dashboard-report-jobs","db","feature-flags","labs","onboarding","otel","session-replay-retention-jobs","transactional-emails","uptime-monitor-jobs"];
|
|
5
|
+
|
|
6
|
+
export default function markBuildDiscoveredPlugins(nitroApp) {
|
|
7
|
+
for (const stem of pluginStems) {
|
|
8
|
+
markDefaultPluginProvided(nitroApp, stem);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -7,8 +7,14 @@ import { z } from "zod";
|
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
archiveDashboard,
|
|
10
|
+
requireDashboardAccess,
|
|
10
11
|
unarchiveDashboard,
|
|
11
12
|
} from "../server/lib/dashboards-store";
|
|
13
|
+
import {
|
|
14
|
+
expectedUpdatedAtArg,
|
|
15
|
+
guardWrite,
|
|
16
|
+
idempotencyKeyArg,
|
|
17
|
+
} from "../server/lib/guarded-writes";
|
|
12
18
|
import { cliBoolean } from "./schema-helpers";
|
|
13
19
|
|
|
14
20
|
function resolveScope() {
|
|
@@ -25,7 +31,8 @@ export default defineAction({
|
|
|
25
31
|
"restore UI; restore them by running this action with `archived: false`. Use " +
|
|
26
32
|
"this instead of `delete-dashboard` when the user might want the dashboard back " +
|
|
27
33
|
"later — only use a hard delete when the user explicitly asks to remove a " +
|
|
28
|
-
"dashboard permanently."
|
|
34
|
+
"dashboard permanently. External MCP clients have no hard delete; this is " +
|
|
35
|
+
"how they delete a dashboard.",
|
|
29
36
|
schema: z.object({
|
|
30
37
|
id: z.string().describe("The dashboard ID"),
|
|
31
38
|
archived: cliBoolean
|
|
@@ -34,13 +41,32 @@ export default defineAction({
|
|
|
34
41
|
.describe(
|
|
35
42
|
"true = archive (default), false = restore an archived dashboard",
|
|
36
43
|
),
|
|
44
|
+
expectedUpdatedAt: expectedUpdatedAtArg("dashboard"),
|
|
45
|
+
idempotencyKey: idempotencyKeyArg,
|
|
37
46
|
}),
|
|
38
47
|
http: { method: "POST" },
|
|
39
|
-
|
|
48
|
+
mcpTool: true,
|
|
49
|
+
run: async (args, actionContext) => {
|
|
40
50
|
const ctx = resolveScope();
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
:
|
|
51
|
+
const guard = guardWrite({
|
|
52
|
+
action: "archive-dashboard",
|
|
53
|
+
target: { kind: "dashboard", id: args.id },
|
|
54
|
+
caller: actionContext?.caller,
|
|
55
|
+
scope: ctx,
|
|
56
|
+
idempotencyKey: args.idempotencyKey,
|
|
57
|
+
expectedUpdatedAt: args.expectedUpdatedAt,
|
|
58
|
+
request: { archived: args.archived },
|
|
59
|
+
});
|
|
60
|
+
guard.requireKey();
|
|
61
|
+
guard.requireFence();
|
|
62
|
+
const write = args.archived ? archiveDashboard : unarchiveDashboard;
|
|
63
|
+
const outcome = await guard.run(
|
|
64
|
+
() => requireDashboardAccess(args.id, ctx, "editor"),
|
|
65
|
+
() =>
|
|
66
|
+
guard.active ? write(args.id, ctx, guard.store) : write(args.id, ctx),
|
|
67
|
+
);
|
|
68
|
+
if ("replayed" in outcome) return { id: args.id, ...outcome.replayed };
|
|
69
|
+
const dash = outcome.written;
|
|
44
70
|
if (!dash) {
|
|
45
71
|
throw new Error(
|
|
46
72
|
`Dashboard "${args.id}" not found (or you don't have access).`,
|
|
@@ -50,6 +76,7 @@ export default defineAction({
|
|
|
50
76
|
id: dash.id,
|
|
51
77
|
name: dash.title,
|
|
52
78
|
archivedAt: dash.archivedAt,
|
|
79
|
+
...guard.resultFields(dash),
|
|
53
80
|
message: args.archived
|
|
54
81
|
? `Dashboard "${dash.title}" archived. Ask the agent in chat to restore it if needed.`
|
|
55
82
|
: `Dashboard "${dash.title}" restored.`,
|
|
@@ -23,7 +23,11 @@ import {
|
|
|
23
23
|
} from "../server/lib/dashboard-panel-verification";
|
|
24
24
|
import { validateFirstPartyDashboardTimeScope } from "../server/lib/dashboard-time-scope";
|
|
25
25
|
import {
|
|
26
|
+
createDashboardOutcome,
|
|
27
|
+
DashboardConflictError,
|
|
26
28
|
getDashboard,
|
|
29
|
+
isDashboardIdTaken,
|
|
30
|
+
requireDashboardAccess,
|
|
27
31
|
upsertDashboard,
|
|
28
32
|
upsertDashboardWithRetryOutcome,
|
|
29
33
|
} from "../server/lib/dashboards-store";
|
|
@@ -36,6 +40,12 @@ import {
|
|
|
36
40
|
type MetricWindow,
|
|
37
41
|
usesFirstPartyDashboardFilters,
|
|
38
42
|
} from "../server/lib/first-party-metric-catalog";
|
|
43
|
+
import {
|
|
44
|
+
expectedUpdatedAtArg,
|
|
45
|
+
guardWrite,
|
|
46
|
+
idempotencyKeyArg,
|
|
47
|
+
type WriteReplay,
|
|
48
|
+
} from "../server/lib/guarded-writes";
|
|
39
49
|
import {
|
|
40
50
|
withNewDashboardTrafficFilter,
|
|
41
51
|
withTrafficFilterOf,
|
|
@@ -171,7 +181,10 @@ export default defineAction({
|
|
|
171
181
|
.describe(
|
|
172
182
|
"Agent calls only. Set true only when the user expects a composed panel to have no rows right now (for example a brand-new workspace); the save then reports verified:false.",
|
|
173
183
|
),
|
|
184
|
+
expectedUpdatedAt: expectedUpdatedAtArg("dashboard"),
|
|
185
|
+
idempotencyKey: idempotencyKeyArg,
|
|
174
186
|
}),
|
|
187
|
+
mcpTool: true,
|
|
175
188
|
mcpApp: {
|
|
176
189
|
compactCatalog: true,
|
|
177
190
|
resource: embedApp({
|
|
@@ -200,11 +213,54 @@ export default defineAction({
|
|
|
200
213
|
? (JSON.parse(args.metrics) as unknown[])
|
|
201
214
|
: [];
|
|
202
215
|
|
|
216
|
+
const guard = guardWrite({
|
|
217
|
+
action: "compose-dashboard",
|
|
218
|
+
target: { kind: "dashboard", id: args.dashboardId },
|
|
219
|
+
caller: actionContext?.caller,
|
|
220
|
+
scope: ctx,
|
|
221
|
+
idempotencyKey: args.idempotencyKey,
|
|
222
|
+
expectedUpdatedAt: args.expectedUpdatedAt,
|
|
223
|
+
request: {
|
|
224
|
+
title: args.title?.trim() || null,
|
|
225
|
+
metrics: rawMetrics,
|
|
226
|
+
overwrite: args.overwrite === true,
|
|
227
|
+
refreshExisting: args.refreshExisting === true,
|
|
228
|
+
allowEmptyResult: args.allowEmptyResult === true,
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
guard.requireKey();
|
|
203
232
|
// Composing into an existing dashboard needs edit rights before any SQL
|
|
204
|
-
// is validated or run for it.
|
|
233
|
+
// is validated or run for it. Read before the preflight, so a duplicate
|
|
234
|
+
// that commits after this read fails the store's fence and is replayed.
|
|
205
235
|
const existing = await getDashboard(args.dashboardId, ctx);
|
|
206
|
-
|
|
236
|
+
// Rechecked before a replay after a failed write, so it reads fresh: a
|
|
237
|
+
// dashboard the caller can no longer see is not a create.
|
|
238
|
+
const replayed = await guard.preflight(async () => {
|
|
239
|
+
if (await isDashboardIdTaken(args.dashboardId)) {
|
|
240
|
+
await requireDashboardAccess(args.dashboardId, ctx, "editor");
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
if (replayed) {
|
|
244
|
+
return {
|
|
245
|
+
id: args.dashboardId,
|
|
246
|
+
dashboardId: args.dashboardId,
|
|
247
|
+
...replayed,
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
if (existing) {
|
|
207
251
|
await requireEditableDashboard(args.dashboardId, ctx, existing);
|
|
252
|
+
guard.requireFence();
|
|
253
|
+
}
|
|
254
|
+
if (
|
|
255
|
+
guard.expectedUpdatedAt !== undefined &&
|
|
256
|
+
existing?.updatedAt !== guard.expectedUpdatedAt
|
|
257
|
+
) {
|
|
258
|
+
throw new DashboardConflictError(
|
|
259
|
+
args.dashboardId,
|
|
260
|
+
existing ? existing.updatedAt : null,
|
|
261
|
+
guard.expectedUpdatedAt,
|
|
262
|
+
);
|
|
263
|
+
}
|
|
208
264
|
|
|
209
265
|
const requests: NormalizedRequest[] = [];
|
|
210
266
|
for (const raw of rawMetrics) {
|
|
@@ -283,6 +339,13 @@ export default defineAction({
|
|
|
283
339
|
let changed = true;
|
|
284
340
|
let appended = existing !== null && !args.overwrite;
|
|
285
341
|
|
|
342
|
+
// A write that loses to a concurrent request with the same key answers
|
|
343
|
+
// with that request's receipt.
|
|
344
|
+
let duplicate: WriteReplay | undefined;
|
|
345
|
+
const recover = async (error: unknown) => {
|
|
346
|
+
duplicate = await guard.recover(error);
|
|
347
|
+
return null;
|
|
348
|
+
};
|
|
286
349
|
const appendToExisting = async () => {
|
|
287
350
|
appended = true;
|
|
288
351
|
const saved = await upsertDashboardWithRetryOutcome(
|
|
@@ -353,7 +416,10 @@ export default defineAction({
|
|
|
353
416
|
}
|
|
354
417
|
return { kind: "sql" as const, body: merged };
|
|
355
418
|
},
|
|
356
|
-
|
|
419
|
+
undefined,
|
|
420
|
+
guard.store,
|
|
421
|
+
).catch(recover);
|
|
422
|
+
if (!saved) return;
|
|
357
423
|
finalConfig = saved.dashboard.config as Record<string, unknown>;
|
|
358
424
|
updatedAt = saved.dashboard.updatedAt;
|
|
359
425
|
changed = saved.didWrite;
|
|
@@ -387,7 +453,13 @@ export default defineAction({
|
|
|
387
453
|
// created this dashboard since `existing` was read.
|
|
388
454
|
const latest = await getDashboard(args.dashboardId, ctx);
|
|
389
455
|
if (latest) await requireEditableDashboard(args.dashboardId, ctx, latest);
|
|
390
|
-
if (latest && !
|
|
456
|
+
if (latest && !existing && guard.active) {
|
|
457
|
+
// Created by someone else while the panels were checked; a guarded
|
|
458
|
+
// create never lands on another writer's dashboard.
|
|
459
|
+
await recover(
|
|
460
|
+
new DashboardConflictError(args.dashboardId, latest.updatedAt),
|
|
461
|
+
);
|
|
462
|
+
} else if (latest && !args.overwrite) {
|
|
391
463
|
await appendToExisting();
|
|
392
464
|
} else if (latest) {
|
|
393
465
|
const composed = withTrafficFilterOf(latest.config, finalConfig);
|
|
@@ -395,10 +467,24 @@ export default defineAction({
|
|
|
395
467
|
args.dashboardId,
|
|
396
468
|
ctx,
|
|
397
469
|
() => ({ kind: "sql" as const, body: composed }),
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
470
|
+
undefined,
|
|
471
|
+
guard.store,
|
|
472
|
+
).catch(recover);
|
|
473
|
+
if (saved) {
|
|
474
|
+
finalConfig = saved.dashboard.config as Record<string, unknown>;
|
|
475
|
+
updatedAt = saved.dashboard.updatedAt;
|
|
476
|
+
changed = saved.didWrite;
|
|
477
|
+
}
|
|
478
|
+
} else if (guard.active) {
|
|
479
|
+
finalConfig = withNewDashboardTrafficFilter(finalConfig);
|
|
480
|
+
const saved = await createDashboardOutcome(
|
|
481
|
+
args.dashboardId,
|
|
482
|
+
"sql",
|
|
483
|
+
finalConfig,
|
|
484
|
+
ctx,
|
|
485
|
+
guard.onCommit,
|
|
486
|
+
).catch(recover);
|
|
487
|
+
if (saved) updatedAt = saved.dashboard.updatedAt;
|
|
402
488
|
} else {
|
|
403
489
|
finalConfig = withNewDashboardTrafficFilter(finalConfig);
|
|
404
490
|
const saved = await upsertDashboard(
|
|
@@ -410,6 +496,13 @@ export default defineAction({
|
|
|
410
496
|
updatedAt = saved.updatedAt;
|
|
411
497
|
}
|
|
412
498
|
}
|
|
499
|
+
if (duplicate) {
|
|
500
|
+
return {
|
|
501
|
+
id: args.dashboardId,
|
|
502
|
+
dashboardId: args.dashboardId,
|
|
503
|
+
...duplicate,
|
|
504
|
+
};
|
|
505
|
+
}
|
|
413
506
|
|
|
414
507
|
const panelCount = Array.isArray(finalConfig.panels)
|
|
415
508
|
? (finalConfig.panels as unknown[]).length
|
|
@@ -480,6 +573,7 @@ export default defineAction({
|
|
|
480
573
|
unknownMetrics,
|
|
481
574
|
invalidMetrics,
|
|
482
575
|
skippedExistingIds,
|
|
576
|
+
...guard.resultFields({ updatedAt }),
|
|
483
577
|
...verdictFields(verdict),
|
|
484
578
|
...(agentCaller && changed
|
|
485
579
|
? {
|
|
@@ -6,22 +6,46 @@ import {
|
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
8
8
|
import { createDashboardFolder } from "../server/lib/dashboard-folders-store";
|
|
9
|
+
import { guardWrite, idempotencyKeyArg } from "../server/lib/guarded-writes";
|
|
9
10
|
|
|
10
11
|
export default defineAction({
|
|
11
|
-
description:
|
|
12
|
+
description:
|
|
13
|
+
"Create a personal dashboard folder, or a shared one visible to the active organization. Put dashboards in it with set-dashboard-folder.",
|
|
12
14
|
schema: z.object({
|
|
13
15
|
name: z.string().min(1).max(120),
|
|
14
16
|
scope: z.enum(["personal", "shared"]),
|
|
17
|
+
idempotencyKey: idempotencyKeyArg,
|
|
15
18
|
}),
|
|
16
19
|
http: { method: "POST" },
|
|
17
|
-
|
|
20
|
+
mcpTool: true,
|
|
21
|
+
run: async ({ name, scope, idempotencyKey }, actionContext) => {
|
|
18
22
|
const email = getRequestUserEmail();
|
|
19
23
|
if (!email) throw new Error("no authenticated user");
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
24
|
+
const ctx = { email, orgId: getRequestOrgId() || null };
|
|
25
|
+
const guard = guardWrite({
|
|
26
|
+
action: "create-dashboard-folder",
|
|
27
|
+
// The server names the folder, so every create shares one target.
|
|
28
|
+
target: { kind: "dashboard-folder", id: "" },
|
|
29
|
+
caller: actionContext?.caller,
|
|
30
|
+
scope: ctx,
|
|
31
|
+
idempotencyKey,
|
|
32
|
+
request: { name: name.trim(), scope },
|
|
33
|
+
});
|
|
34
|
+
guard.requireKey();
|
|
35
|
+
const outcome = await guard.run(
|
|
36
|
+
async () => undefined,
|
|
37
|
+
() =>
|
|
38
|
+
guard.active
|
|
39
|
+
? createDashboardFolder(name, scope, ctx, guard.onCommit)
|
|
40
|
+
: createDashboardFolder(name, scope, ctx),
|
|
41
|
+
);
|
|
42
|
+
if ("replayed" in outcome) {
|
|
43
|
+
return {
|
|
44
|
+
folderId: outcome.replayed.writeReceipt.target.id,
|
|
45
|
+
...outcome.replayed,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const folder = outcome.written;
|
|
49
|
+
return { folder, ...guard.resultFields(folder) };
|
|
26
50
|
},
|
|
27
51
|
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { buildDeepLink } from "@agent-native/core/server";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
createSessionReport,
|
|
7
|
+
sessionReportActionScope,
|
|
8
|
+
} from "../server/lib/session-reports.js";
|
|
9
|
+
import {
|
|
10
|
+
SESSION_REPORT_KEY_MOMENTS_MAX,
|
|
11
|
+
SESSION_REPORT_REPRO_STEPS_MAX,
|
|
12
|
+
SESSION_REPORT_SUMMARY_MAX,
|
|
13
|
+
SESSION_REPORT_TITLE_MAX,
|
|
14
|
+
sessionReportKeyMomentSchema,
|
|
15
|
+
sessionReportSchema,
|
|
16
|
+
} from "../shared/session-reports.js";
|
|
17
|
+
|
|
18
|
+
export default defineAction({
|
|
19
|
+
mcpAnnotations: {
|
|
20
|
+
readOnlyHint: false,
|
|
21
|
+
destructiveHint: false,
|
|
22
|
+
openWorldHint: false,
|
|
23
|
+
},
|
|
24
|
+
description:
|
|
25
|
+
"Save a report on one session replay: a title and summary you write from the session's evidence, its key moments, the steps that reproduce the problem, and the Monitoring error issue it hit. Read the session-replay skill, get-session-replay-summary and get-session-replay-timeline first, and write only what the session shows. The report records the commit the session reported by itself, opens to the caller's organization when the recording is org-visible there (private otherwise), and lives at /sessions/reports/<id>. Requires the Sessions triage Lab.",
|
|
26
|
+
schema: z.object({
|
|
27
|
+
recordingId: z.string().min(1).describe("The session_recordings id"),
|
|
28
|
+
title: z
|
|
29
|
+
.string()
|
|
30
|
+
.trim()
|
|
31
|
+
.min(1)
|
|
32
|
+
.max(SESSION_REPORT_TITLE_MAX)
|
|
33
|
+
.describe(
|
|
34
|
+
"What went wrong, in one line, such as: Deck stayed empty after the upload failed",
|
|
35
|
+
),
|
|
36
|
+
summary: z
|
|
37
|
+
.string()
|
|
38
|
+
.trim()
|
|
39
|
+
.max(SESSION_REPORT_SUMMARY_MAX)
|
|
40
|
+
.describe(
|
|
41
|
+
"What happened and why, in plain words, citing the moments that show it",
|
|
42
|
+
),
|
|
43
|
+
keyMoments: z
|
|
44
|
+
.array(sessionReportKeyMomentSchema)
|
|
45
|
+
.max(SESSION_REPORT_KEY_MOMENTS_MAX)
|
|
46
|
+
.default([])
|
|
47
|
+
.describe("The moments that show the problem, in time order"),
|
|
48
|
+
reproSteps: z
|
|
49
|
+
.array(z.string().trim().min(1).max(500))
|
|
50
|
+
.max(SESSION_REPORT_REPRO_STEPS_MAX)
|
|
51
|
+
.default([])
|
|
52
|
+
.describe("Steps that reproduce it, one action each"),
|
|
53
|
+
errorIssueId: z
|
|
54
|
+
.string()
|
|
55
|
+
.min(1)
|
|
56
|
+
.optional()
|
|
57
|
+
.describe(
|
|
58
|
+
"The Monitoring error issue (erriss_...) the session hit, if any",
|
|
59
|
+
),
|
|
60
|
+
fromMs: z
|
|
61
|
+
.number()
|
|
62
|
+
.int()
|
|
63
|
+
.min(0)
|
|
64
|
+
.optional()
|
|
65
|
+
.describe(
|
|
66
|
+
"The moment the person made the report from, in ms after the recording started",
|
|
67
|
+
),
|
|
68
|
+
}),
|
|
69
|
+
outputSchema: sessionReportSchema,
|
|
70
|
+
publicAgent: { expose: true, readOnly: false, requiresAuth: true },
|
|
71
|
+
run: async (args) => {
|
|
72
|
+
const scope = await sessionReportActionScope();
|
|
73
|
+
return createSessionReport(args, scope);
|
|
74
|
+
},
|
|
75
|
+
link: ({ result }) => ({
|
|
76
|
+
url: buildDeepLink({
|
|
77
|
+
app: "analytics",
|
|
78
|
+
view: "session-report",
|
|
79
|
+
params: { reportId: result.id },
|
|
80
|
+
}),
|
|
81
|
+
label: "Open the report in Analytics",
|
|
82
|
+
view: "session-report",
|
|
83
|
+
}),
|
|
84
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
deleteSessionReport,
|
|
6
|
+
sessionReportActionScope,
|
|
7
|
+
} from "../server/lib/session-reports.js";
|
|
8
|
+
|
|
9
|
+
export default defineAction({
|
|
10
|
+
mcpAnnotations: {
|
|
11
|
+
readOnlyHint: false,
|
|
12
|
+
destructiveHint: true,
|
|
13
|
+
openWorldHint: false,
|
|
14
|
+
},
|
|
15
|
+
description:
|
|
16
|
+
"Delete a session report and its shares, which also ends its agent links. The session replay it cites is untouched. Only its owner or an admin can. Requires the Sessions triage Lab.",
|
|
17
|
+
schema: z.object({
|
|
18
|
+
id: z.string().min(1).describe("The session report id (srep_...)"),
|
|
19
|
+
}),
|
|
20
|
+
outputSchema: z.object({ id: z.string(), deleted: z.literal(true) }),
|
|
21
|
+
publicAgent: { expose: true, readOnly: false, requiresAuth: true },
|
|
22
|
+
run: async ({ id }) => {
|
|
23
|
+
const scope = await sessionReportActionScope();
|
|
24
|
+
return deleteSessionReport(id, scope);
|
|
25
|
+
},
|
|
26
|
+
});
|
|
@@ -42,7 +42,7 @@ const isoDate = z
|
|
|
42
42
|
|
|
43
43
|
export default defineAction({
|
|
44
44
|
description:
|
|
45
|
-
'Return an access-scoped per-session onboarding tree through explicit saved-output events, preserving session counts and direct-parent denominators. When experimentId or splitDesignFirstTouch is supplied, return independent trees for each cohort; Design first-touch cohorts are crossed with experiment arms, and sessionless MCP OAuth signups are counted as events without replay. An aggregated `other` node includes up to 20 root-to-branch label paths, source step keys for identical paths, session counts, and direct-parent percentages; branch summaries are capped at 200 per tree and 64 KiB of serialized detail. `otherBranchCount` gives the full number of branches, and `otherBranchSummariesPartial: true` marks summaries omitted by those bounds. Labels/path segments longer than 300 characters and keys longer than 2,048 characters are visibly shortened with stable hash suffixes and truncation flags so the tree stays within the Design input contract. Journey counts stay bounded by the 200,000-event read cap. BigQuery pages have a 25 GB per-query cap, and maxTotalBytesBilled bounds how many pages one event read may run; it defaults to 275 GB. Event and follow-up queries stop inside a 22-second time budget (15 seconds for the event read, follow-ups get the rest), leaving room in a hosted call before its gateway gives up; tree-format replay lookups run after that budget, so prefer format "summary" for long windows; coverage.truncated and notes identify partial counts, and a
|
|
45
|
+
'Return an access-scoped per-session onboarding tree through explicit saved-output events, preserving session counts and direct-parent denominators. When experimentId or splitDesignFirstTouch is supplied, return independent trees for each cohort; Design first-touch cohorts are crossed with experiment arms, and sessionless MCP OAuth signups are counted as events without replay. An aggregated `other` node includes up to 20 root-to-branch label paths, source step keys for identical paths, session counts, and direct-parent percentages; branch summaries are capped at 200 per tree and 64 KiB of serialized detail. `otherBranchCount` gives the full number of branches, and `otherBranchSummariesPartial: true` marks summaries omitted by those bounds. Labels/path segments longer than 300 characters and keys longer than 2,048 characters are visibly shortened with stable hash suffixes and truncation flags so the tree stays within the Design input contract. Journey counts stay bounded by the 200,000-event read cap. BigQuery pages have a 25 GB per-query cap, and maxTotalBytesBilled bounds how many pages one event read may run; it defaults to 275 GB. Event and follow-up queries stop inside a 22-second time budget (15 seconds for the event read, follow-ups get the rest), leaving room in a hosted call before its gateway gives up; tree-format replay lookups run after that budget, so prefer format "summary" for long windows; coverage.truncated and notes identify partial counts, and when a time limit stopped the call, continueWith.observationWatermark lets the same call continue from the queries already cached or still running. Raise maxTotalBytesBilled deliberately to read more pages, up to 1.275 TB. When event coverage is truncated, replay reads are skipped, coverage.sessionsWithReplay is null, and examples omit recordingId with viewportReason "recording_unknown"; recordingId null means a completed lookup found no replay. followUpMode "session" keeps existing bounded same-session counts. "person" adds aggregate-only activity joined into people by agreed session emails and direct canonical auth_user_id, matching later activity by any email or ID of that person (emails compared as hashes computed in the warehouse), across first-party sessions and apps over a fixed 30-day horizon, with a 25 GB bytes-billed cap per follow-up query; identity coverage says how many sessions matched each way. It separates selected-session activity, outside-session/app activity and their overlap, no activity after a fully observed horizon, right-censoring, unknown identity, identity coverage, and read completeness. Its minute-aligned observationWatermark freezes event and receive time. Unknown identity and sessions without a selected step never count as inactive; no-activity is window-bounded evidence, not permanent churn. Output and attempt IDs are never returned. Incomplete follow-up counts are null. A query that fails for a backend, cost, or per-query timeout reason returns a stage-specific error with safe BigQuery status/reason when available; an internal event-read deadline instead returns completed pages with truncated coverage. An unreadable query never becomes zero counts or an empty-tree substitute.',
|
|
46
46
|
schema: z
|
|
47
47
|
.object({
|
|
48
48
|
dateFrom: isoDate.describe(
|
|
@@ -84,7 +84,7 @@ export default defineAction({
|
|
|
84
84
|
.regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:00\.000Z$/)
|
|
85
85
|
.optional()
|
|
86
86
|
.describe(
|
|
87
|
-
'A past UTC minute, such as 2026-11-10T22:38:00.000Z, to read as of instead of now. Pass
|
|
87
|
+
'A past UTC minute, such as 2026-11-10T22:38:00.000Z, to read as of instead of now. Pass continueWith.observationWatermark from a response a time limit stopped: the queries it finished are cached and the BigQuery queries it stopped keep running, so the same request with this value, sent within a few minutes, continues from them. It pins event time in both follow-up modes; only followUpMode "person" also pins receive time, so in session mode an event that arrives between calls can change pages, which coverage reports as may_have_shifted.',
|
|
88
88
|
),
|
|
89
89
|
format: z
|
|
90
90
|
.enum(["tree", "summary"])
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
getSessionReport,
|
|
6
|
+
sessionReportActionScope,
|
|
7
|
+
} from "../server/lib/session-reports.js";
|
|
8
|
+
import { sessionReportSchema } from "../shared/session-reports.js";
|
|
9
|
+
|
|
10
|
+
export default defineAction({
|
|
11
|
+
description:
|
|
12
|
+
"Get one session report: its title, summary, key moments (atMs is ms after the recording started), repro steps, linked Monitoring error issue, the commit the session reported, and the recording it cites. role is the caller's access. Read the session itself with get-session-replay-summary and recordingId; a report opens only to its writer or someone who can open its recording, so past replay retention only its writer keeps it. Requires the Sessions triage Lab.",
|
|
13
|
+
schema: z.object({
|
|
14
|
+
id: z.string().min(1).describe("The session report id (srep_...)"),
|
|
15
|
+
}),
|
|
16
|
+
outputSchema: z.object({ ...sessionReportSchema.shape, role: z.string() }),
|
|
17
|
+
http: { method: "GET" },
|
|
18
|
+
readOnly: true,
|
|
19
|
+
mcpTool: true,
|
|
20
|
+
publicAgent: { expose: true, readOnly: true, requiresAuth: true },
|
|
21
|
+
run: async ({ id }) => {
|
|
22
|
+
const scope = await sessionReportActionScope();
|
|
23
|
+
return getSessionReport(id, scope);
|
|
24
|
+
},
|
|
25
|
+
});
|
|
@@ -5,7 +5,16 @@ import {
|
|
|
5
5
|
} from "@agent-native/core/server";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
hideAnalysis,
|
|
10
|
+
requireAnalysisAccess,
|
|
11
|
+
unhideAnalysis,
|
|
12
|
+
} from "../server/lib/dashboards-store";
|
|
13
|
+
import {
|
|
14
|
+
expectedUpdatedAtArg,
|
|
15
|
+
guardWrite,
|
|
16
|
+
idempotencyKeyArg,
|
|
17
|
+
} from "../server/lib/guarded-writes";
|
|
9
18
|
import { cliBoolean } from "./schema-helpers";
|
|
10
19
|
|
|
11
20
|
function resolveScope() {
|
|
@@ -20,19 +29,40 @@ export default defineAction({
|
|
|
20
29
|
"Hide or unhide a saved ad-hoc analysis by ID. Hidden analyses stay " +
|
|
21
30
|
"openable by direct link and searchable, but they are omitted from regular " +
|
|
22
31
|
"analysis lists. When an unowned cleanup analysis is unhidden, the current " +
|
|
23
|
-
"user becomes its owner."
|
|
32
|
+
"user becomes its owner. External MCP clients have no hard delete; this is " +
|
|
33
|
+
"how they delete an analysis.",
|
|
24
34
|
schema: z.object({
|
|
25
35
|
id: z.string().describe("The analysis ID"),
|
|
26
36
|
hidden: cliBoolean
|
|
27
37
|
.optional()
|
|
28
38
|
.default(true)
|
|
29
39
|
.describe("true = hide (default), false = unhide"),
|
|
40
|
+
expectedUpdatedAt: expectedUpdatedAtArg("analysis"),
|
|
41
|
+
idempotencyKey: idempotencyKeyArg,
|
|
30
42
|
}),
|
|
31
|
-
|
|
43
|
+
mcpTool: true,
|
|
44
|
+
run: async (args, actionContext) => {
|
|
32
45
|
const ctx = resolveScope();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
:
|
|
46
|
+
const guard = guardWrite({
|
|
47
|
+
action: "hide-analysis",
|
|
48
|
+
target: { kind: "analysis", id: args.id },
|
|
49
|
+
caller: actionContext?.caller,
|
|
50
|
+
scope: ctx,
|
|
51
|
+
idempotencyKey: args.idempotencyKey,
|
|
52
|
+
expectedUpdatedAt: args.expectedUpdatedAt,
|
|
53
|
+
request: { hidden: args.hidden },
|
|
54
|
+
});
|
|
55
|
+
guard.requireKey();
|
|
56
|
+
guard.requireFence();
|
|
57
|
+
const write = args.hidden ? hideAnalysis : unhideAnalysis;
|
|
58
|
+
const outcome = await guard.run(
|
|
59
|
+
() =>
|
|
60
|
+
requireAnalysisAccess(args.id, ctx, args.hidden ? "editor" : "viewer"),
|
|
61
|
+
() =>
|
|
62
|
+
guard.active ? write(args.id, ctx, guard.store) : write(args.id, ctx),
|
|
63
|
+
);
|
|
64
|
+
if ("replayed" in outcome) return { id: args.id, ...outcome.replayed };
|
|
65
|
+
const analysis = outcome.written;
|
|
36
66
|
if (!analysis) {
|
|
37
67
|
throw new Error(
|
|
38
68
|
`Analysis "${args.id}" not found (or you don't have access).`,
|
|
@@ -44,6 +74,7 @@ export default defineAction({
|
|
|
44
74
|
hiddenAt: analysis.hiddenAt,
|
|
45
75
|
hiddenBy: analysis.hiddenBy,
|
|
46
76
|
ownerEmail: analysis.ownerEmail,
|
|
77
|
+
...guard.resultFields(analysis),
|
|
47
78
|
message: args.hidden
|
|
48
79
|
? `Analysis "${analysis.name}" hidden from regular lists.`
|
|
49
80
|
: `Analysis "${analysis.name}" is visible in regular lists.`,
|