@h-ai/ai 1.0.0-beta.7 → 1.0.0-beta.9

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/README.en.md CHANGED
@@ -541,6 +541,8 @@ const manager = ai.context.createManager({
541
541
 
542
542
  ### Configuration
543
543
 
544
+ Rerank inherits the global LLM timeout with per-model overrides; the deadline covers the request and response body, returning RERANK_API_ERROR on timeout.
545
+
544
546
  The LLM protocol field is now `protocol` in `llm`, `llm.models[]`, and `tempModel`, replacing `api`. Values remain `chat | responses | anthropic`. Use `HAI_AI_LLM_PROTOCOL` and `HAI_AI_LLM_MODELS_0_PROTOCOL` (adjust the index for other entries). Old fields and protocol variables fail with a migration message; `apiKey` and its variables are unchanged.
545
547
 
546
548
  ```yaml
package/README.ja.md CHANGED
@@ -541,6 +541,8 @@ const manager = ai.context.createManager({
541
541
 
542
542
  ### 設定
543
543
 
544
+ Rerank は LLM 全体の timeout を継承し、モデル単位で上書きできます。期限は応答本文まで含み、超過時は RERANK_API_ERROR を返します。
545
+
544
546
  LLM の `llm.api`、`llm.models[].api`、`tempModel.api` は `protocol` に統一されました。値は `chat | responses | anthropic` のままです。環境変数は `HAI_AI_LLM_PROTOCOL`、`HAI_AI_LLM_MODELS_0_PROTOCOL`(他の項目は対応する添字)を使います。旧フィールドと旧プロトコル変数は移行案内付きでエラーになります。`apiKey` とその変数は変更ありません。
545
547
 
546
548
  ```yaml
package/README.md CHANGED
@@ -564,6 +564,8 @@ const manager = ai.context.createManager({
564
564
 
565
565
  ### 配置
566
566
 
567
+ Rerank 继承全局 LLM timeout,模型条目可覆盖;同一预算覆盖请求及响应正文,超时返回 RERANK_API_ERROR。
568
+
567
569
  LLM 协议字段已从 `llm.api` / `llm.models[].api` / `tempModel.api` 统一改为 `protocol`,取值仍为 `chat | responses | anthropic`。环境变量改用 `HAI_AI_LLM_PROTOCOL`、`HAI_AI_LLM_MODELS_0_PROTOCOL`(其他项按索引递增)。旧字段和旧协议变量会明确报错并提示迁移;`apiKey` 及其变量不变。
568
570
 
569
571
  ```yaml
package/dist/index.js CHANGED
@@ -1141,6 +1141,10 @@ public static class HaiACPCommandJob {
1141
1141
  }
1142
1142
  }
1143
1143
  `;
1144
+ var compile = `Import-Module ([IO.Path]::Combine($PSHOME, 'Modules', 'Microsoft.PowerShell.Utility', 'Microsoft.PowerShell.Utility.psd1'))
1145
+ Add-Type -TypeDefinition @'
1146
+ ${nativeJob}
1147
+ '@`;
1144
1148
  function powershell(script) {
1145
1149
  return ["-NoLogo", "-NoProfile", "-NonInteractive", "-EncodedCommand", Buffer.from(script, "utf16le").toString("base64")];
1146
1150
  }
@@ -1149,9 +1153,7 @@ function windowsACPCommand(command, args) {
1149
1153
  const key = `__HAI_AI_ACP_JOB_${randomUUID().replaceAll("-", "")}`;
1150
1154
  const script = `$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue'; $InformationPreference='SilentlyContinue'
1151
1155
  try {
1152
- Add-Type -TypeDefinition @'
1153
- ${nativeJob}
1154
- '@
1156
+ ${compile}
1155
1157
  $inputConfig = [Environment]::GetEnvironmentVariable('${key}') | ConvertFrom-Json
1156
1158
  [Environment]::SetEnvironmentVariable('${key}', $null)
1157
1159
  exit ([HaiACPCommandJob]::Run([string]$inputConfig.name, [string]$inputConfig.command, [string[]]$inputConfig.args))
@@ -1161,11 +1163,13 @@ ${nativeJob}
1161
1163
  function windowsACPJobProbe(name) {
1162
1164
  return powershell(`$ErrorActionPreference='Stop'; $ProgressPreference='SilentlyContinue'; $InformationPreference='SilentlyContinue'
1163
1165
  try {
1164
- Add-Type -TypeDefinition @'
1165
- ${nativeJob}
1166
- '@
1166
+ ${compile}
1167
1167
  if ([HaiACPCommandJob]::Empty('${name}')) { exit 0 } else { exit 1 }
1168
- } catch { exit 2 }`);
1168
+ } catch {
1169
+ $cause = $_.Exception.GetBaseException()
1170
+ [Console]::Error.WriteLine(('Windows ACP job probe failed ({0}; win32={1})' -f $cause.GetType().Name, $cause.NativeErrorCode))
1171
+ exit 2
1172
+ }`);
1169
1173
  }
1170
1174
  async function jobProbe(name, timeout) {
1171
1175
  return new Promise((resolve3) => {
@@ -11260,7 +11264,8 @@ function createRerankOperations(config) {
11260
11264
  "Content-Type": "application/json",
11261
11265
  "Authorization": `Bearer ${resolved.apiKey}`
11262
11266
  },
11263
- body: JSON.stringify(body)
11267
+ body: JSON.stringify(body),
11268
+ signal: AbortSignal.timeout(resolved.timeout)
11264
11269
  });
11265
11270
  if (!response.ok) {
11266
11271
  const errorText = await response.text().catch(() => response.statusText);