REFERENCE
SDK Demos
How to use @asgard-js/core and @asgard-js/react, with demos you can try on the page.
cwd:// Download Actions
When an ATTACHMENT's defaultAction / downloadAction uses a cwd://<relative-path>
URI, the SDK intercepts cwd:// and fetches <botProviderEndpoint>/cwd/download
to retrieve the file and trigger a browser download, instead of window.open
(which cannot open cwd://).
This is common with sandbox / code-server style bots: the agent produces a file in
its working directory and offers a cwd:// link for the user to download.
Highlights
- A
cwd://downloadAction(type: "uri") is enough to show the download icon — an EMITdownload_fileis no longer required. - Clicking the card or the download icon fires
GET <base>/cwd/download?custom_channel_id=...&relative_path=....
- A
Code Example (attachment template)
template: {
type: MessageTemplateType.ATTACHMENT,
attachments: [
{
title: "sales-ranking.json",
defaultAction: { type: "uri", uri: "cwd://sales-ranking.json" },
downloadAction: { type: "uri", uri: "cwd://sales-ranking.json" },
},
],
quickReplies: [],
}The example above runs in preview mode (
botProviderEndpoint: "skip") to show the attachment download UI; an actual download requires a Bot Provider that returnscwd://actions and serves/cwd/download.