@agent-native/core 0.12.22 → 0.12.24

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 (118) hide show
  1. package/dist/agent/engine/ai-sdk-engine.d.ts +2 -0
  2. package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
  3. package/dist/agent/engine/ai-sdk-engine.js +4 -2
  4. package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
  5. package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
  6. package/dist/agent/engine/anthropic-engine.js +2 -1
  7. package/dist/agent/engine/anthropic-engine.js.map +1 -1
  8. package/dist/agent/engine/builder-engine.d.ts.map +1 -1
  9. package/dist/agent/engine/builder-engine.js +117 -8
  10. package/dist/agent/engine/builder-engine.js.map +1 -1
  11. package/dist/agent/engine/registry.d.ts.map +1 -1
  12. package/dist/agent/engine/registry.js +24 -13
  13. package/dist/agent/engine/registry.js.map +1 -1
  14. package/dist/agent/production-agent.d.ts +1 -0
  15. package/dist/agent/production-agent.d.ts.map +1 -1
  16. package/dist/agent/production-agent.js +20 -10
  17. package/dist/agent/production-agent.js.map +1 -1
  18. package/dist/agent/thread-data-builder.d.ts +10 -0
  19. package/dist/agent/thread-data-builder.d.ts.map +1 -1
  20. package/dist/agent/thread-data-builder.js +80 -0
  21. package/dist/agent/thread-data-builder.js.map +1 -1
  22. package/dist/agent/types.d.ts +7 -0
  23. package/dist/agent/types.d.ts.map +1 -1
  24. package/dist/agent/types.js.map +1 -1
  25. package/dist/cli/create.d.ts.map +1 -1
  26. package/dist/cli/create.js +3 -3
  27. package/dist/cli/create.js.map +1 -1
  28. package/dist/client/AgentPanel.d.ts.map +1 -1
  29. package/dist/client/AgentPanel.js +10 -2
  30. package/dist/client/AgentPanel.js.map +1 -1
  31. package/dist/client/AssistantChat.d.ts.map +1 -1
  32. package/dist/client/AssistantChat.js +169 -15
  33. package/dist/client/AssistantChat.js.map +1 -1
  34. package/dist/client/ErrorBoundary.d.ts.map +1 -1
  35. package/dist/client/ErrorBoundary.js +3 -2
  36. package/dist/client/ErrorBoundary.js.map +1 -1
  37. package/dist/client/FeedbackButton.js +1 -1
  38. package/dist/client/FeedbackButton.js.map +1 -1
  39. package/dist/client/agent-chat-adapter.d.ts.map +1 -1
  40. package/dist/client/agent-chat-adapter.js +93 -45
  41. package/dist/client/agent-chat-adapter.js.map +1 -1
  42. package/dist/client/analytics.d.ts.map +1 -1
  43. package/dist/client/analytics.js +26 -0
  44. package/dist/client/analytics.js.map +1 -1
  45. package/dist/client/components/ui/tooltip.js +1 -1
  46. package/dist/client/components/ui/tooltip.js.map +1 -1
  47. package/dist/client/composer/PromptComposer.js +1 -1
  48. package/dist/client/composer/PromptComposer.js.map +1 -1
  49. package/dist/client/composer/TiptapComposer.d.ts +5 -0
  50. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  51. package/dist/client/composer/TiptapComposer.js +12 -7
  52. package/dist/client/composer/TiptapComposer.js.map +1 -1
  53. package/dist/client/onboarding/OnboardingPanel.js +2 -1
  54. package/dist/client/onboarding/OnboardingPanel.js.map +1 -1
  55. package/dist/client/progress/RunsTray.d.ts.map +1 -1
  56. package/dist/client/progress/RunsTray.js +18 -3
  57. package/dist/client/progress/RunsTray.js.map +1 -1
  58. package/dist/client/resources/ResourceTree.d.ts.map +1 -1
  59. package/dist/client/resources/ResourceTree.js +5 -4
  60. package/dist/client/resources/ResourceTree.js.map +1 -1
  61. package/dist/client/resources/ResourcesPanel.js +1 -1
  62. package/dist/client/resources/ResourcesPanel.js.map +1 -1
  63. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  64. package/dist/client/settings/useBuilderStatus.js +5 -3
  65. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  66. package/dist/client/sse-event-processor.d.ts.map +1 -1
  67. package/dist/client/sse-event-processor.js +3 -0
  68. package/dist/client/sse-event-processor.js.map +1 -1
  69. package/dist/collab/client.d.ts +9 -0
  70. package/dist/collab/client.d.ts.map +1 -1
  71. package/dist/collab/client.js +36 -10
  72. package/dist/collab/client.js.map +1 -1
  73. package/dist/extensions/html-shell.d.ts.map +1 -1
  74. package/dist/extensions/html-shell.js +12 -0
  75. package/dist/extensions/html-shell.js.map +1 -1
  76. package/dist/mcp-client/errors.d.ts +2 -0
  77. package/dist/mcp-client/errors.d.ts.map +1 -0
  78. package/dist/mcp-client/errors.js +47 -0
  79. package/dist/mcp-client/errors.js.map +1 -0
  80. package/dist/mcp-client/manager.d.ts.map +1 -1
  81. package/dist/mcp-client/manager.js +44 -15
  82. package/dist/mcp-client/manager.js.map +1 -1
  83. package/dist/mcp-client/routes.d.ts +1 -2
  84. package/dist/mcp-client/routes.d.ts.map +1 -1
  85. package/dist/mcp-client/routes.js +2 -27
  86. package/dist/mcp-client/routes.js.map +1 -1
  87. package/dist/onboarding/default-steps.js +1 -1
  88. package/dist/onboarding/default-steps.js.map +1 -1
  89. package/dist/progress/store.d.ts +2 -0
  90. package/dist/progress/store.d.ts.map +1 -1
  91. package/dist/progress/store.js +44 -0
  92. package/dist/progress/store.js.map +1 -1
  93. package/dist/server/action-routes.d.ts +2 -0
  94. package/dist/server/action-routes.d.ts.map +1 -1
  95. package/dist/server/action-routes.js +4 -1
  96. package/dist/server/action-routes.js.map +1 -1
  97. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  98. package/dist/server/agent-chat-plugin.js +27 -15
  99. package/dist/server/agent-chat-plugin.js.map +1 -1
  100. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  101. package/dist/server/core-routes-plugin.js +31 -9
  102. package/dist/server/core-routes-plugin.js.map +1 -1
  103. package/dist/server/credential-provider.d.ts +8 -0
  104. package/dist/server/credential-provider.d.ts.map +1 -1
  105. package/dist/server/credential-provider.js +29 -3
  106. package/dist/server/credential-provider.js.map +1 -1
  107. package/dist/server/index.d.ts +1 -1
  108. package/dist/server/index.d.ts.map +1 -1
  109. package/dist/server/index.js +1 -1
  110. package/dist/server/index.js.map +1 -1
  111. package/dist/server/request-context.d.ts +9 -0
  112. package/dist/server/request-context.d.ts.map +1 -1
  113. package/dist/server/request-context.js +13 -0
  114. package/dist/server/request-context.js.map +1 -1
  115. package/dist/terminal/terminal-plugin.d.ts.map +1 -1
  116. package/dist/terminal/terminal-plugin.js +4 -3
  117. package/dist/terminal/terminal-plugin.js.map +1 -1
  118. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../../src/client/components/ui/tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,MAAM,eAAe,GAAG,gBAAgB,CAAC,QAAQ,CAAC;AAElD,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEtC,MAAM,cAAc,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAEhD,SAAS,oBAAoB,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CACnE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAC9C,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,CACpB,8DAA8D,EAC9D,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CACzE,CAAC;AACJ,CAAC;AAED,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC3D,MAAM,kBAAkB,GACtB,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC3E,OAAO,CACL,KAAC,gBAAgB,CAAC,MAAM,cACtB,KAAC,gBAAgB,CAAC,OAAO,IACvB,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,EAAE,CACX,oJAAoJ,EACpJ,SAAS,CACV,KACG,KAAK,YAER,kBAAkB,GACM,GACH,CAC3B,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC;AAElE,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,CAAC","sourcesContent":["import * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"../../utils.js\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nfunction normalizeTooltipText(text: string): string {\n const decoded = text.replace(/\\\\u([0-9a-fA-F]{4})/g, (_match, hex) =>\n String.fromCharCode(Number.parseInt(hex, 16)),\n );\n return decoded.replace(\n /\\b([A-Za-z][A-Za-z ]*?)\\((?=(?:⌘|⌃|⌥|⇧|Ctrl|Alt|Shift|Cmd))/g,\n (_match, label) => `${label.charAt(0).toUpperCase()}${label.slice(1)} (`,\n );\n}\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 6, children, ...props }, ref) => {\n const normalizedChildren =\n typeof children === \"string\" ? normalizeTooltipText(children) : children;\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-[230] overflow-hidden rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground shadow-md animate-in fade-in-0 zoom-in-95\",\n className,\n )}\n {...props}\n >\n {normalizedChildren}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n normalizeTooltipText,\n};\n"]}
1
+ {"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../../src/client/components/ui/tooltip.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAE5D,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,MAAM,eAAe,GAAG,gBAAgB,CAAC,QAAQ,CAAC;AAElD,MAAM,OAAO,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEtC,MAAM,cAAc,GAAG,gBAAgB,CAAC,OAAO,CAAC;AAEhD,SAAS,oBAAoB,CAAC,IAAY;IACxC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CACnE,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAC9C,CAAC;IACF,OAAO,OAAO,CAAC,OAAO,CACpB,8DAA8D,EAC9D,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CACzE,CAAC;AACJ,CAAC;AAED,MAAM,cAAc,GAAG,KAAK,CAAC,UAAU,CAGrC,CAAC,EAAE,SAAS,EAAE,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC3D,MAAM,kBAAkB,GACtB,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC3E,OAAO,CACL,KAAC,gBAAgB,CAAC,MAAM,cACtB,KAAC,gBAAgB,CAAC,OAAO,IACvB,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,EAAE,CACX,oJAAoJ,EACpJ,SAAS,CACV,KACG,KAAK,YAER,kBAAkB,GACM,GACH,CAC3B,CAAC;AACJ,CAAC,CAAC,CAAC;AACH,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW,CAAC;AAElE,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,eAAe,EACf,oBAAoB,GACrB,CAAC","sourcesContent":["import * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"../../utils.js\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nfunction normalizeTooltipText(text: string): string {\n const decoded = text.replace(/\\\\u([0-9a-fA-F]{4})/g, (_match, hex) =>\n String.fromCharCode(Number.parseInt(hex, 16)),\n );\n return decoded.replace(\n /\\b([A-Za-z][A-Za-z ]*?)\\((?=(?:⌘|⌃|⌥|⇧|Ctrl|Alt|Shift|Cmd))/g,\n (_match, label) => `${label.charAt(0).toUpperCase()}${label.slice(1)} (`,\n );\n}\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 6, children, ...props }, ref) => {\n const normalizedChildren =\n typeof children === \"string\" ? normalizeTooltipText(children) : children;\n return (\n <TooltipPrimitive.Portal>\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-[300] overflow-hidden rounded-md border border-border bg-popover px-2 py-1 text-[11px] text-foreground shadow-md animate-in fade-in-0 zoom-in-95\",\n className,\n )}\n {...props}\n >\n {normalizedChildren}\n </TooltipPrimitive.Content>\n </TooltipPrimitive.Portal>\n );\n});\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport {\n Tooltip,\n TooltipTrigger,\n TooltipContent,\n TooltipProvider,\n normalizeTooltipText,\n};\n"]}
@@ -85,7 +85,7 @@ function AttachmentChip({ attachment, onRemove, }) {
85
85
  return _jsx(PastedTextChip, { attachment: attachment, onRemove: onRemove });
86
86
  }
87
87
  if (src) {
88
- return (_jsxs("div", { className: "group relative h-16 w-16 overflow-hidden rounded-lg border border-border/70 bg-muted/50", children: [_jsx("img", { src: src, alt: attachment.name, className: "h-full w-full object-cover" }), _jsx("button", { type: "button", onClick: () => onRemove(attachment.id), "aria-label": `Remove ${attachment.name}`, className: "absolute right-1 top-1 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border/60 bg-background/90 text-muted-foreground hover:text-foreground", children: _jsx(IconX, { className: "h-3 w-3" }) })] }));
88
+ return (_jsxs("div", { className: "group relative flex h-16 min-w-16 max-w-28 items-center justify-center overflow-hidden rounded-lg border border-border/70 bg-muted/50", children: [_jsx("img", { src: src, alt: attachment.name, className: "max-h-full max-w-full object-contain p-1" }), _jsx("button", { type: "button", onClick: () => onRemove(attachment.id), "aria-label": `Remove ${attachment.name}`, className: "absolute right-1 top-1 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border/60 bg-background/90 text-muted-foreground hover:text-foreground", children: _jsx(IconX, { className: "h-3 w-3" }) })] }));
89
89
  }
90
90
  return (_jsxs("div", { className: "group relative inline-flex max-w-[200px] items-center gap-2 rounded-md border border-border/70 bg-muted/50 px-2 py-1.5 text-xs", children: [_jsx("div", { className: "flex h-6 w-6 shrink-0 items-center justify-center rounded bg-background text-[9px] font-semibold uppercase text-muted-foreground", children: attachment.name.split(".").pop() || "file" }), _jsx("span", { className: "min-w-0 truncate font-medium", children: attachment.name }), _jsx("button", { type: "button", onClick: () => onRemove(attachment.id), "aria-label": `Remove ${attachment.name}`, className: "flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground", children: _jsx(IconX, { className: "h-3 w-3" }) })] }));
91
91
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PromptComposer.js","sourceRoot":"","sources":["../../../src/client/composer/PromptComposer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAY,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,WAAW,EACX,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,cAAc,EAA6B,MAAM,qBAAqB,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,0BAA0B,GAAG,MAAM,CAAC;AA2C1C,sEAAsE;AACtE,mEAAmE;AACnE,sEAAsE;AACtE,MAAM,YAAY,GAAqB;IACrC,KAAK,CAAC,CAAC,GAAG;QACR,OAAO;IACT,CAAC;CACF,CAAC;AAEF;;;;GAIG;AACH,MAAM,+BAA+B;IAC5B,MAAM,GACX,sGAAsG,CAAC;IAElG,KAAK,CAAC,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CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,GACrE,IACqB,GACrB,CACP,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,iBAAiB,GAAG,OAAO,CAC/B,GAAG,EAAE,CACH,IAAI,0BAA0B,CAAC;QAC7B,IAAI,4BAA4B,EAAE;QAClC,IAAI,+BAA+B,EAAE;QACrC,IAAI,2BAA2B,EAAE;KAClC,CAAC,EACJ,EAAE,CACH,CAAC;IACF,MAAM,OAAO,GAAG,eAAe,CAAC,YAAY,EAAE;QAC5C,QAAQ,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE;KAC7C,CAAC,CAAC;IAEH,OAAO,CACL,KAAC,wBAAwB,IAAC,OAAO,EAAE,OAAO,YACxC,KAAC,eAAe,CAAC,IAAI,IAAC,SAAS,EAAC,UAAU,YACxC,KAAC,mBAAmB,OAAK,KAAK,GAAI,GACb,GACE,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["import { useCallback, useEffect, useMemo, useRef, type Ref } from \"react\";\nimport {\n AssistantRuntimeProvider,\n ComposerPrimitive,\n ThreadPrimitive,\n useAui,\n useComposer,\n useLocalRuntime,\n} from \"@assistant-ui/react\";\nimport type {\n Attachment,\n AttachmentAdapter,\n ChatModelAdapter,\n CompleteAttachment,\n PendingAttachment,\n} from \"@assistant-ui/react\";\nimport {\n CompositeAttachmentAdapter,\n SimpleImageAttachmentAdapter,\n SimpleTextAttachmentAdapter,\n} from \"@assistant-ui/react\";\nimport { IconX } from \"@tabler/icons-react\";\nimport { cn } from \"../utils.js\";\nimport { TiptapComposer, type TiptapComposerHandle } from \"./TiptapComposer.js\";\nimport type { Reference } from \"./types.js\";\nimport { useChatModels } from \"../use-chat-models.js\";\nimport type { ReasoningEffort } from \"../../shared/reasoning-effort.js\";\nimport { isPastedTextAttachmentName } from \"./pasted-text.js\";\nimport { PastedTextChip } from \"./PastedTextChip.js\";\n\nconst MAX_INLINE_TEXT_FILE_CHARS = 60_000;\n\n/**\n * Files the user attached via the \"+\" button in PromptComposer. The host owns\n * what to do with them — typically POST to a per-app upload endpoint and pass\n * the resulting URLs/paths into the prompt that gets sent to the agent.\n */\nexport type PromptComposerFile = File;\n\nexport interface PromptComposerSubmitOptions {\n model?: string;\n engine?: string;\n effort?: ReasoningEffort;\n}\n\nexport interface PromptComposerProps {\n /** Called when the user submits the composer. */\n onSubmit: (\n text: string,\n files: PromptComposerFile[],\n references: Reference[],\n options: PromptComposerSubmitOptions,\n ) => void;\n placeholder?: string;\n disabled?: boolean;\n autoFocus?: boolean;\n className?: string;\n /** Forwarded to TiptapComposer for draft persistence. */\n draftScope?: string;\n /** Keep the submitted prompt in the editor. Default: false. */\n preserveDraftOnSubmit?: boolean;\n /** Show the model selector (default: true). */\n showModelSelector?: boolean;\n /** Show the voice dictation button (default: true). */\n voiceEnabled?: boolean;\n /** Show file upload controls and pass submitted files to onSubmit (default: true). */\n attachmentsEnabled?: boolean;\n /** Called whenever the plain editor text changes. */\n onTextChange?: (text: string) => void;\n /** Imperative handle for focusing the composer. */\n composerRef?: Ref<TiptapComposerHandle>;\n}\n\n// Minimal pass-through adapter. PromptComposer always submits through\n// onSubmitOverride, so the runtime never actually calls this — but\n// `useLocalRuntime` needs *something* shaped like a ChatModelAdapter.\nconst NOOP_ADAPTER: ChatModelAdapter = {\n async *run() {\n return;\n },\n};\n\n/**\n * Local clone of AssistantChat's BinaryDocumentAttachmentAdapter so PDFs and\n * PPTX files can be attached without dragging the whole assistant chat module\n * into bundles that just want a prompt popover.\n */\nclass BinaryDocumentAttachmentAdapter implements AttachmentAdapter {\n public accept =\n \"application/pdf,application/vnd.openxmlformats-officedocument.presentationml.presentation,.pdf,.pptx\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: state.file.name,\n type: \"document\",\n name: state.file.name,\n contentType: state.file.type || \"application/octet-stream\",\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [],\n };\n }\n\n public async remove() {\n /* noop */\n }\n}\n\nfunction isInlineableTextFile(file: File): boolean {\n if (file.type.startsWith(\"text/\")) return true;\n if (file.type === \"application/json\") return true;\n return /\\.(txt|md|markdown|csv|json|yaml|yml)$/i.test(file.name);\n}\n\nfunction formatInlineTextFile(name: string, text: string): string {\n const truncated = text.length > MAX_INLINE_TEXT_FILE_CHARS;\n const body = truncated ? text.slice(0, MAX_INLINE_TEXT_FILE_CHARS) : text;\n return [\n `<uploaded-text-file name=\"${name}\">`,\n body,\n truncated\n ? `[Truncated after ${MAX_INLINE_TEXT_FILE_CHARS} characters.]`\n : \"\",\n \"</uploaded-text-file>\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\nfunction getImageSrc(attachment: Attachment): string | null {\n if (attachment.type !== \"image\") return null;\n if (\"file\" in attachment && attachment.file) {\n return URL.createObjectURL(attachment.file);\n }\n const imagePart = attachment.content?.find((part) => part.type === \"image\");\n return imagePart && \"image\" in imagePart ? imagePart.image : null;\n}\n\nfunction AttachmentChip({\n attachment,\n onRemove,\n}: {\n attachment: Attachment;\n onRemove: (id: string) => void;\n}) {\n const src = useMemo(() => getImageSrc(attachment), [attachment]);\n useEffect(\n () => () => {\n if (src?.startsWith(\"blob:\")) URL.revokeObjectURL(src);\n },\n [src],\n );\n\n if (isPastedTextAttachmentName(attachment.name)) {\n return <PastedTextChip attachment={attachment} onRemove={onRemove} />;\n }\n\n if (src) {\n return (\n <div className=\"group relative h-16 w-16 overflow-hidden rounded-lg border border-border/70 bg-muted/50\">\n <img\n src={src}\n alt={attachment.name}\n className=\"h-full w-full object-cover\"\n />\n <button\n type=\"button\"\n onClick={() => onRemove(attachment.id)}\n aria-label={`Remove ${attachment.name}`}\n className=\"absolute right-1 top-1 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border/60 bg-background/90 text-muted-foreground hover:text-foreground\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"group relative inline-flex max-w-[200px] items-center gap-2 rounded-md border border-border/70 bg-muted/50 px-2 py-1.5 text-xs\">\n <div className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded bg-background text-[9px] font-semibold uppercase text-muted-foreground\">\n {attachment.name.split(\".\").pop() || \"file\"}\n </div>\n <span className=\"min-w-0 truncate font-medium\">{attachment.name}</span>\n <button\n type=\"button\"\n onClick={() => onRemove(attachment.id)}\n aria-label={`Remove ${attachment.name}`}\n className=\"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </div>\n );\n}\n\nfunction PromptAttachmentStrip() {\n const attachments = useComposer((state) => state.attachments);\n const aui = useAui();\n\n const handleRemove = useCallback(\n (id: string) => {\n void aui.composer().attachment({ id }).remove();\n },\n [aui],\n );\n\n if (attachments.length === 0) return null;\n return (\n <div className=\"flex flex-wrap gap-2 px-2 pt-2\">\n {attachments.map((attachment) => (\n <AttachmentChip\n key={attachment.id}\n attachment={attachment}\n onRemove={handleRemove}\n />\n ))}\n </div>\n );\n}\n\nfunction PromptComposerInner({\n onSubmit,\n placeholder,\n disabled,\n autoFocus,\n className,\n draftScope,\n preserveDraftOnSubmit = false,\n showModelSelector = true,\n voiceEnabled = true,\n attachmentsEnabled = true,\n onTextChange,\n composerRef,\n}: PromptComposerProps) {\n const localRef = useRef<TiptapComposerHandle>(null);\n const handleRef = composerRef ?? localRef;\n const models = useChatModels();\n\n useEffect(() => {\n if (!autoFocus) return;\n const id = window.setTimeout(() => {\n const target =\n typeof handleRef === \"object\" && handleRef && \"current\" in handleRef\n ? handleRef.current\n : null;\n target?.focus();\n }, 50);\n return () => window.clearTimeout(id);\n }, [autoFocus, handleRef]);\n\n const handleSubmit = useCallback(\n async (\n text: string,\n references: Reference[],\n attachments?: ReadonlyArray<unknown>,\n ) => {\n // PromptComposer hosts (NewWorkspaceAppFlow, create-extension, create-deck,\n // …) submit a single string prompt — they don't run the assistant-ui\n // attachment send pipeline. TiptapComposer auto-converts large pastes\n // into a \"Pasted text\" chip, which would otherwise disappear into an\n // unprocessed File. Inline the chip body back into the prompt text so\n // newlines and full content survive the round-trip.\n const files: File[] = [];\n const pastedTextBlocks: string[] = [];\n for (const att of attachments ?? []) {\n const a = att as Attachment;\n if (\"file\" in a && a.file instanceof File) {\n const file = a.file;\n if (isPastedTextAttachmentName(file.name)) {\n try {\n pastedTextBlocks.push(await file.text());\n } catch {\n // If we can't read it, fall back to surfacing it as a regular\n // attachment file rather than silently losing it.\n files.push(file);\n }\n } else {\n if (isInlineableTextFile(file)) {\n try {\n pastedTextBlocks.push(\n formatInlineTextFile(file.name, await file.text()),\n );\n } catch {\n // Keep the upload path fallback below.\n }\n }\n files.push(file);\n }\n }\n }\n const finalText = pastedTextBlocks.length\n ? [text.trim(), ...pastedTextBlocks].filter(Boolean).join(\"\\n\\n\")\n : text;\n onSubmit(finalText, files, references, {\n model: showModelSelector ? models.selectedModel : undefined,\n engine: showModelSelector ? models.selectedEngine : undefined,\n effort: showModelSelector ? models.selectedEffort : undefined,\n });\n },\n [\n models.selectedEffort,\n models.selectedEngine,\n models.selectedModel,\n onSubmit,\n showModelSelector,\n ],\n );\n\n return (\n <div\n className={cn(\n \"agent-composer-area flex flex-col rounded-lg border border-input bg-background focus-within:ring-1 focus-within:ring-ring\",\n className,\n )}\n >\n <ComposerPrimitive.Root className=\"flex flex-col\">\n <PromptAttachmentStrip />\n <TiptapComposer\n focusRef={handleRef}\n disabled={disabled}\n placeholder={placeholder}\n onSubmit={handleSubmit}\n clearOnSubmit={!preserveDraftOnSubmit}\n plusMenuMode={attachmentsEnabled ? \"upload-only\" : \"hidden\"}\n voiceEnabled={voiceEnabled}\n onTextChange={onTextChange}\n draftScope={draftScope}\n selectedModel={showModelSelector ? models.selectedModel : undefined}\n selectedEffort={showModelSelector ? models.selectedEffort : undefined}\n availableModels={\n showModelSelector ? models.availableModels : undefined\n }\n onModelChange={showModelSelector ? models.onModelChange : undefined}\n onEffortChange={showModelSelector ? models.onEffortChange : undefined}\n />\n </ComposerPrimitive.Root>\n </div>\n );\n}\n\n/**\n * Standalone composer that mirrors the agent sidebar's input experience —\n * voice dictation, file upload, model selector, submit-on-Enter — for use in\n * popovers and inline prompt forms (create tool, create deck, create dashboard,\n * the Dispatch new-app flow, etc.).\n *\n * The host owns submission: when the user presses Enter or clicks submit,\n * `onSubmit(text, files, references, options)` is called. PromptComposer runs\n * its own minimal assistant-ui runtime so it can be dropped into any subtree\n * without needing the outer chat to be mounted.\n */\nexport function PromptComposer(props: PromptComposerProps) {\n const attachmentAdapter = useMemo(\n () =>\n new CompositeAttachmentAdapter([\n new SimpleImageAttachmentAdapter(),\n new BinaryDocumentAttachmentAdapter(),\n new SimpleTextAttachmentAdapter(),\n ]),\n [],\n );\n const runtime = useLocalRuntime(NOOP_ADAPTER, {\n adapters: { attachments: attachmentAdapter },\n });\n\n return (\n <AssistantRuntimeProvider runtime={runtime}>\n <ThreadPrimitive.Root className=\"contents\">\n <PromptComposerInner {...props} />\n </ThreadPrimitive.Root>\n </AssistantRuntimeProvider>\n );\n}\n"]}
1
+ {"version":3,"file":"PromptComposer.js","sourceRoot":"","sources":["../../../src/client/composer/PromptComposer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAY,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,wBAAwB,EACxB,iBAAiB,EACjB,eAAe,EACf,MAAM,EACN,WAAW,EACX,eAAe,GAChB,MAAM,qBAAqB,CAAC;AAQ7B,OAAO,EACL,0BAA0B,EAC1B,4BAA4B,EAC5B,2BAA2B,GAC5B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;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n ComposerPrimitive,\n ThreadPrimitive,\n useAui,\n useComposer,\n useLocalRuntime,\n} from \"@assistant-ui/react\";\nimport type {\n Attachment,\n AttachmentAdapter,\n ChatModelAdapter,\n CompleteAttachment,\n PendingAttachment,\n} from \"@assistant-ui/react\";\nimport {\n CompositeAttachmentAdapter,\n SimpleImageAttachmentAdapter,\n SimpleTextAttachmentAdapter,\n} from \"@assistant-ui/react\";\nimport { IconX } from \"@tabler/icons-react\";\nimport { cn } from \"../utils.js\";\nimport { TiptapComposer, type TiptapComposerHandle } from \"./TiptapComposer.js\";\nimport type { Reference } from \"./types.js\";\nimport { useChatModels } from \"../use-chat-models.js\";\nimport type { ReasoningEffort } from \"../../shared/reasoning-effort.js\";\nimport { isPastedTextAttachmentName } from \"./pasted-text.js\";\nimport { PastedTextChip } from \"./PastedTextChip.js\";\n\nconst MAX_INLINE_TEXT_FILE_CHARS = 60_000;\n\n/**\n * Files the user attached via the \"+\" button in PromptComposer. The host owns\n * what to do with them — typically POST to a per-app upload endpoint and pass\n * the resulting URLs/paths into the prompt that gets sent to the agent.\n */\nexport type PromptComposerFile = File;\n\nexport interface PromptComposerSubmitOptions {\n model?: string;\n engine?: string;\n effort?: ReasoningEffort;\n}\n\nexport interface PromptComposerProps {\n /** Called when the user submits the composer. */\n onSubmit: (\n text: string,\n files: PromptComposerFile[],\n references: Reference[],\n options: PromptComposerSubmitOptions,\n ) => void;\n placeholder?: string;\n disabled?: boolean;\n autoFocus?: boolean;\n className?: string;\n /** Forwarded to TiptapComposer for draft persistence. */\n draftScope?: string;\n /** Keep the submitted prompt in the editor. Default: false. */\n preserveDraftOnSubmit?: boolean;\n /** Show the model selector (default: true). */\n showModelSelector?: boolean;\n /** Show the voice dictation button (default: true). */\n voiceEnabled?: boolean;\n /** Show file upload controls and pass submitted files to onSubmit (default: true). */\n attachmentsEnabled?: boolean;\n /** Called whenever the plain editor text changes. */\n onTextChange?: (text: string) => void;\n /** Imperative handle for focusing the composer. */\n composerRef?: Ref<TiptapComposerHandle>;\n}\n\n// Minimal pass-through adapter. PromptComposer always submits through\n// onSubmitOverride, so the runtime never actually calls this — but\n// `useLocalRuntime` needs *something* shaped like a ChatModelAdapter.\nconst NOOP_ADAPTER: ChatModelAdapter = {\n async *run() {\n return;\n },\n};\n\n/**\n * Local clone of AssistantChat's BinaryDocumentAttachmentAdapter so PDFs and\n * PPTX files can be attached without dragging the whole assistant chat module\n * into bundles that just want a prompt popover.\n */\nclass BinaryDocumentAttachmentAdapter implements AttachmentAdapter {\n public accept =\n \"application/pdf,application/vnd.openxmlformats-officedocument.presentationml.presentation,.pdf,.pptx\";\n\n public async add(state: { file: File }): Promise<PendingAttachment> {\n return {\n id: state.file.name,\n type: \"document\",\n name: state.file.name,\n contentType: state.file.type || \"application/octet-stream\",\n file: state.file,\n status: { type: \"requires-action\", reason: \"composer-send\" },\n };\n }\n\n public async send(\n attachment: PendingAttachment,\n ): Promise<CompleteAttachment> {\n return {\n ...attachment,\n status: { type: \"complete\" },\n content: [],\n };\n }\n\n public async remove() {\n /* noop */\n }\n}\n\nfunction isInlineableTextFile(file: File): boolean {\n if (file.type.startsWith(\"text/\")) return true;\n if (file.type === \"application/json\") return true;\n return /\\.(txt|md|markdown|csv|json|yaml|yml)$/i.test(file.name);\n}\n\nfunction formatInlineTextFile(name: string, text: string): string {\n const truncated = text.length > MAX_INLINE_TEXT_FILE_CHARS;\n const body = truncated ? text.slice(0, MAX_INLINE_TEXT_FILE_CHARS) : text;\n return [\n `<uploaded-text-file name=\"${name}\">`,\n body,\n truncated\n ? `[Truncated after ${MAX_INLINE_TEXT_FILE_CHARS} characters.]`\n : \"\",\n \"</uploaded-text-file>\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n}\n\nfunction getImageSrc(attachment: Attachment): string | null {\n if (attachment.type !== \"image\") return null;\n if (\"file\" in attachment && attachment.file) {\n return URL.createObjectURL(attachment.file);\n }\n const imagePart = attachment.content?.find((part) => part.type === \"image\");\n return imagePart && \"image\" in imagePart ? imagePart.image : null;\n}\n\nfunction AttachmentChip({\n attachment,\n onRemove,\n}: {\n attachment: Attachment;\n onRemove: (id: string) => void;\n}) {\n const src = useMemo(() => getImageSrc(attachment), [attachment]);\n useEffect(\n () => () => {\n if (src?.startsWith(\"blob:\")) URL.revokeObjectURL(src);\n },\n [src],\n );\n\n if (isPastedTextAttachmentName(attachment.name)) {\n return <PastedTextChip attachment={attachment} onRemove={onRemove} />;\n }\n\n if (src) {\n return (\n <div className=\"group relative flex h-16 min-w-16 max-w-28 items-center justify-center overflow-hidden rounded-lg border border-border/70 bg-muted/50\">\n <img\n src={src}\n alt={attachment.name}\n className=\"max-h-full max-w-full object-contain p-1\"\n />\n <button\n type=\"button\"\n onClick={() => onRemove(attachment.id)}\n aria-label={`Remove ${attachment.name}`}\n className=\"absolute right-1 top-1 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full border border-border/60 bg-background/90 text-muted-foreground hover:text-foreground\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </div>\n );\n }\n\n return (\n <div className=\"group relative inline-flex max-w-[200px] items-center gap-2 rounded-md border border-border/70 bg-muted/50 px-2 py-1.5 text-xs\">\n <div className=\"flex h-6 w-6 shrink-0 items-center justify-center rounded bg-background text-[9px] font-semibold uppercase text-muted-foreground\">\n {attachment.name.split(\".\").pop() || \"file\"}\n </div>\n <span className=\"min-w-0 truncate font-medium\">{attachment.name}</span>\n <button\n type=\"button\"\n onClick={() => onRemove(attachment.id)}\n aria-label={`Remove ${attachment.name}`}\n className=\"flex h-5 w-5 shrink-0 cursor-pointer items-center justify-center rounded text-muted-foreground hover:text-foreground\"\n >\n <IconX className=\"h-3 w-3\" />\n </button>\n </div>\n );\n}\n\nfunction PromptAttachmentStrip() {\n const attachments = useComposer((state) => state.attachments);\n const aui = useAui();\n\n const handleRemove = useCallback(\n (id: string) => {\n void aui.composer().attachment({ id }).remove();\n },\n [aui],\n );\n\n if (attachments.length === 0) return null;\n return (\n <div className=\"flex flex-wrap gap-2 px-2 pt-2\">\n {attachments.map((attachment) => (\n <AttachmentChip\n key={attachment.id}\n attachment={attachment}\n onRemove={handleRemove}\n />\n ))}\n </div>\n );\n}\n\nfunction PromptComposerInner({\n onSubmit,\n placeholder,\n disabled,\n autoFocus,\n className,\n draftScope,\n preserveDraftOnSubmit = false,\n showModelSelector = true,\n voiceEnabled = true,\n attachmentsEnabled = true,\n onTextChange,\n composerRef,\n}: PromptComposerProps) {\n const localRef = useRef<TiptapComposerHandle>(null);\n const handleRef = composerRef ?? localRef;\n const models = useChatModels();\n\n useEffect(() => {\n if (!autoFocus) return;\n const id = window.setTimeout(() => {\n const target =\n typeof handleRef === \"object\" && handleRef && \"current\" in handleRef\n ? handleRef.current\n : null;\n target?.focus();\n }, 50);\n return () => window.clearTimeout(id);\n }, [autoFocus, handleRef]);\n\n const handleSubmit = useCallback(\n async (\n text: string,\n references: Reference[],\n attachments?: ReadonlyArray<unknown>,\n ) => {\n // PromptComposer hosts (NewWorkspaceAppFlow, create-extension, create-deck,\n // …) submit a single string prompt — they don't run the assistant-ui\n // attachment send pipeline. TiptapComposer auto-converts large pastes\n // into a \"Pasted text\" chip, which would otherwise disappear into an\n // unprocessed File. Inline the chip body back into the prompt text so\n // newlines and full content survive the round-trip.\n const files: File[] = [];\n const pastedTextBlocks: string[] = [];\n for (const att of attachments ?? []) {\n const a = att as Attachment;\n if (\"file\" in a && a.file instanceof File) {\n const file = a.file;\n if (isPastedTextAttachmentName(file.name)) {\n try {\n pastedTextBlocks.push(await file.text());\n } catch {\n // If we can't read it, fall back to surfacing it as a regular\n // attachment file rather than silently losing it.\n files.push(file);\n }\n } else {\n if (isInlineableTextFile(file)) {\n try {\n pastedTextBlocks.push(\n formatInlineTextFile(file.name, await file.text()),\n );\n } catch {\n // Keep the upload path fallback below.\n }\n }\n files.push(file);\n }\n }\n }\n const finalText = pastedTextBlocks.length\n ? [text.trim(), ...pastedTextBlocks].filter(Boolean).join(\"\\n\\n\")\n : text;\n onSubmit(finalText, files, references, {\n model: showModelSelector ? models.selectedModel : undefined,\n engine: showModelSelector ? models.selectedEngine : undefined,\n effort: showModelSelector ? models.selectedEffort : undefined,\n });\n },\n [\n models.selectedEffort,\n models.selectedEngine,\n models.selectedModel,\n onSubmit,\n showModelSelector,\n ],\n );\n\n return (\n <div\n className={cn(\n \"agent-composer-area flex flex-col rounded-lg border border-input bg-background focus-within:ring-1 focus-within:ring-ring\",\n className,\n )}\n >\n <ComposerPrimitive.Root className=\"flex flex-col\">\n <PromptAttachmentStrip />\n <TiptapComposer\n focusRef={handleRef}\n disabled={disabled}\n placeholder={placeholder}\n onSubmit={handleSubmit}\n clearOnSubmit={!preserveDraftOnSubmit}\n plusMenuMode={attachmentsEnabled ? \"upload-only\" : \"hidden\"}\n voiceEnabled={voiceEnabled}\n onTextChange={onTextChange}\n draftScope={draftScope}\n selectedModel={showModelSelector ? models.selectedModel : undefined}\n selectedEffort={showModelSelector ? models.selectedEffort : undefined}\n availableModels={\n showModelSelector ? models.availableModels : undefined\n }\n onModelChange={showModelSelector ? models.onModelChange : undefined}\n onEffortChange={showModelSelector ? models.onEffortChange : undefined}\n />\n </ComposerPrimitive.Root>\n </div>\n );\n}\n\n/**\n * Standalone composer that mirrors the agent sidebar's input experience —\n * voice dictation, file upload, model selector, submit-on-Enter — for use in\n * popovers and inline prompt forms (create tool, create deck, create dashboard,\n * the Dispatch new-app flow, etc.).\n *\n * The host owns submission: when the user presses Enter or clicks submit,\n * `onSubmit(text, files, references, options)` is called. PromptComposer runs\n * its own minimal assistant-ui runtime so it can be dropped into any subtree\n * without needing the outer chat to be mounted.\n */\nexport function PromptComposer(props: PromptComposerProps) {\n const attachmentAdapter = useMemo(\n () =>\n new CompositeAttachmentAdapter([\n new SimpleImageAttachmentAdapter(),\n new BinaryDocumentAttachmentAdapter(),\n new SimpleTextAttachmentAdapter(),\n ]),\n [],\n );\n const runtime = useLocalRuntime(NOOP_ADAPTER, {\n adapters: { attachments: attachmentAdapter },\n });\n\n return (\n <AssistantRuntimeProvider runtime={runtime}>\n <ThreadPrimitive.Root className=\"contents\">\n <PromptComposerInner {...props} />\n </ThreadPrimitive.Root>\n </AssistantRuntimeProvider>\n );\n}\n"]}
@@ -4,6 +4,11 @@ import { type ReasoningEffort } from "../../shared/reasoning-effort.js";
4
4
  export interface TiptapComposerHandle {
5
5
  focus(): void;
6
6
  }
7
+ export declare function canSubmitComposerContent(options: {
8
+ hasEditorContent: boolean;
9
+ attachmentCount: number;
10
+ disabled?: boolean;
11
+ }): boolean;
7
12
  type ExecMode = "build" | "plan";
8
13
  interface TiptapComposerProps {
9
14
  placeholder?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"TiptapComposer.d.ts","sourceRoot":"","sources":["../../../src/client/composer/TiptapComposer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAgCf,OAAO,KAAK,EAGV,SAAS,EAGV,MAAM,YAAY,CAAC;AAWpB,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,kCAAkC,CAAC;AAO1C,MAAM,WAAW,oBAAoB;IACnC,KAAK,IAAI,IAAI,CAAC;CACf;AA0HD,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjC,UAAU,mBAAmB;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CACT,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,EAAE,EACvB,WAAW,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,KACjC,IAAI,CAAC;IACV;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qDAAqD;IACrD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4FAA4F;IAC5F,YA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,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,QAAQ,CAAC;IACjD;;;;;;;;OAQG;IACH,gCAAgC,CAAC,EAAE,OAAO,CAAC;CAC5C;AAED,wBAAgB,8BAA8B,CAC5C,cAAc,EAAE,MAAM,MAAM,GAAG,SAAS,0OA+BzC;AAuZD,wBAAgB,cAAc,CAAC,EAC7B,WAAgC,EAChC,QAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,aAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,gBAAwB,EACxB,sBAAsB,EACtB,YAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACd,UAAU,EACV,YAAqB,EACrB,gCAAwC,GACzC,EAAE,mBAAmB,2CA47BrB"}
@@ -22,6 +22,10 @@ import { getComposerDraftKey } from "./draft-key.js";
22
22
  import { createPastedTextFile, shouldConvertPasteToAttachment, } from "./pasted-text.js";
23
23
  import { getReasoningEffortOptionsForModel, reasoningEffortLabel, } from "../../shared/reasoning-effort.js";
24
24
  import { Tooltip, TooltipContent, TooltipTrigger, } from "../components/ui/tooltip.js";
25
+ export function canSubmitComposerContent(options) {
26
+ return (!options.disabled &&
27
+ (options.hasEditorContent || options.attachmentCount > 0));
28
+ }
25
29
  const BUILT_IN_COMMANDS = [
26
30
  { name: "clear", description: "Start a new chat", icon: "clear" },
27
31
  { name: "new", description: "Start a new chat", icon: "new" },
@@ -139,9 +143,7 @@ export function createTiptapComposerExtensions(getPlaceholder) {
139
143
  function ModeSelector({ mode, onChange, planModeDisabled = false, planModeDisabledReason = "Open Agent Native Desktop to use Plan mode.", }) {
140
144
  const [open, setOpen] = useState(false);
141
145
  const ActiveIcon = mode === "build" ? IconPencil : IconClipboardList;
142
- return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": mode === "build" ? "Act mode" : "Plan mode", className: `shrink-0 flex items-center gap-1 rounded-md px-2 py-1 text-[12px] font-medium hover:bg-accent/50 ${mode === "plan"
143
- ? "text-amber-700 dark:text-amber-300"
144
- : "text-muted-foreground hover:text-foreground"}`, children: [_jsx(ActiveIcon, { className: "h-3.5 w-3.5" }), mode === "build" ? "Act" : "Plan", _jsx(IconChevronDown, { className: "h-3 w-3 opacity-60" })] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { side: "top", align: "end", sideOffset: 6, "data-agent-native-composer-popover": "true", className: "z-[260] w-60 rounded-lg border border-border bg-popover py-1 shadow-lg animate-in fade-in-0 zoom-in-95", style: { fontSize: 13 }, children: [_jsxs("button", { type: "button", onClick: () => {
146
+ return (_jsxs(PopoverPrimitive.Root, { open: open, onOpenChange: setOpen, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsxs("button", { type: "button", "aria-label": mode === "build" ? "Act mode" : "Plan mode", className: "shrink-0 flex items-center gap-1 rounded-md px-2 py-1 text-[12px] font-medium text-muted-foreground hover:bg-accent/50 hover:text-foreground", children: [_jsx(ActiveIcon, { className: "h-3.5 w-3.5" }), mode === "build" ? "Act" : "Plan", _jsx(IconChevronDown, { className: "h-3 w-3 opacity-60" })] }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { side: "top", align: "end", sideOffset: 6, "data-agent-native-composer-popover": "true", className: "z-[260] w-60 rounded-lg border border-border bg-popover py-1 shadow-lg animate-in fade-in-0 zoom-in-95", style: { fontSize: 13 }, children: [_jsxs("button", { type: "button", onClick: () => {
145
147
  onChange("build");
146
148
  setOpen(false);
147
149
  }, className: "flex w-full items-center gap-3 px-3 py-2 hover:bg-accent/50 text-left", children: [_jsx(IconPencil, { className: "h-4 w-4 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("span", { className: "font-medium text-foreground text-[13px]", children: "Act" }), _jsx("p", { className: "text-[11px] text-muted-foreground mt-0.5", children: "Use tools and make approved changes" })] }), mode === "build" && (_jsx(IconCheck, { className: "h-3.5 w-3.5 shrink-0 text-blue-500" }))] }), _jsxs("button", { type: "button", disabled: planModeDisabled, title: planModeDisabled ? planModeDisabledReason : undefined, onClick: () => {
@@ -151,9 +153,7 @@ function ModeSelector({ mode, onChange, planModeDisabled = false, planModeDisabl
151
153
  setOpen(false);
152
154
  }, className: `flex w-full items-center gap-3 px-3 py-2 text-left ${planModeDisabled
153
155
  ? "cursor-not-allowed opacity-60"
154
- : "hover:bg-accent/50"}`, children: [_jsx(IconClipboardList, { className: `h-4 w-4 shrink-0 ${planModeDisabled
155
- ? "text-muted-foreground"
156
- : "text-amber-600 dark:text-amber-300"}` }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("span", { className: "font-medium text-foreground text-[13px]", children: "Plan" }), _jsx("p", { className: "text-[11px] text-muted-foreground mt-0.5", children: planModeDisabled
156
+ : "hover:bg-accent/50"}`, children: [_jsx(IconClipboardList, { className: "h-4 w-4 shrink-0 text-muted-foreground" }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("span", { className: "font-medium text-foreground text-[13px]", children: "Plan" }), _jsx("p", { className: "text-[11px] text-muted-foreground mt-0.5", children: planModeDisabled
157
157
  ? planModeDisabledReason
158
158
  : "Read-only research and approval first" })] }), mode === "plan" && !planModeDisabled && (_jsx(IconCheck, { className: "h-3.5 w-3.5 shrink-0 text-blue-500" }))] })] }) })] }));
159
159
  }
@@ -315,7 +315,12 @@ export function TiptapComposer({ placeholder = "Message agent...", disabled = fa
315
315
  const composerRuntime = useComposerRuntime();
316
316
  const [editorHasText, setEditorHasText] = useState(false);
317
317
  const composerText = useComposer((state) => state.text);
318
- const canSend = editorHasText && !disabled;
318
+ const composerAttachments = useComposer((state) => state.attachments);
319
+ const canSend = canSubmitComposerContent({
320
+ hasEditorContent: editorHasText,
321
+ attachmentCount: composerAttachments.length,
322
+ disabled,
323
+ });
319
324
  const [composerMode, setComposerMode] = useState(null);
320
325
  const composerModeRef = useRef(null);
321
326
  const isMac = typeof navigator !== "undefined" &&