@agent-native/core 0.172.10 → 0.173.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 (56) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/calendar/actions/view-screen.ts +0 -5
  3. package/corpus/templates/calendar/app/components/calendar/CommandPalette.tsx +1 -1
  4. package/corpus/templates/clips/app/components/player/video-player.tsx +3 -1
  5. package/corpus/templates/clips/changelog/2026-08-24-shared-clips-now-expose-agent-readable-transcript-and-frame-metadata-from-public-links.md +6 -0
  6. package/corpus/templates/clips/server/routes/[...page].get.ts +172 -3
  7. package/corpus/templates/plan/app/components/layout/Header.tsx +1 -1
  8. package/corpus/templates/plan/app/components/layout/Layout.tsx +19 -3
  9. package/corpus/templates/plan/app/components/layout/Sidebar.tsx +11 -10
  10. package/corpus/templates/plan/app/hooks/use-navigation-state.ts +10 -9
  11. package/corpus/templates/plan/app/pages/PlansPage.tsx +1 -1
  12. package/corpus/templates/plan/app/root.tsx +9 -8
  13. package/corpus/templates/plan/app/routes/_index.tsx +6 -30
  14. package/corpus/templates/plan/app/routes/chat.tsx +34 -0
  15. package/corpus/templates/plan/server/plugins/auth.ts +1 -0
  16. package/dist/client/AgentPanel.d.ts +3 -1
  17. package/dist/client/AgentPanel.js +67 -46
  18. package/dist/client/AssistantChat.d.ts +8 -0
  19. package/dist/client/AssistantChat.js +2 -1
  20. package/dist/client/agent-chat/index.d.ts +2 -0
  21. package/dist/client/agent-chat/index.js +2 -0
  22. package/dist/client/chat/index.d.ts +2 -0
  23. package/dist/client/chat/index.js +2 -0
  24. package/dist/client/chat/message-components.d.ts +5 -14
  25. package/dist/client/chat/message-components.js +15 -8
  26. package/dist/client/chat/tool-call-display.js +24 -11
  27. package/dist/client/thinking-display.d.ts +23 -0
  28. package/dist/client/thinking-display.js +86 -0
  29. package/dist/collab/awareness.d.ts +2 -2
  30. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  31. package/dist/localization/core-messages/ar-SA.js +4 -0
  32. package/dist/localization/core-messages/de-DE.js +4 -0
  33. package/dist/localization/core-messages/en-US.d.ts +4 -0
  34. package/dist/localization/core-messages/en-US.js +4 -0
  35. package/dist/localization/core-messages/es-ES.js +4 -0
  36. package/dist/localization/core-messages/fr-FR.js +4 -0
  37. package/dist/localization/core-messages/hi-IN.js +4 -0
  38. package/dist/localization/core-messages/ja-JP.js +4 -0
  39. package/dist/localization/core-messages/ko-KR.js +4 -0
  40. package/dist/localization/core-messages/pt-BR.js +4 -0
  41. package/dist/localization/core-messages/zh-CN.js +4 -0
  42. package/dist/localization/core-messages/zh-TW.js +4 -0
  43. package/dist/localization/core-messages.d.ts +4 -0
  44. package/dist/observability/posthog-ai.d.ts +6 -0
  45. package/dist/observability/posthog-ai.js +6 -0
  46. package/dist/observability/routes.d.ts +3 -3
  47. package/dist/provider-api/actions/custom-provider-registration.d.ts +4 -4
  48. package/dist/provider-api/actions/provider-api.d.ts +8 -8
  49. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  50. package/dist/resources/handlers.d.ts +1 -1
  51. package/dist/secrets/routes.d.ts +6 -6
  52. package/dist/server/transcribe-voice.d.ts +1 -1
  53. package/dist/shared/thinking-display.d.ts +23 -0
  54. package/dist/shared/thinking-display.js +31 -0
  55. package/dist/tracking/providers.js +22 -1
  56. package/package.json +3 -3
@@ -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;
65
66
  states: {
66
67
  clientId: number;
67
68
  state: string;
68
69
  }[];
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;
80
81
  users: {
81
82
  clientId: number;
82
83
  lastSeen: number;
83
84
  }[];
84
- error?: undefined;
85
85
  }>>;
@@ -17,11 +17,11 @@ declare const _default: import("../../action.js").ActionDefinition<{
17
17
  id?: undefined;
18
18
  provider?: undefined;
19
19
  } | {
20
- error?: undefined;
21
20
  configured?: undefined;
22
21
  connectPath?: undefined;
23
22
  url: string;
24
23
  id: string;
25
24
  provider: string;
25
+ error?: undefined;
26
26
  }>;
27
27
  export default _default;
@@ -535,6 +535,10 @@ const messages = {
535
535
  "tool.repeated": "تكرر {{count}} مرة",
536
536
  "tool.result": "النتيجة",
537
537
  "tool.subAgentTask": "مهمة الوكيل الفرعي",
538
+ "thinking.collapsed": "مطوي",
539
+ "thinking.display": "عرض التفكير",
540
+ "thinking.expanded": "موسّع",
541
+ "thinking.hidden": "مخفي",
538
542
  "tool.thought": "فكرة",
539
543
  "tool.thoughtFor": "فكّر لمدة {{duration}}",
540
544
  "tool.viewOutput": "عرض مخرجات {{tool}}",
@@ -181,6 +181,10 @@ const messages = {
181
181
  "tool.repeated": "{{count}}-mal wiederholt",
182
182
  "tool.result": "Ergebnis",
183
183
  "tool.subAgentTask": "Unteragenten-Aufgabe",
184
+ "thinking.collapsed": "Eingeklappt",
185
+ "thinking.display": "Gedankengang",
186
+ "thinking.expanded": "Ausgeklappt",
187
+ "thinking.hidden": "Ausgeblendet",
184
188
  "tool.thought": "Gedankengang",
185
189
  "tool.thoughtFor": "{{duration}} nachgedacht",
186
190
  "tool.viewOutput": "Ausgabe von {{tool}} anzeigen",
@@ -515,6 +515,10 @@ declare const messages: {
515
515
  readonly "tool.repeated": "Repeated {{count}} times";
516
516
  readonly "tool.result": "Result";
517
517
  readonly "tool.subAgentTask": "Sub-agent task";
518
+ readonly "thinking.collapsed": "Collapsed";
519
+ readonly "thinking.display": "Thinking";
520
+ readonly "thinking.expanded": "Expanded";
521
+ readonly "thinking.hidden": "Hidden";
518
522
  readonly "tool.thought": "Thought";
519
523
  readonly "tool.thoughtFor": "Thought for {{duration}}";
520
524
  readonly "tool.viewOutput": "View {{tool}} output";
@@ -515,6 +515,10 @@ const messages = {
515
515
  "tool.repeated": "Repeated {{count}} times",
516
516
  "tool.result": "Result",
517
517
  "tool.subAgentTask": "Sub-agent task",
518
+ "thinking.collapsed": "Collapsed",
519
+ "thinking.display": "Thinking",
520
+ "thinking.expanded": "Expanded",
521
+ "thinking.hidden": "Hidden",
518
522
  "tool.thought": "Thought",
519
523
  "tool.thoughtFor": "Thought for {{duration}}",
520
524
  "tool.viewOutput": "View {{tool}} output",
@@ -181,6 +181,10 @@ const messages = {
181
181
  "tool.repeated": "Repetido {{count}} veces",
182
182
  "tool.result": "Resultado",
183
183
  "tool.subAgentTask": "Tarea del subagente",
184
+ "thinking.collapsed": "Contraído",
185
+ "thinking.display": "Razonamiento",
186
+ "thinking.expanded": "Expandido",
187
+ "thinking.hidden": "Oculto",
184
188
  "tool.thought": "Razonamiento",
185
189
  "tool.thoughtFor": "Razonó durante {{duration}}",
186
190
  "tool.viewOutput": "Ver la salida de {{tool}}",
@@ -181,6 +181,10 @@ const messages = {
181
181
  "tool.repeated": "Répété {{count}} fois",
182
182
  "tool.result": "Résultat",
183
183
  "tool.subAgentTask": "Tâche du sous-agent",
184
+ "thinking.collapsed": "Replié",
185
+ "thinking.display": "Réflexion",
186
+ "thinking.expanded": "Développé",
187
+ "thinking.hidden": "Masqué",
184
188
  "tool.thought": "Réflexion",
185
189
  "tool.thoughtFor": "Réflexion pendant {{duration}}",
186
190
  "tool.viewOutput": "Afficher la sortie de {{tool}}",
@@ -515,6 +515,10 @@ const messages = {
515
515
  "tool.repeated": "{{count}} बार दोहराया गया",
516
516
  "tool.result": "परिणाम",
517
517
  "tool.subAgentTask": "सब-एजेंट कार्य",
518
+ "thinking.collapsed": "संक्षिप्त",
519
+ "thinking.display": "विचार प्रदर्शन",
520
+ "thinking.expanded": "विस्तृत",
521
+ "thinking.hidden": "छिपा हुआ",
518
522
  "tool.thought": "विचार",
519
523
  "tool.thoughtFor": "{{duration}} तक सोचा",
520
524
  "tool.viewOutput": "{{tool}} का आउटपुट देखें",
@@ -510,6 +510,10 @@ const messages = {
510
510
  "tool.repeated": "{{count}} 回繰り返しました",
511
511
  "tool.result": "結果",
512
512
  "tool.subAgentTask": "サブエージェントのタスク",
513
+ "thinking.collapsed": "折りたたみ",
514
+ "thinking.display": "思考の表示",
515
+ "thinking.expanded": "展開",
516
+ "thinking.hidden": "非表示",
513
517
  "tool.thought": "思考",
514
518
  "tool.thoughtFor": "{{duration}} 思考しました",
515
519
  "tool.viewOutput": "{{tool}} の出力を表示",
@@ -510,6 +510,10 @@ const messages = {
510
510
  "tool.repeated": "{{count}}회 반복",
511
511
  "tool.result": "결과",
512
512
  "tool.subAgentTask": "하위 에이전트 작업",
513
+ "thinking.collapsed": "접음",
514
+ "thinking.display": "생각 표시",
515
+ "thinking.expanded": "펼침",
516
+ "thinking.hidden": "숨김",
513
517
  "tool.thought": "생각",
514
518
  "tool.thoughtFor": "{{duration}} 동안 생각함",
515
519
  "tool.viewOutput": "{{tool}} 출력 보기",
@@ -181,6 +181,10 @@ const messages = {
181
181
  "tool.repeated": "Repetido {{count}} vezes",
182
182
  "tool.result": "Resultado",
183
183
  "tool.subAgentTask": "Tarefa do subagente",
184
+ "thinking.collapsed": "Recolhido",
185
+ "thinking.display": "Raciocínio",
186
+ "thinking.expanded": "Expandido",
187
+ "thinking.hidden": "Oculto",
184
188
  "tool.thought": "Raciocínio",
185
189
  "tool.thoughtFor": "Raciocinou por {{duration}}",
186
190
  "tool.viewOutput": "Ver saída de {{tool}}",
@@ -510,6 +510,10 @@ const messages = {
510
510
  "tool.repeated": "重复了 {{count}} 次",
511
511
  "tool.result": "结果",
512
512
  "tool.subAgentTask": "子智能体任务",
513
+ "thinking.collapsed": "折叠",
514
+ "thinking.display": "思考显示",
515
+ "thinking.expanded": "展开",
516
+ "thinking.hidden": "隐藏",
513
517
  "tool.thought": "思考",
514
518
  "tool.thoughtFor": "思考了 {{duration}}",
515
519
  "tool.viewOutput": "查看 {{tool}} 输出",
@@ -510,6 +510,10 @@ const messages = {
510
510
  "tool.repeated": "重複了 {{count}} 次",
511
511
  "tool.result": "結果",
512
512
  "tool.subAgentTask": "子代理任務",
513
+ "thinking.collapsed": "收合",
514
+ "thinking.display": "思考顯示",
515
+ "thinking.expanded": "展開",
516
+ "thinking.hidden": "隱藏",
513
517
  "tool.thought": "思考",
514
518
  "tool.thoughtFor": "思考了 {{duration}}",
515
519
  "tool.viewOutput": "檢視 {{tool}} 輸出",
@@ -517,6 +517,10 @@ export declare const englishAgentChatMessages: {
517
517
  readonly "tool.repeated": "Repeated {{count}} times";
518
518
  readonly "tool.result": "Result";
519
519
  readonly "tool.subAgentTask": "Sub-agent task";
520
+ readonly "thinking.collapsed": "Collapsed";
521
+ readonly "thinking.display": "Thinking";
522
+ readonly "thinking.expanded": "Expanded";
523
+ readonly "thinking.hidden": "Hidden";
520
524
  readonly "tool.thought": "Thought";
521
525
  readonly "tool.thoughtFor": "Thought for {{duration}}";
522
526
  readonly "tool.viewOutput": "View {{tool}} output";
@@ -12,6 +12,12 @@
12
12
  * PostHog's `$session_id`: the latter is the browser session used for session
13
13
  * replay, and the two are different lifetimes.
14
14
  *
15
+ * Events are stamped when the operation BEGAN, which is what every backend
16
+ * except PostHog reads verbatim. PostHog alone treats an AI event's timestamp
17
+ * as the moment the operation ended and recovers the start by subtracting
18
+ * `$ai_latency`; that shift lives in its provider, not here, so one backend's
19
+ * convention cannot move everyone else's clock.
20
+ *
15
21
  * PostHog DERIVES a trace's latency, tokens and cost from its children — its
16
22
  * trace query sums `$ai_latency` over every event whose `$ai_parent_id` is the
17
23
  * trace or absent, and sums tokens/cost over `$ai_generation` / `$ai_embedding`
@@ -12,6 +12,12 @@
12
12
  * PostHog's `$session_id`: the latter is the browser session used for session
13
13
  * replay, and the two are different lifetimes.
14
14
  *
15
+ * Events are stamped when the operation BEGAN, which is what every backend
16
+ * except PostHog reads verbatim. PostHog alone treats an AI event's timestamp
17
+ * as the moment the operation ended and recovers the start by subtracting
18
+ * `$ai_latency`; that shift lives in its provider, not here, so one backend's
19
+ * convention cannot move everyone else's clock.
20
+ *
15
21
  * PostHog DERIVES a trace's latency, tokens and cost from its children — its
16
22
  * trace query sums `$ai_latency` over every event whose `$ai_parent_id` is the
17
23
  * trace or absent, and sums tokens/cost over `$ai_generation` / `$ai_embedding`
@@ -41,16 +41,16 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
41
41
  thumbsUpRate: number;
42
42
  avgEvalScore: number;
43
43
  } | {
44
+ error?: undefined;
44
45
  summary: import("./types.js").TraceSummary;
45
46
  spans: import("./types.js").TraceSpan[];
46
47
  id?: undefined;
47
- error?: undefined;
48
48
  ok?: undefined;
49
49
  } | {
50
+ error?: undefined;
50
51
  summary?: undefined;
51
52
  spans?: undefined;
52
53
  id: string;
53
- error?: undefined;
54
54
  ok?: undefined;
55
55
  } | {
56
56
  summary?: undefined;
@@ -59,9 +59,9 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
59
59
  error: any;
60
60
  ok?: undefined;
61
61
  } | {
62
+ error?: undefined;
62
63
  summary?: undefined;
63
64
  spans?: undefined;
64
65
  id?: undefined;
65
66
  ok: boolean;
66
- error?: undefined;
67
67
  }>>;
@@ -76,6 +76,7 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
76
76
  }>>;
77
77
  }, z.core.$strip>>, {
78
78
  id?: undefined;
79
+ provider?: undefined;
79
80
  deleted?: undefined;
80
81
  providers: {
81
82
  id: string;
@@ -87,7 +88,6 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
87
88
  updatedAt: number;
88
89
  }[];
89
90
  count: number;
90
- provider?: undefined;
91
91
  found?: undefined;
92
92
  registered?: undefined;
93
93
  label?: undefined;
@@ -103,19 +103,19 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
103
103
  label?: undefined;
104
104
  message?: undefined;
105
105
  } | {
106
+ provider?: undefined;
106
107
  deleted?: undefined;
107
108
  providers?: undefined;
108
109
  count?: undefined;
109
- provider?: undefined;
110
110
  found: boolean;
111
111
  id: string;
112
112
  registered?: undefined;
113
113
  label?: undefined;
114
114
  message?: undefined;
115
115
  } | {
116
+ provider?: undefined;
116
117
  providers?: undefined;
117
118
  count?: undefined;
118
- provider?: undefined;
119
119
  found?: undefined;
120
120
  deleted: boolean;
121
121
  id: string;
@@ -123,10 +123,10 @@ export declare function createCustomProviderRegistrationAction<TSchema extends Z
123
123
  label?: undefined;
124
124
  message?: undefined;
125
125
  } | {
126
+ provider?: undefined;
126
127
  deleted?: undefined;
127
128
  providers?: undefined;
128
129
  count?: undefined;
129
- provider?: undefined;
130
130
  found?: undefined;
131
131
  registered: boolean;
132
132
  id: string;
@@ -312,8 +312,6 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
312
312
  scope?: "org" | "user" | undefined;
313
313
  }, {
314
314
  id?: undefined;
315
- provider?: undefined;
316
- deleted?: undefined;
317
315
  providers: {
318
316
  id: string;
319
317
  label: string;
@@ -324,34 +322,36 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
324
322
  updatedAt: number;
325
323
  }[];
326
324
  count: number;
325
+ provider?: undefined;
327
326
  found?: undefined;
327
+ deleted?: undefined;
328
328
  registered?: undefined;
329
329
  label?: undefined;
330
330
  message?: undefined;
331
331
  } | {
332
332
  id?: undefined;
333
- deleted?: undefined;
334
333
  providers?: undefined;
335
334
  count?: undefined;
336
335
  found: boolean;
337
336
  provider: import("../custom-registry.js").CustomProviderConfig;
337
+ deleted?: undefined;
338
338
  registered?: undefined;
339
339
  label?: undefined;
340
340
  message?: undefined;
341
341
  } | {
342
- provider?: undefined;
343
- deleted?: undefined;
344
342
  providers?: undefined;
345
343
  count?: undefined;
344
+ provider?: undefined;
346
345
  found: boolean;
347
346
  id: string;
347
+ deleted?: undefined;
348
348
  registered?: undefined;
349
349
  label?: undefined;
350
350
  message?: undefined;
351
351
  } | {
352
- provider?: undefined;
353
352
  providers?: undefined;
354
353
  count?: undefined;
354
+ provider?: undefined;
355
355
  found?: undefined;
356
356
  deleted: boolean;
357
357
  id: string;
@@ -359,11 +359,11 @@ export declare function createProviderApiActions(runtime: Pick<ProviderApiRuntim
359
359
  label?: undefined;
360
360
  message?: undefined;
361
361
  } | {
362
- provider?: undefined;
363
- deleted?: undefined;
364
362
  providers?: undefined;
365
363
  count?: undefined;
364
+ provider?: undefined;
366
365
  found?: undefined;
366
+ deleted?: undefined;
367
367
  registered: boolean;
368
368
  id: string;
369
369
  label: string;
@@ -73,6 +73,7 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
73
73
  offset?: unknown;
74
74
  limit?: unknown;
75
75
  }, {
76
+ deleted?: undefined;
76
77
  jobs: {
77
78
  id: string;
78
79
  name: string;
@@ -83,7 +84,6 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
83
84
  updatedAt: string;
84
85
  }[];
85
86
  total: number;
86
- deleted?: undefined;
87
87
  jobId?: undefined;
88
88
  } | {
89
89
  jobs?: undefined;
@@ -91,9 +91,9 @@ export declare function createProviderCorpusJobAction(options: CreateProviderCor
91
91
  deleted: boolean;
92
92
  jobId: string;
93
93
  } | {
94
+ deleted?: undefined;
94
95
  jobs?: undefined;
95
96
  total?: undefined;
96
- deleted?: undefined;
97
97
  jobId?: undefined;
98
98
  hits: Record<string, unknown>[];
99
99
  offset: number;
@@ -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;
@@ -37,17 +37,17 @@ export declare function createWriteSecretHandler(): import("h3").EventHandlerWit
37
37
  ok?: undefined;
38
38
  status?: undefined;
39
39
  } | {
40
- error?: undefined;
41
40
  ok: boolean;
42
41
  status: string;
42
+ error?: undefined;
43
43
  } | {
44
44
  ok?: undefined;
45
45
  error: string;
46
46
  removed?: 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
@@ -58,13 +58,13 @@ export declare function createTestSecretHandler(): import("h3").EventHandlerWith
58
58
  error: string;
59
59
  note?: 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
  }>>;
@@ -20,6 +20,6 @@ export declare function createTranscribeVoiceHandler(): import("h3").EventHandle
20
20
  error: string;
21
21
  text?: undefined;
22
22
  } | {
23
- text: string;
24
23
  error?: undefined;
24
+ text: string;
25
25
  }>>;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * How much of the model's reasoning the chat surface shows.
3
+ *
4
+ * This is presentation only. It never changes what the engine requests or
5
+ * what is persisted — a hidden thought was still thought, and switching back
6
+ * to `expanded` reveals the same text on the same historical turns.
7
+ */
8
+ export declare const THINKING_DISPLAY_MODES: readonly ["expanded", "collapsed", "hidden"];
9
+ export type ThinkingDisplay = (typeof THINKING_DISPLAY_MODES)[number];
10
+ /**
11
+ * Collapsed by default: a live reasoning cell that auto-opens pushes the
12
+ * answer out of the viewport on every turn, which is the noise users report.
13
+ * The label and its "Thought for Xs" timing stay visible, one click from the
14
+ * full text.
15
+ */
16
+ export declare const DEFAULT_THINKING_DISPLAY: ThinkingDisplay;
17
+ export declare function isThinkingDisplay(value: unknown): value is ThinkingDisplay;
18
+ /**
19
+ * Returns null for both "nothing stored" and "stored value is not a mode".
20
+ * Callers substitute the default; the distinction does not survive here
21
+ * because there is no repair a caller could make with it.
22
+ */
23
+ export declare function parseThinkingDisplay(value: unknown): ThinkingDisplay | null;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * How much of the model's reasoning the chat surface shows.
3
+ *
4
+ * This is presentation only. It never changes what the engine requests or
5
+ * what is persisted — a hidden thought was still thought, and switching back
6
+ * to `expanded` reveals the same text on the same historical turns.
7
+ */
8
+ export const THINKING_DISPLAY_MODES = [
9
+ "expanded",
10
+ "collapsed",
11
+ "hidden",
12
+ ];
13
+ /**
14
+ * Collapsed by default: a live reasoning cell that auto-opens pushes the
15
+ * answer out of the viewport on every turn, which is the noise users report.
16
+ * The label and its "Thought for Xs" timing stay visible, one click from the
17
+ * full text.
18
+ */
19
+ export const DEFAULT_THINKING_DISPLAY = "collapsed";
20
+ const modeSet = new Set(THINKING_DISPLAY_MODES);
21
+ export function isThinkingDisplay(value) {
22
+ return typeof value === "string" && modeSet.has(value);
23
+ }
24
+ /**
25
+ * Returns null for both "nothing stored" and "stored value is not a mode".
26
+ * Callers substitute the default; the distinction does not survive here
27
+ * because there is no repair a caller could make with it.
28
+ */
29
+ export function parseThinkingDisplay(value) {
30
+ return isThinkingDisplay(value) ? value : null;
31
+ }
@@ -135,6 +135,27 @@ function isPostHogAiObservabilityEvent(eventName) {
135
135
  * `$exception_list` — the framework's own `captureException()` emits camelCase
136
136
  * fields that PostHog would otherwise render as an empty, ungroupable issue.
137
137
  */
138
+ /**
139
+ * PostHog reads an AI event's timestamp as the moment the operation ENDED and
140
+ * recovers its start by subtracting `$ai_latency` (its `operationStartMs`).
141
+ * The framework stamps events when the operation began — which Mixpanel,
142
+ * Amplitude, webhooks and Agent Native Analytics consume verbatim — so the
143
+ * shift belongs here, in the one backend that reads it that way. Events with no
144
+ * `$ai_latency` (a trace, an exception) are unshifted: there is nothing for
145
+ * PostHog to subtract.
146
+ */
147
+ function postHogAiEndTimestamp(event) {
148
+ const latencySeconds = Number(event.properties?.["$ai_latency"]);
149
+ if (!event.timestamp ||
150
+ !Number.isFinite(latencySeconds) ||
151
+ latencySeconds <= 0) {
152
+ return event.timestamp;
153
+ }
154
+ const startedAt = Date.parse(event.timestamp);
155
+ if (Number.isNaN(startedAt))
156
+ return event.timestamp;
157
+ return new Date(startedAt + Math.round(latencySeconds * 1000)).toISOString();
158
+ }
138
159
  function createPostHogProvider(apiKey, host, errorTracking) {
139
160
  const sendToEventsEndpoint = (event, properties, distinctId) => {
140
161
  enqueue(`${host}/i/v0/e/`, JSON.stringify({
@@ -145,7 +166,7 @@ function createPostHogProvider(apiKey, host, errorTracking) {
145
166
  // custom property, stamping the event with its ingestion time instead.
146
167
  // An agent run emits its whole tree in one burst at the end, so that
147
168
  // collapsed a five-minute waterfall into the 100ms it took to flush.
148
- timestamp: event.timestamp,
169
+ timestamp: postHogAiEndTimestamp(event),
149
170
  properties: {
150
171
  distinct_id: distinctId,
151
172
  ...properties,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.172.10",
3
+ "version": "0.173.0",
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": {
@@ -429,8 +429,8 @@
429
429
  "y-protocols": "^1.0.7",
430
430
  "yjs": "^13.6.32",
431
431
  "zod": "^4.3.6",
432
- "@agent-native/recap-cli": "0.5.8",
433
- "@agent-native/toolkit": "^0.16.11"
432
+ "@agent-native/recap-cli": "0.5.9",
433
+ "@agent-native/toolkit": "^0.16.12"
434
434
  },
435
435
  "devDependencies": {
436
436
  "@ai-sdk/anthropic": "^3.0.71",