w-dispatch-ai 1.0.4 → 1.0.6
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.md +94 -17
- package/dist/w-dispatch-ai.umd.js +2 -2
- package/dist/w-dispatch-ai.umd.js.map +1 -1
- package/docs/WDispatchAi.mjs.html +8 -4
- package/docs/adapters.mjs.html +2 -2
- package/docs/dfTimeoutMs.mjs.html +98 -0
- package/docs/dispatchAi.mjs.html +2 -2
- package/docs/dispatchAiFallback.mjs.html +16 -11
- package/docs/dispatchAiWkf.mjs.html +11 -2
- package/docs/dispatchAntigravity.mjs.html +23 -12
- package/docs/dispatchApiOpenaiCompat.mjs.html +5 -4
- package/docs/dispatchClaude.mjs.html +17 -4
- package/docs/dispatchCodex.mjs.html +16 -3
- package/docs/dispatchOpencode.mjs.html +16 -3
- package/docs/getCliArgs.mjs.html +2 -2
- package/docs/getErrorResult.mjs.html +2 -2
- package/docs/global.html +501 -35
- package/docs/index.html +2 -2
- package/docs/resolveProviders.mjs.html +189 -0
- package/docs/wkf_callAiWithFallback.mjs.html +29 -13
- package/docs/wkf_extractJsonLoose.mjs.html +2 -2
- package/docs/wkf_runFanout.mjs.html +2 -2
- package/docs/wkf_runFanoutPipeline.mjs.html +2 -2
- package/docs/wkf_runRolePipeline.mjs.html +2 -2
- package/g.mjs +7 -7
- package/package.json +1 -1
- package/src/WDispatchAi.mjs +6 -2
- package/src/dfTimeoutMs.mjs +26 -0
- package/src/dispatchAiFallback.mjs +14 -9
- package/src/dispatchAiWkf.mjs +9 -0
- package/src/dispatchAntigravity.mjs +21 -10
- package/src/dispatchApiOpenaiCompat.mjs +3 -2
- package/src/dispatchClaude.mjs +15 -2
- package/src/dispatchCodex.mjs +14 -1
- package/src/dispatchOpencode.mjs +14 -1
- package/src/providers.mjs +133 -0
- package/src/resolveProviders.mjs +117 -0
- package/src/wkf/callAiWithFallback.mjs +27 -11
- package/test/unit-WDispatchAi.test.mjs +9 -3
- package/test/unit-callAiWithFallback.test.mjs +15 -0
- package/test/unit-dispatchAi.test.mjs +1 -1
- package/test/unit-dispatchAiFallback.test.mjs +25 -0
- package/test/unit-dispatchAiWkf.test.mjs +8 -0
- package/test/unit-dispatchAntigravity.test.mjs +25 -5
- package/test/unit-providers.test.mjs +66 -0
- package/test/unit-resolveProviders.test.mjs +85 -0
package/docs/global.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WDispatchAi">WDispatchAi</a></li><li><a href="global.html#adapters">adapters</a></li><li><a href="global.html#buildChain">buildChain</a></li><li><a href="global.html#buildValidator">buildValidator</a></li><li><a href="global.html#callAiWithFallback">callAiWithFallback</a></li><li><a href="global.html#callOnce">callOnce</a></li><li><a href="global.html#defaultIntegratePrompt">defaultIntegratePrompt</a></li><li><a href="global.html#dispatchAi">dispatchAi</a></li><li><a href="global.html#dispatchAiFallback">dispatchAiFallback</a></li><li><a href="global.html#dispatchAiWkf">dispatchAiWkf</a></li><li><a href="global.html#dispatchAntigravity">dispatchAntigravity</a></li><li><a href="global.html#dispatchApiOpenaiCompat">dispatchApiOpenaiCompat</a></li><li><a href="global.html#dispatchClaude">dispatchClaude</a></li><li><a href="global.html#dispatchCodex">dispatchCodex</a></li><li><a href="global.html#dispatchOpencode">dispatchOpencode</a></li><li><a href="global.html#extractJsonLoose">extractJsonLoose</a></li><li><a href="global.html#getCliArgs">getCliArgs</a></li><li><a href="global.html#getErrorResult">getErrorResult</a></li><li><a href="global.html#isKeyIndependentFail">isKeyIndependentFail</a></li><li><a href="global.html#runFanout">runFanout</a></li><li><a href="global.html#runFanoutPipeline">runFanoutPipeline</a></li><li><a href="global.html#runRolePipeline">runRolePipeline</a></li></ul>
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WDispatchAi">WDispatchAi</a></li><li><a href="global.html#adapters">adapters</a></li><li><a href="global.html#buildChain">buildChain</a></li><li><a href="global.html#buildValidator">buildValidator</a></li><li><a href="global.html#callAiWithFallback">callAiWithFallback</a></li><li><a href="global.html#callOnce">callOnce</a></li><li><a href="global.html#defaultIntegratePrompt">defaultIntegratePrompt</a></li><li><a href="global.html#dfTimeoutMs">dfTimeoutMs</a></li><li><a href="global.html#dispatchAi">dispatchAi</a></li><li><a href="global.html#dispatchAiFallback">dispatchAiFallback</a></li><li><a href="global.html#dispatchAiWkf">dispatchAiWkf</a></li><li><a href="global.html#dispatchAntigravity">dispatchAntigravity</a></li><li><a href="global.html#dispatchApiOpenaiCompat">dispatchApiOpenaiCompat</a></li><li><a href="global.html#dispatchClaude">dispatchClaude</a></li><li><a href="global.html#dispatchCodex">dispatchCodex</a></li><li><a href="global.html#dispatchOpencode">dispatchOpencode</a></li><li><a href="global.html#extractJsonLoose">extractJsonLoose</a></li><li><a href="global.html#getCliArgs">getCliArgs</a></li><li><a href="global.html#getErrorResult">getErrorResult</a></li><li><a href="global.html#isKeyIndependentFail">isKeyIndependentFail</a></li><li><a href="global.html#resolveProviders">resolveProviders</a></li><li><a href="global.html#runFanout">runFanout</a></li><li><a href="global.html#runFanoutPipeline">runFanoutPipeline</a></li><li><a href="global.html#runRolePipeline">runRolePipeline</a></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
|
|
141
141
|
<dt class="tag-source">Source:</dt>
|
|
142
142
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
143
|
-
<a href="WDispatchAi.mjs.html">WDispatchAi.mjs</a>, <a href="WDispatchAi.mjs.html#
|
|
143
|
+
<a href="WDispatchAi.mjs.html">WDispatchAi.mjs</a>, <a href="WDispatchAi.mjs.html#line35">line 35</a>
|
|
144
144
|
</li></ul></dd>
|
|
145
145
|
|
|
146
146
|
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
|
|
192
192
|
<h5 class="h5-examples">Example</h5>
|
|
193
193
|
|
|
194
|
-
<pre class="prettyprint"><code>詳見dispatchAi、dispatchAiFallback、dispatchAiWkf、dispatchOpencode、dispatchClaude、dispatchCodex、dispatchAntigravity、dispatchApiOpenaiCompat範例</code></pre>
|
|
194
|
+
<pre class="prettyprint"><code>詳見dispatchAi、dispatchAiFallback、dispatchAiWkf、dispatchOpencode、dispatchClaude、dispatchCodex、dispatchAntigravity、dispatchApiOpenaiCompat、resolveProviders範例</code></pre>
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
|
|
@@ -275,6 +275,81 @@ console.log(Object.keys(adapters))
|
|
|
275
275
|
|
|
276
276
|
|
|
277
277
|
|
|
278
|
+
|
|
279
|
+
<h4 class="name" id="dfTimeoutMs"><span class="type-signature"></span>dfTimeoutMs<span class="type-signature"></span></h4>
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<dl class="details">
|
|
286
|
+
|
|
287
|
+
<dt class="tag-description">Description:</dt>
|
|
288
|
+
<dd class="tag-description"><ul class="dummy"><li><p>全套件統一之預設逾時毫秒</p></li></ul></dd>
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
<dt class="tag-source">Source:</dt>
|
|
293
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
294
|
+
<a href="dfTimeoutMs.mjs.html">dfTimeoutMs.mjs</a>, <a href="dfTimeoutMs.mjs.html#line23">line 23</a>
|
|
295
|
+
</li></ul></dd>
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
</dl>
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
<div class="description usertext">
|
|
334
|
+
<p>全套件統一之預設逾時毫秒</p>
|
|
335
|
+
</div>
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
<h5 class="h5-examples">Example</h5>
|
|
344
|
+
|
|
345
|
+
<pre class="prettyprint"><code>import dfTimeoutMs from './src/dfTimeoutMs.mjs'
|
|
346
|
+
|
|
347
|
+
console.log(dfTimeoutMs)
|
|
348
|
+
// => 300000</code></pre>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
278
353
|
|
|
279
354
|
|
|
280
355
|
|
|
@@ -301,7 +376,7 @@ console.log(Object.keys(adapters))
|
|
|
301
376
|
|
|
302
377
|
<dt class="tag-source">Source:</dt>
|
|
303
378
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
304
|
-
<a href="wkf_callAiWithFallback.mjs.html">wkf/callAiWithFallback.mjs</a>, <a href="wkf_callAiWithFallback.mjs.html#
|
|
379
|
+
<a href="wkf_callAiWithFallback.mjs.html">wkf/callAiWithFallback.mjs</a>, <a href="wkf_callAiWithFallback.mjs.html#line70">line 70</a>
|
|
305
380
|
</li></ul></dd>
|
|
306
381
|
|
|
307
382
|
|
|
@@ -492,7 +567,7 @@ console.log(buildChain(providers, { use: 'a', fallback: ['b', 'c'] }))
|
|
|
492
567
|
|
|
493
568
|
<dt class="tag-source">Source:</dt>
|
|
494
569
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
495
|
-
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#
|
|
570
|
+
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#line71">line 71</a>
|
|
496
571
|
</li></ul></dd>
|
|
497
572
|
|
|
498
573
|
|
|
@@ -661,7 +736,7 @@ parse+check接進遞補層之validate——非法回覆視為該家失敗而
|
|
|
661
736
|
|
|
662
737
|
<dt class="tag-source">Source:</dt>
|
|
663
738
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
664
|
-
<a href="wkf_callAiWithFallback.mjs.html">wkf/callAiWithFallback.mjs</a>, <a href="wkf_callAiWithFallback.mjs.html#
|
|
739
|
+
<a href="wkf_callAiWithFallback.mjs.html">wkf/callAiWithFallback.mjs</a>, <a href="wkf_callAiWithFallback.mjs.html#line144">line 144</a>
|
|
665
740
|
</li></ul></dd>
|
|
666
741
|
|
|
667
742
|
|
|
@@ -1130,7 +1205,7 @@ await test()
|
|
|
1130
1205
|
</td>
|
|
1131
1206
|
|
|
1132
1207
|
|
|
1133
|
-
<td class="description last"><p
|
|
1208
|
+
<td class="description last"><p>輸入單次嘗試逾時毫秒正整數,全套件統一預設300000</p></td>
|
|
1134
1209
|
</tr>
|
|
1135
1210
|
|
|
1136
1211
|
|
|
@@ -1175,6 +1250,46 @@ await test()
|
|
|
1175
1250
|
|
|
1176
1251
|
|
|
1177
1252
|
|
|
1253
|
+
<tr>
|
|
1254
|
+
|
|
1255
|
+
<td class="name"><code>minAttemptMs</code></td>
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
<td class="type">
|
|
1259
|
+
|
|
1260
|
+
|
|
1261
|
+
<span class="param-type">Number</span>
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
</td>
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
<td class="attributes">
|
|
1270
|
+
|
|
1271
|
+
<optional><br>
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
</td>
|
|
1278
|
+
|
|
1279
|
+
|
|
1280
|
+
|
|
1281
|
+
<td class="default">
|
|
1282
|
+
|
|
1283
|
+
<code>20000</code>
|
|
1284
|
+
|
|
1285
|
+
</td>
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
<td class="description last"><p>輸入搭配budgetMs之開工門檻毫秒正整數,剩餘預算低於此值即不再開工,預設20000</p></td>
|
|
1289
|
+
</tr>
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1178
1293
|
<tr>
|
|
1179
1294
|
|
|
1180
1295
|
<td class="name"><code>maxRetries</code></td>
|
|
@@ -1330,7 +1445,7 @@ await test()
|
|
|
1330
1445
|
</td>
|
|
1331
1446
|
|
|
1332
1447
|
|
|
1333
|
-
<td class="description last"><p>輸入遞補層事件回調函數,預設null</p></td>
|
|
1448
|
+
<td class="description last"><p>輸入遞補層事件回調函數,預設null。除上列外之其餘鍵(retryDelayMs、maxBuffer、onStdout等)亦一律原樣轉傳dispatchAiFallback</p></td>
|
|
1334
1449
|
</tr>
|
|
1335
1450
|
|
|
1336
1451
|
|
|
@@ -1406,7 +1521,7 @@ await test()
|
|
|
1406
1521
|
|
|
1407
1522
|
<dt class="tag-source">Source:</dt>
|
|
1408
1523
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
1409
|
-
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#
|
|
1524
|
+
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#line137">line 137</a>
|
|
1410
1525
|
</li></ul></dd>
|
|
1411
1526
|
|
|
1412
1527
|
|
|
@@ -2163,7 +2278,7 @@ providers陣列順序即優先序,排前面的先用;
|
|
|
2163
2278
|
|
|
2164
2279
|
<dt class="tag-source">Source:</dt>
|
|
2165
2280
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2166
|
-
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#
|
|
2281
|
+
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line189">line 189</a>
|
|
2167
2282
|
</li></ul></dd>
|
|
2168
2283
|
|
|
2169
2284
|
|
|
@@ -2679,7 +2794,7 @@ await test()
|
|
|
2679
2794
|
</td>
|
|
2680
2795
|
|
|
2681
2796
|
|
|
2682
|
-
<td class="description last"><p>輸入事件回調函數(ev)=>{},ev.type可為'try'、'ok'、'next-key'、'skip-group'、'budget-out'
|
|
2797
|
+
<td class="description last"><p>輸入事件回調函數(ev)=>{},ev.type可為'try'、'ok'、'next-key'、'skip-group'、'budget-out';失敗事件(next-key/skip-group)另帶stdout(被拒回覆)與stderr(錯誤輸出)供診斷,兩者於失敗路徑已由轉接器截斷;回調拋出例外不影響主流程,預設null</p></td>
|
|
2683
2798
|
</tr>
|
|
2684
2799
|
|
|
2685
2800
|
|
|
@@ -2714,12 +2829,12 @@ await test()
|
|
|
2714
2829
|
|
|
2715
2830
|
<td class="default">
|
|
2716
2831
|
|
|
2717
|
-
<code>
|
|
2832
|
+
<code>300000</code>
|
|
2718
2833
|
|
|
2719
2834
|
</td>
|
|
2720
2835
|
|
|
2721
2836
|
|
|
2722
|
-
<td class="description last"><p>輸入各attempt
|
|
2837
|
+
<td class="description last"><p>輸入各attempt共用之逾時毫秒正整數,條目可覆寫,全套件統一預設300000</p></td>
|
|
2723
2838
|
</tr>
|
|
2724
2839
|
|
|
2725
2840
|
|
|
@@ -2833,7 +2948,7 @@ await test()
|
|
|
2833
2948
|
|
|
2834
2949
|
|
|
2835
2950
|
<div class="param-desc">
|
|
2836
|
-
<p>回傳Promise,resolve回傳結果物件,除execCli既有欄位(ok、stdout、stderr、code、error、durationMs、attempts、pid)外,追加providerId(實際使用之群組)、keyIndex(實際使用之金鑰索引,無keys時為null)、kind、model、tried(
|
|
2951
|
+
<p>回傳Promise,resolve回傳結果物件,除execCli既有欄位(ok、stdout、stderr、code、error、durationMs、attempts、pid)外,追加providerId(實際使用之群組)、keyIndex(實際使用之金鑰索引,無keys時為null)、kind、model、tried(全部嘗試歷程陣列,成功時亦回傳;失敗項含stdout與stderr供診斷被拒原因),本函數不會reject</p>
|
|
2837
2952
|
</div>
|
|
2838
2953
|
|
|
2839
2954
|
|
|
@@ -2880,7 +2995,7 @@ defaults為共用呼叫設定,各工作流之callOpt與名額規格可逐項
|
|
|
2880
2995
|
|
|
2881
2996
|
<dt class="tag-source">Source:</dt>
|
|
2882
2997
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2883
|
-
<a href="dispatchAiWkf.mjs.html">dispatchAiWkf.mjs</a>, <a href="dispatchAiWkf.mjs.html#
|
|
2998
|
+
<a href="dispatchAiWkf.mjs.html">dispatchAiWkf.mjs</a>, <a href="dispatchAiWkf.mjs.html#line106">line 106</a>
|
|
2884
2999
|
</li></ul></dd>
|
|
2885
3000
|
|
|
2886
3001
|
|
|
@@ -3201,7 +3316,7 @@ agy自身之--print-timeout未給時由timeoutMs推導並預留30秒緩衝,令
|
|
|
3201
3316
|
|
|
3202
3317
|
<dt class="tag-source">Source:</dt>
|
|
3203
3318
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3204
|
-
<a href="dispatchAntigravity.mjs.html">dispatchAntigravity.mjs</a>, <a href="dispatchAntigravity.mjs.html#
|
|
3319
|
+
<a href="dispatchAntigravity.mjs.html">dispatchAntigravity.mjs</a>, <a href="dispatchAntigravity.mjs.html#line106">line 106</a>
|
|
3205
3320
|
</li></ul></dd>
|
|
3206
3321
|
|
|
3207
3322
|
|
|
@@ -3632,12 +3747,12 @@ await test()
|
|
|
3632
3747
|
|
|
3633
3748
|
<td class="default">
|
|
3634
3749
|
|
|
3635
|
-
<code
|
|
3750
|
+
<code>自動納入cwd</code>
|
|
3636
3751
|
|
|
3637
3752
|
</td>
|
|
3638
3753
|
|
|
3639
3754
|
|
|
3640
|
-
<td class="description last"><p>輸入加入workspace之目錄字串陣列,逐項展開為<code>--add-dir</code
|
|
3755
|
+
<td class="description last"><p>輸入加入workspace之目錄字串陣列,逐項展開為<code>--add-dir</code>。agy以自身scratch目錄為工作區而不採子進程cwd,故未給本參數時自動納入有效cwd令檔案可視範圍與其他CLI轉接器一致;明示給陣列(含空陣列[]代表不揭露任何目錄)則完全尊重呼叫端</p></td>
|
|
3641
3756
|
</tr>
|
|
3642
3757
|
|
|
3643
3758
|
|
|
@@ -3717,7 +3832,7 @@ await test()
|
|
|
3717
3832
|
</td>
|
|
3718
3833
|
|
|
3719
3834
|
|
|
3720
|
-
<td class="description last"><p
|
|
3835
|
+
<td class="description last"><p>輸入逾時毫秒正整數,逾時將強制關閉子進程及其子孫程序,全套件統一預設300000(恰對齊agy自身print-timeout預設5m0s)</p></td>
|
|
3721
3836
|
</tr>
|
|
3722
3837
|
|
|
3723
3838
|
|
|
@@ -3757,7 +3872,7 @@ await test()
|
|
|
3757
3872
|
</td>
|
|
3758
3873
|
|
|
3759
3874
|
|
|
3760
|
-
<td class="description last"><p>輸入子進程工作目錄字串,預設process.cwd()</p></td>
|
|
3875
|
+
<td class="description last"><p>輸入子進程工作目錄字串,預設process.cwd()。注意本參數不影響agy之檔案可視範圍(agy以自身scratch目錄為工作區),可視範圍由addDirs決定(未給addDirs時自動納入本目錄)</p></td>
|
|
3761
3876
|
</tr>
|
|
3762
3877
|
|
|
3763
3878
|
|
|
@@ -3922,7 +4037,7 @@ prompt走HTTP body,無命令列長度限制;
|
|
|
3922
4037
|
|
|
3923
4038
|
<dt class="tag-source">Source:</dt>
|
|
3924
4039
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3925
|
-
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#
|
|
4040
|
+
<a href="dispatchApiOpenaiCompat.mjs.html">dispatchApiOpenaiCompat.mjs</a>, <a href="dispatchApiOpenaiCompat.mjs.html#line327">line 327</a>
|
|
3926
4041
|
</li></ul></dd>
|
|
3927
4042
|
|
|
3928
4043
|
|
|
@@ -4394,12 +4509,12 @@ await test()
|
|
|
4394
4509
|
|
|
4395
4510
|
<td class="default">
|
|
4396
4511
|
|
|
4397
|
-
<code>
|
|
4512
|
+
<code>300000</code>
|
|
4398
4513
|
|
|
4399
4514
|
</td>
|
|
4400
4515
|
|
|
4401
4516
|
|
|
4402
|
-
<td class="description last"><p>輸入逾時毫秒正整數,逾時將中止請求(含回應串流讀取)
|
|
4517
|
+
<td class="description last"><p>輸入逾時毫秒正整數,逾時將中止請求(含回應串流讀取),全套件統一預設300000</p></td>
|
|
4403
4518
|
</tr>
|
|
4404
4519
|
|
|
4405
4520
|
|
|
@@ -4604,7 +4719,7 @@ prompt一律走stdin而非位置參數,因摘要內文可達數萬字,當命
|
|
|
4604
4719
|
|
|
4605
4720
|
<dt class="tag-source">Source:</dt>
|
|
4606
4721
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
4607
|
-
<a href="dispatchClaude.mjs.html">dispatchClaude.mjs</a>, <a href="dispatchClaude.mjs.html#
|
|
4722
|
+
<a href="dispatchClaude.mjs.html">dispatchClaude.mjs</a>, <a href="dispatchClaude.mjs.html#line77">line 77</a>
|
|
4608
4723
|
</li></ul></dd>
|
|
4609
4724
|
|
|
4610
4725
|
|
|
@@ -4657,7 +4772,7 @@ import dispatchClaude from './src/dispatchClaude.mjs'
|
|
|
4657
4772
|
|
|
4658
4773
|
let test = async () => {
|
|
4659
4774
|
|
|
4660
|
-
let r = await dispatchClaude('請只回覆兩個字:完成', { model: 'sonnet'
|
|
4775
|
+
let r = await dispatchClaude('請只回覆兩個字:完成', { model: 'sonnet' })
|
|
4661
4776
|
console.log(r.ok, r.stdout.trim())
|
|
4662
4777
|
// => true '完成'
|
|
4663
4778
|
|
|
@@ -4990,12 +5105,12 @@ await test()
|
|
|
4990
5105
|
|
|
4991
5106
|
<td class="default">
|
|
4992
5107
|
|
|
4993
|
-
<code>
|
|
5108
|
+
<code>300000</code>
|
|
4994
5109
|
|
|
4995
5110
|
</td>
|
|
4996
5111
|
|
|
4997
5112
|
|
|
4998
|
-
<td class="description last"><p
|
|
5113
|
+
<td class="description last"><p>輸入逾時毫秒正整數,逾時將強制關閉子進程及其子孫程序,全套件統一預設300000</p></td>
|
|
4999
5114
|
</tr>
|
|
5000
5115
|
|
|
5001
5116
|
|
|
@@ -5198,7 +5313,7 @@ prompt一律走stdin而非位置參數,因摘要內文可達數萬字,當命
|
|
|
5198
5313
|
|
|
5199
5314
|
<dt class="tag-source">Source:</dt>
|
|
5200
5315
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
5201
|
-
<a href="dispatchCodex.mjs.html">dispatchCodex.mjs</a>, <a href="dispatchCodex.mjs.html#
|
|
5316
|
+
<a href="dispatchCodex.mjs.html">dispatchCodex.mjs</a>, <a href="dispatchCodex.mjs.html#line77">line 77</a>
|
|
5202
5317
|
</li></ul></dd>
|
|
5203
5318
|
|
|
5204
5319
|
|
|
@@ -5584,12 +5699,12 @@ await test()
|
|
|
5584
5699
|
|
|
5585
5700
|
<td class="default">
|
|
5586
5701
|
|
|
5587
|
-
<code>
|
|
5702
|
+
<code>300000</code>
|
|
5588
5703
|
|
|
5589
5704
|
</td>
|
|
5590
5705
|
|
|
5591
5706
|
|
|
5592
|
-
<td class="description last"><p
|
|
5707
|
+
<td class="description last"><p>輸入逾時毫秒正整數,逾時將強制關閉子進程及其子孫程序,全套件統一預設300000</p></td>
|
|
5593
5708
|
</tr>
|
|
5594
5709
|
|
|
5595
5710
|
|
|
@@ -5794,7 +5909,7 @@ prompt一律走stdin而非位置參數,因摘要內文可達數萬字,當命
|
|
|
5794
5909
|
|
|
5795
5910
|
<dt class="tag-source">Source:</dt>
|
|
5796
5911
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
5797
|
-
<a href="dispatchOpencode.mjs.html">dispatchOpencode.mjs</a>, <a href="dispatchOpencode.mjs.html#
|
|
5912
|
+
<a href="dispatchOpencode.mjs.html">dispatchOpencode.mjs</a>, <a href="dispatchOpencode.mjs.html#line118">line 118</a>
|
|
5798
5913
|
</li></ul></dd>
|
|
5799
5914
|
|
|
5800
5915
|
|
|
@@ -6366,12 +6481,12 @@ await test()
|
|
|
6366
6481
|
|
|
6367
6482
|
<td class="default">
|
|
6368
6483
|
|
|
6369
|
-
<code>
|
|
6484
|
+
<code>300000</code>
|
|
6370
6485
|
|
|
6371
6486
|
</td>
|
|
6372
6487
|
|
|
6373
6488
|
|
|
6374
|
-
<td class="description last"><p
|
|
6489
|
+
<td class="description last"><p>輸入逾時毫秒正整數,逾時將強制關閉子進程及其子孫程序,全套件統一預設300000</p></td>
|
|
6375
6490
|
</tr>
|
|
6376
6491
|
|
|
6377
6492
|
|
|
@@ -7115,7 +7230,7 @@ console.log(getErrorResult(null).error)
|
|
|
7115
7230
|
|
|
7116
7231
|
<dt class="tag-source">Source:</dt>
|
|
7117
7232
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
7118
|
-
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#
|
|
7233
|
+
<a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line85">line 85</a>
|
|
7119
7234
|
</li></ul></dd>
|
|
7120
7235
|
|
|
7121
7236
|
|
|
@@ -7257,6 +7372,357 @@ console.log(getErrorResult(null).error)
|
|
|
7257
7372
|
|
|
7258
7373
|
|
|
7259
7374
|
|
|
7375
|
+
<h4 class="name" id="resolveProviders"><span class="type-signature"></span>resolveProviders<span class="signature">(providers, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Object}</span></h4>
|
|
7376
|
+
|
|
7377
|
+
|
|
7378
|
+
|
|
7379
|
+
|
|
7380
|
+
|
|
7381
|
+
|
|
7382
|
+
<dl class="details">
|
|
7383
|
+
|
|
7384
|
+
<dt class="tag-description">Description:</dt>
|
|
7385
|
+
<dd class="tag-description"><ul class="dummy"><li><p>展開providers定義條目:envVar → keys,並可依id自選子集</p>
|
|
7386
|
+
<p>特點:
|
|
7387
|
+
條目之envVar依env來源(預設process.env)展開為keys陣列(變數值以逗號分隔多把),envVar欄位自輸出移除;
|
|
7388
|
+
缺對應環境變數(或值為空)之條目停用並列入skipped,不中斷不throw;
|
|
7389
|
+
無envVar之條目(訂閱登入態CLI)原樣通過;條目已自帶有效keys者以keys為準;
|
|
7390
|
+
opt.pick可依id自選子集並以pick順序回傳(順序即遞補優先序);
|
|
7391
|
+
輸入陣列與條目皆不被改動(輸出為淺拷貝)</p></li></ul></dd>
|
|
7392
|
+
|
|
7393
|
+
|
|
7394
|
+
|
|
7395
|
+
<dt class="tag-source">Source:</dt>
|
|
7396
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
7397
|
+
<a href="resolveProviders.mjs.html">resolveProviders.mjs</a>, <a href="resolveProviders.mjs.html#line56">line 56</a>
|
|
7398
|
+
</li></ul></dd>
|
|
7399
|
+
|
|
7400
|
+
|
|
7401
|
+
|
|
7402
|
+
|
|
7403
|
+
|
|
7404
|
+
|
|
7405
|
+
|
|
7406
|
+
|
|
7407
|
+
|
|
7408
|
+
|
|
7409
|
+
|
|
7410
|
+
|
|
7411
|
+
|
|
7412
|
+
|
|
7413
|
+
|
|
7414
|
+
|
|
7415
|
+
|
|
7416
|
+
|
|
7417
|
+
|
|
7418
|
+
|
|
7419
|
+
|
|
7420
|
+
|
|
7421
|
+
|
|
7422
|
+
|
|
7423
|
+
|
|
7424
|
+
|
|
7425
|
+
|
|
7426
|
+
|
|
7427
|
+
|
|
7428
|
+
|
|
7429
|
+
|
|
7430
|
+
</dl>
|
|
7431
|
+
|
|
7432
|
+
|
|
7433
|
+
|
|
7434
|
+
|
|
7435
|
+
|
|
7436
|
+
|
|
7437
|
+
|
|
7438
|
+
|
|
7439
|
+
|
|
7440
|
+
|
|
7441
|
+
|
|
7442
|
+
<h5 class="h5-examples">Example</h5>
|
|
7443
|
+
|
|
7444
|
+
<pre class="prettyprint"><code>import resolveProviders from './src/resolveProviders.mjs'
|
|
7445
|
+
import providersAll from './src/providers.mjs'
|
|
7446
|
+
|
|
7447
|
+
process.loadEnvFile('./.env') //金鑰放.env, 變數值以逗號分隔多把
|
|
7448
|
+
|
|
7449
|
+
//全取: envVar展開為keys, 缺環境變數者列入skipped
|
|
7450
|
+
let { providers, table, skipped } = resolveProviders(providersAll)
|
|
7451
|
+
console.log(providers.length, skipped)
|
|
7452
|
+
// => 10 []
|
|
7453
|
+
|
|
7454
|
+
//自選: 依pick順序回傳(順序即遞補優先序), 可直接餵dispatchAiFallback
|
|
7455
|
+
let r2 = resolveProviders(providersAll, { pick: ['agnes:agnes-2.5-flash', 'claude:sonnet'] })
|
|
7456
|
+
console.log(r2.providers.map((p) => p.id))
|
|
7457
|
+
// => [ 'agnes:agnes-2.5-flash', 'claude:sonnet' ]
|
|
7458
|
+
|
|
7459
|
+
//table可直接餵dispatchAiWkf之providers定義表
|
|
7460
|
+
//let wkf = dispatchAiWkf({ providers: r2.table, defaults: { timeoutMs: 1200000 } })</code></pre>
|
|
7461
|
+
|
|
7462
|
+
|
|
7463
|
+
|
|
7464
|
+
|
|
7465
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
7466
|
+
|
|
7467
|
+
|
|
7468
|
+
<table class="params">
|
|
7469
|
+
<thead>
|
|
7470
|
+
<tr>
|
|
7471
|
+
|
|
7472
|
+
<th>Name</th>
|
|
7473
|
+
|
|
7474
|
+
|
|
7475
|
+
<th>Type</th>
|
|
7476
|
+
|
|
7477
|
+
|
|
7478
|
+
<th>Attributes</th>
|
|
7479
|
+
|
|
7480
|
+
|
|
7481
|
+
|
|
7482
|
+
<th>Default</th>
|
|
7483
|
+
|
|
7484
|
+
|
|
7485
|
+
<th class="last">Description</th>
|
|
7486
|
+
</tr>
|
|
7487
|
+
</thead>
|
|
7488
|
+
|
|
7489
|
+
<tbody>
|
|
7490
|
+
|
|
7491
|
+
|
|
7492
|
+
<tr>
|
|
7493
|
+
|
|
7494
|
+
<td class="name"><code>providers</code></td>
|
|
7495
|
+
|
|
7496
|
+
|
|
7497
|
+
<td class="type">
|
|
7498
|
+
|
|
7499
|
+
|
|
7500
|
+
<span class="param-type">Array</span>
|
|
7501
|
+
|
|
7502
|
+
|
|
7503
|
+
|
|
7504
|
+
|
|
7505
|
+
</td>
|
|
7506
|
+
|
|
7507
|
+
|
|
7508
|
+
<td class="attributes">
|
|
7509
|
+
|
|
7510
|
+
|
|
7511
|
+
|
|
7512
|
+
|
|
7513
|
+
|
|
7514
|
+
</td>
|
|
7515
|
+
|
|
7516
|
+
|
|
7517
|
+
|
|
7518
|
+
<td class="default">
|
|
7519
|
+
|
|
7520
|
+
</td>
|
|
7521
|
+
|
|
7522
|
+
|
|
7523
|
+
<td class="description last"><p>輸入providers條目物件陣列(如providers.mjs之預設匯出)</p></td>
|
|
7524
|
+
</tr>
|
|
7525
|
+
|
|
7526
|
+
|
|
7527
|
+
|
|
7528
|
+
<tr>
|
|
7529
|
+
|
|
7530
|
+
<td class="name"><code>opt</code></td>
|
|
7531
|
+
|
|
7532
|
+
|
|
7533
|
+
<td class="type">
|
|
7534
|
+
|
|
7535
|
+
|
|
7536
|
+
<span class="param-type">Object</span>
|
|
7537
|
+
|
|
7538
|
+
|
|
7539
|
+
|
|
7540
|
+
|
|
7541
|
+
</td>
|
|
7542
|
+
|
|
7543
|
+
|
|
7544
|
+
<td class="attributes">
|
|
7545
|
+
|
|
7546
|
+
<optional><br>
|
|
7547
|
+
|
|
7548
|
+
|
|
7549
|
+
|
|
7550
|
+
|
|
7551
|
+
|
|
7552
|
+
</td>
|
|
7553
|
+
|
|
7554
|
+
|
|
7555
|
+
|
|
7556
|
+
<td class="default">
|
|
7557
|
+
|
|
7558
|
+
<code>{}</code>
|
|
7559
|
+
|
|
7560
|
+
</td>
|
|
7561
|
+
|
|
7562
|
+
|
|
7563
|
+
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
7564
|
+
<h6>Properties</h6>
|
|
7565
|
+
|
|
7566
|
+
|
|
7567
|
+
<table class="params">
|
|
7568
|
+
<thead>
|
|
7569
|
+
<tr>
|
|
7570
|
+
|
|
7571
|
+
<th>Name</th>
|
|
7572
|
+
|
|
7573
|
+
|
|
7574
|
+
<th>Type</th>
|
|
7575
|
+
|
|
7576
|
+
|
|
7577
|
+
<th>Attributes</th>
|
|
7578
|
+
|
|
7579
|
+
|
|
7580
|
+
|
|
7581
|
+
<th>Default</th>
|
|
7582
|
+
|
|
7583
|
+
|
|
7584
|
+
<th class="last">Description</th>
|
|
7585
|
+
</tr>
|
|
7586
|
+
</thead>
|
|
7587
|
+
|
|
7588
|
+
<tbody>
|
|
7589
|
+
|
|
7590
|
+
|
|
7591
|
+
<tr>
|
|
7592
|
+
|
|
7593
|
+
<td class="name"><code>env</code></td>
|
|
7594
|
+
|
|
7595
|
+
|
|
7596
|
+
<td class="type">
|
|
7597
|
+
|
|
7598
|
+
|
|
7599
|
+
<span class="param-type">Object</span>
|
|
7600
|
+
|
|
7601
|
+
|
|
7602
|
+
|
|
7603
|
+
|
|
7604
|
+
</td>
|
|
7605
|
+
|
|
7606
|
+
|
|
7607
|
+
<td class="attributes">
|
|
7608
|
+
|
|
7609
|
+
<optional><br>
|
|
7610
|
+
|
|
7611
|
+
|
|
7612
|
+
|
|
7613
|
+
|
|
7614
|
+
|
|
7615
|
+
</td>
|
|
7616
|
+
|
|
7617
|
+
|
|
7618
|
+
|
|
7619
|
+
<td class="default">
|
|
7620
|
+
|
|
7621
|
+
<code>process.env</code>
|
|
7622
|
+
|
|
7623
|
+
</td>
|
|
7624
|
+
|
|
7625
|
+
|
|
7626
|
+
<td class="description last"><p>輸入金鑰來源物件(變數名 → 逗號分隔之金鑰字串),預設process.env</p></td>
|
|
7627
|
+
</tr>
|
|
7628
|
+
|
|
7629
|
+
|
|
7630
|
+
|
|
7631
|
+
<tr>
|
|
7632
|
+
|
|
7633
|
+
<td class="name"><code>pick</code></td>
|
|
7634
|
+
|
|
7635
|
+
|
|
7636
|
+
<td class="type">
|
|
7637
|
+
|
|
7638
|
+
|
|
7639
|
+
<span class="param-type">Array</span>
|
|
7640
|
+
|
|
7641
|
+
|
|
7642
|
+
|
|
7643
|
+
|
|
7644
|
+
</td>
|
|
7645
|
+
|
|
7646
|
+
|
|
7647
|
+
<td class="attributes">
|
|
7648
|
+
|
|
7649
|
+
<optional><br>
|
|
7650
|
+
|
|
7651
|
+
|
|
7652
|
+
|
|
7653
|
+
|
|
7654
|
+
|
|
7655
|
+
</td>
|
|
7656
|
+
|
|
7657
|
+
|
|
7658
|
+
|
|
7659
|
+
<td class="default">
|
|
7660
|
+
|
|
7661
|
+
<code>null</code>
|
|
7662
|
+
|
|
7663
|
+
</td>
|
|
7664
|
+
|
|
7665
|
+
|
|
7666
|
+
<td class="description last"><p>輸入自選id字串陣列,依此順序回傳對應條目,查無之id列入missing,預設null代表全取(依原順序)</p></td>
|
|
7667
|
+
</tr>
|
|
7668
|
+
|
|
7669
|
+
|
|
7670
|
+
</tbody>
|
|
7671
|
+
</table>
|
|
7672
|
+
|
|
7673
|
+
</td>
|
|
7674
|
+
</tr>
|
|
7675
|
+
|
|
7676
|
+
|
|
7677
|
+
</tbody>
|
|
7678
|
+
</table>
|
|
7679
|
+
|
|
7680
|
+
|
|
7681
|
+
|
|
7682
|
+
|
|
7683
|
+
|
|
7684
|
+
|
|
7685
|
+
|
|
7686
|
+
|
|
7687
|
+
|
|
7688
|
+
|
|
7689
|
+
|
|
7690
|
+
|
|
7691
|
+
|
|
7692
|
+
|
|
7693
|
+
|
|
7694
|
+
|
|
7695
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
7696
|
+
|
|
7697
|
+
|
|
7698
|
+
<div class="param-desc">
|
|
7699
|
+
<p>回傳物件,內含providers(可直接餵dispatchAiFallback之條目陣列)、table(id對條目之物件,可直接餵dispatchAiWkf)、skipped(缺環境變數而停用之{id,envVar}陣列)、missing(pick查無之id字串陣列)</p>
|
|
7700
|
+
</div>
|
|
7701
|
+
|
|
7702
|
+
|
|
7703
|
+
|
|
7704
|
+
<dl class="param-type">
|
|
7705
|
+
<dt>
|
|
7706
|
+
Type
|
|
7707
|
+
</dt>
|
|
7708
|
+
<dd>
|
|
7709
|
+
|
|
7710
|
+
<span class="param-type">Object</span>
|
|
7711
|
+
|
|
7712
|
+
|
|
7713
|
+
|
|
7714
|
+
</dd>
|
|
7715
|
+
</dl>
|
|
7716
|
+
|
|
7717
|
+
|
|
7718
|
+
|
|
7719
|
+
|
|
7720
|
+
|
|
7721
|
+
|
|
7722
|
+
|
|
7723
|
+
|
|
7724
|
+
|
|
7725
|
+
|
|
7260
7726
|
<h4 class="name" id="runFanout"><span class="type-signature type-signature-async">(async) </span>runFanout<span class="signature">(opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
7261
7727
|
|
|
7262
7728
|
|
|
@@ -8804,7 +9270,7 @@ await test()
|
|
|
8804
9270
|
<br class="clear">
|
|
8805
9271
|
|
|
8806
9272
|
<footer>
|
|
8807
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
9273
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Fri Aug 14 2026 12:30:07 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
8808
9274
|
</footer>
|
|
8809
9275
|
|
|
8810
9276
|
<script>prettyPrint();</script>
|