@agent-native/core 0.153.4 → 0.153.5

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 (67) hide show
  1. package/corpus/templates/analytics/actions/account-deep-dive.ts +1 -0
  2. package/corpus/templates/analytics/actions/bigquery-query.ts +1 -0
  3. package/corpus/templates/analytics/actions/bigquery.ts +1 -0
  4. package/corpus/templates/analytics/actions/content-calendar-schema.ts +1 -0
  5. package/corpus/templates/analytics/actions/content-calendar.ts +1 -0
  6. package/corpus/templates/analytics/actions/gcloud.ts +1 -0
  7. package/corpus/templates/analytics/actions/get-data-program.ts +1 -0
  8. package/corpus/templates/analytics/actions/get-error-issue.ts +1 -0
  9. package/corpus/templates/analytics/actions/get-monitor-stats.ts +1 -0
  10. package/corpus/templates/analytics/actions/get-monitor.ts +1 -0
  11. package/corpus/templates/analytics/actions/get-session-replay-events.ts +1 -0
  12. package/corpus/templates/analytics/actions/get-session-replay-summary.ts +1 -0
  13. package/corpus/templates/analytics/actions/get-session-replay-timeline.ts +1 -0
  14. package/corpus/templates/analytics/actions/gong-calls.ts +1 -0
  15. package/corpus/templates/analytics/actions/gong-native-insights.ts +1 -0
  16. package/corpus/templates/analytics/actions/grafana.ts +1 -0
  17. package/corpus/templates/analytics/actions/hubspot-deals.ts +1 -0
  18. package/corpus/templates/analytics/actions/hubspot-metrics.ts +1 -0
  19. package/corpus/templates/analytics/actions/hubspot-pipelines.ts +1 -0
  20. package/corpus/templates/analytics/actions/hubspot-records.ts +1 -0
  21. package/corpus/templates/analytics/actions/jira-search.ts +1 -0
  22. package/corpus/templates/analytics/actions/jira.ts +1 -0
  23. package/corpus/templates/analytics/actions/list-error-issues.ts +1 -0
  24. package/corpus/templates/analytics/actions/list-monitors.ts +1 -0
  25. package/corpus/templates/analytics/actions/list-session-recordings.ts +1 -0
  26. package/corpus/templates/analytics/actions/match-error-issues.ts +1 -0
  27. package/corpus/templates/analytics/actions/prometheus.ts +1 -0
  28. package/corpus/templates/analytics/actions/pylon-issues.ts +1 -0
  29. package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +1 -0
  30. package/corpus/templates/analytics/actions/query-dashboard-panel.ts +1 -0
  31. package/corpus/templates/analytics/actions/query-inbound-forms.ts +1 -0
  32. package/corpus/templates/analytics/actions/run-monitor-check.ts +1 -0
  33. package/corpus/templates/analytics/actions/sentry.ts +1 -0
  34. package/corpus/templates/analytics/actions/seo-blog-pages.ts +1 -0
  35. package/corpus/templates/analytics/actions/seo-page-keywords.ts +1 -0
  36. package/corpus/templates/analytics/actions/seo-top-keywords.ts +1 -0
  37. package/corpus/templates/analytics/actions/slack-messages.ts +1 -0
  38. package/corpus/templates/analytics/actions/stripe.ts +1 -0
  39. package/corpus/templates/analytics/actions/test-custom-api-connection.ts +1 -0
  40. package/corpus/templates/analytics/server/lib/real-data-actions.ts +38 -47
  41. package/corpus/templates/analytics/server/plugins/agent-chat.ts +40 -34
  42. package/dist/action.d.ts +13 -0
  43. package/dist/action.js +3 -0
  44. package/dist/agent/engine/tool-call-journal-seed.d.ts +27 -10
  45. package/dist/agent/engine/tool-call-journal-seed.js +46 -32
  46. package/dist/agent/production-agent.d.ts +33 -0
  47. package/dist/agent/production-agent.js +172 -57
  48. package/dist/agent/run-loop-with-resume.d.ts +1 -1
  49. package/dist/agent/run-loop-with-resume.js +49 -35
  50. package/dist/client/agent-chat-adapter.js +204 -273
  51. package/dist/client/sse-event-processor.d.ts +7 -0
  52. package/dist/client/sse-event-processor.js +21 -1
  53. package/dist/collab/awareness.d.ts +2 -2
  54. package/dist/collab/struct-routes.d.ts +1 -1
  55. package/dist/observability/routes.d.ts +5 -5
  56. package/dist/progress/routes.d.ts +1 -1
  57. package/dist/provider-api/actions/github-repo-files.js +1 -0
  58. package/dist/provider-api/actions/provider-api.js +1 -0
  59. package/dist/provider-api/actions/staged-datasets.js +1 -0
  60. package/dist/provider-api/corpus-jobs.js +1 -0
  61. package/dist/resources/handlers.d.ts +1 -1
  62. package/dist/secrets/routes.d.ts +9 -9
  63. package/dist/server/action-discovery.js +2 -0
  64. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  65. package/dist/server/realtime-token.d.ts +1 -1
  66. package/dist/server/transcribe-voice.d.ts +1 -1
  67. package/package.json +3 -3
@@ -2,7 +2,13 @@ import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, }
2
2
  import { emitChatFirstOpenApp } from "./chat-first.js";
3
3
  import { formatChatErrorText, normalizeChatError } from "./error-format.js";
4
4
  import { humanizeToolLabelText, humanizeToolName, runningToolLabel, } from "./tool-display.js";
5
- const INTERRUPTED_TOOL_RESULT = "Interrupted before this tool returned a result.";
5
+ /**
6
+ * Kept verbatim in sync with `INTERRUPTED_TOOL_RESULT_MARKER`
7
+ * (agent/production-agent.ts): the server matches this substring in replayed
8
+ * history to count how many times a write tool was interrupted, which is the
9
+ * only thing that tells "we do not know if it landed" apart from "it failed".
10
+ */
11
+ export const INTERRUPTED_TOOL_RESULT = "Interrupted before this tool returned a result.";
6
12
  const INTERRUPTED_ACTIVITY_RESULT = "Stopped before this action started.";
7
13
  /**
8
14
  * Maximum number of assistant-ui repository updates we deliver in one browser
@@ -1542,11 +1548,25 @@ export function processEvent(ev, content, toolCallCounter, tabId, state) {
1542
1548
  }
1543
1549
  return { action: "continue" };
1544
1550
  }
1551
+ /**
1552
+ * Drop the draft the server is about to re-emit — the narration since the last
1553
+ * completed tool, not the whole turn. A `clear` arrives on a final-answer-guard
1554
+ * retry or a continuation, both of which resume AFTER the last completed tool
1555
+ * call, so anything before that boundary is settled multi-step narration the
1556
+ * retry will never re-send. Wiping it read to users as "it deleted its reply
1557
+ * and started over", and `thread-data-builder` replays this same scoping on
1558
+ * rebuild, so the loss survived a reload.
1559
+ */
1545
1560
  function clearAssistantDraftContent(content) {
1546
1561
  for (let index = content.length - 1; index >= 0; index--) {
1547
1562
  const part = content[index];
1548
1563
  if (!part)
1549
1564
  continue;
1565
+ if (part.type === "tool-call" &&
1566
+ part.activity !== true &&
1567
+ part.result !== undefined) {
1568
+ return;
1569
+ }
1550
1570
  if (part.type === "text" || part.type === "reasoning") {
1551
1571
  content.splice(index, 1);
1552
1572
  continue;
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
62
62
  error: string;
63
63
  states?: undefined;
64
64
  } | {
65
- error?: undefined;
66
65
  states: {
67
66
  clientId: number;
68
67
  state: string;
69
68
  }[];
69
+ error?: undefined;
70
70
  }>>;
71
71
  /**
72
72
  * GET /_agent-native/collab/:docId/users
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
77
77
  error: string;
78
78
  users?: undefined;
79
79
  } | {
80
- error?: undefined;
81
80
  users: {
82
81
  clientId: number;
83
82
  lastSeen: number;
84
83
  }[];
84
+ error?: undefined;
85
85
  }>>;
@@ -13,8 +13,8 @@
13
13
  * Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
14
14
  */
15
15
  export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
16
- ok?: undefined;
17
16
  error: string;
17
+ ok?: undefined;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
@@ -41,27 +41,27 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
- error?: undefined;
45
- ok?: undefined;
46
44
  summary: import("./types.js").TraceSummary;
47
45
  spans: import("./types.js").TraceSpan[];
48
46
  id?: undefined;
49
- } | {
50
47
  error?: undefined;
51
48
  ok?: undefined;
49
+ } | {
52
50
  summary?: undefined;
53
51
  spans?: undefined;
54
52
  id: string;
55
- } | {
53
+ error?: undefined;
56
54
  ok?: undefined;
55
+ } | {
57
56
  summary?: undefined;
58
57
  spans?: undefined;
59
58
  id?: undefined;
60
59
  error: any;
60
+ ok?: undefined;
61
61
  } | {
62
- error?: undefined;
63
62
  summary?: undefined;
64
63
  spans?: undefined;
65
64
  id?: undefined;
66
65
  ok: boolean;
66
+ error?: undefined;
67
67
  }>>;
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- error?: undefined;
19
18
  ok: boolean;
19
+ error?: undefined;
20
20
  }>>;
@@ -130,6 +130,7 @@ export function createGitHubRepoFilesAction(runtime, options = {}) {
130
130
  needsApproval: requireApprovalForWrites
131
131
  ? (args) => args.operation === "write" || args.operation === "delete"
132
132
  : false,
133
+ grounding: true,
133
134
  run: async (args) => {
134
135
  if (args.operation === "list") {
135
136
  return runtime.listGitHubRepositoryFiles({
@@ -231,6 +231,7 @@ export function createProviderApiRequestAction(runtime, options = {}) {
231
231
  }),
232
232
  summary: (args) => buildProviderApiAuditSummary(args),
233
233
  },
234
+ grounding: true,
234
235
  run: async (rawArgs) => {
235
236
  const args = rawArgs;
236
237
  if (args.stageAs) {
@@ -120,6 +120,7 @@ export function createQueryStagedDatasetAction(options = {}) {
120
120
  schema,
121
121
  http: options.http ?? false,
122
122
  readOnly: true,
123
+ grounding: true,
123
124
  run: async (rawArgs) => {
124
125
  const args = rawArgs;
125
126
  const scope = resolveScope("query-staged-dataset", args, options);
@@ -205,6 +205,7 @@ export function createProviderCorpusJobAction(options) {
205
205
  "When status is paused or quota_wait, call operation=continue with the jobId after the indicated time/budget. Report coverage counts, paginationComplete, and any remaining gaps; a max-pages stop is not exhaustive.",
206
206
  schema: ProviderCorpusJobSchema,
207
207
  http: false,
208
+ grounding: true,
208
209
  run: async (args) => runProviderCorpusJobAction(args, options),
209
210
  });
210
211
  }
@@ -48,8 +48,8 @@ export declare function handleUpdateResource(event: any): Promise<import("./stor
48
48
  }>;
49
49
  /** DELETE /_agent-native/resources/:id — delete a resource */
50
50
  export declare function handleDeleteResource(event: any): Promise<{
51
- ok?: undefined;
52
51
  error: string;
52
+ ok?: undefined;
53
53
  } | {
54
54
  error?: undefined;
55
55
  ok: boolean;
@@ -34,37 +34,37 @@ export declare function createListSecretsHandler(): import("h3").EventHandlerWit
34
34
  /** POST /_agent-native/secrets/:key — write a secret. */
35
35
  export declare function createWriteSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
36
36
  error: string;
37
- ok?: undefined;
38
37
  status?: undefined;
38
+ ok?: undefined;
39
39
  } | {
40
- error?: undefined;
41
40
  ok: boolean;
42
41
  status: string;
42
+ error?: undefined;
43
43
  } | {
44
- ok?: undefined;
45
44
  error: string;
46
45
  removed?: undefined;
46
+ ok?: undefined;
47
47
  } | {
48
- error?: undefined;
49
48
  ok: boolean;
50
49
  removed: boolean;
50
+ error?: undefined;
51
51
  }>>;
52
52
  /**
53
53
  * POST /_agent-native/secrets/:key/test — validate an optional candidate value
54
54
  * or the current stored value without changing anything.
55
55
  */
56
56
  export declare function createTestSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
57
- ok?: undefined;
58
57
  error: string;
59
58
  note?: undefined;
59
+ ok?: undefined;
60
60
  } | {
61
- error?: undefined;
62
61
  ok: boolean;
63
62
  note?: undefined;
64
- } | {
65
63
  error?: undefined;
64
+ } | {
66
65
  ok: boolean;
67
66
  note: string;
67
+ error?: undefined;
68
68
  } | {
69
69
  note?: undefined;
70
70
  ok: boolean;
@@ -95,11 +95,11 @@ export interface AdHocSecretPayload {
95
95
  export declare function createAdHocSecretHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<AdHocSecretPayload[] | {
96
96
  error: string;
97
97
  } | {
98
- error?: undefined;
99
98
  ok: boolean;
100
99
  key: string;
101
- } | {
102
100
  error?: undefined;
101
+ } | {
103
102
  ok: boolean;
104
103
  removed: boolean;
104
+ error?: undefined;
105
105
  }>>;
@@ -168,6 +168,8 @@ function preserveActionFlags(entry) {
168
168
  }
169
169
  if (typeof entry.readOnly === "boolean")
170
170
  out.readOnly = entry.readOnly;
171
+ if (typeof entry.grounding === "boolean")
172
+ out.grounding = entry.grounding;
171
173
  if (typeof entry.allowInPlanMode === "boolean") {
172
174
  out.allowInPlanMode = entry.allowInPlanMode;
173
175
  }
@@ -27,10 +27,10 @@ export declare function resolveAgentEngineApiKeyWriteTarget(event: H3Event, scop
27
27
  export declare function createAgentEngineApiKeyHandler(): import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
28
28
  error: any;
29
29
  } | {
30
- error?: undefined;
31
30
  ok: boolean;
32
31
  key: string;
33
32
  baseUrlKey?: string;
34
33
  scope: AgentEngineApiKeyScope;
34
+ error?: undefined;
35
35
  }>>;
36
36
  export {};
@@ -26,8 +26,8 @@ export declare function createRealtimeTokenHandler(): import("h3").EventHandlerW
26
26
  expiresAt?: undefined;
27
27
  ttlSeconds?: undefined;
28
28
  } | {
29
- error?: undefined;
30
29
  token: string;
31
30
  expiresAt: string;
32
31
  ttlSeconds: number;
32
+ error?: undefined;
33
33
  }>>;
@@ -20,6 +20,6 @@ export declare function createTranscribeVoiceHandler(): import("h3").EventHandle
20
20
  error: string;
21
21
  text?: undefined;
22
22
  } | {
23
- error?: undefined;
24
23
  text: string;
24
+ error?: undefined;
25
25
  }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.153.4",
3
+ "version": "0.153.5",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {
@@ -421,8 +421,8 @@
421
421
  "y-protocols": "^1.0.7",
422
422
  "yjs": "^13.6.31",
423
423
  "zod": "^4.3.6",
424
- "@agent-native/recap-cli": "0.5.4",
425
- "@agent-native/toolkit": "^0.14.1"
424
+ "@agent-native/toolkit": "^0.14.1",
425
+ "@agent-native/recap-cli": "0.5.4"
426
426
  },
427
427
  "devDependencies": {
428
428
  "@ai-sdk/anthropic": "^3.0.71",