@agent-native/core 0.157.9 → 0.157.10

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 (107) hide show
  1. package/corpus/templates/analytics/scripts/first-party-analytics-postgres-retention-dry-run.sql +5 -2
  2. package/corpus/templates/analytics/server/lib/first-party-analytics-backend.ts +3 -1
  3. package/corpus/templates/analytics/server/lib/first-party-analytics-purge.ts +18 -6
  4. package/corpus/templates/analytics/server/plugins/db.ts +139 -0
  5. package/corpus/templates/slides/AGENTS.md +14 -10
  6. package/corpus/templates/slides/actions/export-pptx.ts +1094 -94
  7. package/corpus/templates/slides/actions/import-file.ts +16 -1
  8. package/corpus/templates/slides/actions/import-pptx.ts +61 -43
  9. package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +222 -29
  10. package/corpus/templates/slides/app/components/editor/ExportMenu.tsx +71 -0
  11. package/corpus/templates/slides/app/global.css +19 -1
  12. package/corpus/templates/slides/app/lib/export-google-slides-client.ts +44 -5
  13. package/corpus/templates/slides/app/lib/export-pdf-client.ts +13 -6
  14. package/corpus/templates/slides/app/lib/export-pptx-client.ts +556 -25
  15. package/corpus/templates/slides/app/pages/DeckEditor.tsx +18 -1
  16. package/corpus/templates/slides/server/handlers/import/html-converter.ts +1176 -26
  17. package/corpus/templates/slides/server/handlers/import/pdf-fidelity-parser.ts +13 -0
  18. package/corpus/templates/slides/server/handlers/import/pptx-assets.ts +24 -0
  19. package/corpus/templates/slides/shared/aspect-ratios.ts +13 -1
  20. package/dist/agent/harness/migrations.js +24 -3
  21. package/dist/agent/production-agent.js +11 -0
  22. package/dist/agent/run-loop-with-resume.js +21 -4
  23. package/dist/automations/service.d.ts +6 -0
  24. package/dist/automations/service.js +35 -0
  25. package/dist/cli/code-agent-connector.d.ts +4 -1
  26. package/dist/cli/code-agent-connector.js +154 -23
  27. package/dist/cli/code-agent-executor.js +255 -13
  28. package/dist/cli/code-agent-runs.d.ts +1 -0
  29. package/dist/cli/code-agent-runs.js +2 -1
  30. package/dist/cli/portal-workspace.d.ts +49 -0
  31. package/dist/cli/portal-workspace.js +320 -0
  32. package/dist/client/AssistantChat.d.ts +1 -1
  33. package/dist/client/AssistantChat.js +39 -61
  34. package/dist/client/ConnectBuilderCard.js +33 -5
  35. package/dist/client/agent-chat-adapter.js +4 -0
  36. package/dist/client/analytics-platform.d.ts +2 -0
  37. package/dist/client/analytics-platform.js +12 -0
  38. package/dist/client/analytics.d.ts +3 -0
  39. package/dist/client/analytics.js +10 -1
  40. package/dist/client/chat/index.d.ts +1 -0
  41. package/dist/client/chat/index.js +1 -0
  42. package/dist/client/chat/run-recovery.d.ts +2 -1
  43. package/dist/client/chat/run-recovery.js +2 -2
  44. package/dist/client/chat-first/apps-rail.d.ts +1 -1
  45. package/dist/client/chat-first/apps-rail.js +11 -11
  46. package/dist/client/chat-first/surface-tabs.d.ts +1 -1
  47. package/dist/client/chat-first/surface-tabs.js +38 -36
  48. package/dist/client/chat-first/types.d.ts +5 -0
  49. package/dist/client/chat-first.d.ts +1 -1
  50. package/dist/client/chat-first.js +4 -4
  51. package/dist/client/desktop-local-code-change.d.ts +10 -0
  52. package/dist/client/desktop-local-code-change.js +16 -0
  53. package/dist/client/index.d.ts +1 -0
  54. package/dist/client/index.js +1 -0
  55. package/dist/client/observability/ThumbsFeedback.js +21 -7
  56. package/dist/client/terminal/AgentTerminal.d.ts +9 -1
  57. package/dist/client/terminal/AgentTerminal.js +38 -3
  58. package/dist/client/terminal/index.d.ts +1 -1
  59. package/dist/client/terminal/index.js +1 -1
  60. package/dist/client/track.js +9 -1
  61. package/dist/client/use-action.js +3 -0
  62. package/dist/collab/struct-routes.d.ts +1 -1
  63. package/dist/deploy/build.js +1 -1
  64. package/dist/ingestion/pptx.d.ts +78 -0
  65. package/dist/ingestion/pptx.js +991 -107
  66. package/dist/integrations/index.d.ts +3 -3
  67. package/dist/integrations/index.js +2 -2
  68. package/dist/integrations/plugin.js +95 -6
  69. package/dist/integrations/remote-commands-store.d.ts +5 -0
  70. package/dist/integrations/remote-commands-store.js +63 -22
  71. package/dist/integrations/remote-devices-store.d.ts +2 -1
  72. package/dist/integrations/remote-devices-store.js +46 -0
  73. package/dist/integrations/remote-types.d.ts +20 -0
  74. package/dist/jobs/actions/list-recurring-jobs.d.ts +3 -0
  75. package/dist/jobs/actions/list-recurring-jobs.js +5 -1
  76. package/dist/jobs/frontmatter.d.ts +16 -0
  77. package/dist/jobs/frontmatter.js +53 -0
  78. package/dist/jobs/remote-execution.d.ts +42 -0
  79. package/dist/jobs/remote-execution.js +287 -0
  80. package/dist/jobs/scheduler.js +102 -3
  81. package/dist/jobs/tools.js +50 -3
  82. package/dist/notifications/routes.d.ts +4 -4
  83. package/dist/provider-api/actions/custom-provider-registration.d.ts +9 -9
  84. package/dist/provider-api/actions/provider-api.d.ts +14 -14
  85. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  86. package/dist/resources/handlers.d.ts +1 -1
  87. package/dist/server/action-routes.js +4 -2
  88. package/dist/server/agent-chat-plugin.js +6 -0
  89. package/dist/server/agent-run-context.d.ts +1 -0
  90. package/dist/server/agent-run-context.js +9 -0
  91. package/dist/server/core-routes-plugin.js +8 -1
  92. package/dist/server/request-context.d.ts +2 -0
  93. package/dist/shared/analytics-platform.d.ts +6 -0
  94. package/dist/shared/analytics-platform.js +14 -0
  95. package/dist/shared/mcp-embed-headers.d.ts +1 -1
  96. package/dist/shared/mcp-embed-headers.js +1 -1
  97. package/dist/styles/agent-native.css +83 -103
  98. package/dist/terminal/cli-registry.js +5 -0
  99. package/dist/tracking/registry.js +9 -1
  100. package/dist/triggers/actions/list-automations.d.ts +3 -0
  101. package/dist/triggers/actions/list-automations.js +3 -0
  102. package/dist/triggers/actions/manage-automation.d.ts +9 -0
  103. package/dist/triggers/actions/manage-automation.js +14 -2
  104. package/dist/triggers/actions.js +82 -7
  105. package/docs/content/template-content-developers.mdx +48 -0
  106. package/docs/content/toolkit-ui.mdx +57 -0
  107. package/package.json +2 -2
@@ -33,7 +33,7 @@ function injectXtermCss() {
33
33
  .xterm .composition-view { display: none; position: absolute; white-space: nowrap; z-index: 1; }
34
34
  .xterm .composition-view.active { display: block; }
35
35
  .xterm .xterm-viewport {
36
- background-color: #000; overflow-y: scroll;
36
+ background-color: var(--agent-terminal-background); overflow-y: scroll;
37
37
  cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0;
38
38
  }
39
39
  .xterm .xterm-screen { position: relative; }
@@ -85,8 +85,12 @@ export function formatWebSocketHostname(hostname) {
85
85
  ? `[${hostname}]`
86
86
  : hostname;
87
87
  }
88
- export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame = true, theme, fontSize = 12, className, style, onConnectionChange, onAgentRunningChange, }) {
88
+ export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame = true, theme, fontSize = 12, className, style, onConnectionChange, onAgentRunningChange, submitRequest, onPromptSubmitted, }) {
89
89
  const termRef = useRef(null);
90
+ const submitPromptRef = useRef(null);
91
+ const pendingSubmitRequestRef = useRef(null);
92
+ const onPromptSubmittedRef = useRef(onPromptSubmitted);
93
+ onPromptSubmittedRef.current = onPromptSubmitted;
90
94
  const [connected, setConnected] = useState(false);
91
95
  const [error, setError] = useState(null);
92
96
  const [inFrame, setInFrame] = useState(false);
@@ -226,6 +230,22 @@ export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame =
226
230
  let agentRunning = false;
227
231
  let idleTimer = null;
228
232
  let connectionId = 0;
233
+ function submitPrompt(request) {
234
+ const text = request.text.trim();
235
+ if (!text)
236
+ return;
237
+ if (!ws || ws.readyState !== WebSocket.OPEN) {
238
+ pendingSubmitRequestRef.current = request;
239
+ return;
240
+ }
241
+ ws.send(text + "\r");
242
+ agentRunning = true;
243
+ notifyAgentRunning(true);
244
+ if (pendingSubmitRequestRef.current?.id === request.id) {
245
+ pendingSubmitRequestRef.current = null;
246
+ }
247
+ onPromptSubmittedRef.current?.(request);
248
+ }
229
249
  function sendResize() {
230
250
  if (ws && ws.readyState === WebSocket.OPEN && term) {
231
251
  ws.send(JSON.stringify({
@@ -258,6 +278,9 @@ export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame =
258
278
  cols: term.cols,
259
279
  rows: term.rows,
260
280
  }));
281
+ const pendingRequest = pendingSubmitRequestRef.current;
282
+ if (pendingRequest)
283
+ submitPrompt(pendingRequest);
261
284
  };
262
285
  socket.onmessage = (event) => {
263
286
  const data = event.data instanceof ArrayBuffer
@@ -328,6 +351,10 @@ export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame =
328
351
  };
329
352
  window.addEventListener("message", messageHandler);
330
353
  cleanupMessageHandler = () => window.removeEventListener("message", messageHandler);
354
+ submitPromptRef.current = submitPrompt;
355
+ const initialRequest = pendingSubmitRequestRef.current;
356
+ if (initialRequest)
357
+ submitPrompt(initialRequest);
331
358
  connect(fullWsUrl);
332
359
  // Store cleanup references
333
360
  return () => {
@@ -340,6 +367,7 @@ export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame =
340
367
  ws.close();
341
368
  ws = null;
342
369
  }
370
+ submitPromptRef.current = null;
343
371
  };
344
372
  }
345
373
  let cleanup;
@@ -353,6 +381,12 @@ export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame =
353
381
  };
354
382
  // eslint-disable-next-line react-hooks/exhaustive-deps
355
383
  }, [hideInFrame, inFrame, command, flags, wsUrlProp]);
384
+ useEffect(() => {
385
+ if (!submitRequest)
386
+ return;
387
+ pendingSubmitRequestRef.current = submitRequest;
388
+ submitPromptRef.current?.(submitRequest);
389
+ }, [submitRequest?.id, submitRequest?.text]);
356
390
  if (hideInFrame && inFrame) {
357
391
  return null;
358
392
  }
@@ -361,6 +395,7 @@ export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame =
361
395
  ...style,
362
396
  background: terminalBackground,
363
397
  backgroundColor: terminalBackground,
398
+ "--agent-terminal-background": terminalBackground,
364
399
  };
365
400
  return (_jsx("div", { ref: termRef, className: className, style: {
366
401
  width: "100%",
@@ -374,7 +409,7 @@ export function AgentTerminal({ command, flags, wsUrl: wsUrlProp, hideInFrame =
374
409
  display: "flex",
375
410
  alignItems: "center",
376
411
  justifyContent: "center",
377
- backgroundColor: "#111",
412
+ backgroundColor: terminalBackground,
378
413
  color: "#ff7b72",
379
414
  fontSize: "13px",
380
415
  fontFamily: "monospace",
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * Embeddable agent CLI terminal component.
5
5
  */
6
- export { AgentTerminal, type AgentTerminalProps } from "./AgentTerminal.js";
6
+ export { AgentTerminal, type AgentTerminalProps, type AgentTerminalSubmitRequest, } from "./AgentTerminal.js";
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * Embeddable agent CLI terminal component.
5
5
  */
6
- export { AgentTerminal } from "./AgentTerminal.js";
6
+ export { AgentTerminal, } from "./AgentTerminal.js";
@@ -1,3 +1,5 @@
1
+ import { ANALYTICS_CLIENT_PLATFORM_HEADER, ANALYTICS_CLIENT_PLATFORM_PROPERTY, } from "../shared/analytics-platform.js";
2
+ import { getAnalyticsClientPlatform } from "./analytics-platform.js";
1
3
  import { getOrCreateAnalyticsSessionId } from "./analytics-session.js";
2
4
  import { agentNativePath } from "./api-path.js";
3
5
  /**
@@ -28,9 +30,14 @@ export function track(name, properties) {
28
30
  return Promise.resolve();
29
31
  if (typeof name !== "string" || !name.trim())
30
32
  return Promise.resolve();
33
+ const clientPlatform = getAnalyticsClientPlatform();
34
+ const trackedProperties = {
35
+ ...(properties ?? {}),
36
+ [ANALYTICS_CLIENT_PLATFORM_PROPERTY]: clientPlatform,
37
+ };
31
38
  let body;
32
39
  try {
33
- body = JSON.stringify(properties === undefined ? { name } : { name, properties });
40
+ body = JSON.stringify({ name, properties: trackedProperties });
34
41
  }
35
42
  catch {
36
43
  // Non-serializable properties — drop rather than throw into the caller.
@@ -45,6 +52,7 @@ export function track(name, properties) {
45
52
  // middleware trusts it as a first-party marker. Matches the convention
46
53
  // used by other client writes (application-state, guided-questions).
47
54
  "X-Agent-Native-CSRF": "1",
55
+ [ANALYTICS_CLIENT_PLATFORM_HEADER]: clientPlatform,
48
56
  // Same session the action client and agent chat send, so a client event
49
57
  // and the server events from the same visit share one session.
50
58
  ...(browserSessionId
@@ -22,6 +22,8 @@
22
22
  * compatibility.
23
23
  */
24
24
  import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
25
+ import { ANALYTICS_CLIENT_PLATFORM_HEADER } from "../shared/analytics-platform.js";
26
+ import { getAnalyticsClientPlatform } from "./analytics-platform.js";
25
27
  import { getOrCreateAnalyticsSessionId } from "./analytics-session.js";
26
28
  import { trackEvent } from "./analytics.js";
27
29
  import { agentNativePath } from "./api-path.js";
@@ -203,6 +205,7 @@ async function performActionFetch(name, method, params, options) {
203
205
  if (browserSessionId) {
204
206
  headers["X-Agent-Native-Session-Id"] = browserSessionId;
205
207
  }
208
+ headers[ANALYTICS_CLIENT_PLATFORM_HEADER] = getAnalyticsClientPlatform();
206
209
  const init = {
207
210
  method,
208
211
  headers,
@@ -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
- error: string;
17
16
  ok?: undefined;
17
+ error: string;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
@@ -1245,7 +1245,7 @@ async function getHandler() {
1245
1245
  headers: {
1246
1246
  "Access-Control-Allow-Origin": "*",
1247
1247
  "Access-Control-Allow-Methods": "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS",
1248
- "Access-Control-Allow-Headers": "Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-User-Timezone,X-Agent-Native-Tool-Bridge,X-Agent-Native-Tool-Id,X-Agent-Native-Frontend,X-Agent-Native-Client-Compatibility,X-Agent-Native-Build-Id,X-Agent-Native-Embed-Target",
1248
+ "Access-Control-Allow-Headers": "Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-User-Timezone,X-Agent-Native-Session-Id,X-Agent-Native-Client-Platform,X-Agent-Native-Tool-Bridge,X-Agent-Native-Tool-Id,X-Agent-Native-Frontend,X-Agent-Native-Client-Compatibility,X-Agent-Native-Build-Id,X-Agent-Native-Embed-Target",
1249
1249
  },
1250
1250
  });
1251
1251
  }
@@ -21,6 +21,8 @@ export interface ParsedPptxParagraph {
21
21
  lineSpacing?: number;
22
22
  spaceBeforePt?: number;
23
23
  spaceAfterPt?: number;
24
+ /** `a:pPr/@_rtl` — the paragraph's base writing direction is right-to-left. Only set when the source states it; absent means inherit (LTR). */
25
+ rtl?: boolean;
24
26
  }
25
27
  export interface ParsedPptxElement {
26
28
  id: string;
@@ -32,10 +34,22 @@ export interface ParsedPptxElement {
32
34
  width: number;
33
35
  height: number;
34
36
  rotation?: number;
37
+ /** `a:xfrm/@_flipH` — the shape's geometry is mirrored across its own vertical axis before rotation. */
38
+ flipH?: boolean;
39
+ /** `a:xfrm/@_flipV` — the shape's geometry is mirrored across its own horizontal axis before rotation. */
40
+ flipV?: boolean;
35
41
  shapeType?: string;
42
+ /** `a:prstGeom/a:avLst` adjustment values keyed by guide name (`adj`, `adj1`, ...), in the preset's own units. Absent when the deck accepts the preset's defaults. */
43
+ shapeAdjustments?: Record<string, number>;
44
+ /** `a:custGeom`'s authored outline, when the shape declares one instead of a preset. */
45
+ geometry?: ParsedPptxGeometry;
36
46
  fill?: string;
37
47
  lineColor?: string;
38
48
  lineWidth?: number;
49
+ /** `a:ln/a:headEnd` — the decoration drawn where the line starts. */
50
+ lineHeadEnd?: ParsedPptxLineEnd;
51
+ /** `a:ln/a:tailEnd` — the decoration drawn where the line ends. */
52
+ lineTailEnd?: ParsedPptxLineEnd;
39
53
  padding?: {
40
54
  left: number;
41
55
  right: number;
@@ -47,15 +61,77 @@ export interface ParsedPptxElement {
47
61
  image?: ParsedPptxImage;
48
62
  table?: ParsedPptxTable;
49
63
  }
64
+ /**
65
+ * One end of a line or connector — the round dots a chevron timeline's
66
+ * connectors terminate in (`<a:headEnd type="oval"/>`), an arrowhead, a
67
+ * diamond. Recorded whatever the type, including the ones a consumer cannot
68
+ * draw, so an end a renderer skips stays distinguishable from a line the
69
+ * source drew bare and an export can still round-trip it.
70
+ */
71
+ export interface ParsedPptxLineEnd {
72
+ /** `@_type`: `none`, `triangle`, `stealth`, `diamond`, `oval`, or `arrow`. */
73
+ type: string;
74
+ /** `@_w`/`@_len` — the end's size across and along the line, as `sm`/`med`/`lg` multiples of the line's own width, not absolute units. Absent means the OOXML default (`med`). */
75
+ w?: string;
76
+ len?: string;
77
+ }
78
+ /** A single `a:path` command, in the path's own `w`/`h` coordinate space. `arcTo` keeps OOXML's radii-and-angles form because converting it needs the current point, which only a consumer walking the whole command list knows. */
79
+ export type ParsedPptxPathCommand = {
80
+ kind: "moveTo" | "lnTo" | "quadBezTo" | "cubicBezTo";
81
+ points: {
82
+ x: number;
83
+ y: number;
84
+ }[];
85
+ } | {
86
+ kind: "arcTo";
87
+ /** Ellipse radii in path units. */
88
+ wR: number;
89
+ hR: number;
90
+ /** Start angle and swing, in 60000ths of a degree, clockwise from the +x axis. */
91
+ stAng: number;
92
+ swAng: number;
93
+ } | {
94
+ kind: "close";
95
+ };
96
+ /** One `a:custGeom/a:pathLst/a:path`. `w`/`h` define the coordinate space its points are expressed in; the shape's own box is what they scale onto. */
97
+ export interface ParsedPptxPath {
98
+ w: number;
99
+ h: number;
100
+ commands: ParsedPptxPathCommand[];
101
+ }
102
+ export interface ParsedPptxGeometry {
103
+ kind: "custom";
104
+ paths: ParsedPptxPath[];
105
+ }
50
106
  /** A `p:graphicFrame`'s `a:tbl` flattened into a simple row/cell grid. `hMerge`/`vMerge` continuation cells are omitted — their content is already represented once, by the spanning cell's `colSpan`/`rowSpan`. */
51
107
  export interface ParsedPptxTable {
52
108
  rows: ParsedPptxTableCell[][];
109
+ /** Authored `a:tblGrid/a:gridCol/@_w` values, in EMUs, when present. */
110
+ columnWidthsEmu?: number[];
111
+ /** Authored `a:tr/@_h` values, in EMUs, when present. */
112
+ rowHeightsEmu?: number[];
53
113
  }
54
114
  export interface ParsedPptxTableCell {
55
115
  paragraphs: ParsedPptxParagraph[];
56
116
  colSpan?: number;
57
117
  rowSpan?: number;
58
118
  fill?: string;
119
+ /** Resolved cell edges. A side is present only when the cell's own `a:tcPr/a:lnL|R|T|B` or the deck table style's `a:tcBdr` draws a line there — a cell the source leaves borderless stays borderless. */
120
+ borders?: ParsedPptxTableCellBorders;
121
+ }
122
+ export interface ParsedPptxTableCellBorders {
123
+ left?: ParsedPptxTableBorder;
124
+ right?: ParsedPptxTableBorder;
125
+ top?: ParsedPptxTableBorder;
126
+ bottom?: ParsedPptxTableBorder;
127
+ }
128
+ /** One resolved table cell edge, from an `a:ln`. */
129
+ export interface ParsedPptxTableBorder {
130
+ color: string;
131
+ /** `a:ln/@_w`, in EMU. Absent when the line declares no width. */
132
+ widthEmu?: number;
133
+ /** `a:prstDash/@_val`, collapsed onto the CSS border styles that can draw it. Absent for a solid line. */
134
+ dash?: "dashed" | "dotted";
59
135
  }
60
136
  export type ParsedPptxTransition = "instant" | "none" | "fade" | "slide" | "zoom";
61
137
  export interface ParsedPptxImage {
@@ -108,6 +184,8 @@ export interface ParsedPptxPresentation {
108
184
  colors: string[];
109
185
  fonts: string[];
110
186
  };
187
+ /** Slides the source deck marked `show="0"` and this import deliberately left out — the only legitimate reason `slides.length` is short of the deck's `p:sldId` count, so callers can say so instead of reporting a silently shorter deck. */
188
+ hiddenSlideCount?: number;
111
189
  }
112
190
  export declare function parsePptxPresentation(fileBuffer: Uint8Array): Promise<ParsedPptxPresentation>;
113
191
  export declare function parsePptxSlideMetadata(value: unknown): ParsedPptxSlideMetadata;