@amigo-ai/platform-sdk 0.63.0 → 0.64.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.
- package/api.md +1 -0
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +29 -3
- package/dist/index.mjs.map +2 -2
- package/dist/resources/conversations.js +33 -3
- package/dist/resources/conversations.js.map +1 -1
- package/dist/types/generated/api.d.ts +87 -2
- package/dist/types/generated/api.d.ts.map +1 -1
- package/dist/types/resources/conversations.d.ts +23 -0
- package/dist/types/resources/conversations.d.ts.map +1 -1
- package/dist/types/resources/intake.d.ts.map +1 -1
- package/dist/types/resources/metrics.d.ts.map +1 -1
- package/dist/types/resources/operators.d.ts.map +1 -1
- package/dist/types/resources/services.d.ts.map +1 -1
- package/dist/types/resources/settings.d.ts.map +1 -1
- package/dist/types/resources/surfaces.d.ts.map +1 -1
- package/dist/types/resources/world.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2095,21 +2095,47 @@ var ConversationsResource = class extends WorkspaceScopedResource {
|
|
|
2095
2095
|
* alongside the response turns. Server-side default is `false` — without
|
|
2096
2096
|
* this opt-in the `tool_calls` array on the `TurnResponse` will be empty
|
|
2097
2097
|
* even when the agent invoked tools during the turn.
|
|
2098
|
+
*
|
|
2099
|
+
* Pass `options.poll: true` for a no-message drain-and-report poll (see
|
|
2100
|
+
* {@link pollTurn} for the ergonomic wrapper): the agent surfaces any
|
|
2101
|
+
* background tool results that completed since the last turn. A poll must
|
|
2102
|
+
* NOT carry a `request.message` (the server rejects it 422); prefer
|
|
2103
|
+
* {@link pollTurn}.
|
|
2098
2104
|
*/
|
|
2099
2105
|
async createTurn(conversationId, request, options) {
|
|
2106
|
+
if (options?.poll && request.message) {
|
|
2107
|
+
throw new ConfigurationError("poll cannot be combined with a message; use pollTurn() instead");
|
|
2108
|
+
}
|
|
2109
|
+
const query = {};
|
|
2110
|
+
if (options?.includeToolCalls !== void 0) query.include_tool_calls = options.includeToolCalls;
|
|
2111
|
+
if (options?.poll !== void 0) query.poll = options.poll;
|
|
2100
2112
|
return extractData(
|
|
2101
2113
|
await this.client.POST("/v1/{workspace_id}/conversations/{conversation_id}/turns", {
|
|
2102
2114
|
params: {
|
|
2103
2115
|
path: { workspace_id: this.workspaceId, conversation_id: conversationId },
|
|
2104
|
-
...
|
|
2105
|
-
query: { include_tool_calls: options.includeToolCalls }
|
|
2106
|
-
}
|
|
2116
|
+
...Object.keys(query).length > 0 && { query }
|
|
2107
2117
|
},
|
|
2108
2118
|
body: request,
|
|
2109
2119
|
headers: { Accept: "application/json" }
|
|
2110
2120
|
})
|
|
2111
2121
|
);
|
|
2112
2122
|
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Poll a conversation for background tool results without sending a user
|
|
2125
|
+
* message. Drains any background tool calls that completed since the last
|
|
2126
|
+
* turn and returns the agent's report; when nothing is pending the response
|
|
2127
|
+
* has empty `output` and `tool_calls` (the idle case) — treat that as "keep
|
|
2128
|
+
* polling". Poll no more than once every ~5s per conversation.
|
|
2129
|
+
*
|
|
2130
|
+
* @example
|
|
2131
|
+
* ```ts
|
|
2132
|
+
* const res = await client.conversations.pollTurn(convId, { includeToolCalls: true });
|
|
2133
|
+
* if (res.output.length || res.tool_calls?.length) render(res); // else poll again later
|
|
2134
|
+
* ```
|
|
2135
|
+
*/
|
|
2136
|
+
async pollTurn(conversationId, options) {
|
|
2137
|
+
return this.createTurn(conversationId, {}, { ...options, poll: true });
|
|
2138
|
+
}
|
|
2113
2139
|
/**
|
|
2114
2140
|
* Send a message and receive the agent's response as an SSE byte stream.
|
|
2115
2141
|
*
|