opencode-auto-resume 1.0.0 → 1.0.1
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 +10 -0
- package/dist/index.js +234 -123
- package/package.json +8 -2
- package/src/index.ts +0 -770
- package/tsconfig.json +0 -14
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __export = (target, all) => {
|
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
// node_modules/zod/v4/classic/external.js
|
|
17
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/external.js
|
|
18
18
|
var exports_external = {};
|
|
19
19
|
__export(exports_external, {
|
|
20
20
|
xid: () => xid2,
|
|
@@ -244,7 +244,7 @@ __export(exports_external, {
|
|
|
244
244
|
$brand: () => $brand
|
|
245
245
|
});
|
|
246
246
|
|
|
247
|
-
// node_modules/zod/v4/core/index.js
|
|
247
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/index.js
|
|
248
248
|
var exports_core2 = {};
|
|
249
249
|
__export(exports_core2, {
|
|
250
250
|
version: () => version,
|
|
@@ -508,7 +508,7 @@ __export(exports_core2, {
|
|
|
508
508
|
$ZodAny: () => $ZodAny
|
|
509
509
|
});
|
|
510
510
|
|
|
511
|
-
// node_modules/zod/v4/core/core.js
|
|
511
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/core.js
|
|
512
512
|
var NEVER = Object.freeze({
|
|
513
513
|
status: "aborted"
|
|
514
514
|
});
|
|
@@ -575,7 +575,7 @@ function config(newConfig) {
|
|
|
575
575
|
Object.assign(globalConfig, newConfig);
|
|
576
576
|
return globalConfig;
|
|
577
577
|
}
|
|
578
|
-
// node_modules/zod/v4/core/util.js
|
|
578
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/util.js
|
|
579
579
|
var exports_util = {};
|
|
580
580
|
__export(exports_util, {
|
|
581
581
|
unwrapMessage: () => unwrapMessage,
|
|
@@ -1204,7 +1204,7 @@ class Class {
|
|
|
1204
1204
|
constructor(..._args) {}
|
|
1205
1205
|
}
|
|
1206
1206
|
|
|
1207
|
-
// node_modules/zod/v4/core/errors.js
|
|
1207
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/errors.js
|
|
1208
1208
|
var initializer = (inst, def) => {
|
|
1209
1209
|
inst.name = "$ZodError";
|
|
1210
1210
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -1347,7 +1347,7 @@ function prettifyError(error) {
|
|
|
1347
1347
|
`);
|
|
1348
1348
|
}
|
|
1349
1349
|
|
|
1350
|
-
// node_modules/zod/v4/core/parse.js
|
|
1350
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/parse.js
|
|
1351
1351
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
1352
1352
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
1353
1353
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -1434,7 +1434,7 @@ var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
1434
1434
|
return _safeParseAsync(_Err)(schema, value, _ctx);
|
|
1435
1435
|
};
|
|
1436
1436
|
var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync($ZodRealError);
|
|
1437
|
-
// node_modules/zod/v4/core/regexes.js
|
|
1437
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/regexes.js
|
|
1438
1438
|
var exports_regexes = {};
|
|
1439
1439
|
__export(exports_regexes, {
|
|
1440
1440
|
xid: () => xid,
|
|
@@ -1586,7 +1586,7 @@ var sha512_hex = /^[0-9a-fA-F]{128}$/;
|
|
|
1586
1586
|
var sha512_base64 = /* @__PURE__ */ fixedBase64(86, "==");
|
|
1587
1587
|
var sha512_base64url = /* @__PURE__ */ fixedBase64url(86);
|
|
1588
1588
|
|
|
1589
|
-
// node_modules/zod/v4/core/checks.js
|
|
1589
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/checks.js
|
|
1590
1590
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
1591
1591
|
var _a;
|
|
1592
1592
|
inst._zod ?? (inst._zod = {});
|
|
@@ -2127,7 +2127,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
2127
2127
|
};
|
|
2128
2128
|
});
|
|
2129
2129
|
|
|
2130
|
-
// node_modules/zod/v4/core/doc.js
|
|
2130
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/doc.js
|
|
2131
2131
|
class Doc {
|
|
2132
2132
|
constructor(args = []) {
|
|
2133
2133
|
this.content = [];
|
|
@@ -2165,14 +2165,14 @@ class Doc {
|
|
|
2165
2165
|
}
|
|
2166
2166
|
}
|
|
2167
2167
|
|
|
2168
|
-
// node_modules/zod/v4/core/versions.js
|
|
2168
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/versions.js
|
|
2169
2169
|
var version = {
|
|
2170
2170
|
major: 4,
|
|
2171
2171
|
minor: 1,
|
|
2172
2172
|
patch: 8
|
|
2173
2173
|
};
|
|
2174
2174
|
|
|
2175
|
-
// node_modules/zod/v4/core/schemas.js
|
|
2175
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/schemas.js
|
|
2176
2176
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
2177
2177
|
var _a;
|
|
2178
2178
|
inst ?? (inst = {});
|
|
@@ -3995,7 +3995,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
3995
3995
|
payload.issues.push(issue(_iss));
|
|
3996
3996
|
}
|
|
3997
3997
|
}
|
|
3998
|
-
// node_modules/zod/v4/locales/index.js
|
|
3998
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/index.js
|
|
3999
3999
|
var exports_locales = {};
|
|
4000
4000
|
__export(exports_locales, {
|
|
4001
4001
|
zhTW: () => zh_TW_default,
|
|
@@ -4046,7 +4046,7 @@ __export(exports_locales, {
|
|
|
4046
4046
|
ar: () => ar_default
|
|
4047
4047
|
});
|
|
4048
4048
|
|
|
4049
|
-
// node_modules/zod/v4/locales/ar.js
|
|
4049
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ar.js
|
|
4050
4050
|
var error = () => {
|
|
4051
4051
|
const Sizable = {
|
|
4052
4052
|
string: { unit: "\u062D\u0631\u0641", verb: "\u0623\u0646 \u064A\u062D\u0648\u064A" },
|
|
@@ -4162,7 +4162,7 @@ function ar_default() {
|
|
|
4162
4162
|
localeError: error()
|
|
4163
4163
|
};
|
|
4164
4164
|
}
|
|
4165
|
-
// node_modules/zod/v4/locales/az.js
|
|
4165
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/az.js
|
|
4166
4166
|
var error2 = () => {
|
|
4167
4167
|
const Sizable = {
|
|
4168
4168
|
string: { unit: "simvol", verb: "olmal\u0131d\u0131r" },
|
|
@@ -4277,7 +4277,7 @@ function az_default() {
|
|
|
4277
4277
|
localeError: error2()
|
|
4278
4278
|
};
|
|
4279
4279
|
}
|
|
4280
|
-
// node_modules/zod/v4/locales/be.js
|
|
4280
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/be.js
|
|
4281
4281
|
function getBelarusianPlural(count, one, few, many) {
|
|
4282
4282
|
const absCount = Math.abs(count);
|
|
4283
4283
|
const lastDigit = absCount % 10;
|
|
@@ -4441,7 +4441,7 @@ function be_default() {
|
|
|
4441
4441
|
localeError: error3()
|
|
4442
4442
|
};
|
|
4443
4443
|
}
|
|
4444
|
-
// node_modules/zod/v4/locales/ca.js
|
|
4444
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ca.js
|
|
4445
4445
|
var error4 = () => {
|
|
4446
4446
|
const Sizable = {
|
|
4447
4447
|
string: { unit: "car\xE0cters", verb: "contenir" },
|
|
@@ -4558,7 +4558,7 @@ function ca_default() {
|
|
|
4558
4558
|
localeError: error4()
|
|
4559
4559
|
};
|
|
4560
4560
|
}
|
|
4561
|
-
// node_modules/zod/v4/locales/cs.js
|
|
4561
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/cs.js
|
|
4562
4562
|
var error5 = () => {
|
|
4563
4563
|
const Sizable = {
|
|
4564
4564
|
string: { unit: "znak\u016F", verb: "m\xEDt" },
|
|
@@ -4693,7 +4693,7 @@ function cs_default() {
|
|
|
4693
4693
|
localeError: error5()
|
|
4694
4694
|
};
|
|
4695
4695
|
}
|
|
4696
|
-
// node_modules/zod/v4/locales/da.js
|
|
4696
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/da.js
|
|
4697
4697
|
var error6 = () => {
|
|
4698
4698
|
const Sizable = {
|
|
4699
4699
|
string: { unit: "tegn", verb: "havde" },
|
|
@@ -4824,7 +4824,7 @@ function da_default() {
|
|
|
4824
4824
|
localeError: error6()
|
|
4825
4825
|
};
|
|
4826
4826
|
}
|
|
4827
|
-
// node_modules/zod/v4/locales/de.js
|
|
4827
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/de.js
|
|
4828
4828
|
var error7 = () => {
|
|
4829
4829
|
const Sizable = {
|
|
4830
4830
|
string: { unit: "Zeichen", verb: "zu haben" },
|
|
@@ -4940,7 +4940,7 @@ function de_default() {
|
|
|
4940
4940
|
localeError: error7()
|
|
4941
4941
|
};
|
|
4942
4942
|
}
|
|
4943
|
-
// node_modules/zod/v4/locales/en.js
|
|
4943
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/en.js
|
|
4944
4944
|
var parsedType = (data) => {
|
|
4945
4945
|
const t = typeof data;
|
|
4946
4946
|
switch (t) {
|
|
@@ -5057,7 +5057,7 @@ function en_default() {
|
|
|
5057
5057
|
localeError: error8()
|
|
5058
5058
|
};
|
|
5059
5059
|
}
|
|
5060
|
-
// node_modules/zod/v4/locales/eo.js
|
|
5060
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/eo.js
|
|
5061
5061
|
var parsedType2 = (data) => {
|
|
5062
5062
|
const t = typeof data;
|
|
5063
5063
|
switch (t) {
|
|
@@ -5173,7 +5173,7 @@ function eo_default() {
|
|
|
5173
5173
|
localeError: error9()
|
|
5174
5174
|
};
|
|
5175
5175
|
}
|
|
5176
|
-
// node_modules/zod/v4/locales/es.js
|
|
5176
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/es.js
|
|
5177
5177
|
var error10 = () => {
|
|
5178
5178
|
const Sizable = {
|
|
5179
5179
|
string: { unit: "caracteres", verb: "tener" },
|
|
@@ -5321,7 +5321,7 @@ function es_default() {
|
|
|
5321
5321
|
localeError: error10()
|
|
5322
5322
|
};
|
|
5323
5323
|
}
|
|
5324
|
-
// node_modules/zod/v4/locales/fa.js
|
|
5324
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/fa.js
|
|
5325
5325
|
var error11 = () => {
|
|
5326
5326
|
const Sizable = {
|
|
5327
5327
|
string: { unit: "\u06A9\u0627\u0631\u0627\u06A9\u062A\u0631", verb: "\u062F\u0627\u0634\u062A\u0647 \u0628\u0627\u0634\u062F" },
|
|
@@ -5443,7 +5443,7 @@ function fa_default() {
|
|
|
5443
5443
|
localeError: error11()
|
|
5444
5444
|
};
|
|
5445
5445
|
}
|
|
5446
|
-
// node_modules/zod/v4/locales/fi.js
|
|
5446
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/fi.js
|
|
5447
5447
|
var error12 = () => {
|
|
5448
5448
|
const Sizable = {
|
|
5449
5449
|
string: { unit: "merkki\xE4", subject: "merkkijonon" },
|
|
@@ -5565,7 +5565,7 @@ function fi_default() {
|
|
|
5565
5565
|
localeError: error12()
|
|
5566
5566
|
};
|
|
5567
5567
|
}
|
|
5568
|
-
// node_modules/zod/v4/locales/fr.js
|
|
5568
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/fr.js
|
|
5569
5569
|
var error13 = () => {
|
|
5570
5570
|
const Sizable = {
|
|
5571
5571
|
string: { unit: "caract\xE8res", verb: "avoir" },
|
|
@@ -5681,7 +5681,7 @@ function fr_default() {
|
|
|
5681
5681
|
localeError: error13()
|
|
5682
5682
|
};
|
|
5683
5683
|
}
|
|
5684
|
-
// node_modules/zod/v4/locales/fr-CA.js
|
|
5684
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/fr-CA.js
|
|
5685
5685
|
var error14 = () => {
|
|
5686
5686
|
const Sizable = {
|
|
5687
5687
|
string: { unit: "caract\xE8res", verb: "avoir" },
|
|
@@ -5798,7 +5798,7 @@ function fr_CA_default() {
|
|
|
5798
5798
|
localeError: error14()
|
|
5799
5799
|
};
|
|
5800
5800
|
}
|
|
5801
|
-
// node_modules/zod/v4/locales/he.js
|
|
5801
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/he.js
|
|
5802
5802
|
var error15 = () => {
|
|
5803
5803
|
const Sizable = {
|
|
5804
5804
|
string: { unit: "\u05D0\u05D5\u05EA\u05D9\u05D5\u05EA", verb: "\u05DC\u05DB\u05DC\u05D5\u05DC" },
|
|
@@ -5914,7 +5914,7 @@ function he_default() {
|
|
|
5914
5914
|
localeError: error15()
|
|
5915
5915
|
};
|
|
5916
5916
|
}
|
|
5917
|
-
// node_modules/zod/v4/locales/hu.js
|
|
5917
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/hu.js
|
|
5918
5918
|
var error16 = () => {
|
|
5919
5919
|
const Sizable = {
|
|
5920
5920
|
string: { unit: "karakter", verb: "legyen" },
|
|
@@ -6030,7 +6030,7 @@ function hu_default() {
|
|
|
6030
6030
|
localeError: error16()
|
|
6031
6031
|
};
|
|
6032
6032
|
}
|
|
6033
|
-
// node_modules/zod/v4/locales/id.js
|
|
6033
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/id.js
|
|
6034
6034
|
var error17 = () => {
|
|
6035
6035
|
const Sizable = {
|
|
6036
6036
|
string: { unit: "karakter", verb: "memiliki" },
|
|
@@ -6146,7 +6146,7 @@ function id_default() {
|
|
|
6146
6146
|
localeError: error17()
|
|
6147
6147
|
};
|
|
6148
6148
|
}
|
|
6149
|
-
// node_modules/zod/v4/locales/is.js
|
|
6149
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/is.js
|
|
6150
6150
|
var parsedType3 = (data) => {
|
|
6151
6151
|
const t = typeof data;
|
|
6152
6152
|
switch (t) {
|
|
@@ -6263,7 +6263,7 @@ function is_default() {
|
|
|
6263
6263
|
localeError: error18()
|
|
6264
6264
|
};
|
|
6265
6265
|
}
|
|
6266
|
-
// node_modules/zod/v4/locales/it.js
|
|
6266
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/it.js
|
|
6267
6267
|
var error19 = () => {
|
|
6268
6268
|
const Sizable = {
|
|
6269
6269
|
string: { unit: "caratteri", verb: "avere" },
|
|
@@ -6379,7 +6379,7 @@ function it_default() {
|
|
|
6379
6379
|
localeError: error19()
|
|
6380
6380
|
};
|
|
6381
6381
|
}
|
|
6382
|
-
// node_modules/zod/v4/locales/ja.js
|
|
6382
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ja.js
|
|
6383
6383
|
var error20 = () => {
|
|
6384
6384
|
const Sizable = {
|
|
6385
6385
|
string: { unit: "\u6587\u5B57", verb: "\u3067\u3042\u308B" },
|
|
@@ -6494,7 +6494,7 @@ function ja_default() {
|
|
|
6494
6494
|
localeError: error20()
|
|
6495
6495
|
};
|
|
6496
6496
|
}
|
|
6497
|
-
// node_modules/zod/v4/locales/ka.js
|
|
6497
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ka.js
|
|
6498
6498
|
var parsedType4 = (data) => {
|
|
6499
6499
|
const t = typeof data;
|
|
6500
6500
|
switch (t) {
|
|
@@ -6619,7 +6619,7 @@ function ka_default() {
|
|
|
6619
6619
|
localeError: error21()
|
|
6620
6620
|
};
|
|
6621
6621
|
}
|
|
6622
|
-
// node_modules/zod/v4/locales/km.js
|
|
6622
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/km.js
|
|
6623
6623
|
var error22 = () => {
|
|
6624
6624
|
const Sizable = {
|
|
6625
6625
|
string: { unit: "\u178F\u17BD\u17A2\u1780\u17D2\u179F\u179A", verb: "\u1782\u17BD\u179A\u1798\u17B6\u1793" },
|
|
@@ -6737,11 +6737,11 @@ function km_default() {
|
|
|
6737
6737
|
};
|
|
6738
6738
|
}
|
|
6739
6739
|
|
|
6740
|
-
// node_modules/zod/v4/locales/kh.js
|
|
6740
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/kh.js
|
|
6741
6741
|
function kh_default() {
|
|
6742
6742
|
return km_default();
|
|
6743
6743
|
}
|
|
6744
|
-
// node_modules/zod/v4/locales/ko.js
|
|
6744
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ko.js
|
|
6745
6745
|
var error23 = () => {
|
|
6746
6746
|
const Sizable = {
|
|
6747
6747
|
string: { unit: "\uBB38\uC790", verb: "to have" },
|
|
@@ -6862,7 +6862,7 @@ function ko_default() {
|
|
|
6862
6862
|
localeError: error23()
|
|
6863
6863
|
};
|
|
6864
6864
|
}
|
|
6865
|
-
// node_modules/zod/v4/locales/lt.js
|
|
6865
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/lt.js
|
|
6866
6866
|
var parsedType5 = (data) => {
|
|
6867
6867
|
const t = typeof data;
|
|
6868
6868
|
return parsedTypeFromType(t, data);
|
|
@@ -7091,7 +7091,7 @@ function lt_default() {
|
|
|
7091
7091
|
localeError: error24()
|
|
7092
7092
|
};
|
|
7093
7093
|
}
|
|
7094
|
-
// node_modules/zod/v4/locales/mk.js
|
|
7094
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/mk.js
|
|
7095
7095
|
var error25 = () => {
|
|
7096
7096
|
const Sizable = {
|
|
7097
7097
|
string: { unit: "\u0437\u043D\u0430\u0446\u0438", verb: "\u0434\u0430 \u0438\u043C\u0430\u0430\u0442" },
|
|
@@ -7208,7 +7208,7 @@ function mk_default() {
|
|
|
7208
7208
|
localeError: error25()
|
|
7209
7209
|
};
|
|
7210
7210
|
}
|
|
7211
|
-
// node_modules/zod/v4/locales/ms.js
|
|
7211
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ms.js
|
|
7212
7212
|
var error26 = () => {
|
|
7213
7213
|
const Sizable = {
|
|
7214
7214
|
string: { unit: "aksara", verb: "mempunyai" },
|
|
@@ -7324,7 +7324,7 @@ function ms_default() {
|
|
|
7324
7324
|
localeError: error26()
|
|
7325
7325
|
};
|
|
7326
7326
|
}
|
|
7327
|
-
// node_modules/zod/v4/locales/nl.js
|
|
7327
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/nl.js
|
|
7328
7328
|
var error27 = () => {
|
|
7329
7329
|
const Sizable = {
|
|
7330
7330
|
string: { unit: "tekens" },
|
|
@@ -7441,7 +7441,7 @@ function nl_default() {
|
|
|
7441
7441
|
localeError: error27()
|
|
7442
7442
|
};
|
|
7443
7443
|
}
|
|
7444
|
-
// node_modules/zod/v4/locales/no.js
|
|
7444
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/no.js
|
|
7445
7445
|
var error28 = () => {
|
|
7446
7446
|
const Sizable = {
|
|
7447
7447
|
string: { unit: "tegn", verb: "\xE5 ha" },
|
|
@@ -7557,7 +7557,7 @@ function no_default() {
|
|
|
7557
7557
|
localeError: error28()
|
|
7558
7558
|
};
|
|
7559
7559
|
}
|
|
7560
|
-
// node_modules/zod/v4/locales/ota.js
|
|
7560
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ota.js
|
|
7561
7561
|
var error29 = () => {
|
|
7562
7562
|
const Sizable = {
|
|
7563
7563
|
string: { unit: "harf", verb: "olmal\u0131d\u0131r" },
|
|
@@ -7673,7 +7673,7 @@ function ota_default() {
|
|
|
7673
7673
|
localeError: error29()
|
|
7674
7674
|
};
|
|
7675
7675
|
}
|
|
7676
|
-
// node_modules/zod/v4/locales/ps.js
|
|
7676
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ps.js
|
|
7677
7677
|
var error30 = () => {
|
|
7678
7678
|
const Sizable = {
|
|
7679
7679
|
string: { unit: "\u062A\u0648\u06A9\u064A", verb: "\u0648\u0644\u0631\u064A" },
|
|
@@ -7795,7 +7795,7 @@ function ps_default() {
|
|
|
7795
7795
|
localeError: error30()
|
|
7796
7796
|
};
|
|
7797
7797
|
}
|
|
7798
|
-
// node_modules/zod/v4/locales/pl.js
|
|
7798
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/pl.js
|
|
7799
7799
|
var error31 = () => {
|
|
7800
7800
|
const Sizable = {
|
|
7801
7801
|
string: { unit: "znak\xF3w", verb: "mie\u0107" },
|
|
@@ -7912,7 +7912,7 @@ function pl_default() {
|
|
|
7912
7912
|
localeError: error31()
|
|
7913
7913
|
};
|
|
7914
7914
|
}
|
|
7915
|
-
// node_modules/zod/v4/locales/pt.js
|
|
7915
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/pt.js
|
|
7916
7916
|
var error32 = () => {
|
|
7917
7917
|
const Sizable = {
|
|
7918
7918
|
string: { unit: "caracteres", verb: "ter" },
|
|
@@ -8028,7 +8028,7 @@ function pt_default() {
|
|
|
8028
8028
|
localeError: error32()
|
|
8029
8029
|
};
|
|
8030
8030
|
}
|
|
8031
|
-
// node_modules/zod/v4/locales/ru.js
|
|
8031
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ru.js
|
|
8032
8032
|
function getRussianPlural(count, one, few, many) {
|
|
8033
8033
|
const absCount = Math.abs(count);
|
|
8034
8034
|
const lastDigit = absCount % 10;
|
|
@@ -8192,7 +8192,7 @@ function ru_default() {
|
|
|
8192
8192
|
localeError: error33()
|
|
8193
8193
|
};
|
|
8194
8194
|
}
|
|
8195
|
-
// node_modules/zod/v4/locales/sl.js
|
|
8195
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/sl.js
|
|
8196
8196
|
var error34 = () => {
|
|
8197
8197
|
const Sizable = {
|
|
8198
8198
|
string: { unit: "znakov", verb: "imeti" },
|
|
@@ -8309,7 +8309,7 @@ function sl_default() {
|
|
|
8309
8309
|
localeError: error34()
|
|
8310
8310
|
};
|
|
8311
8311
|
}
|
|
8312
|
-
// node_modules/zod/v4/locales/sv.js
|
|
8312
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/sv.js
|
|
8313
8313
|
var error35 = () => {
|
|
8314
8314
|
const Sizable = {
|
|
8315
8315
|
string: { unit: "tecken", verb: "att ha" },
|
|
@@ -8427,7 +8427,7 @@ function sv_default() {
|
|
|
8427
8427
|
localeError: error35()
|
|
8428
8428
|
};
|
|
8429
8429
|
}
|
|
8430
|
-
// node_modules/zod/v4/locales/ta.js
|
|
8430
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ta.js
|
|
8431
8431
|
var error36 = () => {
|
|
8432
8432
|
const Sizable = {
|
|
8433
8433
|
string: { unit: "\u0B8E\u0BB4\u0BC1\u0BA4\u0BCD\u0BA4\u0BC1\u0B95\u0BCD\u0B95\u0BB3\u0BCD", verb: "\u0B95\u0BCA\u0BA3\u0BCD\u0B9F\u0BBF\u0BB0\u0BC1\u0B95\u0BCD\u0B95 \u0BB5\u0BC7\u0BA3\u0BCD\u0B9F\u0BC1\u0BAE\u0BCD" },
|
|
@@ -8544,7 +8544,7 @@ function ta_default() {
|
|
|
8544
8544
|
localeError: error36()
|
|
8545
8545
|
};
|
|
8546
8546
|
}
|
|
8547
|
-
// node_modules/zod/v4/locales/th.js
|
|
8547
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/th.js
|
|
8548
8548
|
var error37 = () => {
|
|
8549
8549
|
const Sizable = {
|
|
8550
8550
|
string: { unit: "\u0E15\u0E31\u0E27\u0E2D\u0E31\u0E01\u0E29\u0E23", verb: "\u0E04\u0E27\u0E23\u0E21\u0E35" },
|
|
@@ -8661,7 +8661,7 @@ function th_default() {
|
|
|
8661
8661
|
localeError: error37()
|
|
8662
8662
|
};
|
|
8663
8663
|
}
|
|
8664
|
-
// node_modules/zod/v4/locales/tr.js
|
|
8664
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/tr.js
|
|
8665
8665
|
var parsedType6 = (data) => {
|
|
8666
8666
|
const t = typeof data;
|
|
8667
8667
|
switch (t) {
|
|
@@ -8776,7 +8776,7 @@ function tr_default() {
|
|
|
8776
8776
|
localeError: error38()
|
|
8777
8777
|
};
|
|
8778
8778
|
}
|
|
8779
|
-
// node_modules/zod/v4/locales/uk.js
|
|
8779
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/uk.js
|
|
8780
8780
|
var error39 = () => {
|
|
8781
8781
|
const Sizable = {
|
|
8782
8782
|
string: { unit: "\u0441\u0438\u043C\u0432\u043E\u043B\u0456\u0432", verb: "\u043C\u0430\u0442\u0438\u043C\u0435" },
|
|
@@ -8893,11 +8893,11 @@ function uk_default() {
|
|
|
8893
8893
|
};
|
|
8894
8894
|
}
|
|
8895
8895
|
|
|
8896
|
-
// node_modules/zod/v4/locales/ua.js
|
|
8896
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ua.js
|
|
8897
8897
|
function ua_default() {
|
|
8898
8898
|
return uk_default();
|
|
8899
8899
|
}
|
|
8900
|
-
// node_modules/zod/v4/locales/ur.js
|
|
8900
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/ur.js
|
|
8901
8901
|
var error40 = () => {
|
|
8902
8902
|
const Sizable = {
|
|
8903
8903
|
string: { unit: "\u062D\u0631\u0648\u0641", verb: "\u06C1\u0648\u0646\u0627" },
|
|
@@ -9014,7 +9014,7 @@ function ur_default() {
|
|
|
9014
9014
|
localeError: error40()
|
|
9015
9015
|
};
|
|
9016
9016
|
}
|
|
9017
|
-
// node_modules/zod/v4/locales/vi.js
|
|
9017
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/vi.js
|
|
9018
9018
|
var error41 = () => {
|
|
9019
9019
|
const Sizable = {
|
|
9020
9020
|
string: { unit: "k\xFD t\u1EF1", verb: "c\xF3" },
|
|
@@ -9130,7 +9130,7 @@ function vi_default() {
|
|
|
9130
9130
|
localeError: error41()
|
|
9131
9131
|
};
|
|
9132
9132
|
}
|
|
9133
|
-
// node_modules/zod/v4/locales/zh-CN.js
|
|
9133
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/zh-CN.js
|
|
9134
9134
|
var error42 = () => {
|
|
9135
9135
|
const Sizable = {
|
|
9136
9136
|
string: { unit: "\u5B57\u7B26", verb: "\u5305\u542B" },
|
|
@@ -9246,7 +9246,7 @@ function zh_CN_default() {
|
|
|
9246
9246
|
localeError: error42()
|
|
9247
9247
|
};
|
|
9248
9248
|
}
|
|
9249
|
-
// node_modules/zod/v4/locales/zh-TW.js
|
|
9249
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/zh-TW.js
|
|
9250
9250
|
var error43 = () => {
|
|
9251
9251
|
const Sizable = {
|
|
9252
9252
|
string: { unit: "\u5B57\u5143", verb: "\u64C1\u6709" },
|
|
@@ -9363,7 +9363,7 @@ function zh_TW_default() {
|
|
|
9363
9363
|
localeError: error43()
|
|
9364
9364
|
};
|
|
9365
9365
|
}
|
|
9366
|
-
// node_modules/zod/v4/locales/yo.js
|
|
9366
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/locales/yo.js
|
|
9367
9367
|
var error44 = () => {
|
|
9368
9368
|
const Sizable = {
|
|
9369
9369
|
string: { unit: "\xE0mi", verb: "n\xED" },
|
|
@@ -9478,7 +9478,7 @@ function yo_default() {
|
|
|
9478
9478
|
localeError: error44()
|
|
9479
9479
|
};
|
|
9480
9480
|
}
|
|
9481
|
-
// node_modules/zod/v4/core/registries.js
|
|
9481
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/registries.js
|
|
9482
9482
|
var $output = Symbol("ZodOutput");
|
|
9483
9483
|
var $input = Symbol("ZodInput");
|
|
9484
9484
|
|
|
@@ -9529,7 +9529,7 @@ function registry() {
|
|
|
9529
9529
|
return new $ZodRegistry;
|
|
9530
9530
|
}
|
|
9531
9531
|
var globalRegistry = /* @__PURE__ */ registry();
|
|
9532
|
-
// node_modules/zod/v4/core/api.js
|
|
9532
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/api.js
|
|
9533
9533
|
function _string(Class2, params) {
|
|
9534
9534
|
return new Class2({
|
|
9535
9535
|
type: "string",
|
|
@@ -10407,7 +10407,7 @@ function _stringFormat(Class2, format, fnOrRegex, _params = {}) {
|
|
|
10407
10407
|
const inst = new Class2(def);
|
|
10408
10408
|
return inst;
|
|
10409
10409
|
}
|
|
10410
|
-
// node_modules/zod/v4/core/to-json-schema.js
|
|
10410
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/to-json-schema.js
|
|
10411
10411
|
class JSONSchemaGenerator {
|
|
10412
10412
|
constructor(params) {
|
|
10413
10413
|
this.counter = 0;
|
|
@@ -11211,9 +11211,9 @@ function isTransforming(_schema, _ctx) {
|
|
|
11211
11211
|
}
|
|
11212
11212
|
throw new Error(`Unknown schema type: ${def.type}`);
|
|
11213
11213
|
}
|
|
11214
|
-
// node_modules/zod/v4/core/json-schema.js
|
|
11214
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/json-schema.js
|
|
11215
11215
|
var exports_json_schema = {};
|
|
11216
|
-
// node_modules/zod/v4/classic/iso.js
|
|
11216
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/iso.js
|
|
11217
11217
|
var exports_iso = {};
|
|
11218
11218
|
__export(exports_iso, {
|
|
11219
11219
|
time: () => time2,
|
|
@@ -11254,7 +11254,7 @@ function duration2(params) {
|
|
|
11254
11254
|
return _isoDuration(ZodISODuration, params);
|
|
11255
11255
|
}
|
|
11256
11256
|
|
|
11257
|
-
// node_modules/zod/v4/classic/errors.js
|
|
11257
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/errors.js
|
|
11258
11258
|
var initializer2 = (inst, issues) => {
|
|
11259
11259
|
$ZodError.init(inst, issues);
|
|
11260
11260
|
inst.name = "ZodError";
|
|
@@ -11289,7 +11289,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
11289
11289
|
Parent: Error
|
|
11290
11290
|
});
|
|
11291
11291
|
|
|
11292
|
-
// node_modules/zod/v4/classic/parse.js
|
|
11292
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/parse.js
|
|
11293
11293
|
var parse3 = /* @__PURE__ */ _parse(ZodRealError);
|
|
11294
11294
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
11295
11295
|
var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
@@ -11303,7 +11303,7 @@ var safeDecode2 = /* @__PURE__ */ _safeDecode(ZodRealError);
|
|
|
11303
11303
|
var safeEncodeAsync2 = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
|
|
11304
11304
|
var safeDecodeAsync2 = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
|
|
11305
11305
|
|
|
11306
|
-
// node_modules/zod/v4/classic/schemas.js
|
|
11306
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/schemas.js
|
|
11307
11307
|
var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
11308
11308
|
$ZodType.init(inst, def);
|
|
11309
11309
|
inst.def = def;
|
|
@@ -12278,7 +12278,7 @@ function json(params) {
|
|
|
12278
12278
|
function preprocess(fn, schema) {
|
|
12279
12279
|
return pipe(transform(fn), schema);
|
|
12280
12280
|
}
|
|
12281
|
-
// node_modules/zod/v4/classic/compat.js
|
|
12281
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/compat.js
|
|
12282
12282
|
var ZodIssueCode = {
|
|
12283
12283
|
invalid_type: "invalid_type",
|
|
12284
12284
|
too_big: "too_big",
|
|
@@ -12302,7 +12302,7 @@ function getErrorMap() {
|
|
|
12302
12302
|
}
|
|
12303
12303
|
var ZodFirstPartyTypeKind;
|
|
12304
12304
|
(function(ZodFirstPartyTypeKind2) {})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
12305
|
-
// node_modules/zod/v4/classic/coerce.js
|
|
12305
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/coerce.js
|
|
12306
12306
|
var exports_coerce = {};
|
|
12307
12307
|
__export(exports_coerce, {
|
|
12308
12308
|
string: () => string3,
|
|
@@ -12327,9 +12327,9 @@ function date4(params) {
|
|
|
12327
12327
|
return _coercedDate(ZodDate, params);
|
|
12328
12328
|
}
|
|
12329
12329
|
|
|
12330
|
-
// node_modules/zod/v4/classic/external.js
|
|
12330
|
+
// ../../../node_modules/@opencode-ai/plugin/node_modules/zod/v4/classic/external.js
|
|
12331
12331
|
config(en_default());
|
|
12332
|
-
// node_modules/@opencode-ai/plugin/dist/tool.js
|
|
12332
|
+
// ../../../node_modules/@opencode-ai/plugin/dist/tool.js
|
|
12333
12333
|
function tool(input) {
|
|
12334
12334
|
return input;
|
|
12335
12335
|
}
|
|
@@ -12346,16 +12346,40 @@ var ABORT_CONTINUE_DELAY_MS = 2000;
|
|
|
12346
12346
|
var DEFAULT_LOOP_MAX_CONTINUES = 3;
|
|
12347
12347
|
var DEFAULT_LOOP_WINDOW_MS = 10 * 60000;
|
|
12348
12348
|
var TOOL_TEXT_CHECK_DELAY_MS = 1500;
|
|
12349
|
+
var MAX_IDLE_SESSIONS = 50;
|
|
12350
|
+
var IDLE_CLEANUP_MS = 10 * 60000;
|
|
12351
|
+
var SESSION_DISCOVERY_INTERVAL_MS = 60000;
|
|
12352
|
+
var TOOL_TEXT_RECOVERY_PROMPT = "Your last message contained a raw tool call printed as text instead of being executed. " + "Please use the proper tool calling mechanism to execute it.";
|
|
12349
12353
|
var TOOL_TEXT_PATTERNS = [
|
|
12350
12354
|
/<function\s*=/i,
|
|
12351
12355
|
/<function>/i,
|
|
12352
12356
|
/<\/function>/i,
|
|
12353
12357
|
/<parameter\s*=/i,
|
|
12354
12358
|
/<parameter>/i,
|
|
12355
|
-
/<\/parameter>/i
|
|
12359
|
+
/<\/parameter>/i,
|
|
12360
|
+
/<tool_call[\s>]/i,
|
|
12361
|
+
/<\/tool_call>/i,
|
|
12362
|
+
/<tool[\s_]name\s*=/i,
|
|
12363
|
+
/<invoke\s+/i,
|
|
12364
|
+
/<func(?:t|ti|tio|tion)?$/im,
|
|
12365
|
+
/<par(?:a|am|ame|amet|amete|ameter)?$/im,
|
|
12366
|
+
/<(?:edit|write|read|bash|grep|glob|search|replace|execute|run)\s*(?:\s[^>]*)?\s*(?:\/>|>)/i
|
|
12367
|
+
];
|
|
12368
|
+
var TRUNCATED_XML_PATTERNS = [
|
|
12369
|
+
{ open: /<function[^>]*>/i, close: /<\/function>/i },
|
|
12370
|
+
{ open: /<parameter[^>]*>/i, close: /<\/parameter>/i },
|
|
12371
|
+
{ open: /<tool_call[^>]*>/i, close: /<\/tool_call>/i }
|
|
12356
12372
|
];
|
|
12357
12373
|
function containsToolCallAsText(text) {
|
|
12358
|
-
|
|
12374
|
+
if (text.length <= 10)
|
|
12375
|
+
return false;
|
|
12376
|
+
if (TOOL_TEXT_PATTERNS.some((pat) => pat.test(text)))
|
|
12377
|
+
return true;
|
|
12378
|
+
for (const { open, close } of TRUNCATED_XML_PATTERNS) {
|
|
12379
|
+
if (open.test(text) && !close.test(text))
|
|
12380
|
+
return true;
|
|
12381
|
+
}
|
|
12382
|
+
return false;
|
|
12359
12383
|
}
|
|
12360
12384
|
var AutoResumePlugin = async (ctx, options) => {
|
|
12361
12385
|
const chunkTimeoutMs = options?.chunkTimeoutMs ?? DEFAULT_CHUNK_TIMEOUT_MS;
|
|
@@ -12369,19 +12393,25 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12369
12393
|
const loopWindowMs = options?.loopWindowMs ?? DEFAULT_LOOP_WINDOW_MS;
|
|
12370
12394
|
const sessions = new Map;
|
|
12371
12395
|
let timer = null;
|
|
12396
|
+
let discoveryTimer = null;
|
|
12372
12397
|
let initialised = false;
|
|
12373
12398
|
let prevBusyCount = 0;
|
|
12374
|
-
|
|
12375
|
-
|
|
12376
|
-
|
|
12399
|
+
function recordContinue(sid) {
|
|
12400
|
+
const w = sessions.get(sid);
|
|
12401
|
+
if (!w)
|
|
12402
|
+
return;
|
|
12403
|
+
w.continueTimestamps.push(Date.now());
|
|
12377
12404
|
const cutoff = Date.now() - loopWindowMs;
|
|
12378
|
-
while (continueTimestamps.length > 0 && continueTimestamps[0] < cutoff) {
|
|
12379
|
-
continueTimestamps.shift();
|
|
12405
|
+
while (w.continueTimestamps.length > 0 && w.continueTimestamps[0] < cutoff) {
|
|
12406
|
+
w.continueTimestamps.shift();
|
|
12380
12407
|
}
|
|
12381
12408
|
}
|
|
12382
|
-
function isHallucinationLoop() {
|
|
12383
|
-
|
|
12384
|
-
|
|
12409
|
+
function isHallucinationLoop(sid) {
|
|
12410
|
+
const w = sessions.get(sid);
|
|
12411
|
+
if (!w)
|
|
12412
|
+
return false;
|
|
12413
|
+
recordContinue(sid);
|
|
12414
|
+
return w.continueTimestamps.length >= loopMaxContinues;
|
|
12385
12415
|
}
|
|
12386
12416
|
async function log(level, msg) {
|
|
12387
12417
|
try {
|
|
@@ -12402,21 +12432,19 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12402
12432
|
gaveUp: false,
|
|
12403
12433
|
orphanWatchStartAt: null,
|
|
12404
12434
|
aborting: false,
|
|
12405
|
-
toolTextRecovered: false
|
|
12435
|
+
toolTextRecovered: false,
|
|
12436
|
+
toolTextAttempts: 0,
|
|
12437
|
+
continueTimestamps: [],
|
|
12438
|
+
idleSince: null
|
|
12406
12439
|
};
|
|
12407
12440
|
sessions.set(sid, w);
|
|
12408
12441
|
}
|
|
12409
12442
|
return w;
|
|
12410
12443
|
}
|
|
12411
|
-
function
|
|
12412
|
-
const
|
|
12413
|
-
|
|
12414
|
-
|
|
12415
|
-
w.lastActivityAt = now;
|
|
12416
|
-
w.resumeAttempts = 0;
|
|
12417
|
-
w.gaveUp = false;
|
|
12418
|
-
w.orphanWatchStartAt = null;
|
|
12419
|
-
}
|
|
12444
|
+
function touchSession(sid) {
|
|
12445
|
+
const w = sessions.get(sid);
|
|
12446
|
+
if (w && w.status === "busy" && !w.userCancelled) {
|
|
12447
|
+
w.lastActivityAt = Date.now();
|
|
12420
12448
|
}
|
|
12421
12449
|
}
|
|
12422
12450
|
function busyCount() {
|
|
@@ -12456,12 +12484,52 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12456
12484
|
function backoffMs(attempt) {
|
|
12457
12485
|
return Math.min(baseBackoffMs * Math.pow(2, attempt - 1), maxBackoffMs);
|
|
12458
12486
|
}
|
|
12487
|
+
function cleanupIdleSessions() {
|
|
12488
|
+
const now = Date.now();
|
|
12489
|
+
const toDelete = [];
|
|
12490
|
+
let idleCount = 0;
|
|
12491
|
+
for (const [sid, w] of sessions) {
|
|
12492
|
+
if (w.status !== "busy") {
|
|
12493
|
+
idleCount++;
|
|
12494
|
+
if (w.idleSince && now - w.idleSince > IDLE_CLEANUP_MS) {
|
|
12495
|
+
toDelete.push(sid);
|
|
12496
|
+
}
|
|
12497
|
+
}
|
|
12498
|
+
}
|
|
12499
|
+
if (idleCount > MAX_IDLE_SESSIONS) {
|
|
12500
|
+
const idleEntries = [];
|
|
12501
|
+
for (const [sid, w] of sessions) {
|
|
12502
|
+
if (w.status !== "busy" && w.idleSince) {
|
|
12503
|
+
idleEntries.push({ sid, idleSince: w.idleSince });
|
|
12504
|
+
}
|
|
12505
|
+
}
|
|
12506
|
+
idleEntries.sort((a, b) => a.idleSince - b.idleSince);
|
|
12507
|
+
const excess = idleCount - MAX_IDLE_SESSIONS;
|
|
12508
|
+
for (let i = 0;i < excess && i < idleEntries.length; i++) {
|
|
12509
|
+
if (!toDelete.includes(idleEntries[i].sid)) {
|
|
12510
|
+
toDelete.push(idleEntries[i].sid);
|
|
12511
|
+
}
|
|
12512
|
+
}
|
|
12513
|
+
}
|
|
12514
|
+
for (const sid of toDelete) {
|
|
12515
|
+
sessions.delete(sid);
|
|
12516
|
+
}
|
|
12517
|
+
if (toDelete.length > 0) {
|
|
12518
|
+
log("debug", `Cleaned up ${toDelete.length} idle session(s). Map size: ${sessions.size}`);
|
|
12519
|
+
}
|
|
12520
|
+
}
|
|
12459
12521
|
async function checkForToolCallAsText(sid, w) {
|
|
12460
12522
|
if (w.userCancelled || w.toolTextRecovered)
|
|
12461
12523
|
return;
|
|
12462
|
-
if (
|
|
12524
|
+
if (w.toolTextAttempts > 0) {
|
|
12525
|
+
const elapsed = Date.now() - w.lastRetryAt;
|
|
12526
|
+
const requiredBackoff = backoffMs(w.toolTextAttempts);
|
|
12527
|
+
if (elapsed < requiredBackoff)
|
|
12528
|
+
return;
|
|
12529
|
+
}
|
|
12530
|
+
if (w.toolTextAttempts >= maxRetries)
|
|
12463
12531
|
return;
|
|
12464
|
-
await log("debug", `${short(sid)} - checking for tool-call-as-text`);
|
|
12532
|
+
await log("debug", `${short(sid)} - checking for tool-call-as-text (attempt ${w.toolTextAttempts + 1})`);
|
|
12465
12533
|
try {
|
|
12466
12534
|
const response = await ctx.client.session.messages({
|
|
12467
12535
|
path: { id: sid }
|
|
@@ -12487,23 +12555,25 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12487
12555
|
if (part.type !== "text")
|
|
12488
12556
|
continue;
|
|
12489
12557
|
const text = part.text ?? "";
|
|
12490
|
-
if (
|
|
12558
|
+
if (containsToolCallAsText(text)) {
|
|
12491
12559
|
w.toolTextRecovered = true;
|
|
12492
|
-
|
|
12493
|
-
|
|
12494
|
-
|
|
12560
|
+
w.toolTextAttempts++;
|
|
12561
|
+
await log("info", `Tool-call-as-text detected on ${short(sid)}! ` + `Attempt ${w.toolTextAttempts}/${maxRetries}. Sending recovery prompt...`);
|
|
12562
|
+
if (isHallucinationLoop(sid)) {
|
|
12563
|
+
await log("warn", `Hallucination loop detected on ${short(sid)} \u2014 aborting instead`);
|
|
12495
12564
|
await tryAbortAndResume(sid, w);
|
|
12496
12565
|
} else {
|
|
12497
12566
|
try {
|
|
12498
12567
|
await ctx.client.session.prompt({
|
|
12499
12568
|
path: { id: sid },
|
|
12500
|
-
body: { parts: [{ type: "text", text:
|
|
12569
|
+
body: { parts: [{ type: "text", text: TOOL_TEXT_RECOVERY_PROMPT }] }
|
|
12501
12570
|
});
|
|
12502
|
-
recordContinue();
|
|
12503
|
-
|
|
12571
|
+
recordContinue(sid);
|
|
12572
|
+
w.lastRetryAt = Date.now();
|
|
12573
|
+
await log("info", `${short(sid)} - tool-call-as-text recovery sent (attempt ${w.toolTextAttempts})`);
|
|
12504
12574
|
} catch (err) {
|
|
12505
|
-
const
|
|
12506
|
-
await log("warn", `${short(sid)} - tool-call-as-text recovery failed: ${
|
|
12575
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
12576
|
+
await log("warn", `${short(sid)} - tool-call-as-text recovery failed: ${errMsg}`);
|
|
12507
12577
|
}
|
|
12508
12578
|
}
|
|
12509
12579
|
return;
|
|
@@ -12511,8 +12581,8 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12511
12581
|
}
|
|
12512
12582
|
}
|
|
12513
12583
|
} catch (err) {
|
|
12514
|
-
const
|
|
12515
|
-
log("debug", `${short(sid)} - could not fetch messages: ${
|
|
12584
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
12585
|
+
log("debug", `${short(sid)} - could not fetch messages: ${errMsg}`);
|
|
12516
12586
|
}
|
|
12517
12587
|
}
|
|
12518
12588
|
async function tryAbortAndResume(sid, w) {
|
|
@@ -12525,8 +12595,8 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12525
12595
|
await ctx.client.session.abort({ sessionID: sid });
|
|
12526
12596
|
await log("info", `${short(sid)} - abort OK`);
|
|
12527
12597
|
} catch (err) {
|
|
12528
|
-
const
|
|
12529
|
-
await log("warn", `${short(sid)} - abort failed: ${
|
|
12598
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
12599
|
+
await log("warn", `${short(sid)} - abort failed: ${errMsg}`);
|
|
12530
12600
|
w.aborting = false;
|
|
12531
12601
|
return false;
|
|
12532
12602
|
}
|
|
@@ -12538,7 +12608,7 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12538
12608
|
path: { id: sid },
|
|
12539
12609
|
body: { parts: [{ type: "text", text: "continue" }] }
|
|
12540
12610
|
});
|
|
12541
|
-
recordContinue();
|
|
12611
|
+
recordContinue(sid);
|
|
12542
12612
|
await log("info", `${short(sid)} - abort+continue done`);
|
|
12543
12613
|
w.lastRetryAt = Date.now();
|
|
12544
12614
|
w.orphanWatchStartAt = null;
|
|
@@ -12546,8 +12616,8 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12546
12616
|
w.aborting = false;
|
|
12547
12617
|
return true;
|
|
12548
12618
|
} catch (err) {
|
|
12549
|
-
const
|
|
12550
|
-
await log("warn", `${short(sid)} - continue after abort failed: ${
|
|
12619
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
12620
|
+
await log("warn", `${short(sid)} - continue after abort failed: ${errMsg}`);
|
|
12551
12621
|
w.aborting = false;
|
|
12552
12622
|
return false;
|
|
12553
12623
|
}
|
|
@@ -12558,7 +12628,7 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12558
12628
|
const requiredBackoff = backoffMs(w.resumeAttempts);
|
|
12559
12629
|
if (w.lastRetryAt > 0 && elapsedSinceRetry < requiredBackoff)
|
|
12560
12630
|
return false;
|
|
12561
|
-
if (isHallucinationLoop()) {
|
|
12631
|
+
if (isHallucinationLoop(sid)) {
|
|
12562
12632
|
await log("warn", `Hallucination loop on ${short(sid)}! Aborting...`);
|
|
12563
12633
|
return await tryAbortAndResume(sid, w);
|
|
12564
12634
|
}
|
|
@@ -12570,17 +12640,46 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12570
12640
|
path: { id: sid },
|
|
12571
12641
|
body: { parts: [{ type: "text", text: "continue" }] }
|
|
12572
12642
|
});
|
|
12573
|
-
recordContinue();
|
|
12643
|
+
recordContinue(sid);
|
|
12574
12644
|
await log("info", `${short(sid)} - retry sent`);
|
|
12575
12645
|
w.lastRetryAt = now;
|
|
12576
12646
|
return true;
|
|
12577
12647
|
} catch (err) {
|
|
12578
|
-
const
|
|
12579
|
-
await log("warn", `${short(sid)} - retry failed: ${
|
|
12648
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
12649
|
+
await log("warn", `${short(sid)} - retry failed: ${errMsg}`);
|
|
12580
12650
|
w.lastRetryAt = now;
|
|
12581
12651
|
return false;
|
|
12582
12652
|
}
|
|
12583
12653
|
}
|
|
12654
|
+
async function discoverSessions() {
|
|
12655
|
+
try {
|
|
12656
|
+
const response = await ctx.client.session.list();
|
|
12657
|
+
const data = response;
|
|
12658
|
+
let list = [];
|
|
12659
|
+
if (Array.isArray(data)) {
|
|
12660
|
+
list = data;
|
|
12661
|
+
} else if (Array.isArray(data.data)) {
|
|
12662
|
+
list = data.data;
|
|
12663
|
+
}
|
|
12664
|
+
for (const s of list) {
|
|
12665
|
+
const sid = s.id;
|
|
12666
|
+
if (sid && !sessions.has(sid)) {
|
|
12667
|
+
ensureWatch(sid);
|
|
12668
|
+
const status = s.status;
|
|
12669
|
+
if (status) {
|
|
12670
|
+
const w = sessions.get(sid);
|
|
12671
|
+
w.status = status;
|
|
12672
|
+
if (status === "idle")
|
|
12673
|
+
w.idleSince = Date.now();
|
|
12674
|
+
}
|
|
12675
|
+
log("debug", `Discovered session ${short(sid)} via list()`);
|
|
12676
|
+
}
|
|
12677
|
+
}
|
|
12678
|
+
} catch (err) {
|
|
12679
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
12680
|
+
log("debug", `Session discovery failed: ${errMsg}`);
|
|
12681
|
+
}
|
|
12682
|
+
}
|
|
12584
12683
|
function startTimer() {
|
|
12585
12684
|
if (timer)
|
|
12586
12685
|
return;
|
|
@@ -12620,19 +12719,23 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12620
12719
|
}
|
|
12621
12720
|
}
|
|
12622
12721
|
}
|
|
12722
|
+
cleanupIdleSessions();
|
|
12623
12723
|
}, checkIntervalMs);
|
|
12624
12724
|
if (timer.unref)
|
|
12625
12725
|
timer.unref();
|
|
12726
|
+
discoveryTimer = setInterval(() => {
|
|
12727
|
+
discoverSessions();
|
|
12728
|
+
}, SESSION_DISCOVERY_INTERVAL_MS);
|
|
12729
|
+
if (discoveryTimer.unref)
|
|
12730
|
+
discoveryTimer.unref();
|
|
12731
|
+
setTimeout(discoverSessions, 5000);
|
|
12626
12732
|
}
|
|
12627
12733
|
startTimer();
|
|
12628
12734
|
function handleEvent(ev) {
|
|
12629
12735
|
const type = ev.type;
|
|
12630
12736
|
const sid = getSid(ev);
|
|
12631
12737
|
if (sid) {
|
|
12632
|
-
|
|
12633
|
-
if (w && (w.status === "busy" || w.status === "unknown")) {
|
|
12634
|
-
touchAndPropagate();
|
|
12635
|
-
}
|
|
12738
|
+
touchSession(sid);
|
|
12636
12739
|
}
|
|
12637
12740
|
switch (type) {
|
|
12638
12741
|
case "session.status": {
|
|
@@ -12643,18 +12746,22 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12643
12746
|
const w = ensureWatch(sid);
|
|
12644
12747
|
w.status = statusType;
|
|
12645
12748
|
if (statusType === "busy") {
|
|
12646
|
-
|
|
12749
|
+
w.lastActivityAt = Date.now();
|
|
12647
12750
|
w.userCancelled = false;
|
|
12648
12751
|
w.resumeAttempts = 0;
|
|
12649
12752
|
w.gaveUp = false;
|
|
12650
12753
|
w.orphanWatchStartAt = null;
|
|
12651
12754
|
w.aborting = false;
|
|
12652
12755
|
w.toolTextRecovered = false;
|
|
12756
|
+
w.toolTextAttempts = 0;
|
|
12757
|
+
w.continueTimestamps = [];
|
|
12758
|
+
w.idleSince = null;
|
|
12653
12759
|
log("debug", `${short(sid)} -> busy (${busyCount()})`);
|
|
12654
12760
|
} else if (statusType === "idle") {
|
|
12655
12761
|
w.status = "idle";
|
|
12656
12762
|
w.userCancelled = false;
|
|
12657
12763
|
w.aborting = false;
|
|
12764
|
+
w.idleSince = Date.now();
|
|
12658
12765
|
const currentBusy = busyCount();
|
|
12659
12766
|
if (prevBusyCount > 1 && currentBusy === 1) {
|
|
12660
12767
|
const lone = getLoneBusySession();
|
|
@@ -12665,13 +12772,13 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12665
12772
|
}
|
|
12666
12773
|
prevBusyCount = currentBusy;
|
|
12667
12774
|
log("debug", `${short(sid)} -> idle (${currentBusy})`);
|
|
12668
|
-
if (!w.toolTextRecovered && w.
|
|
12775
|
+
if (!w.toolTextRecovered && w.toolTextAttempts < maxRetries) {
|
|
12669
12776
|
setTimeout(() => {
|
|
12670
12777
|
checkForToolCallAsText(sid, w);
|
|
12671
12778
|
}, TOOL_TEXT_CHECK_DELAY_MS);
|
|
12672
12779
|
}
|
|
12673
12780
|
} else if (statusType === "retry") {
|
|
12674
|
-
|
|
12781
|
+
touchSession(sid);
|
|
12675
12782
|
log("debug", `${short(sid)} -> provider retry`);
|
|
12676
12783
|
}
|
|
12677
12784
|
break;
|
|
@@ -12697,7 +12804,8 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12697
12804
|
w.userCancelled = false;
|
|
12698
12805
|
w.orphanWatchStartAt = null;
|
|
12699
12806
|
w.aborting = false;
|
|
12700
|
-
|
|
12807
|
+
w.idleSince = Date.now();
|
|
12808
|
+
if (!w.toolTextRecovered && w.toolTextAttempts < maxRetries) {
|
|
12701
12809
|
setTimeout(() => {
|
|
12702
12810
|
checkForToolCallAsText(sid, w);
|
|
12703
12811
|
}, TOOL_TEXT_CHECK_DELAY_MS);
|
|
@@ -12716,6 +12824,7 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12716
12824
|
w.status = "idle";
|
|
12717
12825
|
w.orphanWatchStartAt = null;
|
|
12718
12826
|
w.aborting = false;
|
|
12827
|
+
w.idleSince = Date.now();
|
|
12719
12828
|
}
|
|
12720
12829
|
}
|
|
12721
12830
|
log("info", "User abort (ESC)");
|
|
@@ -12735,6 +12844,7 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12735
12844
|
w.orphanWatchStartAt = null;
|
|
12736
12845
|
w.aborting = false;
|
|
12737
12846
|
w.toolTextRecovered = false;
|
|
12847
|
+
w.toolTextAttempts = 0;
|
|
12738
12848
|
}
|
|
12739
12849
|
break;
|
|
12740
12850
|
}
|
|
@@ -12744,12 +12854,12 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12744
12854
|
event: async ({ event }) => {
|
|
12745
12855
|
if (!initialised) {
|
|
12746
12856
|
initialised = true;
|
|
12747
|
-
log("info", `
|
|
12857
|
+
log("info", `v8.0 ready. timeout=${chunkTimeoutMs}ms, orphan=${subagentWaitMs}ms, loop=${loopMaxContinues}x/${loopWindowMs / 1000}s`);
|
|
12748
12858
|
}
|
|
12749
12859
|
handleEvent(event);
|
|
12750
12860
|
},
|
|
12751
12861
|
config: async () => {
|
|
12752
|
-
log("info", `
|
|
12862
|
+
log("info", `v8.0 config OK`);
|
|
12753
12863
|
},
|
|
12754
12864
|
tool: {
|
|
12755
12865
|
resume: tool({
|
|
@@ -12784,11 +12894,12 @@ var AutoResumePlugin = async (ctx, options) => {
|
|
|
12784
12894
|
path: { id: targetSid },
|
|
12785
12895
|
body: { agent: toolCtx.agent, parts: [{ type: "text", text }] }
|
|
12786
12896
|
});
|
|
12787
|
-
recordContinue();
|
|
12897
|
+
recordContinue(targetSid);
|
|
12788
12898
|
if (w) {
|
|
12789
12899
|
w.orphanWatchStartAt = null;
|
|
12790
12900
|
w.resumeAttempts = 0;
|
|
12791
12901
|
w.toolTextRecovered = false;
|
|
12902
|
+
w.toolTextAttempts = 0;
|
|
12792
12903
|
}
|
|
12793
12904
|
return `Resume sent to ${short(targetSid)}: "${text}"`;
|
|
12794
12905
|
} catch (err) {
|