@ai-sdk/workflow 1.0.0-canary.72 → 1.0.0-canary.73

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @ai-sdk/workflow
2
2
 
3
+ ## 1.0.0-canary.73
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [023550e]
8
+ - Updated dependencies [e92fc45]
9
+ - ai@7.0.0-canary.156
10
+
3
11
  ## 1.0.0-canary.72
4
12
 
5
13
  ### Patch Changes
package/dist/index.mjs CHANGED
@@ -1945,16 +1945,16 @@ function toUIMessageChunk(part) {
1945
1945
  case "raw":
1946
1946
  return void 0;
1947
1947
  default: {
1948
- const p = part;
1949
- if (p.type === "tool-approval-request") {
1948
+ const passthroughPart = part;
1949
+ if (passthroughPart.type === "tool-approval-request") {
1950
1950
  return {
1951
1951
  type: "tool-approval-request",
1952
- approvalId: p.approvalId,
1953
- toolCallId: p.toolCallId
1952
+ approvalId: passthroughPart.approvalId,
1953
+ toolCallId: passthroughPart.toolCallId
1954
1954
  };
1955
1955
  }
1956
- if (p.type === "finish-step" || p.type === "start-step" || p.type === "tool-output-denied") {
1957
- return p;
1956
+ if (passthroughPart.type === "finish-step" || passthroughPart.type === "start-step" || passthroughPart.type === "tool-output-denied") {
1957
+ return passthroughPart;
1958
1958
  }
1959
1959
  return void 0;
1960
1960
  }
@@ -2053,7 +2053,7 @@ var WorkflowChatTransport = class {
2053
2053
  messageId
2054
2054
  }) : void 0;
2055
2055
  const url = (_a = requestConfig == null ? void 0 : requestConfig.api) != null ? _a : this.api;
2056
- const res = await this.fetch(url, {
2056
+ const response = await this.fetch(url, {
2057
2057
  method: "POST",
2058
2058
  body: JSON.stringify(
2059
2059
  (_b = requestConfig == null ? void 0 : requestConfig.body) != null ? _b : { messages, ...options.body }
@@ -2062,21 +2062,21 @@ var WorkflowChatTransport = class {
2062
2062
  credentials: requestConfig == null ? void 0 : requestConfig.credentials,
2063
2063
  signal: abortSignal
2064
2064
  });
2065
- if (!res.ok || !res.body) {
2065
+ if (!response.ok || !response.body) {
2066
2066
  throw new Error(
2067
- `Failed to fetch chat: ${res.status} ${await res.text()}`
2067
+ `Failed to fetch chat: ${response.status} ${await response.text()}`
2068
2068
  );
2069
2069
  }
2070
- const workflowRunId = res.headers.get("x-workflow-run-id");
2070
+ const workflowRunId = response.headers.get("x-workflow-run-id");
2071
2071
  if (!workflowRunId) {
2072
2072
  throw new Error(
2073
2073
  'Workflow run ID not found in "x-workflow-run-id" response header'
2074
2074
  );
2075
2075
  }
2076
- await ((_c = this.onChatSendMessage) == null ? void 0 : _c.call(this, res, options));
2076
+ await ((_c = this.onChatSendMessage) == null ? void 0 : _c.call(this, response, options));
2077
2077
  try {
2078
2078
  const chunkStream = parseJsonEventStream({
2079
- stream: res.body,
2079
+ stream: response.body,
2080
2080
  schema: uiMessageChunkSchema
2081
2081
  });
2082
2082
  for await (const chunk of createAsyncIterableStream(chunkStream)) {
@@ -2111,8 +2111,8 @@ var WorkflowChatTransport = class {
2111
2111
  * @throws Error if the reconnection request fails or returns a non-OK status
2112
2112
  */
2113
2113
  async reconnectToStream(options) {
2114
- const it = this.reconnectToStreamIterator(options);
2115
- return convertAsyncIteratorToReadableStream(it);
2114
+ const reconnectIterator = this.reconnectToStreamIterator(options);
2115
+ return convertAsyncIteratorToReadableStream(reconnectIterator);
2116
2116
  }
2117
2117
  async *reconnectToStreamIterator(options, workflowRunId, initialChunkIndex = 0) {
2118
2118
  var _a, _b;
@@ -2135,20 +2135,22 @@ var WorkflowChatTransport = class {
2135
2135
  while (!gotFinish) {
2136
2136
  const startIndex = useExplicitStartIndex ? explicitStartIndex : replayFromStart ? 0 : chunkIndex;
2137
2137
  const url = `${baseUrl}?startIndex=${startIndex}`;
2138
- const res = await this.fetch(url, {
2138
+ const response = await this.fetch(url, {
2139
2139
  headers: requestConfig == null ? void 0 : requestConfig.headers,
2140
2140
  credentials: requestConfig == null ? void 0 : requestConfig.credentials,
2141
2141
  signal: options.abortSignal
2142
2142
  });
2143
- if (!res.ok || !res.body) {
2143
+ if (!response.ok || !response.body) {
2144
2144
  throw new Error(
2145
- `Failed to fetch chat: ${res.status} ${await res.text()}`
2145
+ `Failed to fetch chat: ${response.status} ${await response.text()}`
2146
2146
  );
2147
2147
  }
2148
2148
  if (useExplicitStartIndex && explicitStartIndex > 0) {
2149
2149
  chunkIndex = explicitStartIndex;
2150
2150
  } else if (useExplicitStartIndex && explicitStartIndex < 0) {
2151
- const tailIndexHeader = res.headers.get("x-workflow-stream-tail-index");
2151
+ const tailIndexHeader = response.headers.get(
2152
+ "x-workflow-stream-tail-index"
2153
+ );
2152
2154
  const tailIndex = tailIndexHeader !== null ? parseInt(tailIndexHeader, 10) : NaN;
2153
2155
  if (!Number.isNaN(tailIndex)) {
2154
2156
  chunkIndex = Math.max(0, tailIndex + 1 + explicitStartIndex);
@@ -2162,7 +2164,7 @@ var WorkflowChatTransport = class {
2162
2164
  useExplicitStartIndex = false;
2163
2165
  try {
2164
2166
  const chunkStream = parseJsonEventStream({
2165
- stream: res.body,
2167
+ stream: response.body,
2166
2168
  schema: uiMessageChunkSchema
2167
2169
  });
2168
2170
  for await (const chunk of createAsyncIterableStream(chunkStream)) {