@abelxiaoxing/cadence 2.0.46 → 2.0.48
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 +5 -3
- package/README.zh-CN.md +5 -3
- package/docs/conversation-mode.md +43 -3
- package/docs/reuse-and-distribution.md +5 -3
- package/package.json +2 -1
- package/src/cadence-instructions.ts +1 -1
- package/src/cadence-mode.ts +2 -2
- package/src/coordinator-tools.mjs +3 -1
- package/src/model-preview.mjs +41 -11
- package/src/native-build.ts +1 -1
- package/src/research-tools.mjs +28 -21
- package/src/sdk-worker.mjs +161 -84
- package/src/service/contracts/workbench.ts +8 -0
- package/src/service/contracts/workflow.ts +34 -11
- package/src/service-cli.mjs +41 -11
- package/src/service-host.mjs +868 -463
- package/src/worker-capture.mjs +77 -23
- package/src/worker-model.mjs +343 -0
- package/src/worker-public.mjs +44 -16
- package/src/worker-toolkit.mjs +60 -46
- package/src/worker-tools.mjs +77 -57
- package/web/dist/assets/cadence.css +1 -1
- package/web/dist/assets/cadence.js +21 -21
- package/web/dist/manifest.json +7 -7
package/src/service-cli.mjs
CHANGED
|
@@ -191,7 +191,6 @@ var LIMITS = Object.freeze({
|
|
|
191
191
|
wsClientFrameBytes: 16 * 1024,
|
|
192
192
|
startWaitMs: 1e4,
|
|
193
193
|
stopWaitMs: 60000,
|
|
194
|
-
authWaitMs: 30000,
|
|
195
194
|
authValidityMarginMs: 120000,
|
|
196
195
|
browserLifetimeMs: 12 * 60 * 60 * 1000,
|
|
197
196
|
terminateGraceMs: 1000,
|
|
@@ -208,23 +207,17 @@ var LIMITS = Object.freeze({
|
|
|
208
207
|
frameBytes: 64 * 1024,
|
|
209
208
|
chunkBytes: 8 * 1024,
|
|
210
209
|
detailBytes: 32 * 1024 * 1024,
|
|
211
|
-
childProtocolBytes: 128 * 1024 * 1024,
|
|
212
210
|
dataFrames: 1e5,
|
|
213
211
|
controlFrames: 256,
|
|
214
|
-
|
|
212
|
+
captureEntries: 4096,
|
|
215
213
|
workerQueueBytes: 4 * 1024 * 1024,
|
|
216
214
|
workerQueueFrames: 1024,
|
|
217
215
|
ownerQueueBytes: 8 * 1024 * 1024,
|
|
218
216
|
ownerQueueFrames: 2048,
|
|
219
217
|
ownerControlBytes: 1024 * 1024,
|
|
220
218
|
ownerControlFrames: 256,
|
|
221
|
-
recordingStallMs: 5000,
|
|
222
219
|
episodes: 8,
|
|
223
|
-
queuedAssignments: 128,
|
|
224
220
|
childReservations: 2,
|
|
225
|
-
episodeMs: 6 * 60 * 60 * 1000,
|
|
226
|
-
readyWaitMs: 10 * 60 * 1000,
|
|
227
|
-
workerMs: 1200000,
|
|
228
221
|
artifactPartBytes: 256 * 1024,
|
|
229
222
|
progressBatchMs: 100,
|
|
230
223
|
progressBatchBytes: 256 * 1024,
|
|
@@ -655,7 +648,7 @@ function checkSelection(v) {
|
|
|
655
648
|
kind: oneOf(o.kind, ["configured", "manual"]),
|
|
656
649
|
name: text(o.name, 128, true),
|
|
657
650
|
command: text(o.command, 4096, true),
|
|
658
|
-
timeoutMs: integer(o.timeoutMs, 100,
|
|
651
|
+
timeoutMs: integer(o.timeoutMs, 100, 1200000)
|
|
659
652
|
};
|
|
660
653
|
const controls = /[\x00-\x08\x0b-\x1f\x7f-\x9f\u202a-\u202e\u2066-\u2069]/u;
|
|
661
654
|
if (controls.test(result.name) || controls.test(result.command) || /[\n\t]/.test(result.name) || result.name === "Manual command")
|
|
@@ -728,8 +721,25 @@ function decodeHandoff(v) {
|
|
|
728
721
|
})
|
|
729
722
|
};
|
|
730
723
|
}
|
|
724
|
+
function decodeStopCause(v) {
|
|
725
|
+
const o = closed(v, ["source", "reason", "target"]);
|
|
726
|
+
return {
|
|
727
|
+
source: oneOf(o.source, [
|
|
728
|
+
"user",
|
|
729
|
+
"service",
|
|
730
|
+
"owner",
|
|
731
|
+
"command",
|
|
732
|
+
"worker",
|
|
733
|
+
"coordinator",
|
|
734
|
+
"unknown"
|
|
735
|
+
]),
|
|
736
|
+
reason: text(o.reason, 128, true),
|
|
737
|
+
target: text(o.target, 128, true)
|
|
738
|
+
};
|
|
739
|
+
}
|
|
731
740
|
function decodeNativeSettlement(v) {
|
|
732
741
|
const o = closed(v, [
|
|
742
|
+
...Object.hasOwn(v ?? {}, "stop") ? ["stop"] : [],
|
|
733
743
|
"outcome",
|
|
734
744
|
"closure",
|
|
735
745
|
"exitCode",
|
|
@@ -741,6 +751,7 @@ function decodeNativeSettlement(v) {
|
|
|
741
751
|
"capture"
|
|
742
752
|
]);
|
|
743
753
|
const r = {
|
|
754
|
+
...o.stop === undefined ? {} : { stop: decodeStopCause(o.stop) },
|
|
744
755
|
outcome: oneOf(o.outcome, [
|
|
745
756
|
"completed",
|
|
746
757
|
"failed",
|
|
@@ -874,6 +885,19 @@ function sourceId(v) {
|
|
|
874
885
|
invalid();
|
|
875
886
|
return s;
|
|
876
887
|
}
|
|
888
|
+
function decodeModelRetry(v) {
|
|
889
|
+
const o = closed(v, ["phase", "attempt", "maxAttempts", "delayMs"]);
|
|
890
|
+
const maxAttempts = integer(o.maxAttempts, 1);
|
|
891
|
+
const progress = {
|
|
892
|
+
phase: oneOf(o.phase, ["waiting", "requesting"]),
|
|
893
|
+
attempt: integer(o.attempt, 1, maxAttempts),
|
|
894
|
+
maxAttempts,
|
|
895
|
+
delayMs: integer(o.delayMs, 0, 2147483647)
|
|
896
|
+
};
|
|
897
|
+
if (progress.phase === "requesting" && progress.delayMs !== 0)
|
|
898
|
+
throw new ContractError("invalid");
|
|
899
|
+
return progress;
|
|
900
|
+
}
|
|
877
901
|
function decodeCaptureEvent(v) {
|
|
878
902
|
const kind = tag(v);
|
|
879
903
|
switch (kind) {
|
|
@@ -1061,6 +1085,10 @@ function decodeCaptureEvent(v) {
|
|
|
1061
1085
|
coverage: decodeCoverage(o.coverage)
|
|
1062
1086
|
};
|
|
1063
1087
|
}
|
|
1088
|
+
case "model-retry": {
|
|
1089
|
+
const o = closed(v, ["kind", "progress"]);
|
|
1090
|
+
return { kind, progress: nullable(o.progress, decodeModelRetry) };
|
|
1091
|
+
}
|
|
1064
1092
|
case "capture-status": {
|
|
1065
1093
|
const o = closed(v, ["kind", "coverage"]);
|
|
1066
1094
|
return { kind, coverage: decodeCoverage(o.coverage) };
|
|
@@ -1095,6 +1123,7 @@ function decodeCaptureEvent(v) {
|
|
|
1095
1123
|
}
|
|
1096
1124
|
function decodeCheckNativeSettlement(v) {
|
|
1097
1125
|
const o = closed(v, [
|
|
1126
|
+
...Object.hasOwn(v ?? {}, "stop") ? ["stop"] : [],
|
|
1098
1127
|
"outcome",
|
|
1099
1128
|
"closure",
|
|
1100
1129
|
"exitCode",
|
|
@@ -1103,6 +1132,7 @@ function decodeCheckNativeSettlement(v) {
|
|
|
1103
1132
|
"stdin"
|
|
1104
1133
|
]);
|
|
1105
1134
|
const r = {
|
|
1135
|
+
...o.stop === undefined ? {} : { stop: decodeStopCause(o.stop) },
|
|
1106
1136
|
outcome: oneOf(o.outcome, [
|
|
1107
1137
|
"completed",
|
|
1108
1138
|
"failed",
|
|
@@ -1220,8 +1250,8 @@ function decodeRunSettlement(v) {
|
|
|
1220
1250
|
}
|
|
1221
1251
|
function decodeSourceRange(v) {
|
|
1222
1252
|
const o = closed(v, ["first", "last", "firstObservedMs", "lastObservedMs"]);
|
|
1223
|
-
const first = integer(o.first, 1,
|
|
1224
|
-
const last = integer(o.last, first,
|
|
1253
|
+
const first = integer(o.first, 1, Number.MAX_SAFE_INTEGER);
|
|
1254
|
+
const last = integer(o.last, first, Number.MAX_SAFE_INTEGER);
|
|
1225
1255
|
const firstObservedMs = integer(o.firstObservedMs);
|
|
1226
1256
|
const lastObservedMs = integer(o.lastObservedMs, firstObservedMs);
|
|
1227
1257
|
if (first === last && firstObservedMs !== lastObservedMs)
|