w-dispatch-ai 1.0.0 → 1.0.2

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/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#dispatchAi">dispatchAi</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#getCliArgs">getCliArgs</a></li><li><a href="global.html#getErrorResult">getErrorResult</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#dispatchAi">dispatchAi</a></li><li><a href="global.html#dispatchAiFallback">dispatchAiFallback</a></li><li><a href="global.html#dispatchAntigravity">dispatchAntigravity</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#getCliArgs">getCliArgs</a></li><li><a href="global.html#getErrorResult">getErrorResult</a></li><li><a href="global.html#isKeyIndependentFail">isKeyIndependentFail</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#line29">line 29</a>
143
+ <a href="WDispatchAi.mjs.html">WDispatchAi.mjs</a>, <a href="WDispatchAi.mjs.html#line31">line 31</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、dispatchOpencode、dispatchClaude、dispatchCodex範例</code></pre>
194
+ <pre class="prettyprint"><code>詳見dispatchAi、dispatchAiFallback、dispatchOpencode、dispatchClaude、dispatchCodex、dispatchAntigravity範例</code></pre>
195
195
 
196
196
 
197
197
 
@@ -214,7 +214,7 @@
214
214
 
215
215
  <dt class="tag-source">Source:</dt>
216
216
  <dd class="tag-source"><ul class="dummy"><li>
217
- <a href="adapters.mjs.html">adapters.mjs</a>, <a href="adapters.mjs.html#line21">line 21</a>
217
+ <a href="adapters.mjs.html">adapters.mjs</a>, <a href="adapters.mjs.html#line22">line 22</a>
218
218
  </li></ul></dd>
219
219
 
220
220
 
@@ -270,7 +270,7 @@
270
270
  <pre class="prettyprint"><code>import adapters from './src/adapters.mjs'
271
271
 
272
272
  console.log(Object.keys(adapters))
273
- // => ['opencode', 'claude', 'codex']</code></pre>
273
+ // => ['opencode', 'claude', 'codex', 'antigravity']</code></pre>
274
274
 
275
275
 
276
276
 
@@ -532,6 +532,1442 @@ await test()
532
532
 
533
533
 
534
534
 
535
+ <h5 class="h5-returns">Returns:</h5>
536
+
537
+
538
+ <div class="param-desc">
539
+ <p>回傳Promise,resolve回傳結果物件,內含ok(是否成功布林值)、stdout(標準輸出字串)、stderr(標準錯誤字串)、code(離開碼)、error(錯誤訊息字串,成功時為空字串)、durationMs(耗時毫秒)、attempts(實際嘗試次數),本函數不會reject</p>
540
+ </div>
541
+
542
+
543
+
544
+ <dl class="param-type">
545
+ <dt>
546
+ Type
547
+ </dt>
548
+ <dd>
549
+
550
+ <span class="param-type">Promise</span>
551
+
552
+
553
+
554
+ </dd>
555
+ </dl>
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+
564
+
565
+
566
+ <h4 class="name" id="dispatchAiFallback"><span class="type-signature type-signature-async">(async) </span>dispatchAiFallback<span class="signature">(prompt, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
567
+
568
+
569
+
570
+
571
+
572
+
573
+ <dl class="details">
574
+
575
+ <dt class="tag-description">Description:</dt>
576
+ <dd class="tag-description"><ul class="dummy"><li><p>依供應商清單順序自動遞補調用AI,組內多金鑰以游標輪替</p>
577
+ <p>特點:
578
+ providers陣列順序即優先序,排前面的先用;
579
+ 條目本身即該次調用之opt(除id與keys外原樣透傳對應轉接器),與dispatchAi「條目直接當opt」同一約定;
580
+ 條目給予keys(多把金鑰)時以游標輪替,某把失敗自動換下一把,全數失敗才遞補下一組;
581
+ 與金鑰無關之失敗(逾時/執行檔不存在/參數錯誤/輸出未過驗證/未知kind)直接整組跳過,不逐把空耗;
582
+ 跨次執行僅記憶游標(經store注入持久化),不設金鑰停用清單——額度視窗形態多樣(5小時滾動/逐時/逐日),
583
+ 停用會把已恢復的金鑰閒置,而重探的代價僅一次快速失敗;
584
+ 本函數不會reject,一律以結果物件之ok與error欄位回報成敗</p></li></ul></dd>
585
+
586
+
587
+
588
+ <dt class="tag-source">Source:</dt>
589
+ <dd class="tag-source"><ul class="dummy"><li>
590
+ <a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line152">line 152</a>
591
+ </li></ul></dd>
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+
604
+
605
+
606
+
607
+
608
+
609
+
610
+
611
+
612
+
613
+
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+
622
+
623
+ </dl>
624
+
625
+
626
+
627
+
628
+
629
+
630
+
631
+
632
+
633
+
634
+
635
+ <h5 class="h5-examples">Example</h5>
636
+
637
+ <pre class="prettyprint"><code>//need opencode, claude, codex cli in system PATH
638
+
639
+ import dispatchAiFallback from './src/dispatchAiFallback.mjs'
640
+
641
+ let test = async () => {
642
+
643
+ let r = await dispatchAiFallback('請只回覆兩個字:完成', {
644
+ providers: [
645
+ {
646
+ id: 'deepseek',
647
+ kind: 'opencode',
648
+ model: 'opencode/deepseek-v4-flash-free',
649
+ provider: 'opencode',
650
+ keys: ['sk-aaa', 'sk-bbb'], //多把金鑰, 某把失敗自動換下一把
651
+ timeoutMs: 180000,
652
+ },
653
+ { id: 'claude', kind: 'claude', model: 'sonnet' }, //deepseek全敗時遞補
654
+ { id: 'codex', kind: 'codex', model: 'gpt-5.6-luna', sandbox: 'read-only' },
655
+ ],
656
+ budgetMs: 600000,
657
+ onEvent: (ev) => console.log(ev.type, ev.providerId, ev.keyIndex),
658
+ })
659
+ console.log(r.ok, r.providerId, r.keyIndex, r.tried.length)
660
+ // => true 'deepseek' 0 1
661
+
662
+ }
663
+ await test()
664
+ .catch((err) => {
665
+ console.log(err)
666
+ })</code></pre>
667
+
668
+
669
+
670
+
671
+ <h5 class="h5-parameters">Parameters:</h5>
672
+
673
+
674
+ <table class="params">
675
+ <thead>
676
+ <tr>
677
+
678
+ <th>Name</th>
679
+
680
+
681
+ <th>Type</th>
682
+
683
+
684
+ <th>Attributes</th>
685
+
686
+
687
+
688
+ <th>Default</th>
689
+
690
+
691
+ <th class="last">Description</th>
692
+ </tr>
693
+ </thead>
694
+
695
+ <tbody>
696
+
697
+
698
+ <tr>
699
+
700
+ <td class="name"><code>prompt</code></td>
701
+
702
+
703
+ <td class="type">
704
+
705
+
706
+ <span class="param-type">String</span>
707
+
708
+
709
+
710
+
711
+ </td>
712
+
713
+
714
+ <td class="attributes">
715
+
716
+
717
+
718
+
719
+
720
+ </td>
721
+
722
+
723
+
724
+ <td class="default">
725
+
726
+ </td>
727
+
728
+
729
+ <td class="description last"><p>輸入提示詞字串,一律以stdin傳入子進程</p></td>
730
+ </tr>
731
+
732
+
733
+
734
+ <tr>
735
+
736
+ <td class="name"><code>opt</code></td>
737
+
738
+
739
+ <td class="type">
740
+
741
+
742
+ <span class="param-type">Object</span>
743
+
744
+
745
+
746
+
747
+ </td>
748
+
749
+
750
+ <td class="attributes">
751
+
752
+ &lt;optional><br>
753
+
754
+
755
+
756
+
757
+
758
+ </td>
759
+
760
+
761
+
762
+ <td class="default">
763
+
764
+ <code>{}</code>
765
+
766
+ </td>
767
+
768
+
769
+ <td class="description last"><p>輸入設定物件,預設{}</p>
770
+ <h6>Properties</h6>
771
+
772
+
773
+ <table class="params">
774
+ <thead>
775
+ <tr>
776
+
777
+ <th>Name</th>
778
+
779
+
780
+ <th>Type</th>
781
+
782
+
783
+ <th>Attributes</th>
784
+
785
+
786
+
787
+ <th>Default</th>
788
+
789
+
790
+ <th class="last">Description</th>
791
+ </tr>
792
+ </thead>
793
+
794
+ <tbody>
795
+
796
+
797
+ <tr>
798
+
799
+ <td class="name"><code>providers</code></td>
800
+
801
+
802
+ <td class="type">
803
+
804
+
805
+ <span class="param-type">Array</span>
806
+
807
+
808
+
809
+
810
+ </td>
811
+
812
+
813
+ <td class="attributes">
814
+
815
+
816
+
817
+
818
+
819
+ </td>
820
+
821
+
822
+
823
+ <td class="default">
824
+
825
+ </td>
826
+
827
+
828
+ <td class="description last"><p>輸入供應商條目物件陣列,順序即優先序。各條目除下列鍵外,其餘鍵(kind、model、exe、provider、config、sandbox、timeoutMs等)即該條目之opt原樣透傳對應轉接器</p>
829
+ <h6>Properties</h6>
830
+
831
+
832
+ <table class="params">
833
+ <thead>
834
+ <tr>
835
+
836
+ <th>Name</th>
837
+
838
+
839
+ <th>Type</th>
840
+
841
+
842
+ <th>Attributes</th>
843
+
844
+
845
+
846
+ <th>Default</th>
847
+
848
+
849
+ <th class="last">Description</th>
850
+ </tr>
851
+ </thead>
852
+
853
+ <tbody>
854
+
855
+
856
+ <tr>
857
+
858
+ <td class="name"><code>id</code></td>
859
+
860
+
861
+ <td class="type">
862
+
863
+
864
+ <span class="param-type">String</span>
865
+
866
+
867
+
868
+
869
+ </td>
870
+
871
+
872
+ <td class="attributes">
873
+
874
+ &lt;optional><br>
875
+
876
+
877
+
878
+
879
+
880
+ </td>
881
+
882
+
883
+
884
+ <td class="default">
885
+
886
+ <code>條目索引字串</code>
887
+
888
+ </td>
889
+
890
+
891
+ <td class="description last"><p>輸入群組識別字串,游標以此為鍵,多金鑰條目應給予穩定id,預設為條目索引字串</p></td>
892
+ </tr>
893
+
894
+
895
+
896
+ <tr>
897
+
898
+ <td class="name"><code>keys</code></td>
899
+
900
+
901
+ <td class="type">
902
+
903
+
904
+ <span class="param-type">Array</span>
905
+
906
+
907
+
908
+
909
+ </td>
910
+
911
+
912
+ <td class="attributes">
913
+
914
+ &lt;optional><br>
915
+
916
+
917
+
918
+
919
+
920
+ </td>
921
+
922
+
923
+
924
+ <td class="default">
925
+
926
+ <code>[]</code>
927
+
928
+ </td>
929
+
930
+
931
+ <td class="description last"><p>輸入同一服務之多把API key字串陣列,逐次注入輪替(kind為opencode時須同時於條目給予provider),省略代表沿用CLI既有登入狀態之單一虛擬金鑰</p></td>
932
+ </tr>
933
+
934
+
935
+ </tbody>
936
+ </table>
937
+
938
+ </td>
939
+ </tr>
940
+
941
+
942
+
943
+ <tr>
944
+
945
+ <td class="name"><code>budgetMs</code></td>
946
+
947
+
948
+ <td class="type">
949
+
950
+
951
+ <span class="param-type">Number</span>
952
+
953
+
954
+
955
+
956
+ </td>
957
+
958
+
959
+ <td class="attributes">
960
+
961
+ &lt;optional><br>
962
+
963
+
964
+
965
+
966
+
967
+ </td>
968
+
969
+
970
+
971
+ <td class="default">
972
+
973
+ <code>null</code>
974
+
975
+ </td>
976
+
977
+
978
+ <td class="description last"><p>輸入整輪遞補之時間上限毫秒正整數,剩餘預算會壓進每次呼叫之timeoutMs,預設null代表不限</p></td>
979
+ </tr>
980
+
981
+
982
+
983
+ <tr>
984
+
985
+ <td class="name"><code>minAttemptMs</code></td>
986
+
987
+
988
+ <td class="type">
989
+
990
+
991
+ <span class="param-type">Number</span>
992
+
993
+
994
+
995
+
996
+ </td>
997
+
998
+
999
+ <td class="attributes">
1000
+
1001
+ &lt;optional><br>
1002
+
1003
+
1004
+
1005
+
1006
+
1007
+ </td>
1008
+
1009
+
1010
+
1011
+ <td class="default">
1012
+
1013
+ <code>20000</code>
1014
+
1015
+ </td>
1016
+
1017
+
1018
+ <td class="description last"><p>輸入單次嘗試之最低剩餘預算毫秒正整數,剩餘低於此值即停止嘗試回報budget exhausted,預設20000</p></td>
1019
+ </tr>
1020
+
1021
+
1022
+
1023
+ <tr>
1024
+
1025
+ <td class="name"><code>store</code></td>
1026
+
1027
+
1028
+ <td class="type">
1029
+
1030
+
1031
+ <span class="param-type">Object</span>
1032
+
1033
+
1034
+
1035
+
1036
+ </td>
1037
+
1038
+
1039
+ <td class="attributes">
1040
+
1041
+ &lt;optional><br>
1042
+
1043
+
1044
+
1045
+
1046
+
1047
+ </td>
1048
+
1049
+
1050
+
1051
+ <td class="default">
1052
+
1053
+ <code>null</code>
1054
+
1055
+ </td>
1056
+
1057
+
1058
+ <td class="description last"><p>輸入狀態持久化物件{get:()=&gt;state,set:(state)=&gt;{}},state內含cursors(逐群組游標),省略代表用行程內記憶體(跨呼叫有效,重啟歸零)。假定單行程序列調用,並行請自行加鎖</p></td>
1059
+ </tr>
1060
+
1061
+
1062
+
1063
+ <tr>
1064
+
1065
+ <td class="name"><code>onEvent</code></td>
1066
+
1067
+
1068
+ <td class="type">
1069
+
1070
+
1071
+ <span class="param-type">function</span>
1072
+
1073
+
1074
+
1075
+
1076
+ </td>
1077
+
1078
+
1079
+ <td class="attributes">
1080
+
1081
+ &lt;optional><br>
1082
+
1083
+
1084
+
1085
+
1086
+
1087
+ </td>
1088
+
1089
+
1090
+
1091
+ <td class="default">
1092
+
1093
+ <code>null</code>
1094
+
1095
+ </td>
1096
+
1097
+
1098
+ <td class="description last"><p>輸入事件回調函數(ev)=&gt;{},ev.type可為'try'、'ok'、'next-key'、'skip-group'、'budget-out',回調拋出例外不影響主流程,預設null</p></td>
1099
+ </tr>
1100
+
1101
+
1102
+
1103
+ <tr>
1104
+
1105
+ <td class="name"><code>timeoutMs</code></td>
1106
+
1107
+
1108
+ <td class="type">
1109
+
1110
+
1111
+ <span class="param-type">Number</span>
1112
+
1113
+
1114
+
1115
+
1116
+ </td>
1117
+
1118
+
1119
+ <td class="attributes">
1120
+
1121
+ &lt;optional><br>
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+ </td>
1128
+
1129
+
1130
+
1131
+ <td class="default">
1132
+
1133
+ <code>120000</code>
1134
+
1135
+ </td>
1136
+
1137
+
1138
+ <td class="description last"><p>輸入各attempt共用之逾時毫秒正整數,條目可覆寫,預設120000</p></td>
1139
+ </tr>
1140
+
1141
+
1142
+
1143
+ <tr>
1144
+
1145
+ <td class="name"><code>validate</code></td>
1146
+
1147
+
1148
+ <td class="type">
1149
+
1150
+
1151
+ <span class="param-type">String</span>
1152
+ |
1153
+
1154
+ <span class="param-type">function</span>
1155
+
1156
+
1157
+
1158
+
1159
+ </td>
1160
+
1161
+
1162
+ <td class="attributes">
1163
+
1164
+ &lt;optional><br>
1165
+
1166
+
1167
+
1168
+
1169
+
1170
+ </td>
1171
+
1172
+
1173
+
1174
+ <td class="default">
1175
+
1176
+ </td>
1177
+
1178
+
1179
+ <td class="description last"><p>輸入各attempt共用之stdout驗證規則,條目可覆寫,預設undefined</p></td>
1180
+ </tr>
1181
+
1182
+
1183
+
1184
+ <tr>
1185
+
1186
+ <td class="name"><code>maxRetries</code></td>
1187
+
1188
+
1189
+ <td class="type">
1190
+
1191
+
1192
+ <span class="param-type">Number</span>
1193
+
1194
+
1195
+
1196
+
1197
+ </td>
1198
+
1199
+
1200
+ <td class="attributes">
1201
+
1202
+ &lt;optional><br>
1203
+
1204
+
1205
+
1206
+
1207
+
1208
+ </td>
1209
+
1210
+
1211
+
1212
+ <td class="default">
1213
+
1214
+ <code>0</code>
1215
+
1216
+ </td>
1217
+
1218
+
1219
+ <td class="description last"><p>輸入各attempt共用之同家重試次數非負整數,韌性建議交給換家而非重試同一家,預設0</p></td>
1220
+ </tr>
1221
+
1222
+
1223
+ </tbody>
1224
+ </table>
1225
+
1226
+ </td>
1227
+ </tr>
1228
+
1229
+
1230
+ </tbody>
1231
+ </table>
1232
+
1233
+
1234
+
1235
+
1236
+
1237
+
1238
+
1239
+
1240
+
1241
+
1242
+
1243
+
1244
+
1245
+
1246
+
1247
+
1248
+ <h5 class="h5-returns">Returns:</h5>
1249
+
1250
+
1251
+ <div class="param-desc">
1252
+ <p>回傳Promise,resolve回傳結果物件,除execCli既有欄位(ok、stdout、stderr、code、error、durationMs、attempts、pid)外,追加providerId(實際使用之群組)、keyIndex(實際使用之金鑰索引,無keys時為null)、kind、model、tried(全部嘗試歷程陣列,成功時亦回傳),本函數不會reject</p>
1253
+ </div>
1254
+
1255
+
1256
+
1257
+ <dl class="param-type">
1258
+ <dt>
1259
+ Type
1260
+ </dt>
1261
+ <dd>
1262
+
1263
+ <span class="param-type">Promise</span>
1264
+
1265
+
1266
+
1267
+ </dd>
1268
+ </dl>
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+
1278
+
1279
+ <h4 class="name" id="dispatchAntigravity"><span class="type-signature type-signature-async">(async) </span>dispatchAntigravity<span class="signature">(prompt, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1280
+
1281
+
1282
+
1283
+
1284
+
1285
+
1286
+ <dl class="details">
1287
+
1288
+ <dt class="tag-description">Description:</dt>
1289
+ <dd class="tag-description"><ul class="dummy"><li><p>以Google Antigravity CLI(agy)呼叫AI模型</p>
1290
+ <p>特點:
1291
+ prompt作為<code>--print</code>旗標之值傳遞而非stdin(agy介面如此,塞stdin會進互動模式卡住),
1292
+ 故prompt受命令列長度上限約束,超過30000字元回傳錯誤結果物件;
1293
+ model須為<code>agy models</code>第一欄之slug(如gemini-3.6-flash-low),注意agy錯誤訊息列出的是顯示名稱而非slug;
1294
+ 帶檔位之slug(-high/-medium/-low結尾)與effort同時給定且檔位不一致時agy回conflicts錯誤(一致則放行),
1295
+ effort需agy&gt;=1.1.11,建議搭配不帶檔位之基礎slug(如gemini-3.1-pro)使用;
1296
+ 預設帶<code>--dangerously-skip-permissions</code>令非互動print模式不卡權限確認,可給予skipPermissions為false保留權限閘門;
1297
+ agy自身之--print-timeout未給時由timeoutMs推導並預留30秒緩衝,令CLI先於外層逾時;
1298
+ 沿用agy既有OAuth登入狀態(首次須於桌面互動模式完成登入);
1299
+ 本函數不會reject,一律以結果物件之ok與error欄位回報成敗</p></li></ul></dd>
1300
+
1301
+
1302
+
1303
+ <dt class="tag-source">Source:</dt>
1304
+ <dd class="tag-source"><ul class="dummy"><li>
1305
+ <a href="dispatchAntigravity.mjs.html">dispatchAntigravity.mjs</a>, <a href="dispatchAntigravity.mjs.html#line105">line 105</a>
1306
+ </li></ul></dd>
1307
+
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+
1314
+
1315
+
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+
1323
+
1324
+
1325
+
1326
+
1327
+
1328
+
1329
+
1330
+
1331
+
1332
+
1333
+
1334
+
1335
+
1336
+
1337
+
1338
+ </dl>
1339
+
1340
+
1341
+
1342
+
1343
+
1344
+
1345
+
1346
+
1347
+
1348
+
1349
+
1350
+ <h5 class="h5-examples">Example</h5>
1351
+
1352
+ <pre class="prettyprint"><code>//need agy cli in system PATH, and OAuth login completed
1353
+
1354
+ import dispatchAntigravity from './src/dispatchAntigravity.mjs'
1355
+
1356
+ let test = async () => {
1357
+
1358
+ let r = await dispatchAntigravity('請只回覆兩個字:完成', { model: 'gemini-3.6-flash-low' })
1359
+ console.log(r.ok, r.stdout.trim())
1360
+ // => true 完成
1361
+
1362
+ //基礎slug搭配effort(不可用帶檔位之slug併用effort)
1363
+ let r2 = await dispatchAntigravity('請只回覆兩個字:完成', { model: 'gemini-3.1-pro', effort: 'low' })
1364
+ console.log(r2.ok)
1365
+ // => true
1366
+
1367
+ let re = await dispatchAntigravity('')
1368
+ console.log(re.ok, re.error)
1369
+ // => false 'prompt must be a non-empty string'
1370
+
1371
+ }
1372
+ await test()
1373
+ .catch((err) => {
1374
+ console.log(err)
1375
+ })</code></pre>
1376
+
1377
+
1378
+
1379
+
1380
+ <h5 class="h5-parameters">Parameters:</h5>
1381
+
1382
+
1383
+ <table class="params">
1384
+ <thead>
1385
+ <tr>
1386
+
1387
+ <th>Name</th>
1388
+
1389
+
1390
+ <th>Type</th>
1391
+
1392
+
1393
+ <th>Attributes</th>
1394
+
1395
+
1396
+
1397
+ <th>Default</th>
1398
+
1399
+
1400
+ <th class="last">Description</th>
1401
+ </tr>
1402
+ </thead>
1403
+
1404
+ <tbody>
1405
+
1406
+
1407
+ <tr>
1408
+
1409
+ <td class="name"><code>prompt</code></td>
1410
+
1411
+
1412
+ <td class="type">
1413
+
1414
+
1415
+ <span class="param-type">String</span>
1416
+
1417
+
1418
+
1419
+
1420
+ </td>
1421
+
1422
+
1423
+ <td class="attributes">
1424
+
1425
+
1426
+
1427
+
1428
+
1429
+ </td>
1430
+
1431
+
1432
+
1433
+ <td class="default">
1434
+
1435
+ </td>
1436
+
1437
+
1438
+ <td class="description last"><p>輸入提示詞字串,作為<code>--print</code>旗標之值傳遞,長度上限30000字元</p></td>
1439
+ </tr>
1440
+
1441
+
1442
+
1443
+ <tr>
1444
+
1445
+ <td class="name"><code>opt</code></td>
1446
+
1447
+
1448
+ <td class="type">
1449
+
1450
+
1451
+ <span class="param-type">Object</span>
1452
+
1453
+
1454
+
1455
+
1456
+ </td>
1457
+
1458
+
1459
+ <td class="attributes">
1460
+
1461
+ &lt;optional><br>
1462
+
1463
+
1464
+
1465
+
1466
+
1467
+ </td>
1468
+
1469
+
1470
+
1471
+ <td class="default">
1472
+
1473
+ <code>{}</code>
1474
+
1475
+ </td>
1476
+
1477
+
1478
+ <td class="description last"><p>輸入設定物件,預設{}</p>
1479
+ <h6>Properties</h6>
1480
+
1481
+
1482
+ <table class="params">
1483
+ <thead>
1484
+ <tr>
1485
+
1486
+ <th>Name</th>
1487
+
1488
+
1489
+ <th>Type</th>
1490
+
1491
+
1492
+ <th>Attributes</th>
1493
+
1494
+
1495
+
1496
+ <th>Default</th>
1497
+
1498
+
1499
+ <th class="last">Description</th>
1500
+ </tr>
1501
+ </thead>
1502
+
1503
+ <tbody>
1504
+
1505
+
1506
+ <tr>
1507
+
1508
+ <td class="name"><code>exe</code></td>
1509
+
1510
+
1511
+ <td class="type">
1512
+
1513
+
1514
+ <span class="param-type">String</span>
1515
+
1516
+
1517
+
1518
+
1519
+ </td>
1520
+
1521
+
1522
+ <td class="attributes">
1523
+
1524
+ &lt;optional><br>
1525
+
1526
+
1527
+
1528
+
1529
+
1530
+ </td>
1531
+
1532
+
1533
+
1534
+ <td class="default">
1535
+
1536
+ <code>'agy'</code>
1537
+
1538
+ </td>
1539
+
1540
+
1541
+ <td class="description last"><p>輸入agy執行檔名稱或絕對路徑字串,命令名為agy非antigravity,給予名稱時由execCli自系統PATH解析,預設'agy'</p></td>
1542
+ </tr>
1543
+
1544
+
1545
+
1546
+ <tr>
1547
+
1548
+ <td class="name"><code>model</code></td>
1549
+
1550
+
1551
+ <td class="type">
1552
+
1553
+
1554
+ <span class="param-type">String</span>
1555
+
1556
+
1557
+
1558
+
1559
+ </td>
1560
+
1561
+
1562
+ <td class="attributes">
1563
+
1564
+ &lt;optional><br>
1565
+
1566
+
1567
+
1568
+
1569
+
1570
+ </td>
1571
+
1572
+
1573
+
1574
+ <td class="default">
1575
+
1576
+ <code>''</code>
1577
+
1578
+ </td>
1579
+
1580
+
1581
+ <td class="description last"><p>輸入模型slug字串,須為<code>agy models</code>第一欄之slug,例如'gemini-3.6-flash-low'、'gemini-3.1-pro-high',預設''代表不帶<code>--model</code>旗標由agy自行決定</p></td>
1582
+ </tr>
1583
+
1584
+
1585
+
1586
+ <tr>
1587
+
1588
+ <td class="name"><code>effort</code></td>
1589
+
1590
+
1591
+ <td class="type">
1592
+
1593
+
1594
+ <span class="param-type">String</span>
1595
+
1596
+
1597
+
1598
+
1599
+ </td>
1600
+
1601
+
1602
+ <td class="attributes">
1603
+
1604
+ &lt;optional><br>
1605
+
1606
+
1607
+
1608
+
1609
+
1610
+ </td>
1611
+
1612
+
1613
+
1614
+ <td class="default">
1615
+
1616
+ <code>''</code>
1617
+
1618
+ </td>
1619
+
1620
+
1621
+ <td class="description last"><p>輸入推理深度字串,可選'low'、'medium'、'high',需agy&gt;=1.1.11,建議搭配不帶檔位之基礎slug;與帶檔位slug併用且檔位不一致時agy回conflicts錯誤,預設''代表不帶</p></td>
1622
+ </tr>
1623
+
1624
+
1625
+
1626
+ <tr>
1627
+
1628
+ <td class="name"><code>skipPermissions</code></td>
1629
+
1630
+
1631
+ <td class="type">
1632
+
1633
+
1634
+ <span class="param-type">Boolean</span>
1635
+
1636
+
1637
+
1638
+
1639
+ </td>
1640
+
1641
+
1642
+ <td class="attributes">
1643
+
1644
+ &lt;optional><br>
1645
+
1646
+
1647
+
1648
+
1649
+
1650
+ </td>
1651
+
1652
+
1653
+
1654
+ <td class="default">
1655
+
1656
+ <code>true</code>
1657
+
1658
+ </td>
1659
+
1660
+
1661
+ <td class="description last"><p>輸入是否帶<code>--dangerously-skip-permissions</code>旗標布林值,false代表保留CLI權限閘門,預設true</p></td>
1662
+ </tr>
1663
+
1664
+
1665
+
1666
+ <tr>
1667
+
1668
+ <td class="name"><code>printTimeout</code></td>
1669
+
1670
+
1671
+ <td class="type">
1672
+
1673
+
1674
+ <span class="param-type">String</span>
1675
+
1676
+
1677
+
1678
+
1679
+ </td>
1680
+
1681
+
1682
+ <td class="attributes">
1683
+
1684
+ &lt;optional><br>
1685
+
1686
+
1687
+
1688
+
1689
+
1690
+ </td>
1691
+
1692
+
1693
+
1694
+ <td class="default">
1695
+
1696
+ <code>''</code>
1697
+
1698
+ </td>
1699
+
1700
+
1701
+ <td class="description last"><p>輸入agy自身等待上限字串(如'10m'、'570s'),預設''代表由timeoutMs推導(扣30秒緩衝,下限30秒)</p></td>
1702
+ </tr>
1703
+
1704
+
1705
+
1706
+ <tr>
1707
+
1708
+ <td class="name"><code>addDirs</code></td>
1709
+
1710
+
1711
+ <td class="type">
1712
+
1713
+
1714
+ <span class="param-type">Array</span>
1715
+
1716
+
1717
+
1718
+
1719
+ </td>
1720
+
1721
+
1722
+ <td class="attributes">
1723
+
1724
+ &lt;optional><br>
1725
+
1726
+
1727
+
1728
+
1729
+
1730
+ </td>
1731
+
1732
+
1733
+
1734
+ <td class="default">
1735
+
1736
+ <code>[]</code>
1737
+
1738
+ </td>
1739
+
1740
+
1741
+ <td class="description last"><p>輸入加入workspace之目錄字串陣列,逐項展開為<code>--add-dir</code>,預設[]</p></td>
1742
+ </tr>
1743
+
1744
+
1745
+
1746
+ <tr>
1747
+
1748
+ <td class="name"><code>extraArgs</code></td>
1749
+
1750
+
1751
+ <td class="type">
1752
+
1753
+
1754
+ <span class="param-type">Array</span>
1755
+
1756
+
1757
+
1758
+
1759
+ </td>
1760
+
1761
+
1762
+ <td class="attributes">
1763
+
1764
+ &lt;optional><br>
1765
+
1766
+
1767
+
1768
+
1769
+
1770
+ </td>
1771
+
1772
+
1773
+
1774
+ <td class="default">
1775
+
1776
+ <code>[]</code>
1777
+
1778
+ </td>
1779
+
1780
+
1781
+ <td class="description last"><p>輸入額外命令列旗標字串陣列(如--output-format、--json-schema、--mode),將接於固定旗標之後、<code>--print</code>之前,預設[]</p></td>
1782
+ </tr>
1783
+
1784
+
1785
+
1786
+ <tr>
1787
+
1788
+ <td class="name"><code>timeoutMs</code></td>
1789
+
1790
+
1791
+ <td class="type">
1792
+
1793
+
1794
+ <span class="param-type">Number</span>
1795
+
1796
+
1797
+
1798
+
1799
+ </td>
1800
+
1801
+
1802
+ <td class="attributes">
1803
+
1804
+ &lt;optional><br>
1805
+
1806
+
1807
+
1808
+
1809
+
1810
+ </td>
1811
+
1812
+
1813
+
1814
+ <td class="default">
1815
+
1816
+ <code>300000</code>
1817
+
1818
+ </td>
1819
+
1820
+
1821
+ <td class="description last"><p>輸入逾時毫秒正整數,逾時將強制關閉子進程及其子孫程序,agy為agent型CLI故預設較長之300000,預設300000</p></td>
1822
+ </tr>
1823
+
1824
+
1825
+
1826
+ <tr>
1827
+
1828
+ <td class="name"><code>cwd</code></td>
1829
+
1830
+
1831
+ <td class="type">
1832
+
1833
+
1834
+ <span class="param-type">String</span>
1835
+
1836
+
1837
+
1838
+
1839
+ </td>
1840
+
1841
+
1842
+ <td class="attributes">
1843
+
1844
+ &lt;optional><br>
1845
+
1846
+
1847
+
1848
+
1849
+
1850
+ </td>
1851
+
1852
+
1853
+
1854
+ <td class="default">
1855
+
1856
+ <code>process.cwd()</code>
1857
+
1858
+ </td>
1859
+
1860
+
1861
+ <td class="description last"><p>輸入子進程工作目錄字串,預設process.cwd()</p></td>
1862
+ </tr>
1863
+
1864
+
1865
+
1866
+ <tr>
1867
+
1868
+ <td class="name"><code>validate</code></td>
1869
+
1870
+
1871
+ <td class="type">
1872
+
1873
+
1874
+ <span class="param-type">String</span>
1875
+ |
1876
+
1877
+ <span class="param-type">function</span>
1878
+
1879
+
1880
+
1881
+
1882
+ </td>
1883
+
1884
+
1885
+ <td class="attributes">
1886
+
1887
+ &lt;optional><br>
1888
+
1889
+
1890
+
1891
+
1892
+
1893
+ </td>
1894
+
1895
+
1896
+
1897
+ <td class="default">
1898
+
1899
+ </td>
1900
+
1901
+
1902
+ <td class="description last"><p>輸入stdout驗證規則字串或自訂驗證函數,規則字串支援'nonempty'、'json'、'min:100',多規則可用逗號串接,預設undefined代表不驗證</p></td>
1903
+ </tr>
1904
+
1905
+
1906
+
1907
+ <tr>
1908
+
1909
+ <td class="name"><code>maxRetries</code></td>
1910
+
1911
+
1912
+ <td class="type">
1913
+
1914
+
1915
+ <span class="param-type">Number</span>
1916
+
1917
+
1918
+
1919
+
1920
+ </td>
1921
+
1922
+
1923
+ <td class="attributes">
1924
+
1925
+ &lt;optional><br>
1926
+
1927
+
1928
+
1929
+
1930
+
1931
+ </td>
1932
+
1933
+
1934
+
1935
+ <td class="default">
1936
+
1937
+ <code>0</code>
1938
+
1939
+ </td>
1940
+
1941
+
1942
+ <td class="description last"><p>輸入失敗後最大重試次數非負整數,預設0</p></td>
1943
+ </tr>
1944
+
1945
+
1946
+ </tbody>
1947
+ </table>
1948
+
1949
+ </td>
1950
+ </tr>
1951
+
1952
+
1953
+ </tbody>
1954
+ </table>
1955
+
1956
+
1957
+
1958
+
1959
+
1960
+
1961
+
1962
+
1963
+
1964
+
1965
+
1966
+
1967
+
1968
+
1969
+
1970
+
535
1971
  <h5 class="h5-returns">Returns:</h5>
536
1972
 
537
1973
 
@@ -2892,6 +4328,164 @@ console.log(getErrorResult(null).error)
2892
4328
 
2893
4329
 
2894
4330
 
4331
+
4332
+
4333
+
4334
+
4335
+ <h4 class="name" id="isKeyIndependentFail"><span class="type-signature"></span>isKeyIndependentFail<span class="signature">(r)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
4336
+
4337
+
4338
+
4339
+
4340
+
4341
+
4342
+ <dl class="details">
4343
+
4344
+ <dt class="tag-description">Description:</dt>
4345
+ <dd class="tag-description"><ul class="dummy"><li><p>判斷失敗結果是否與「哪一把金鑰」無關(換組內金鑰必然再敗, 應整組跳過)</p></li></ul></dd>
4346
+
4347
+
4348
+
4349
+ <dt class="tag-source">Source:</dt>
4350
+ <dd class="tag-source"><ul class="dummy"><li>
4351
+ <a href="dispatchAiFallback.mjs.html">dispatchAiFallback.mjs</a>, <a href="dispatchAiFallback.mjs.html#line56">line 56</a>
4352
+ </li></ul></dd>
4353
+
4354
+
4355
+
4356
+
4357
+
4358
+
4359
+
4360
+
4361
+
4362
+
4363
+
4364
+
4365
+
4366
+
4367
+
4368
+
4369
+
4370
+
4371
+
4372
+
4373
+
4374
+
4375
+
4376
+
4377
+
4378
+
4379
+
4380
+
4381
+
4382
+
4383
+
4384
+ </dl>
4385
+
4386
+
4387
+
4388
+
4389
+
4390
+
4391
+
4392
+
4393
+
4394
+
4395
+
4396
+
4397
+
4398
+ <h5 class="h5-parameters">Parameters:</h5>
4399
+
4400
+
4401
+ <table class="params">
4402
+ <thead>
4403
+ <tr>
4404
+
4405
+ <th>Name</th>
4406
+
4407
+
4408
+ <th>Type</th>
4409
+
4410
+
4411
+
4412
+
4413
+
4414
+ <th class="last">Description</th>
4415
+ </tr>
4416
+ </thead>
4417
+
4418
+ <tbody>
4419
+
4420
+
4421
+ <tr>
4422
+
4423
+ <td class="name"><code>r</code></td>
4424
+
4425
+
4426
+ <td class="type">
4427
+
4428
+
4429
+ <span class="param-type">Object</span>
4430
+
4431
+
4432
+
4433
+
4434
+ </td>
4435
+
4436
+
4437
+
4438
+
4439
+
4440
+ <td class="description last"><p>輸入dispatchAi失敗結果物件</p></td>
4441
+ </tr>
4442
+
4443
+
4444
+ </tbody>
4445
+ </table>
4446
+
4447
+
4448
+
4449
+
4450
+
4451
+
4452
+
4453
+
4454
+
4455
+
4456
+
4457
+
4458
+
4459
+
4460
+
4461
+
4462
+ <h5 class="h5-returns">Returns:</h5>
4463
+
4464
+
4465
+ <div class="param-desc">
4466
+ <p>回傳是否應整組跳過之布林值</p>
4467
+ </div>
4468
+
4469
+
4470
+
4471
+ <dl class="param-type">
4472
+ <dt>
4473
+ Type
4474
+ </dt>
4475
+ <dd>
4476
+
4477
+ <span class="param-type">Boolean</span>
4478
+
4479
+
4480
+
4481
+ </dd>
4482
+ </dl>
4483
+
4484
+
4485
+
4486
+
4487
+
4488
+
2895
4489
 
2896
4490
 
2897
4491
 
@@ -2911,7 +4505,7 @@ console.log(getErrorResult(null).error)
2911
4505
  <br class="clear">
2912
4506
 
2913
4507
  <footer>
2914
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sun Aug 09 2026 22:39:08 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
4508
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Mon Aug 10 2026 09:36:49 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2915
4509
  </footer>
2916
4510
 
2917
4511
  <script>prettyPrint();</script>