Skip to content

Commit ae708f8

Browse files
wixysamcursoragent
andcommitted
Add agents module documentation and fix copy script for new docs.json structure
- Add JSDoc documentation for agents module (conversations, messages, realtime subscriptions) - Fix copy-to-local-docs script to match current docs.json nav structure (SDK anchor instead of References > JavaScript SDK) Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent a6dd3bc commit ae708f8

2 files changed

Lines changed: 19 additions & 24 deletions

File tree

scripts/mintlify-post-processing/copy-to-local-docs.js

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ function updateDocsJson(repoDir, sdkFiles) {
159159
`SDK Reference pages: ${JSON.stringify(sdkReferencePages, null, 2)}`
160160
);
161161

162-
// Navigate to: Developers tab -> anchors -> References anchor -> groups -> JavaScript SDK -> SDK Reference
162+
// Navigate to: Developers tab -> anchors -> SDK anchor -> groups -> SDK Reference
163163
const developersTab = docs.navigation.tabs.find(
164164
(tab) => tab.tab === "Developers"
165165
);
@@ -169,42 +169,31 @@ function updateDocsJson(repoDir, sdkFiles) {
169169
process.exit(1);
170170
}
171171

172-
// Find the References anchor (new structure uses anchors instead of groups at tab level)
173-
const referencesAnchor = developersTab.anchors?.find(
174-
(anchor) => anchor.anchor === "References"
172+
// Find the SDK anchor
173+
const sdkAnchor = developersTab.anchors?.find(
174+
(anchor) => anchor.anchor === "SDK"
175175
);
176176

177-
if (!referencesAnchor) {
178-
console.error("Could not find 'References' anchor in Developers tab");
177+
if (!sdkAnchor) {
178+
console.error("Could not find 'SDK' anchor in Developers tab");
179179
process.exit(1);
180180
}
181181

182-
// Find the JavaScript SDK group within the References anchor
183-
const jsSdkGroup = referencesAnchor.groups?.find(
184-
(g) => g.group === "JavaScript SDK"
185-
);
186-
187-
if (!jsSdkGroup) {
188-
console.error(
189-
"Could not find 'JavaScript SDK' group in References anchor"
190-
);
191-
process.exit(1);
192-
}
193-
194-
// Find SDK Reference within JavaScript SDK's pages (it's a nested group object)
195-
const sdkRefIndex = jsSdkGroup.pages.findIndex(
196-
(page) => typeof page === "object" && page.group === "SDK Reference"
182+
// Find SDK Reference within the SDK anchor's groups
183+
const sdkRefIndex = sdkAnchor.groups.findIndex(
184+
(g) => g.group === "SDK Reference"
197185
);
198186

199187
if (sdkRefIndex === -1) {
200-
console.error("Could not find 'SDK Reference' group in JavaScript SDK");
188+
console.error("Could not find 'SDK Reference' group in SDK anchor");
201189
process.exit(1);
202190
}
203191

204192
// Update the SDK Reference pages with our generated groups
205-
jsSdkGroup.pages[sdkRefIndex] = {
193+
sdkAnchor.groups[sdkRefIndex] = {
206194
group: "SDK Reference",
207195
icon: "brackets-curly",
196+
expanded: true,
208197
pages: sdkReferencePages,
209198
};
210199

src/modules/agents.types.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ export interface AgentsModuleConfig {
181181
*
182182
* This module is available to use with a client in all authentication modes:
183183
*
184-
* - **Anonymous or User authentication** (`base44.agents`): Access is scoped to the current user's permissions. Anonymous users can create conversations but can't retrieve them later, while authenticated users can access conversations they created.
184+
* - **Anonymous or User authentication** (`base44.agents`): Access is scoped to the current user's permissions. Users must be authenticated to create and access conversations.
185185
* - **Service role authentication** (`base44.asServiceRole.agents`): Operations have elevated admin-level permissions. Can access all conversations that the app's admin role has access to.
186186
*
187187
*/
@@ -211,6 +211,8 @@ export interface AgentsModule {
211211
* Retrieves a single conversation using its unique identifier. To retrieve
212212
* all conversations, use {@linkcode getConversations | getConversations()} To filter, sort, or paginate conversations, use {@linkcode listConversations | listConversations()}.
213213
*
214+
* This function returns the complete stored conversation including full tool call results, even for large responses.
215+
*
214216
* @param conversationId - The unique identifier of the conversation.
215217
* @returns Promise resolving to the conversation, or undefined if not found.
216218
*
@@ -322,6 +324,10 @@ export interface AgentsModule {
322324
* Establishes a WebSocket connection to receive instant updates when new
323325
* messages are added to the conversation. Returns an unsubscribe function
324326
* to clean up the connection.
327+
*
328+
* <Note>
329+
When receiving messages through this function, tool call data is truncated for efficiency — `arguments_string` is limited to 500 characters and `results` to 50 characters. The complete tool call data is always saved in storage and can be retrieved by calling {@linkcode getConversation | getConversation()} after the message completes.
330+
</Note>
325331
*
326332
* @param conversationId - The conversation ID to subscribe to.
327333
* @param onUpdate - Callback function called when the conversation is updated. The callback receives a conversation object with the following properties:

0 commit comments

Comments
 (0)