@ray-js/t-agent-plugin-aistream 0.2.0-beta-16 → 0.2.0-beta-17

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.
@@ -42,6 +42,7 @@ interface AIStreamSessionOptions {
42
42
  userData?: Attribute[];
43
43
  }
44
44
  interface AIStreamEventOptions {
45
+ signal?: AbortSignal;
45
46
  userData?: Attribute[];
46
47
  }
47
48
  export declare class AIStreamSession {
@@ -224,6 +224,7 @@ export class AIStreamSession {
224
224
  return this.promise;
225
225
  }
226
226
  async startEvent() {
227
+ var _options$signal;
227
228
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
228
229
  if (this.disposed) {
229
230
  throw new AIStreamEventError('Event has been disposed', AIStreamErrorCode.AIStreamError);
@@ -232,6 +233,7 @@ export class AIStreamSession {
232
233
  throw new AIStreamEventError('Cannot start a new event while another is active', AIStreamErrorCode.AIStreamError);
233
234
  }
234
235
  await this.ensureSession();
236
+ (_options$signal = options.signal) === null || _options$signal === void 0 || _options$signal.throwIfAborted();
235
237
  const {
236
238
  eventId
237
239
  } = await sendEventStart(_objectSpread({
@@ -100,6 +100,7 @@ export function sendBlocksToAIStream(params) {
100
100
  }
101
101
  let error;
102
102
  [error, event] = await tryCatch(() => session.startEvent({
103
+ signal,
103
104
  userData: [{
104
105
  type: AIStreamAttributeType.AI_CHAT,
105
106
  payloadType: AIStreamAttributePayloadType.STRING,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/t-agent-plugin-aistream",
3
- "version": "0.2.0-beta-16",
3
+ "version": "0.2.0-beta-17",
4
4
  "author": "Tuya.inc",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -35,5 +35,5 @@
35
35
  "devDependencies": {
36
36
  "@types/url-parse": "^1.4.11"
37
37
  },
38
- "gitHead": "d9abc8e193dc1db6a7f9fca9ebeba2ff6462b713"
38
+ "gitHead": "32e3d3ae017d11825e0bfd4dc4441abe67bd8ef0"
39
39
  }