@agent-native/core-corpus 0.200.0-nightly-20261002124406 → 0.200.0

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.
Files changed (128) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/gong/SKILL.md +10 -8
  3. package/corpus/templates/analytics/.agents/skills/session-replay/SKILL.md +48 -0
  4. package/corpus/templates/analytics/AGENTS.md +7 -1
  5. package/corpus/templates/analytics/CHANGELOG.md +13 -0
  6. package/corpus/templates/analytics/actions/account-deep-dive.ts +1 -0
  7. package/corpus/templates/analytics/actions/bigquery.ts +1 -0
  8. package/corpus/templates/analytics/actions/builder-blog-articles.ts +1 -0
  9. package/corpus/templates/analytics/actions/configure-gong-native-insights.ts +1 -1
  10. package/corpus/templates/analytics/actions/create-session-replay-agent-link.ts +1 -0
  11. package/corpus/templates/analytics/actions/data-source-status.ts +1 -0
  12. package/corpus/templates/analytics/actions/db-admin-federated-read.ts +1 -0
  13. package/corpus/templates/analytics/actions/get-analysis.ts +3 -1
  14. package/corpus/templates/analytics/actions/get-data-program.ts +1 -0
  15. package/corpus/templates/analytics/actions/get-error-issue.ts +1 -0
  16. package/corpus/templates/analytics/actions/get-first-party-analytics-health.ts +1 -0
  17. package/corpus/templates/analytics/actions/get-session-replay-summary.ts +1 -0
  18. package/corpus/templates/analytics/actions/get-session-replay-timeline.ts +1 -0
  19. package/corpus/templates/analytics/actions/get-sql-dashboard.ts +1 -0
  20. package/corpus/templates/analytics/actions/gong-calls.ts +11 -10
  21. package/corpus/templates/analytics/actions/gong-native-insights.ts +31 -148
  22. package/corpus/templates/analytics/actions/hubspot-deals.ts +14 -15
  23. package/corpus/templates/analytics/actions/hubspot-metrics.ts +2 -1
  24. package/corpus/templates/analytics/actions/hubspot-pipelines.ts +3 -1
  25. package/corpus/templates/analytics/actions/hubspot-records.ts +1 -0
  26. package/corpus/templates/analytics/actions/list-analyses.ts +1 -0
  27. package/corpus/templates/analytics/actions/list-dashboard-folders.ts +3 -1
  28. package/corpus/templates/analytics/actions/list-data-dictionary.ts +1 -0
  29. package/corpus/templates/analytics/actions/list-data-programs.ts +2 -1
  30. package/corpus/templates/analytics/actions/list-error-issues.ts +1 -0
  31. package/corpus/templates/analytics/actions/list-event-catalog.ts +90 -0
  32. package/corpus/templates/analytics/actions/list-session-event-names.ts +44 -0
  33. package/corpus/templates/analytics/actions/list-session-recordings.ts +28 -8
  34. package/corpus/templates/analytics/actions/list-sql-dashboards.ts +1 -0
  35. package/corpus/templates/analytics/actions/match-error-issues.ts +1 -0
  36. package/corpus/templates/analytics/actions/navigate.ts +1 -1
  37. package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +1 -0
  38. package/corpus/templates/analytics/actions/run-gong-native-insight.ts +121 -0
  39. package/corpus/templates/analytics/actions/search-analytics-query-catalog.ts +1 -0
  40. package/corpus/templates/analytics/actions/search-bigquery-schema.ts +1 -0
  41. package/corpus/templates/analytics/actions/search-dashboard-references.ts +1 -0
  42. package/corpus/templates/analytics/actions/view-screen.ts +47 -0
  43. package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +4 -0
  44. package/corpus/templates/analytics/app/i18n/en-US.ts +37 -1
  45. package/corpus/templates/analytics/app/pages/Settings.tsx +6 -0
  46. package/corpus/templates/analytics/app/pages/sessions/EventCatalogPage.tsx +343 -0
  47. package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +203 -7
  48. package/corpus/templates/analytics/app/pages/sessions/SessionEventFilter.tsx +291 -0
  49. package/corpus/templates/analytics/app/pages/sessions/SessionsTriagePage.tsx +119 -1
  50. package/corpus/templates/analytics/app/routes/sessions.events.tsx +10 -0
  51. package/corpus/templates/analytics/changelog/2026-09-30-external-agents-read-analytics-directly-over-mcp.md +6 -0
  52. package/corpus/templates/analytics/changelog/2026-09-30-with-the-sessions-triage-lab-on-filter-sessions-by-events-th.md +6 -0
  53. package/corpus/templates/analytics/changelog/2026-10-01-clear-all-resets-every-sessions-filter-in-one-click.md +6 -0
  54. package/corpus/templates/analytics/changelog/2026-10-02-retention-reports-now-compare-returns-from-paid-and-untagged.md +6 -0
  55. package/corpus/templates/analytics/server/db/schema.ts +106 -0
  56. package/corpus/templates/analytics/server/lib/analytics-mcp.ts +19 -0
  57. package/corpus/templates/analytics/server/lib/canonical-first-party-dashboard-repair.ts +88 -2
  58. package/corpus/templates/analytics/server/lib/dashboards-store.ts +57 -10
  59. package/corpus/templates/analytics/server/lib/first-party-analytics.ts +22 -7
  60. package/corpus/templates/analytics/server/lib/gong-native-operations.ts +35 -0
  61. package/corpus/templates/analytics/server/lib/real-data-actions.ts +4 -1
  62. package/corpus/templates/analytics/server/lib/session-event-index.ts +817 -0
  63. package/corpus/templates/analytics/server/lib/session-replay-agent-context.ts +7 -1
  64. package/corpus/templates/analytics/server/lib/session-replay.ts +22 -1
  65. package/corpus/templates/analytics/server/lib/sessions-triage-lab.ts +25 -0
  66. package/corpus/templates/analytics/server/plugins/agent-chat.ts +2 -8
  67. package/corpus/templates/analytics/server/plugins/db.ts +66 -0
  68. package/corpus/templates/analytics/server/plugins/labs.ts +3 -1
  69. package/corpus/templates/analytics/shared/labs.ts +3 -2
  70. package/corpus/templates/analytics/shared/session-events.ts +121 -0
  71. package/corpus/templates/brain/CHANGELOG.md +6 -0
  72. package/corpus/templates/calendar/CHANGELOG.md +6 -0
  73. package/corpus/templates/calendar/app/hooks/use-events.ts +10 -5
  74. package/corpus/templates/calendar/app/hooks/use-overlay-people.ts +7 -1
  75. package/corpus/templates/clips/CHANGELOG.md +20 -0
  76. package/corpus/templates/clips/actions/create-recording.ts +1 -2
  77. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +2 -2
  78. package/corpus/templates/clips/app/global.css +35 -0
  79. package/corpus/templates/clips/app/lib/local-recording-upload.ts +2 -3
  80. package/corpus/templates/clips/app/routes/record.tsx +1 -1
  81. package/corpus/templates/clips/changelog/2026-10-02-recording-reminders-and-other-actionable-notifications-show-.md +6 -0
  82. package/corpus/templates/clips/changelog/2026-10-02-temporary-upload-authorization-failures-no-longer-trigger-un.md +6 -0
  83. package/corpus/templates/clips/server/routes/api/uploads/[recordingId]/abort.post.ts +13 -7
  84. package/corpus/templates/content/CHANGELOG.md +17 -0
  85. package/corpus/templates/content/actions/_comment-write-pool.test-fixture.ts +954 -0
  86. package/corpus/templates/content/actions/search-documents.ts +83 -39
  87. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +107 -36
  88. package/corpus/templates/content/app/components/editor/PageDraftRecovery.tsx +7 -2
  89. package/corpus/templates/content/app/components/editor/page-draft-journal.ts +12 -0
  90. package/corpus/templates/content/changelog/2026-09-30-search-matches-page-text-from-word-starts.md +6 -0
  91. package/corpus/templates/content/changelog/2026-09-30-search-stays-fast-in-large-workspaces.md +6 -0
  92. package/corpus/templates/content/changelog/2026-10-01-suggested-edits-replace-whole-words-on-pages-with-bold-itali.md +6 -0
  93. package/corpus/templates/content/evals/search-relevance/README.md +92 -0
  94. package/corpus/templates/content/evals/search-relevance/baseline.json +59 -0
  95. package/corpus/templates/content/evals/search-relevance/cases.ts +377 -0
  96. package/corpus/templates/content/evals/search-relevance/corpus.ts +1581 -0
  97. package/corpus/templates/content/package.json +1 -0
  98. package/corpus/templates/content/server/db/index.ts +34 -0
  99. package/corpus/templates/content/server/plugins/db.ts +8 -0
  100. package/corpus/templates/content/shared/search-query.ts +9 -89
  101. package/corpus/templates/content/shared/suggestion-diff.ts +61 -28
  102. package/corpus/templates/content/vitest.config.ts +4 -0
  103. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +31 -2
  104. package/corpus/templates/design/.generated/bridge/hit-test.generated.ts +12 -8
  105. package/corpus/templates/design/CHANGELOG.md +15 -0
  106. package/corpus/templates/design/actions/generate-design.ts +1 -1
  107. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +7 -0
  108. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +27 -9
  109. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +54 -2
  110. package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +18 -8
  111. package/corpus/templates/design/app/pages/DesignEditor.tsx +75 -31
  112. package/corpus/templates/design/app/pages/design-editor/commands/cross-screen-element-drop.ts +2 -2
  113. package/corpus/templates/design/app/pages/design-editor/commands/publish-visual-edit-pending.ts +105 -6
  114. package/corpus/templates/design/changelog/2026-10-01-live-visual-edits-stay-in-sync-when-your-app-hot-reloads.md +6 -0
  115. package/corpus/templates/dispatch/CHANGELOG.md +10 -0
  116. package/corpus/templates/forms/CHANGELOG.md +6 -0
  117. package/corpus/templates/mail/CHANGELOG.md +4 -0
  118. package/corpus/templates/plan/CHANGELOG.md +10 -0
  119. package/corpus/templates/slides/CHANGELOG.md +21 -0
  120. package/corpus/templates/slides/app/components/editor/bullet-editing.ts +4 -1
  121. package/corpus/templates/slides/app/components/editor/in-place-text-session.ts +65 -22
  122. package/corpus/templates/slides/app/components/editor/rich-text-selection.ts +38 -4
  123. package/corpus/templates/slides/app/context/DeckContext.tsx +5 -4
  124. package/corpus/templates/slides/changelog/2026-10-02-slide-text-editing-now-preserves-formatting-and-caret-placem.md +6 -0
  125. package/corpus/templates/slides/scripts/edit-fidelity/authoring-fuzz.ts +859 -218
  126. package/corpus/templates/slides/scripts/edit-fidelity/run.ts +35 -17
  127. package/package.json +1 -1
  128. package/corpus/templates/analytics/server/lib/analytics-connector-catalog.ts +0 -12
package/corpus/README.md CHANGED
@@ -32,4 +32,4 @@ rg -n "defineAction|useActionQuery" node_modules/@agent-native/core-corpus/corpu
32
32
 
33
33
  ## Generated Counts
34
34
 
35
- - template files: 11005
35
+ - template files: 11031
@@ -12,13 +12,15 @@ dive that asks what happened in customer conversations.
12
12
 
13
13
  ## Actions
14
14
 
15
- - `gong-native-insights` — one provider-native qualitative synthesis operation
16
- (`ask_account`, `ask_deal`, or `generate_brief`) through Gong's connected MCP.
17
- Use it for themes, risks, summaries, and deck narrative when the native tools
18
- are connected. One action invocation makes at most one Gong AI request; omit
19
- `operation` to inspect its schemas without spending a credit request, and set
20
- `allowCreditRequest=true` only for the one consolidated request you intend to
21
- send. Paid calls also require a workspace owner to enable them once with
15
+ - `gong-native-insights` — lists the connected provider-native qualitative
16
+ synthesis operations (`ask_account`, `ask_deal`, `generate_brief`) and their
17
+ schemas. It never calls Gong AI or spends a credit request.
18
+ - `run-gong-native-insight` — sends one of those operations through Gong's
19
+ connected MCP. Use it for themes, risks, summaries, and deck narrative when
20
+ the native tools are connected. One invocation makes at most one Gong AI
21
+ request; set `allowCreditRequest=true` only for the one consolidated request
22
+ you intend to send, and each paid request asks for approval. Paid calls also
23
+ require a workspace owner to enable them once with
22
24
  `configure-gong-native-insights`; the policy defaults off and disabling it
23
25
  never blocks the raw evidence path.
24
26
  - `account-deep-dive` — first choice for named account/deal deep dives that
@@ -39,7 +41,7 @@ native/indexed search can answer the question.
39
41
 
40
42
  ## Route Synthesis and Evidence Separately
41
43
 
42
- - Use `gong-native-insights` for qualitative synthesis where Gong may retrieve
44
+ - Use `run-gong-native-insight` for qualitative synthesis where Gong may retrieve
43
45
  and analyze evidence internally. Its result is provider synthesis: coverage
44
46
  is unknown and raw transcript evidence is unavailable.
45
47
  - Use `gong-calls` or `provider-corpus-job` for quotes, exact counts, transcript
@@ -65,6 +65,54 @@ agent answers about browser recordings in the Analytics template.
65
65
  console events plus the additive `networkErrorCount` column on
66
66
  `session_recordings`. Keep new columns additive.
67
67
 
68
+ ## App Events In Sessions
69
+
70
+ - `trackEvent` also emits an `agent-native.event` custom event holding only
71
+ `{ name }` (120 chars max, 1000 per replay, counted across page reloads).
72
+ Telemetry names such as `pageview`, `action.response`, and `session status`
73
+ stay unmarked; lifecycle aliases don't get a second marker. Never add event
74
+ properties to the payload.
75
+ - The replay viewer shows these markers, plus failed
76
+ `/_agent-native/actions/<name>` requests as "Action failed", only while the
77
+ Sessions triage Lab is on. With the Lab off the viewer and the agent timeline
78
+ keep their earlier shape.
79
+ - `recordAnalyticsEvents` writes the per-session event index
80
+ (`analytics_session_events`) and a per-tenant coverage start inside the
81
+ transaction that stores the events, in every sink mode. After that
82
+ transaction commits it writes the daily catalog
83
+ (`analytics_event_catalog_daily`) and each event's latest sighting
84
+ (`analytics_event_catalog_latest`) best-effort, together in one short
85
+ transaction, because the catalog lists events from the latest table. A
86
+ catalog failure only warns, and the catalog never decides a filter. Lists,
87
+ did/didn't filters, and the catalog read only these tables, never BigQuery.
88
+ The catalog keeps the 1,000 most recently seen events, sorted by volume, and
89
+ sets `truncated` when it cut the list; its app flags still count every event
90
+ in the range.
91
+ - Unique indexes hold caller text raw, so it must stay short enough for an
92
+ index entry: index rows use hashed ids, event names and apps are cut to 200
93
+ and 100 characters, and a session id over 256 characters skips the index.
94
+ Bound any new caller value before it reaches a key.
95
+ - Event filters exclude a session if any of its recordings started before the
96
+ tenant's coverage start, because one analytics session can span tabs.
97
+ Coverage starts only after a session write succeeds, and the reported start
98
+ is the latest among the viewer's tenants. "Didn't" also needs at least one
99
+ index row for the session and no gap marker: a failed index write rolls back
100
+ to a savepoint and records the batch's sessions in
101
+ `analytics_session_event_gaps` in the same transaction, so a later
102
+ successful batch cannot make them look complete. If the marker cannot be
103
+ written either, the batch fails and its events are not stored. Keep session
104
+ index writes inside that transaction. Deploys ship code before the scheduled
105
+ migration creates these tables, so until `analytics_session_event_coverage`
106
+ exists ingest stores events unindexed and warns: with no coverage, no
107
+ session can read as complete. Reads in that window report no coverage
108
+ instead of failing: no event names, a null coverage start, an empty
109
+ catalog, and no session matching an event filter. That is the only unmarked
110
+ gap, and it holds only while the coverage table is the last index table a
111
+ migration creates.
112
+ The retention sweep removes a session's index rows together, once all of
113
+ them are two days past replay retention, and its gap marker after that. The
114
+ BigQuery-cutover purge leaves these tables alone.
115
+
68
116
  ## Agent Diagnostics Surface
69
117
 
70
118
  - `buildSessionReplayAgentContext` includes a `diagnostics` section: up to 50
@@ -88,12 +88,18 @@ certified ones); label figures "Unverified" when no live query ran.
88
88
  - `list-session-recordings` filters scoped replays by date, app, duration,
89
89
  signals, visitor type, and email domain. Use `paginated: true` for sorted
90
90
  pages with a real total and app counts; the default returns an array.
91
+ - With the Sessions triage Lab on, `didEvents` / `didNotEvents` filter by
92
+ tracked events. Get real names and session counts from
93
+ `list-session-event-names`, and event health from `list-event-catalog`. Both
94
+ read Analytics' own index, which covers sessions only from its coverage
95
+ start. Never query BigQuery for these views.
91
96
 
92
97
  ## Application State
93
98
 
94
99
  - `navigation` exposes the current dashboard, analysis, source, chart, and
95
100
  selection. `navigate` moves the user between supported Analytics surfaces,
96
- `"sessions"`, `"monitoring"`, and `"agents"`. Use `view-screen` when the
101
+ `"sessions"`, `"event-catalog"`, `"monitoring"`, and `"agents"`. Use
102
+ `view-screen` when the
97
103
  active context is unclear.
98
104
  - Clicking a panel stages it as a chat context chip and writes `selected-object`
99
105
  with `type="dashboard-panel"`. Read `dashboard-management` for the
@@ -3,15 +3,28 @@
3
3
  All notable user-facing changes to Agent-Native Analytics are documented here. Open it any
4
4
  time from the command menu (Cmd+K → "What's new") or from Settings.
5
5
 
6
+ ## 2026-10-02
7
+
8
+ ### Improved
9
+
10
+ - Retention reports now compare returns from paid and untagged signups.
11
+
6
12
  ## 2026-10-01
7
13
 
8
14
  ### Improved
9
15
 
16
+ - Clear all resets every Sessions filter in one click.
17
+ - The first-party retention chart now splits 1-7d return into paid and untagged signups, and a Chat Readiness at Prompt panel shows whether AI was ready and how many prompts got no reply.
10
18
  - Error issues in Monitoring link straight to the chat thread that failed, and one underlying error now stays a single issue instead of splitting after each deploy
11
19
  - The observability settings tab is now labeled Observability.
12
20
 
13
21
  ## 2026-09-30
14
22
 
23
+ ### Added
24
+
25
+ - External agents connected over MCP can read dashboards, saved analyses, the data dictionary, blog articles and provider data directly, without handing the question to the Analytics agent.
26
+ - With the Sessions triage Lab on, filter sessions by events they did or didn't send, see app events and failed actions on replay timelines, and browse an event catalog.
27
+
15
28
  ### Improved
16
29
 
17
30
  - Removed excess spacing above the sidebar footer
@@ -417,6 +417,7 @@ export default defineAction({
417
417
  }),
418
418
  http: { method: "GET" },
419
419
  readOnly: true,
420
+ mcpTool: true,
420
421
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
421
422
  grounding: true,
422
423
  run: async (args) => {
@@ -127,6 +127,7 @@ export default defineAction({
127
127
  sql: z.string().describe("SQL query to execute"),
128
128
  }),
129
129
  readOnly: true,
130
+ mcpTool: false,
130
131
  toolCallable: true,
131
132
  grounding: true,
132
133
  run: async (args, context?: ActionRunContext) => {
@@ -216,6 +216,7 @@ export default defineAction({
216
216
  }),
217
217
  http: { method: "GET" },
218
218
  readOnly: true,
219
+ mcpTool: true,
219
220
  grounding: true,
220
221
  run: async (args, context) => {
221
222
  return listBuilderBlogArticles(args, context);
@@ -5,7 +5,7 @@ import { writeGongNativeInsightsPolicy } from "../server/lib/gong-native-policy"
5
5
 
6
6
  export default defineAction({
7
7
  description:
8
- "Enable or disable paid Gong native semantic operations for the current workspace. Enabling this permits individually authorized gong-native-insights calls to consume Gong credits; it does not send a Gong request by itself. Disable it to fail closed for every semantic request while keeping raw Gong evidence actions available.",
8
+ "Enable or disable paid Gong native semantic operations for the current workspace. Enabling this permits individually authorized run-gong-native-insight calls to consume Gong credits; it does not send a Gong request by itself. Disable it to fail closed for every semantic request while keeping raw Gong evidence actions available.",
9
9
  schema: z.object({
10
10
  enabled: z
11
11
  .boolean()
@@ -28,4 +28,5 @@ export default defineAction({
28
28
  });
29
29
  },
30
30
  readOnly: true,
31
+ mcpTool: false,
31
32
  });
@@ -96,6 +96,7 @@ export default defineAction({
96
96
  ),
97
97
  }),
98
98
  http: { method: "GET" },
99
+ mcpTool: true,
99
100
  run: async (args) => {
100
101
  const ctx = tryRequestCredentialContext();
101
102
  if (!ctx) {
@@ -22,6 +22,7 @@ export default defineAction({
22
22
  },
23
23
  http: { method: "POST" },
24
24
  readOnly: true,
25
+ mcpTool: false,
25
26
  grounding: true,
26
27
  run: async (args, ctx) => {
27
28
  const admin = await requireDbAdminContextFromRequest(ctx);
@@ -14,7 +14,8 @@ import {
14
14
  } from "../server/lib/dashboards-store";
15
15
 
16
16
  export default defineAction({
17
- description: "Get a saved ad-hoc analysis by ID, including its full results.",
17
+ description:
18
+ "Get a saved ad-hoc analysis by ID, including its question, data sources, and full results. Use list-analyses to find IDs.",
18
19
  schema: z.object({
19
20
  id: z.string().describe("The analysis ID"),
20
21
  reviewPreview: z
@@ -31,6 +32,7 @@ export default defineAction({
31
32
  }),
32
33
  http: { method: "GET" },
33
34
  readOnly: true,
35
+ mcpTool: true,
34
36
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
35
37
  mcpApp: {
36
38
  compactCatalog: true,
@@ -19,6 +19,7 @@ export default defineAction({
19
19
  }),
20
20
  http: { method: "GET" },
21
21
  readOnly: true,
22
+ mcpTool: true,
22
23
  run: async (args) => {
23
24
  const ctx = getCredentialContext();
24
25
  if (!ctx) throw new Error("No authenticated context for get-data-program.");
@@ -28,6 +28,7 @@ export default defineAction({
28
28
  }),
29
29
  http: { method: "GET" },
30
30
  readOnly: true,
31
+ mcpTool: true,
31
32
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
32
33
  grounding: true,
33
34
  run: async (args) => {
@@ -79,6 +79,7 @@ export default defineAction({
79
79
  outputSchema: healthSchema,
80
80
  http: { method: "GET" },
81
81
  readOnly: true,
82
+ mcpTool: true,
82
83
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
83
84
  run: async () => {
84
85
  const scope = resolveScope();
@@ -21,6 +21,7 @@ export default defineAction({
21
21
  }),
22
22
  http: { method: "GET" },
23
23
  readOnly: true,
24
+ mcpTool: true,
24
25
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
25
26
  grounding: true,
26
27
  run: async (args) => {
@@ -31,6 +31,7 @@ export default defineAction({
31
31
  }),
32
32
  http: { method: "GET" },
33
33
  readOnly: true,
34
+ mcpTool: true,
34
35
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
35
36
  grounding: true,
36
37
  run: async (args) => {
@@ -44,6 +44,7 @@ export default defineAction({
44
44
  }),
45
45
  http: { method: "GET" },
46
46
  readOnly: true,
47
+ mcpTool: true,
47
48
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
48
49
  mcpApp: {
49
50
  compactCatalog: true,
@@ -487,12 +487,13 @@ function normalizeGongDate(
487
487
 
488
488
  export default defineAction({
489
489
  readOnly: true,
490
+ mcpTool: true,
490
491
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
491
492
  maxResultChars: 100_000,
492
493
  description:
493
- "Query bounded Gong sales-call evidence. Pass --users for the user list, --transcript for one transcript, or --company for a bounded search by company/domain/person/email. Without --company, the action lists calls in the date window; set exhaustive=true only for a small bounded cohort of fewer than 500 records, not a broad org-wide export. For account-level transcript mention questions, transcriptQuery performs a case-insensitive local scan after batched transcript retrieval and returns coverage counts plus snippets; it is not Gong's server-side keyword search. Use includeTranscripts=true for bounded qualitative context. For broad keyword, tracker, cross-account, or absence-sensitive work, use provider-api-catalog/provider-api-docs, stage the raw Gong API response, then use query-staged-dataset or a Data Program; use provider-corpus-job only when raw transcript bodies are required.",
494
+ "Query bounded Gong sales-call evidence. Pass --users for the user list, --transcript for one transcript, or --company for a bounded call search; without --company, lists calls in the date window. For broad keyword, tracker, cross-account, or absence-sensitive work, stage the raw Gong API response via provider-api-catalog/provider-api-docs/provider-api-request, then use query-staged-dataset or a Data Program; use provider-corpus-job only for durable scans that require raw transcript bodies.",
494
495
  schema: z.object({
495
- users: cliBoolean.optional().describe("Set to true to list Gong users"),
496
+ users: cliBoolean.optional().describe("List Gong users"),
496
497
  transcript: z.string().optional().describe("Call ID to get transcript"),
497
498
  rawTranscript: cliBoolean
498
499
  .optional()
@@ -514,7 +515,7 @@ export default defineAction({
514
515
  .max(200)
515
516
  .optional()
516
517
  .describe(
517
- "Maximum number of calls to return for call searches (default 8, max 200). Use 5-8 for quick checks, 20-50 for thorough account analysis, 100-200 for large-scale coverage.",
518
+ "Max calls to return (default 8). Use 5-8 for quick checks, 20-50 for thorough account analysis, 100-200 for large-scale coverage.",
518
519
  ),
519
520
  includeTranscripts: cliBoolean
520
521
  .optional()
@@ -528,7 +529,7 @@ export default defineAction({
528
529
  .max(MAX_GONG_TRANSCRIPT_LIMIT)
529
530
  .optional()
530
531
  .describe(
531
- "Number of matching calls to load transcripts for when includeTranscripts=true (default 3, max 50). Use 3-5 for a first pass; increase to 10-20+ for thorough account analysis.",
532
+ "Matching calls to load transcripts for when includeTranscripts=true (default 3). Use 3-5 for a first pass, 10-20+ for thorough account analysis.",
532
533
  ),
533
534
  transcriptMaxChars: z.coerce
534
535
  .number()
@@ -537,13 +538,13 @@ export default defineAction({
537
538
  .max(MAX_TRANSCRIPT_MAX_CHARS)
538
539
  .optional()
539
540
  .describe(
540
- "Maximum transcript characters to return per call (default 8000, max 100000). Batched results also share a 60000-character aggregate excerpt budget. Use the default for analysis; raise it only when the user asks for more quoted detail.",
541
+ "Max transcript characters per call (default 8000). Batched results also share a 60000-character aggregate excerpt budget. Use the default for analysis; raise it only when the user asks for more quoted detail.",
541
542
  ),
542
543
  transcriptQuery: z
543
544
  .string()
544
545
  .optional()
545
546
  .describe(
546
- "Case-insensitive phrase to search inside matching call transcripts after batched retrieval. Use only for bounded account/call searches where the matching set is already small. For broad cohort or exhaustive absence research, use the raw Gong API tracker/staging path plus query-staged-dataset or a Data Program, or provider-corpus-job when raw transcript bodies are required. Returns coverage counts and short snippets only, not full transcripts.",
547
+ "Case-insensitive phrase for a local scan of matching call transcripts after batched retrieval; not Gong's server-side keyword search. Use only for bounded account-level mention questions where the matching call set is already small. Returns coverage counts and short snippets, not full transcripts.",
547
548
  ),
548
549
  transcriptScanLimit: z.coerce
549
550
  .number()
@@ -552,24 +553,24 @@ export default defineAction({
552
553
  .max(MAX_TRANSCRIPT_SCAN_LIMIT)
553
554
  .optional()
554
555
  .describe(
555
- "Maximum number of matching calls whose transcripts should be fetched and searched when transcriptQuery is set (default 50, max 200). Combine with exhaustive=true and after/before for defensible bounded coverage.",
556
+ "Max matching calls whose transcripts are fetched and searched when transcriptQuery is set (default 50). Combine with exhaustive=true and after/before for defensible bounded coverage.",
556
557
  ),
557
558
  exhaustive: cliBoolean
558
559
  .optional()
559
560
  .describe(
560
- "Return EVERY matching call in the window instead of stopping at `limit`; without company, return every call page only for a small bounded cohort of fewer than 500 records. Cohorts at or above 500 fail closed with guidance to use provider-api-request staging and query-staged-dataset or a Data Program. By default this is metadata-only. With includeTranscripts=true, transcripts are fetched in batches and explicit coverage is returned. For broad or absence-sensitive work, prefer the raw Gong API tracker/staging path plus query-staged-dataset or a Data Program; use provider-corpus-job for durable raw-transcript scans. Always bound this with after/before or a small days window.",
561
+ "Return EVERY matching call in the window instead of stopping at `limit`. Without company, use only for a small bounded cohort of fewer than 500 records, not a broad org-wide export. Cohorts at or above 500 fail closed with staging guidance. Metadata-only unless includeTranscripts=true, which fetches transcripts in batches and returns explicit coverage. Always bound this with after/before or a small days window.",
561
562
  ),
562
563
  after: z
563
564
  .string()
564
565
  .optional()
565
566
  .describe(
566
- "Only include calls on/after this date (ISO yyyy-mm-dd or full timestamp), e.g. a deal's closed-won date. Sets the window start and overrides `days` for the start bound.",
567
+ "Only include calls on/after this date (ISO yyyy-mm-dd or full timestamp), e.g. a deal's closed-won date. Overrides `days` for the window start.",
567
568
  ),
568
569
  before: z
569
570
  .string()
570
571
  .optional()
571
572
  .describe(
572
- "Only include calls on/before this date (ISO yyyy-mm-dd or full timestamp). Sets the window end.",
573
+ "Only include calls on/before this date (ISO yyyy-mm-dd or full timestamp).",
573
574
  ),
574
575
  }),
575
576
  http: { method: "GET" },
@@ -1,167 +1,50 @@
1
1
  import { defineAction } from "@agent-native/core/action";
2
- import {
3
- callMcpTool,
4
- listVisibleMcpTools,
5
- type AppMcpTool,
6
- } from "@agent-native/core/mcp-client";
7
2
  import { z } from "zod";
8
3
 
9
- import { readGongNativeInsightsPolicy } from "../server/lib/gong-native-policy";
10
-
11
- const GONG_NATIVE_OPERATIONS = [
12
- "ask_account",
13
- "ask_deal",
14
- "generate_brief",
15
- ] as const;
16
-
17
- type GongNativeOperation = (typeof GONG_NATIVE_OPERATIONS)[number];
18
-
19
- function operationName(value: string): string {
20
- return value.trim().toLowerCase().replace(/-/g, "_");
21
- }
22
-
23
- function gongNativeTools(tools: AppMcpTool[]): AppMcpTool[] {
24
- const names = new Set<string>(GONG_NATIVE_OPERATIONS);
25
- return tools.filter((tool) => names.has(operationName(tool.name)));
26
- }
27
-
28
- function selectTool(
29
- tools: AppMcpTool[],
30
- operation: GongNativeOperation,
31
- ): AppMcpTool | null {
32
- const matches = tools.filter(
33
- (tool) => operationName(tool.name) === operation,
34
- );
35
- if (matches.length === 1) return matches[0];
36
- const gongNamed = matches.filter((tool) => /gong/i.test(tool.serverId));
37
- return gongNamed.length === 1 ? gongNamed[0] : null;
38
- }
4
+ import {
5
+ gongNativeOperationName,
6
+ listGongNativeTools,
7
+ } from "../server/lib/gong-native-operations";
39
8
 
40
9
  export default defineAction({
41
10
  description:
42
- "Use Gong's official MCP semantic operations for one bounded qualitative synthesis request. Omit operation to inspect the connected schemas without spending Gong credits. Paid calls fail closed unless configure-gong-native-insights has enabled them for this workspace and this invocation sets allowCreditRequest=true. With operation, pass one consolidated arguments object; each invocation independently consumes Gong credits. Use this only for themes, risks, summaries, and deck narrative. For transcripts, quotes, counts, source records, or absence/exhaustive claims use gong-calls or the provider corpus evidence path instead.",
43
- schema: z.object({
44
- operation: z
45
- .enum(GONG_NATIVE_OPERATIONS)
46
- .optional()
47
- .describe(
48
- "Official Gong MCP operation. Omit to list the currently connected operation schemas without calling Gong AI.",
49
- ),
50
- allowCreditRequest: z
51
- .boolean()
52
- .default(false)
53
- .describe(
54
- "Explicitly authorize this one Gong semantic request. Leave false while inspecting schemas or when the workspace should not spend Gong credits.",
55
- ),
56
- arguments: z
57
- .record(z.string(), z.unknown())
58
- .default({})
59
- .describe(
60
- "Arguments passed unchanged to the connected Gong MCP operation. Consolidate related questions into one request and narrow the entity/date scope.",
61
- ),
62
- }),
11
+ "List the Gong native semantic operations (ask_account, ask_deal, generate_brief) connected in this request scope, with their input schemas. This never calls Gong AI or consumes Gong credits. To send one paid qualitative synthesis request, call run-gong-native-insight with the chosen operation. For transcripts, quotes, counts, source records, or absence/exhaustive claims use gong-calls or the provider corpus evidence path instead.",
12
+ // Paid execution moved to run-gong-native-insight. Reject its arguments here
13
+ // instead of silently returning a listing to an older caller.
14
+ schema: z.strictObject(
15
+ {},
16
+ {
17
+ error: (issue) =>
18
+ issue.code === "unrecognized_keys"
19
+ ? `gong-native-insights only lists operations and takes no arguments (got ${issue.keys.join(", ")}). Send a paid Gong request with run-gong-native-insight.`
20
+ : undefined,
21
+ },
22
+ ),
63
23
  readOnly: true,
64
24
  parallelSafe: true,
65
- needsApproval: ({ operation, allowCreditRequest }) =>
66
- Boolean(operation && allowCreditRequest),
25
+ mcpTool: true,
67
26
  publicAgent: { expose: true, readOnly: true, requiresAuth: true },
68
27
  http: false,
69
- grounding: true,
70
- run: async ({ operation, allowCreditRequest, arguments: args }) => {
71
- const tools = gongNativeTools(await listVisibleMcpTools());
72
- if (!operation) {
73
- return {
74
- connected: tools.length > 0,
75
- creditRequests: 0,
76
- creditUnit: "request",
77
- evidenceMode: "provider-synthesis",
78
- rawEvidenceAvailable: false,
79
- operations: tools.map((tool) => ({
80
- operation: operationName(tool.name),
81
- serverId: tool.serverId,
82
- description: tool.description,
83
- inputSchema: tool.inputSchema,
84
- })),
85
- evidenceFallbackAction: "gong-calls",
86
- guidance:
87
- tools.length > 0
88
- ? "Choose one operation and make one consolidated, narrowly scoped request. Inspecting this catalog did not call Gong AI or consume a Gong credit request."
89
- : "No official Gong semantic MCP operations are connected in this request scope. Use gong-calls for bounded evidence, or connect Gong MCP before using the synthesis path.",
90
- };
91
- }
92
-
93
- if (!allowCreditRequest) {
94
- return {
95
- connected: tools.length > 0,
96
- operation,
97
- blocked: true,
98
- creditRequests: 0,
99
- creditUnit: "request",
100
- evidenceMode: "provider-synthesis",
101
- rawEvidenceAvailable: false,
102
- evidenceFallbackAction: "gong-calls",
103
- guidance:
104
- "This Gong semantic request was not sent. Set allowCreditRequest=true only after choosing one consolidated, narrowly scoped request; use gong-calls for evidence retrieval without Gong AI synthesis.",
105
- };
106
- }
107
-
108
- const policy = await readGongNativeInsightsPolicy();
109
- if (!policy.enabled) {
110
- return {
111
- connected: tools.length > 0,
112
- operation,
113
- blocked: true,
114
- blockedBy: "workspace-policy",
115
- policy,
116
- creditRequests: 0,
117
- creditUnit: "request",
118
- evidenceMode: "provider-synthesis",
119
- rawEvidenceAvailable: false,
120
- evidenceFallbackAction: "gong-calls",
121
- guidance:
122
- "This Gong semantic request was not sent because paid native insights are disabled for this workspace. An authorized user can enable them with configure-gong-native-insights; use gong-calls for evidence retrieval in the meantime.",
123
- };
124
- }
125
-
126
- const tool = selectTool(tools, operation);
127
- if (!tool) {
128
- return {
129
- connected: tools.length > 0,
130
- operation,
131
- creditRequests: 0,
132
- creditUnit: "request",
133
- evidenceMode: "provider-synthesis",
134
- rawEvidenceAvailable: false,
135
- error:
136
- tools.length === 0
137
- ? "No official Gong semantic MCP operations are connected in this request scope."
138
- : `The ${operation} operation is missing or ambiguous across connected MCP servers.`,
139
- availableOperations: tools.map((candidate) => ({
140
- operation: operationName(candidate.name),
141
- serverId: candidate.serverId,
142
- })),
143
- evidenceFallbackAction: "gong-calls",
144
- };
145
- }
146
-
147
- const startedAt = Date.now();
148
- const result = await callMcpTool(tool.serverId, tool.name, args);
28
+ run: async () => {
29
+ const tools = await listGongNativeTools();
149
30
  return {
150
- connected: true,
151
- source: "gong-native-mcp",
152
- operation,
153
- creditRequests: 1,
31
+ connected: tools.length > 0,
32
+ creditRequests: 0,
154
33
  creditUnit: "request",
155
- durationMs: Date.now() - startedAt,
156
34
  evidenceMode: "provider-synthesis",
157
- synthesisOnly: true,
158
35
  rawEvidenceAvailable: false,
159
- coverageComplete: false,
160
- coverageUnknown: true,
161
- result,
36
+ operations: tools.map((tool) => ({
37
+ operation: gongNativeOperationName(tool.name),
38
+ serverId: tool.serverId,
39
+ description: tool.description,
40
+ inputSchema: tool.inputSchema,
41
+ })),
42
+ executionAction: "run-gong-native-insight",
162
43
  evidenceFallbackAction: "gong-calls",
163
44
  guidance:
164
- "Treat this as Gong-generated qualitative synthesis, not transcript evidence. Do not use it for verbatim quotes, exact counts, source-record claims, or proof of absence; route those to gong-calls or the provider corpus evidence path.",
45
+ tools.length > 0
46
+ ? "Choose one operation and send one consolidated, narrowly scoped request with run-gong-native-insight. Inspecting this catalog did not call Gong AI or consume a Gong credit request."
47
+ : "No official Gong semantic MCP operations are connected in this request scope. Use gong-calls for bounded evidence, or connect Gong MCP before using the synthesis path.",
165
48
  };
166
49
  },
167
50
  });