adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
45 lines (44 loc) • 1.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ActiveStreamingTool = void 0;
/**
* Represents an active streaming tool that is running.
*/
class ActiveStreamingTool {
/**
* Creates a new instance of ActiveStreamingTool.
*
* @param task The task Promise
* @param options Additional options
*/
constructor(task, options) {
/** Whether the task is done */
this.done = false;
/** Whether the task has been cancelled */
this.cancelled = false;
this.task = task;
if (options) {
this.name = options.name;
this.args = options.args;
this.id = options.id;
this.done = options.done || false;
this.cancelled = options.cancelled || false;
}
}
/**
* Marks the streaming tool as completed.
*
* @param result The result of the function.
*/
complete(result) {
this.done = true;
this.result = result;
}
/**
* Marks the streaming tool as cancelled.
*/
cancel() {
this.cancelled = true;
}
}
exports.ActiveStreamingTool = ActiveStreamingTool;