@agent-native/core 0.98.5 → 0.98.7

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 (135) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +18 -0
  3. package/corpus/core/docs/content/external-agents.mdx +66 -7
  4. package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +40 -7
  5. package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +41 -7
  6. package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +41 -7
  7. package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +41 -7
  8. package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +40 -7
  9. package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +40 -7
  10. package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +40 -7
  11. package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +41 -7
  12. package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +39 -7
  13. package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +39 -7
  14. package/corpus/core/package.json +1 -1
  15. package/corpus/core/src/a2a/handlers.ts +101 -26
  16. package/corpus/core/src/a2a/task-store.ts +128 -3
  17. package/corpus/core/src/client/session-replay.ts +67 -5
  18. package/corpus/core/src/integrations/adapters/slack.ts +207 -17
  19. package/corpus/core/src/integrations/identity-links-store.ts +210 -0
  20. package/corpus/core/src/integrations/identity.ts +196 -0
  21. package/corpus/core/src/integrations/index.ts +6 -0
  22. package/corpus/core/src/integrations/plugin.ts +130 -1
  23. package/corpus/core/src/integrations/types.ts +37 -0
  24. package/corpus/core/src/integrations/webhook-handler.ts +1 -0
  25. package/corpus/core/src/mcp/build-server.ts +127 -22
  26. package/corpus/core/src/mcp/builtin-tools.ts +5 -2
  27. package/corpus/core/src/mcp/external-agent-policy.ts +18 -0
  28. package/corpus/core/src/mcp/index.ts +1 -0
  29. package/corpus/core/src/server/agent-chat/plugin-options.ts +12 -1
  30. package/corpus/core/src/server/agent-chat/script-entries.ts +20 -3
  31. package/corpus/core/src/server/agent-chat-plugin.ts +3 -0
  32. package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
  33. package/corpus/templates/analytics/.agents/skills/session-replay/SKILL.md +4 -1
  34. package/corpus/templates/analytics/AGENTS.md +20 -5
  35. package/corpus/templates/analytics/actions/create-session-replay-agent-link.ts +0 -1
  36. package/corpus/templates/analytics/actions/get-session-replay-events.ts +0 -1
  37. package/corpus/templates/analytics/actions/get-session-replay-timeline.ts +40 -0
  38. package/corpus/templates/analytics/actions/list-error-issues.ts +12 -0
  39. package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +4 -1
  40. package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +48 -17
  41. package/corpus/templates/analytics/changelog/2026-07-12-analytics-uses-the-full-in-app-agent-for-multi-step-incident.md +6 -0
  42. package/corpus/templates/analytics/changelog/2026-07-12-connected-external-agents-can-now-look-up-sessions-error-iss.md +6 -0
  43. package/corpus/templates/analytics/changelog/2026-07-12-session-identities-stay-visible-when-demo-mode-is-off.md +6 -0
  44. package/corpus/templates/analytics/server/handlers/session-replay.ts +15 -9
  45. package/corpus/templates/analytics/server/lib/analytics-connector-catalog.ts +2 -2
  46. package/corpus/templates/analytics/server/lib/error-capture.ts +47 -5
  47. package/corpus/templates/analytics/server/lib/session-replay-agent-context.ts +72 -22
  48. package/corpus/templates/analytics/server/lib/session-replay.ts +41 -11
  49. package/corpus/templates/analytics/server/plugins/agent-chat.ts +7 -0
  50. package/corpus/templates/analytics/server/plugins/db.ts +15 -0
  51. package/corpus/templates/analytics/server/routes/api/session-replay/agent-diagnostics.json.get.ts +8 -5
  52. package/corpus/templates/analytics/server/routes/api/session-replay/agent-events.json.get.ts +8 -3
  53. package/corpus/templates/calendar/app/components/calendar/DeleteEventDialog.tsx +12 -2
  54. package/corpus/templates/forms/app/global.css +54 -8
  55. package/corpus/templates/forms/app/pages/AskPage.tsx +35 -13
  56. package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +11 -17
  57. package/corpus/templates/forms/app/pages/ResponsesPage.tsx +8 -5
  58. package/corpus/templates/forms/changelog/2026-07-12-ask-forms-suggestions-now-sit-beneath-the-composer-for-a-tig.md +6 -0
  59. package/corpus/templates/forms/changelog/2026-07-12-builder-response-tables-now-fill-the-view-without-a-redundan.md +6 -0
  60. package/corpus/templates/forms/changelog/2026-07-12-response-tables-now-fill-the-available-pane-with-a-flexible-.md +6 -0
  61. package/corpus/templates/mail/AGENTS.md +3 -1
  62. package/corpus/templates/mail/server/lib/mail-integrations.ts +3 -0
  63. package/dist/a2a/handlers.d.ts.map +1 -1
  64. package/dist/a2a/handlers.js +89 -20
  65. package/dist/a2a/handlers.js.map +1 -1
  66. package/dist/a2a/task-store.d.ts +32 -1
  67. package/dist/a2a/task-store.d.ts.map +1 -1
  68. package/dist/a2a/task-store.js +111 -4
  69. package/dist/a2a/task-store.js.map +1 -1
  70. package/dist/client/session-replay.d.ts.map +1 -1
  71. package/dist/client/session-replay.js +53 -8
  72. package/dist/client/session-replay.js.map +1 -1
  73. package/dist/collab/routes.d.ts +1 -1
  74. package/dist/integrations/adapters/slack.d.ts.map +1 -1
  75. package/dist/integrations/adapters/slack.js +176 -17
  76. package/dist/integrations/adapters/slack.js.map +1 -1
  77. package/dist/integrations/identity-links-store.d.ts +23 -0
  78. package/dist/integrations/identity-links-store.d.ts.map +1 -0
  79. package/dist/integrations/identity-links-store.js +158 -0
  80. package/dist/integrations/identity-links-store.js.map +1 -0
  81. package/dist/integrations/identity.d.ts +28 -0
  82. package/dist/integrations/identity.d.ts.map +1 -0
  83. package/dist/integrations/identity.js +142 -0
  84. package/dist/integrations/identity.js.map +1 -0
  85. package/dist/integrations/index.d.ts +2 -0
  86. package/dist/integrations/index.d.ts.map +1 -1
  87. package/dist/integrations/index.js +2 -0
  88. package/dist/integrations/index.js.map +1 -1
  89. package/dist/integrations/plugin.d.ts.map +1 -1
  90. package/dist/integrations/plugin.js +93 -1
  91. package/dist/integrations/plugin.js.map +1 -1
  92. package/dist/integrations/types.d.ts +31 -0
  93. package/dist/integrations/types.d.ts.map +1 -1
  94. package/dist/integrations/types.js.map +1 -1
  95. package/dist/integrations/webhook-handler.js +1 -0
  96. package/dist/integrations/webhook-handler.js.map +1 -1
  97. package/dist/mcp/build-server.d.ts +9 -2
  98. package/dist/mcp/build-server.d.ts.map +1 -1
  99. package/dist/mcp/build-server.js +97 -20
  100. package/dist/mcp/build-server.js.map +1 -1
  101. package/dist/mcp/builtin-tools.d.ts.map +1 -1
  102. package/dist/mcp/builtin-tools.js +5 -2
  103. package/dist/mcp/builtin-tools.js.map +1 -1
  104. package/dist/mcp/external-agent-policy.d.ts +19 -0
  105. package/dist/mcp/external-agent-policy.d.ts.map +1 -0
  106. package/dist/mcp/external-agent-policy.js +2 -0
  107. package/dist/mcp/external-agent-policy.js.map +1 -0
  108. package/dist/mcp/index.d.ts +1 -0
  109. package/dist/mcp/index.d.ts.map +1 -1
  110. package/dist/mcp/index.js.map +1 -1
  111. package/dist/notifications/routes.d.ts +1 -1
  112. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  113. package/dist/server/agent-chat/plugin-options.d.ts +11 -1
  114. package/dist/server/agent-chat/plugin-options.d.ts.map +1 -1
  115. package/dist/server/agent-chat/plugin-options.js.map +1 -1
  116. package/dist/server/agent-chat/script-entries.d.ts.map +1 -1
  117. package/dist/server/agent-chat/script-entries.js +16 -2
  118. package/dist/server/agent-chat/script-entries.js.map +1 -1
  119. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  120. package/dist/server/agent-chat-plugin.js +3 -0
  121. package/dist/server/agent-chat-plugin.js.map +1 -1
  122. package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
  123. package/docs/content/external-agents.mdx +66 -7
  124. package/docs/content/locales/ar-SA/external-agents.mdx +40 -7
  125. package/docs/content/locales/de-DE/external-agents.mdx +41 -7
  126. package/docs/content/locales/es-ES/external-agents.mdx +41 -7
  127. package/docs/content/locales/fr-FR/external-agents.mdx +41 -7
  128. package/docs/content/locales/hi-IN/external-agents.mdx +40 -7
  129. package/docs/content/locales/ja-JP/external-agents.mdx +40 -7
  130. package/docs/content/locales/ko-KR/external-agents.mdx +40 -7
  131. package/docs/content/locales/pt-BR/external-agents.mdx +41 -7
  132. package/docs/content/locales/zh-CN/external-agents.mdx +39 -7
  133. package/docs/content/locales/zh-TW/external-agents.mdx +39 -7
  134. package/package.json +1 -1
  135. package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
@@ -120,6 +120,7 @@ function getState() {
120
120
  g[SESSION_REPLAY_STATE_KEY] = {
121
121
  active: false,
122
122
  startPromise: null,
123
+ startGeneration: 0,
123
124
  replayId: null,
124
125
  startedAtMs: null,
125
126
  sequence: 0,
@@ -152,6 +153,7 @@ function getState() {
152
153
  state.pendingFlushReason ??= null;
153
154
  state.pendingFlushWaiters ??= [];
154
155
  state.awaitingFullSnapshot ??= false;
156
+ state.startGeneration ??= 0;
155
157
  return state;
156
158
  }
157
159
  // The replay session record (replayId + sequence counter) lives in
@@ -656,12 +658,14 @@ const REPLAY_RESOURCE_TAGS = new Set([
656
658
  "audio",
657
659
  "track",
658
660
  "input",
661
+ "object",
659
662
  "link",
660
663
  ]);
661
664
  const NO_REPLAY_RESOURCE_ATTRIBUTES = new Set();
662
665
  const REPLAY_SRC_ATTRIBUTES = new Set(["src"]);
663
666
  const REPLAY_SRCSET_ATTRIBUTES = new Set(["src", "srcset"]);
664
667
  const REPLAY_VIDEO_ATTRIBUTES = new Set(["src", "poster"]);
668
+ const REPLAY_OBJECT_ATTRIBUTES = new Set(["data"]);
665
669
  const REPLAY_HREF_ATTRIBUTES = new Set(["href"]);
666
670
  function replayAttributeString(attributes, key) {
667
671
  return typeof attributes[key] === "string"
@@ -692,6 +696,8 @@ function replayPreservedResourceAttributes(node) {
692
696
  case "audio":
693
697
  case "track":
694
698
  return REPLAY_SRC_ATTRIBUTES;
699
+ case "object":
700
+ return REPLAY_OBJECT_ATTRIBUTES;
695
701
  case "input":
696
702
  return node.type === "image"
697
703
  ? REPLAY_SRC_ATTRIBUTES
@@ -983,12 +989,12 @@ class ReplayUploadHttpError extends Error {
983
989
  this.status = status;
984
990
  }
985
991
  }
986
- /** 4xx statuses where retrying the exact same batch can never succeed --
987
- * e.g. a 409 chunk-sequence/checksum conflict, or a 400 the server will
988
- * reject again. 408 (timeout) and 429 (rate limit) are excluded because a
989
- * later retry can plausibly succeed. */
992
+ /** 4xx statuses where retrying the exact same batch can never succeed.
993
+ * Keep this deliberately narrow: 401/403/404 can be temporary during auth or
994
+ * deploy transitions, and stopping forever on one of those would silently
995
+ * black out the rest of a long-lived SPA session. */
990
996
  function isDefinitiveReplayUploadClientError(status) {
991
- return status >= 400 && status < 500 && status !== 408 && status !== 429;
997
+ return status === 400 || status === 409 || status === 413 || status === 422;
992
998
  }
993
999
  async function sendReplayUpload(options, body, callbacks = {}) {
994
1000
  if (isCrossOriginReplayEndpoint(options.endpoint)) {
@@ -1382,6 +1388,21 @@ export async function flushSessionReplay(reason = "manual") {
1382
1388
  * on internal option shapes continuing to round-trip through the public API.
1383
1389
  */
1384
1390
  async function restartSessionReplayAfterConflict(state, options, sessionId) {
1391
+ // Share the public-start mutex. A consumer may call start in the await gap
1392
+ // after the rejected recorder stops; both paths must converge on one rrweb
1393
+ // instance rather than racing two fresh identities.
1394
+ if (state.startPromise)
1395
+ return state.startPromise;
1396
+ const startGeneration = ++state.startGeneration;
1397
+ let startPromise;
1398
+ startPromise = restartSessionReplayAfterConflictInternal(state, options, sessionId, startGeneration).finally(() => {
1399
+ if (state.startPromise === startPromise)
1400
+ state.startPromise = null;
1401
+ });
1402
+ state.startPromise = startPromise;
1403
+ return startPromise;
1404
+ }
1405
+ async function restartSessionReplayAfterConflictInternal(state, options, sessionId, startGeneration) {
1385
1406
  if (options.shouldStart && !options.shouldStart()) {
1386
1407
  return { started: false, reason: "disabled", sessionId, sampled: true };
1387
1408
  }
@@ -1402,7 +1423,7 @@ async function restartSessionReplayAfterConflict(state, options, sessionId) {
1402
1423
  sampled: true,
1403
1424
  };
1404
1425
  }
1405
- return startSessionReplayRecorder(state, options, sessionId, true, initialProperties);
1426
+ return startSessionReplayRecorder(state, options, sessionId, true, initialProperties, startGeneration);
1406
1427
  }
1407
1428
  function installUrlMonitor(state) {
1408
1429
  if (!state.options || state.restoreUrlMonitor)
@@ -2178,8 +2199,12 @@ export async function startSessionReplay(options = {}) {
2178
2199
  }
2179
2200
  if (state.startPromise)
2180
2201
  return state.startPromise;
2202
+ // This is a new caller-initiated recording episode. A prior episode's
2203
+ // conflict-loop guard must not prevent this one from recovering once.
2204
+ state.automaticConflictRestartAttempted = false;
2205
+ const startGeneration = ++state.startGeneration;
2181
2206
  let startPromise;
2182
- startPromise = startSessionReplayRecorder(state, normalized, sessionId, sampled, initialProperties).finally(() => {
2207
+ startPromise = startSessionReplayRecorder(state, normalized, sessionId, sampled, initialProperties, startGeneration).finally(() => {
2183
2208
  if (state.startPromise === startPromise) {
2184
2209
  state.startPromise = null;
2185
2210
  }
@@ -2187,7 +2212,7 @@ export async function startSessionReplay(options = {}) {
2187
2212
  state.startPromise = startPromise;
2188
2213
  return startPromise;
2189
2214
  }
2190
- async function startSessionReplayRecorder(state, normalized, sessionId, sampled, initialProperties) {
2215
+ async function startSessionReplayRecorder(state, normalized, sessionId, sampled, initialProperties, startGeneration) {
2191
2216
  if (state.active && state.replayId) {
2192
2217
  return {
2193
2218
  started: true,
@@ -2204,6 +2229,9 @@ async function startSessionReplayRecorder(state, normalized, sessionId, sampled,
2204
2229
  catch {
2205
2230
  return { started: false, reason: "import-failed", sessionId, sampled };
2206
2231
  }
2232
+ if (state.startGeneration !== startGeneration) {
2233
+ return { started: false, reason: "disabled", sessionId, sampled };
2234
+ }
2207
2235
  if (normalized.shouldStart && !normalized.shouldStart()) {
2208
2236
  return { started: false, reason: "disabled", sessionId, sampled };
2209
2237
  }
@@ -2232,6 +2260,19 @@ async function startSessionReplayRecorder(state, normalized, sessionId, sampled,
2232
2260
  };
2233
2261
  }
2234
2262
  }
2263
+ // stopSessionReplay may be called while the duplicate-tab probe is waiting.
2264
+ // Recheck both cancellation and the caller's live eligibility before rrweb
2265
+ // is activated so a deferred start cannot escape a route/auth teardown.
2266
+ if (state.startGeneration !== startGeneration ||
2267
+ (normalized.shouldStart && !normalized.shouldStart())) {
2268
+ try {
2269
+ replayChannel?.close();
2270
+ }
2271
+ catch {
2272
+ // best-effort cleanup
2273
+ }
2274
+ return { started: false, reason: "disabled", sessionId, sampled };
2275
+ }
2235
2276
  state.options = normalized;
2236
2277
  state.replayId = replaySession.replayId;
2237
2278
  state.startedAtMs = replaySession.startedAtMs;
@@ -2328,6 +2369,10 @@ async function startSessionReplayRecorder(state, normalized, sessionId, sampled,
2328
2369
  }
2329
2370
  export async function stopSessionReplay(reason = "manual") {
2330
2371
  const state = getState();
2372
+ // Invalidate an import/probe that has not set `active` yet. Without this,
2373
+ // stop during the duplicated-tab claim window was a no-op and rrweb started
2374
+ // after the caller believed recording had been disabled.
2375
+ state.startGeneration += 1;
2331
2376
  if (!state.active)
2332
2377
  return;
2333
2378
  // Restore console/fetch/XHR before tearing down the recorder: the restore