@sema-agent/cli 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm-shrinkwrap.json +14 -14
- package/package.json +5 -5
- package/sema.js +1365 -741
package/sema.js
CHANGED
|
@@ -1591,8 +1591,8 @@ var init_emitter = __esm({
|
|
|
1591
1591
|
return false;
|
|
1592
1592
|
}
|
|
1593
1593
|
const ccEvent = args[0] instanceof Event2 ? args[0] : null;
|
|
1594
|
-
for (const
|
|
1595
|
-
|
|
1594
|
+
for (const listener5 of listeners6) {
|
|
1595
|
+
listener5.apply(this, args);
|
|
1596
1596
|
if (ccEvent?.didStopImmediatePropagation()) {
|
|
1597
1597
|
break;
|
|
1598
1598
|
}
|
|
@@ -4068,14 +4068,14 @@ var init_settingsCache = __esm({
|
|
|
4068
4068
|
function createSignal() {
|
|
4069
4069
|
const listeners6 = /* @__PURE__ */ new Set();
|
|
4070
4070
|
return {
|
|
4071
|
-
subscribe(
|
|
4072
|
-
listeners6.add(
|
|
4071
|
+
subscribe(listener5) {
|
|
4072
|
+
listeners6.add(listener5);
|
|
4073
4073
|
return () => {
|
|
4074
|
-
listeners6.delete(
|
|
4074
|
+
listeners6.delete(listener5);
|
|
4075
4075
|
};
|
|
4076
4076
|
},
|
|
4077
4077
|
emit(...args) {
|
|
4078
|
-
for (const
|
|
4078
|
+
for (const listener5 of listeners6) listener5(...args);
|
|
4079
4079
|
},
|
|
4080
4080
|
clear() {
|
|
4081
4081
|
listeners6.clear();
|
|
@@ -5667,11 +5667,11 @@ function hasBinaryExtension(filePath) {
|
|
|
5667
5667
|
const ext = filePath.slice(filePath.lastIndexOf(".")).toLowerCase();
|
|
5668
5668
|
return BINARY_EXTENSIONS.has(ext);
|
|
5669
5669
|
}
|
|
5670
|
-
function isBinaryContent(
|
|
5671
|
-
const checkSize = Math.min(
|
|
5670
|
+
function isBinaryContent(buffer5) {
|
|
5671
|
+
const checkSize = Math.min(buffer5.length, BINARY_CHECK_SIZE);
|
|
5672
5672
|
let nonPrintable = 0;
|
|
5673
5673
|
for (let i = 0; i < checkSize; i++) {
|
|
5674
|
-
const byte =
|
|
5674
|
+
const byte = buffer5[i];
|
|
5675
5675
|
if (byte === 0) {
|
|
5676
5676
|
return true;
|
|
5677
5677
|
}
|
|
@@ -5835,7 +5835,7 @@ function createBufferedWriter({
|
|
|
5835
5835
|
maxBufferBytes = Infinity,
|
|
5836
5836
|
immediateMode = false
|
|
5837
5837
|
}) {
|
|
5838
|
-
let
|
|
5838
|
+
let buffer5 = [];
|
|
5839
5839
|
let bufferBytes = 0;
|
|
5840
5840
|
let flushTimer = null;
|
|
5841
5841
|
let pendingOverflow = null;
|
|
@@ -5850,9 +5850,9 @@ function createBufferedWriter({
|
|
|
5850
5850
|
writeFn(pendingOverflow.join(""));
|
|
5851
5851
|
pendingOverflow = null;
|
|
5852
5852
|
}
|
|
5853
|
-
if (
|
|
5854
|
-
writeFn(
|
|
5855
|
-
|
|
5853
|
+
if (buffer5.length === 0) return;
|
|
5854
|
+
writeFn(buffer5.join(""));
|
|
5855
|
+
buffer5 = [];
|
|
5856
5856
|
bufferBytes = 0;
|
|
5857
5857
|
clearTimer();
|
|
5858
5858
|
}
|
|
@@ -5863,14 +5863,14 @@ function createBufferedWriter({
|
|
|
5863
5863
|
}
|
|
5864
5864
|
function flushDeferred() {
|
|
5865
5865
|
if (pendingOverflow) {
|
|
5866
|
-
pendingOverflow.push(...
|
|
5867
|
-
|
|
5866
|
+
pendingOverflow.push(...buffer5);
|
|
5867
|
+
buffer5 = [];
|
|
5868
5868
|
bufferBytes = 0;
|
|
5869
5869
|
clearTimer();
|
|
5870
5870
|
return;
|
|
5871
5871
|
}
|
|
5872
|
-
const detached =
|
|
5873
|
-
|
|
5872
|
+
const detached = buffer5;
|
|
5873
|
+
buffer5 = [];
|
|
5874
5874
|
bufferBytes = 0;
|
|
5875
5875
|
clearTimer();
|
|
5876
5876
|
pendingOverflow = detached;
|
|
@@ -5886,10 +5886,10 @@ function createBufferedWriter({
|
|
|
5886
5886
|
writeFn(content);
|
|
5887
5887
|
return;
|
|
5888
5888
|
}
|
|
5889
|
-
|
|
5889
|
+
buffer5.push(content);
|
|
5890
5890
|
bufferBytes += content.length;
|
|
5891
5891
|
scheduleFlush();
|
|
5892
|
-
if (
|
|
5892
|
+
if (buffer5.length >= maxBufferSize || bufferBytes >= maxBufferBytes) {
|
|
5893
5893
|
flushDeferred();
|
|
5894
5894
|
}
|
|
5895
5895
|
},
|
|
@@ -7173,14 +7173,14 @@ var init_env = __esm({
|
|
|
7173
7173
|
// node_modules/@anthropic-ai/sdk/internal/utils/bytes.mjs
|
|
7174
7174
|
function concatBytes(buffers) {
|
|
7175
7175
|
let length = 0;
|
|
7176
|
-
for (const
|
|
7177
|
-
length +=
|
|
7176
|
+
for (const buffer5 of buffers) {
|
|
7177
|
+
length += buffer5.length;
|
|
7178
7178
|
}
|
|
7179
7179
|
const output = new Uint8Array(length);
|
|
7180
7180
|
let index = 0;
|
|
7181
|
-
for (const
|
|
7182
|
-
output.set(
|
|
7183
|
-
index +=
|
|
7181
|
+
for (const buffer5 of buffers) {
|
|
7182
|
+
output.set(buffer5, index);
|
|
7183
|
+
index += buffer5.length;
|
|
7184
7184
|
}
|
|
7185
7185
|
return output;
|
|
7186
7186
|
}
|
|
@@ -7815,30 +7815,30 @@ var init_credential_chain = __esm({
|
|
|
7815
7815
|
});
|
|
7816
7816
|
|
|
7817
7817
|
// node_modules/@anthropic-ai/sdk/internal/decoders/line.mjs
|
|
7818
|
-
function findNewlineIndex(
|
|
7818
|
+
function findNewlineIndex(buffer5, startIndex) {
|
|
7819
7819
|
const newline = 10;
|
|
7820
7820
|
const carriage = 13;
|
|
7821
|
-
for (let i = startIndex ?? 0; i <
|
|
7822
|
-
if (
|
|
7821
|
+
for (let i = startIndex ?? 0; i < buffer5.length; i++) {
|
|
7822
|
+
if (buffer5[i] === newline) {
|
|
7823
7823
|
return { preceding: i, index: i + 1, carriage: false };
|
|
7824
7824
|
}
|
|
7825
|
-
if (
|
|
7825
|
+
if (buffer5[i] === carriage) {
|
|
7826
7826
|
return { preceding: i, index: i + 1, carriage: true };
|
|
7827
7827
|
}
|
|
7828
7828
|
}
|
|
7829
7829
|
return null;
|
|
7830
7830
|
}
|
|
7831
|
-
function findDoubleNewlineIndex(
|
|
7831
|
+
function findDoubleNewlineIndex(buffer5) {
|
|
7832
7832
|
const newline = 10;
|
|
7833
7833
|
const carriage = 13;
|
|
7834
|
-
for (let i = 0; i <
|
|
7835
|
-
if (
|
|
7834
|
+
for (let i = 0; i < buffer5.length - 1; i++) {
|
|
7835
|
+
if (buffer5[i] === newline && buffer5[i + 1] === newline) {
|
|
7836
7836
|
return i + 2;
|
|
7837
7837
|
}
|
|
7838
|
-
if (
|
|
7838
|
+
if (buffer5[i] === carriage && buffer5[i + 1] === carriage) {
|
|
7839
7839
|
return i + 2;
|
|
7840
7840
|
}
|
|
7841
|
-
if (
|
|
7841
|
+
if (buffer5[i] === carriage && buffer5[i + 1] === newline && i + 3 < buffer5.length && buffer5[i + 2] === carriage && buffer5[i + 3] === newline) {
|
|
7842
7842
|
return i + 4;
|
|
7843
7843
|
}
|
|
7844
7844
|
}
|
|
@@ -10014,20 +10014,20 @@ var require_sha256 = __commonJS({
|
|
|
10014
10014
|
return digest;
|
|
10015
10015
|
}
|
|
10016
10016
|
exports3.hmac = hmac;
|
|
10017
|
-
function fillBuffer(
|
|
10017
|
+
function fillBuffer(buffer5, hmac2, info, counter) {
|
|
10018
10018
|
var num = counter[0];
|
|
10019
10019
|
if (num === 0) {
|
|
10020
10020
|
throw new Error("hkdf: cannot expand more");
|
|
10021
10021
|
}
|
|
10022
10022
|
hmac2.reset();
|
|
10023
10023
|
if (num > 1) {
|
|
10024
|
-
hmac2.update(
|
|
10024
|
+
hmac2.update(buffer5);
|
|
10025
10025
|
}
|
|
10026
10026
|
if (info) {
|
|
10027
10027
|
hmac2.update(info);
|
|
10028
10028
|
}
|
|
10029
10029
|
hmac2.update(counter);
|
|
10030
|
-
hmac2.finish(
|
|
10030
|
+
hmac2.finish(buffer5);
|
|
10031
10031
|
counter[0]++;
|
|
10032
10032
|
}
|
|
10033
10033
|
var hkdfSalt = new Uint8Array(exports3.digestLength);
|
|
@@ -10041,18 +10041,18 @@ var require_sha256 = __commonJS({
|
|
|
10041
10041
|
var counter = new Uint8Array([1]);
|
|
10042
10042
|
var okm = hmac(salt, key);
|
|
10043
10043
|
var hmac_ = new HMAC(okm);
|
|
10044
|
-
var
|
|
10045
|
-
var bufpos =
|
|
10044
|
+
var buffer5 = new Uint8Array(hmac_.digestLength);
|
|
10045
|
+
var bufpos = buffer5.length;
|
|
10046
10046
|
var out6 = new Uint8Array(length);
|
|
10047
10047
|
for (var i = 0; i < length; i++) {
|
|
10048
|
-
if (bufpos ===
|
|
10049
|
-
fillBuffer(
|
|
10048
|
+
if (bufpos === buffer5.length) {
|
|
10049
|
+
fillBuffer(buffer5, hmac_, info, counter);
|
|
10050
10050
|
bufpos = 0;
|
|
10051
10051
|
}
|
|
10052
|
-
out6[i] =
|
|
10052
|
+
out6[i] = buffer5[bufpos++];
|
|
10053
10053
|
}
|
|
10054
10054
|
hmac_.clean();
|
|
10055
|
-
|
|
10055
|
+
buffer5.fill(0);
|
|
10056
10056
|
counter.fill(0);
|
|
10057
10057
|
return out6;
|
|
10058
10058
|
}
|
|
@@ -13763,9 +13763,9 @@ var init_BetaMessageStream = __esm({
|
|
|
13763
13763
|
* called, multiple times.
|
|
13764
13764
|
* @returns this MessageStream, so that calls can be chained
|
|
13765
13765
|
*/
|
|
13766
|
-
on(event,
|
|
13766
|
+
on(event, listener5) {
|
|
13767
13767
|
const listeners6 = __classPrivateFieldGet(this, _BetaMessageStream_listeners, "f")[event] || (__classPrivateFieldGet(this, _BetaMessageStream_listeners, "f")[event] = []);
|
|
13768
|
-
listeners6.push({ listener:
|
|
13768
|
+
listeners6.push({ listener: listener5 });
|
|
13769
13769
|
return this;
|
|
13770
13770
|
}
|
|
13771
13771
|
/**
|
|
@@ -13775,11 +13775,11 @@ var init_BetaMessageStream = __esm({
|
|
|
13775
13775
|
* off() must be called multiple times to remove each instance.
|
|
13776
13776
|
* @returns this MessageStream, so that calls can be chained
|
|
13777
13777
|
*/
|
|
13778
|
-
off(event,
|
|
13778
|
+
off(event, listener5) {
|
|
13779
13779
|
const listeners6 = __classPrivateFieldGet(this, _BetaMessageStream_listeners, "f")[event];
|
|
13780
13780
|
if (!listeners6)
|
|
13781
13781
|
return this;
|
|
13782
|
-
const index = listeners6.findIndex((l3) => l3.listener ===
|
|
13782
|
+
const index = listeners6.findIndex((l3) => l3.listener === listener5);
|
|
13783
13783
|
if (index >= 0)
|
|
13784
13784
|
listeners6.splice(index, 1);
|
|
13785
13785
|
return this;
|
|
@@ -13789,9 +13789,9 @@ var init_BetaMessageStream = __esm({
|
|
|
13789
13789
|
* this listener is removed and then invoked.
|
|
13790
13790
|
* @returns this MessageStream, so that calls can be chained
|
|
13791
13791
|
*/
|
|
13792
|
-
once(event,
|
|
13792
|
+
once(event, listener5) {
|
|
13793
13793
|
const listeners6 = __classPrivateFieldGet(this, _BetaMessageStream_listeners, "f")[event] || (__classPrivateFieldGet(this, _BetaMessageStream_listeners, "f")[event] = []);
|
|
13794
|
-
listeners6.push({ listener:
|
|
13794
|
+
listeners6.push({ listener: listener5, once: true });
|
|
13795
13795
|
return this;
|
|
13796
13796
|
}
|
|
13797
13797
|
/**
|
|
@@ -13848,7 +13848,7 @@ var init_BetaMessageStream = __esm({
|
|
|
13848
13848
|
const listeners6 = __classPrivateFieldGet(this, _BetaMessageStream_listeners, "f")[event];
|
|
13849
13849
|
if (listeners6) {
|
|
13850
13850
|
__classPrivateFieldGet(this, _BetaMessageStream_listeners, "f")[event] = listeners6.filter((l3) => !l3.once);
|
|
13851
|
-
listeners6.forEach(({ listener:
|
|
13851
|
+
listeners6.forEach(({ listener: listener5 }) => listener5(...args));
|
|
13852
13852
|
}
|
|
13853
13853
|
if (event === "abort") {
|
|
13854
13854
|
const error52 = args[0];
|
|
@@ -16191,9 +16191,9 @@ var init_MessageStream = __esm({
|
|
|
16191
16191
|
* called, multiple times.
|
|
16192
16192
|
* @returns this MessageStream, so that calls can be chained
|
|
16193
16193
|
*/
|
|
16194
|
-
on(event,
|
|
16194
|
+
on(event, listener5) {
|
|
16195
16195
|
const listeners6 = __classPrivateFieldGet(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet(this, _MessageStream_listeners, "f")[event] = []);
|
|
16196
|
-
listeners6.push({ listener:
|
|
16196
|
+
listeners6.push({ listener: listener5 });
|
|
16197
16197
|
return this;
|
|
16198
16198
|
}
|
|
16199
16199
|
/**
|
|
@@ -16203,11 +16203,11 @@ var init_MessageStream = __esm({
|
|
|
16203
16203
|
* off() must be called multiple times to remove each instance.
|
|
16204
16204
|
* @returns this MessageStream, so that calls can be chained
|
|
16205
16205
|
*/
|
|
16206
|
-
off(event,
|
|
16206
|
+
off(event, listener5) {
|
|
16207
16207
|
const listeners6 = __classPrivateFieldGet(this, _MessageStream_listeners, "f")[event];
|
|
16208
16208
|
if (!listeners6)
|
|
16209
16209
|
return this;
|
|
16210
|
-
const index = listeners6.findIndex((l3) => l3.listener ===
|
|
16210
|
+
const index = listeners6.findIndex((l3) => l3.listener === listener5);
|
|
16211
16211
|
if (index >= 0)
|
|
16212
16212
|
listeners6.splice(index, 1);
|
|
16213
16213
|
return this;
|
|
@@ -16217,9 +16217,9 @@ var init_MessageStream = __esm({
|
|
|
16217
16217
|
* this listener is removed and then invoked.
|
|
16218
16218
|
* @returns this MessageStream, so that calls can be chained
|
|
16219
16219
|
*/
|
|
16220
|
-
once(event,
|
|
16220
|
+
once(event, listener5) {
|
|
16221
16221
|
const listeners6 = __classPrivateFieldGet(this, _MessageStream_listeners, "f")[event] || (__classPrivateFieldGet(this, _MessageStream_listeners, "f")[event] = []);
|
|
16222
|
-
listeners6.push({ listener:
|
|
16222
|
+
listeners6.push({ listener: listener5, once: true });
|
|
16223
16223
|
return this;
|
|
16224
16224
|
}
|
|
16225
16225
|
/**
|
|
@@ -16276,7 +16276,7 @@ var init_MessageStream = __esm({
|
|
|
16276
16276
|
const listeners6 = __classPrivateFieldGet(this, _MessageStream_listeners, "f")[event];
|
|
16277
16277
|
if (listeners6) {
|
|
16278
16278
|
__classPrivateFieldGet(this, _MessageStream_listeners, "f")[event] = listeners6.filter((l3) => !l3.once);
|
|
16279
|
-
listeners6.forEach(({ listener:
|
|
16279
|
+
listeners6.forEach(({ listener: listener5 }) => listener5(...args));
|
|
16280
16280
|
}
|
|
16281
16281
|
if (event === "abort") {
|
|
16282
16282
|
const error52 = args[0];
|
|
@@ -17892,12 +17892,12 @@ var init_baseAssignIn = __esm({
|
|
|
17892
17892
|
});
|
|
17893
17893
|
|
|
17894
17894
|
// node_modules/lodash-es/_cloneBuffer.js
|
|
17895
|
-
function cloneBuffer(
|
|
17895
|
+
function cloneBuffer(buffer5, isDeep) {
|
|
17896
17896
|
if (isDeep) {
|
|
17897
|
-
return
|
|
17897
|
+
return buffer5.slice();
|
|
17898
17898
|
}
|
|
17899
|
-
var length =
|
|
17900
|
-
|
|
17899
|
+
var length = buffer5.length, result = allocUnsafe ? allocUnsafe(length) : new buffer5.constructor(length);
|
|
17900
|
+
buffer5.copy(result);
|
|
17901
17901
|
return result;
|
|
17902
17902
|
}
|
|
17903
17903
|
var freeExports3, freeModule3, moduleExports3, Buffer3, allocUnsafe, cloneBuffer_default;
|
|
@@ -17989,8 +17989,8 @@ var init_cloneArrayBuffer = __esm({
|
|
|
17989
17989
|
|
|
17990
17990
|
// node_modules/lodash-es/_cloneDataView.js
|
|
17991
17991
|
function cloneDataView(dataView, isDeep) {
|
|
17992
|
-
var
|
|
17993
|
-
return new dataView.constructor(
|
|
17992
|
+
var buffer5 = isDeep ? cloneArrayBuffer_default(dataView.buffer) : dataView.buffer;
|
|
17993
|
+
return new dataView.constructor(buffer5, dataView.byteOffset, dataView.byteLength);
|
|
17994
17994
|
}
|
|
17995
17995
|
var cloneDataView_default;
|
|
17996
17996
|
var init_cloneDataView = __esm({
|
|
@@ -18030,8 +18030,8 @@ var init_cloneSymbol = __esm({
|
|
|
18030
18030
|
|
|
18031
18031
|
// node_modules/lodash-es/_cloneTypedArray.js
|
|
18032
18032
|
function cloneTypedArray(typedArray2, isDeep) {
|
|
18033
|
-
var
|
|
18034
|
-
return new typedArray2.constructor(
|
|
18033
|
+
var buffer5 = isDeep ? cloneArrayBuffer_default(typedArray2.buffer) : typedArray2.buffer;
|
|
18034
|
+
return new typedArray2.constructor(buffer5, typedArray2.byteOffset, typedArray2.length);
|
|
18035
18035
|
}
|
|
18036
18036
|
var cloneTypedArray_default;
|
|
18037
18037
|
var init_cloneTypedArray = __esm({
|
|
@@ -18564,11 +18564,11 @@ async function readFileRange(path27, offset, maxBytes) {
|
|
|
18564
18564
|
return null;
|
|
18565
18565
|
}
|
|
18566
18566
|
const bytesToRead = Math.min(size - offset, maxBytes);
|
|
18567
|
-
const
|
|
18567
|
+
const buffer5 = Buffer.allocUnsafe(bytesToRead);
|
|
18568
18568
|
let totalRead = 0;
|
|
18569
18569
|
while (totalRead < bytesToRead) {
|
|
18570
18570
|
const { bytesRead } = await fh.read(
|
|
18571
|
-
|
|
18571
|
+
buffer5,
|
|
18572
18572
|
totalRead,
|
|
18573
18573
|
bytesToRead - totalRead,
|
|
18574
18574
|
offset + totalRead
|
|
@@ -18579,7 +18579,7 @@ async function readFileRange(path27, offset, maxBytes) {
|
|
|
18579
18579
|
totalRead += bytesRead;
|
|
18580
18580
|
}
|
|
18581
18581
|
return {
|
|
18582
|
-
content:
|
|
18582
|
+
content: buffer5.toString("utf8", 0, totalRead),
|
|
18583
18583
|
bytesRead: totalRead,
|
|
18584
18584
|
bytesTotal: size
|
|
18585
18585
|
};
|
|
@@ -18600,11 +18600,11 @@ async function tailFile(path27, maxBytes) {
|
|
|
18600
18600
|
}
|
|
18601
18601
|
const offset = Math.max(0, size - maxBytes);
|
|
18602
18602
|
const bytesToRead = size - offset;
|
|
18603
|
-
const
|
|
18603
|
+
const buffer5 = Buffer.allocUnsafe(bytesToRead);
|
|
18604
18604
|
let totalRead = 0;
|
|
18605
18605
|
while (totalRead < bytesToRead) {
|
|
18606
18606
|
const { bytesRead } = await fh.read(
|
|
18607
|
-
|
|
18607
|
+
buffer5,
|
|
18608
18608
|
totalRead,
|
|
18609
18609
|
bytesToRead - totalRead,
|
|
18610
18610
|
offset + totalRead
|
|
@@ -18615,7 +18615,7 @@ async function tailFile(path27, maxBytes) {
|
|
|
18615
18615
|
totalRead += bytesRead;
|
|
18616
18616
|
}
|
|
18617
18617
|
return {
|
|
18618
|
-
content:
|
|
18618
|
+
content: buffer5.toString("utf8", 0, totalRead),
|
|
18619
18619
|
bytesRead: totalRead,
|
|
18620
18620
|
bytesTotal: size
|
|
18621
18621
|
};
|
|
@@ -18633,13 +18633,13 @@ async function* readLinesReverse(path27) {
|
|
|
18633
18633
|
const stats3 = await fileHandle.stat();
|
|
18634
18634
|
let position2 = stats3.size;
|
|
18635
18635
|
let remainder = Buffer.alloc(0);
|
|
18636
|
-
const
|
|
18636
|
+
const buffer5 = Buffer.alloc(CHUNK_SIZE2);
|
|
18637
18637
|
while (position2 > 0) {
|
|
18638
18638
|
const currentChunkSize = Math.min(CHUNK_SIZE2, position2);
|
|
18639
18639
|
position2 -= currentChunkSize;
|
|
18640
|
-
await fileHandle.read(
|
|
18640
|
+
await fileHandle.read(buffer5, 0, currentChunkSize, position2);
|
|
18641
18641
|
const combined = Buffer.concat([
|
|
18642
|
-
|
|
18642
|
+
buffer5.subarray(0, currentChunkSize),
|
|
18643
18643
|
remainder
|
|
18644
18644
|
]);
|
|
18645
18645
|
const firstNewline = combined.indexOf(10);
|
|
@@ -18762,9 +18762,9 @@ var init_fsOperations = __esm({
|
|
|
18762
18762
|
let fd2 = void 0;
|
|
18763
18763
|
try {
|
|
18764
18764
|
fd2 = fs4.openSync(fsPath, "r");
|
|
18765
|
-
const
|
|
18766
|
-
const bytesRead = fs4.readSync(fd2,
|
|
18767
|
-
return { buffer:
|
|
18765
|
+
const buffer5 = Buffer.alloc(options.length);
|
|
18766
|
+
const bytesRead = fs4.readSync(fd2, buffer5, 0, options.length, 0);
|
|
18767
|
+
return { buffer: buffer5, bytesRead };
|
|
18768
18768
|
} finally {
|
|
18769
18769
|
if (fd2) fs4.closeSync(fd2);
|
|
18770
18770
|
}
|
|
@@ -18963,11 +18963,11 @@ var init_fsOperations = __esm({
|
|
|
18963
18963
|
try {
|
|
18964
18964
|
const { size } = await handle.stat();
|
|
18965
18965
|
const readSize = Math.min(size, maxBytes);
|
|
18966
|
-
const
|
|
18966
|
+
const buffer5 = Buffer.allocUnsafe(readSize);
|
|
18967
18967
|
let offset = 0;
|
|
18968
18968
|
while (offset < readSize) {
|
|
18969
18969
|
const { bytesRead } = await handle.read(
|
|
18970
|
-
|
|
18970
|
+
buffer5,
|
|
18971
18971
|
offset,
|
|
18972
18972
|
readSize - offset,
|
|
18973
18973
|
offset
|
|
@@ -18975,7 +18975,7 @@ var init_fsOperations = __esm({
|
|
|
18975
18975
|
if (bytesRead === 0) break;
|
|
18976
18976
|
offset += bytesRead;
|
|
18977
18977
|
}
|
|
18978
|
-
return offset < readSize ?
|
|
18978
|
+
return offset < readSize ? buffer5.subarray(0, offset) : buffer5;
|
|
18979
18979
|
} finally {
|
|
18980
18980
|
await handle.close();
|
|
18981
18981
|
}
|
|
@@ -19626,15 +19626,15 @@ var require_readShebang = __commonJS({
|
|
|
19626
19626
|
var shebangCommand = require_shebang_command();
|
|
19627
19627
|
function readShebang(command8) {
|
|
19628
19628
|
const size = 150;
|
|
19629
|
-
const
|
|
19629
|
+
const buffer5 = Buffer.alloc(size);
|
|
19630
19630
|
let fd2;
|
|
19631
19631
|
try {
|
|
19632
19632
|
fd2 = fs15.openSync(command8, "r");
|
|
19633
|
-
fs15.readSync(fd2,
|
|
19633
|
+
fs15.readSync(fd2, buffer5, 0, size, 0);
|
|
19634
19634
|
fs15.closeSync(fd2);
|
|
19635
19635
|
} catch (e) {
|
|
19636
19636
|
}
|
|
19637
|
-
return shebangCommand(
|
|
19637
|
+
return shebangCommand(buffer5.toString());
|
|
19638
19638
|
}
|
|
19639
19639
|
module2.exports = readShebang;
|
|
19640
19640
|
}
|
|
@@ -20636,12 +20636,12 @@ var init_mjs = __esm({
|
|
|
20636
20636
|
}
|
|
20637
20637
|
this.#loaded = false;
|
|
20638
20638
|
signals.forEach((sig) => {
|
|
20639
|
-
const
|
|
20640
|
-
if (!
|
|
20639
|
+
const listener5 = this.#sigListeners[sig];
|
|
20640
|
+
if (!listener5) {
|
|
20641
20641
|
throw new Error("Listener not defined for signal: " + sig);
|
|
20642
20642
|
}
|
|
20643
20643
|
try {
|
|
20644
|
-
this.#process.removeListener(sig,
|
|
20644
|
+
this.#process.removeListener(sig, listener5);
|
|
20645
20645
|
} catch (_2) {
|
|
20646
20646
|
}
|
|
20647
20647
|
});
|
|
@@ -21182,8 +21182,8 @@ var init_stream = __esm({
|
|
|
21182
21182
|
return error52.bufferedData;
|
|
21183
21183
|
}
|
|
21184
21184
|
};
|
|
21185
|
-
getStreamPromise = (stream5, { encoding, buffer:
|
|
21186
|
-
if (!stream5 || !
|
|
21185
|
+
getStreamPromise = (stream5, { encoding, buffer: buffer5, maxBuffer }) => {
|
|
21186
|
+
if (!stream5 || !buffer5) {
|
|
21187
21187
|
return;
|
|
21188
21188
|
}
|
|
21189
21189
|
if (encoding === "utf8" || encoding === "utf-8") {
|
|
@@ -21195,13 +21195,13 @@ var init_stream = __esm({
|
|
|
21195
21195
|
return applyEncoding(stream5, maxBuffer, encoding);
|
|
21196
21196
|
};
|
|
21197
21197
|
applyEncoding = async (stream5, maxBuffer, encoding) => {
|
|
21198
|
-
const
|
|
21199
|
-
return
|
|
21198
|
+
const buffer5 = await getStreamAsBuffer(stream5, { maxBuffer });
|
|
21199
|
+
return buffer5.toString(encoding);
|
|
21200
21200
|
};
|
|
21201
|
-
getSpawnedResult = async ({ stdout, stderr, all: all4 }, { encoding, buffer:
|
|
21202
|
-
const stdoutPromise = getStreamPromise(stdout, { encoding, buffer:
|
|
21203
|
-
const stderrPromise = getStreamPromise(stderr, { encoding, buffer:
|
|
21204
|
-
const allPromise = getStreamPromise(all4, { encoding, buffer:
|
|
21201
|
+
getSpawnedResult = async ({ stdout, stderr, all: all4 }, { encoding, buffer: buffer5, maxBuffer }, processDone) => {
|
|
21202
|
+
const stdoutPromise = getStreamPromise(stdout, { encoding, buffer: buffer5, maxBuffer });
|
|
21203
|
+
const stderrPromise = getStreamPromise(stderr, { encoding, buffer: buffer5, maxBuffer });
|
|
21204
|
+
const allPromise = getStreamPromise(all4, { encoding, buffer: buffer5, maxBuffer: maxBuffer * 2 });
|
|
21205
21205
|
try {
|
|
21206
21206
|
return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
|
|
21207
21207
|
} catch (error52) {
|
|
@@ -25421,16 +25421,16 @@ var init_mergeWith = __esm({
|
|
|
25421
25421
|
|
|
25422
25422
|
// build-src/src/utils/fileRead.ts
|
|
25423
25423
|
function detectEncodingForResolvedPath(resolvedPath) {
|
|
25424
|
-
const { buffer:
|
|
25424
|
+
const { buffer: buffer5, bytesRead } = getFsImplementation().readSync(resolvedPath, {
|
|
25425
25425
|
length: 4096
|
|
25426
25426
|
});
|
|
25427
25427
|
if (bytesRead === 0) {
|
|
25428
25428
|
return "utf8";
|
|
25429
25429
|
}
|
|
25430
25430
|
if (bytesRead >= 2) {
|
|
25431
|
-
if (
|
|
25431
|
+
if (buffer5[0] === 255 && buffer5[1] === 254) return "utf16le";
|
|
25432
25432
|
}
|
|
25433
|
-
if (bytesRead >= 3 &&
|
|
25433
|
+
if (bytesRead >= 3 && buffer5[0] === 239 && buffer5[1] === 187 && buffer5[2] === 191) {
|
|
25434
25434
|
return "utf8";
|
|
25435
25435
|
}
|
|
25436
25436
|
return "utf8";
|
|
@@ -40857,8 +40857,8 @@ function detectLineEndings(filePath, encoding = "utf8") {
|
|
|
40857
40857
|
try {
|
|
40858
40858
|
const fs15 = getFsImplementation();
|
|
40859
40859
|
const { resolvedPath } = safeResolvePath(fs15, filePath);
|
|
40860
|
-
const { buffer:
|
|
40861
|
-
const content =
|
|
40860
|
+
const { buffer: buffer5, bytesRead } = fs15.readSync(resolvedPath, { length: 4096 });
|
|
40861
|
+
const content = buffer5.toString(encoding, 0, bytesRead);
|
|
40862
40862
|
return detectLineEndingsForString(content);
|
|
40863
40863
|
} catch (error52) {
|
|
40864
40864
|
logError(error52);
|
|
@@ -57683,9 +57683,9 @@ var require_follow_redirects = __commonJS({
|
|
|
57683
57683
|
if (error52) {
|
|
57684
57684
|
self2.emit("error", error52);
|
|
57685
57685
|
} else if (i < buffers.length) {
|
|
57686
|
-
var
|
|
57686
|
+
var buffer5 = buffers[i++];
|
|
57687
57687
|
if (!request.finished) {
|
|
57688
|
-
request.write(
|
|
57688
|
+
request.write(buffer5.data, buffer5.encoding, writeNext);
|
|
57689
57689
|
}
|
|
57690
57690
|
} else if (self2._ended) {
|
|
57691
57691
|
request.end();
|
|
@@ -57957,14 +57957,14 @@ function fromDataURI(uri, asBlob, options) {
|
|
|
57957
57957
|
} else if (params) {
|
|
57958
57958
|
mime = "text/plain" + params;
|
|
57959
57959
|
}
|
|
57960
|
-
const
|
|
57960
|
+
const buffer5 = encoding === "base64" ? Buffer.from(body, "base64") : Buffer.from(decodeURIComponent(body), encoding);
|
|
57961
57961
|
if (asBlob) {
|
|
57962
57962
|
if (!_Blob) {
|
|
57963
57963
|
throw new AxiosError_default("Blob is not supported", AxiosError_default.ERR_NOT_SUPPORT);
|
|
57964
57964
|
}
|
|
57965
|
-
return new _Blob([
|
|
57965
|
+
return new _Blob([buffer5], { type: mime });
|
|
57966
57966
|
}
|
|
57967
|
-
return
|
|
57967
|
+
return buffer5;
|
|
57968
57968
|
}
|
|
57969
57969
|
throw new AxiosError_default("Unsupported protocol " + protocol, AxiosError_default.ERR_NOT_SUPPORT);
|
|
57970
57970
|
}
|
|
@@ -58593,7 +58593,7 @@ var init_progressEventReducer = __esm({
|
|
|
58593
58593
|
init_speedometer();
|
|
58594
58594
|
init_throttle();
|
|
58595
58595
|
init_utils4();
|
|
58596
|
-
progressEventReducer = (
|
|
58596
|
+
progressEventReducer = (listener5, isDownloadStream, freq = 3) => {
|
|
58597
58597
|
let bytesNotified = 0;
|
|
58598
58598
|
const _speedometer = speedometer_default(50, 250);
|
|
58599
58599
|
return throttle_default((e) => {
|
|
@@ -58617,7 +58617,7 @@ var init_progressEventReducer = __esm({
|
|
|
58617
58617
|
lengthComputable: total != null,
|
|
58618
58618
|
[isDownloadStream ? "download" : "upload"]: true
|
|
58619
58619
|
};
|
|
58620
|
-
|
|
58620
|
+
listener5(data);
|
|
58621
58621
|
}, freq);
|
|
58622
58622
|
};
|
|
58623
58623
|
progressEventDecorator = (total, throttled) => {
|
|
@@ -61229,25 +61229,25 @@ var init_CancelToken = __esm({
|
|
|
61229
61229
|
/**
|
|
61230
61230
|
* Subscribe to the cancel signal
|
|
61231
61231
|
*/
|
|
61232
|
-
subscribe(
|
|
61232
|
+
subscribe(listener5) {
|
|
61233
61233
|
if (this.reason) {
|
|
61234
|
-
|
|
61234
|
+
listener5(this.reason);
|
|
61235
61235
|
return;
|
|
61236
61236
|
}
|
|
61237
61237
|
if (this._listeners) {
|
|
61238
|
-
this._listeners.push(
|
|
61238
|
+
this._listeners.push(listener5);
|
|
61239
61239
|
} else {
|
|
61240
|
-
this._listeners = [
|
|
61240
|
+
this._listeners = [listener5];
|
|
61241
61241
|
}
|
|
61242
61242
|
}
|
|
61243
61243
|
/**
|
|
61244
61244
|
* Unsubscribe from the cancel signal
|
|
61245
61245
|
*/
|
|
61246
|
-
unsubscribe(
|
|
61246
|
+
unsubscribe(listener5) {
|
|
61247
61247
|
if (!this._listeners) {
|
|
61248
61248
|
return;
|
|
61249
61249
|
}
|
|
61250
|
-
const index = this._listeners.indexOf(
|
|
61250
|
+
const index = this._listeners.indexOf(listener5);
|
|
61251
61251
|
if (index !== -1) {
|
|
61252
61252
|
this._listeners.splice(index, 1);
|
|
61253
61253
|
}
|
|
@@ -65631,29 +65631,29 @@ var require_polyfills = __commonJS({
|
|
|
65631
65631
|
})(fs15.rename);
|
|
65632
65632
|
}
|
|
65633
65633
|
fs15.read = typeof fs15.read !== "function" ? fs15.read : (function(fs$read) {
|
|
65634
|
-
function read(fd2,
|
|
65634
|
+
function read(fd2, buffer5, offset, length, position2, callback_) {
|
|
65635
65635
|
var callback;
|
|
65636
65636
|
if (callback_ && typeof callback_ === "function") {
|
|
65637
65637
|
var eagCounter = 0;
|
|
65638
65638
|
callback = function(er, _2, __) {
|
|
65639
65639
|
if (er && er.code === "EAGAIN" && eagCounter < 10) {
|
|
65640
65640
|
eagCounter++;
|
|
65641
|
-
return fs$read.call(fs15, fd2,
|
|
65641
|
+
return fs$read.call(fs15, fd2, buffer5, offset, length, position2, callback);
|
|
65642
65642
|
}
|
|
65643
65643
|
callback_.apply(this, arguments);
|
|
65644
65644
|
};
|
|
65645
65645
|
}
|
|
65646
|
-
return fs$read.call(fs15, fd2,
|
|
65646
|
+
return fs$read.call(fs15, fd2, buffer5, offset, length, position2, callback);
|
|
65647
65647
|
}
|
|
65648
65648
|
if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
|
|
65649
65649
|
return read;
|
|
65650
65650
|
})(fs15.read);
|
|
65651
65651
|
fs15.readSync = typeof fs15.readSync !== "function" ? fs15.readSync : /* @__PURE__ */ (function(fs$readSync) {
|
|
65652
|
-
return function(fd2,
|
|
65652
|
+
return function(fd2, buffer5, offset, length, position2) {
|
|
65653
65653
|
var eagCounter = 0;
|
|
65654
65654
|
while (true) {
|
|
65655
65655
|
try {
|
|
65656
|
-
return fs$readSync.call(fs15, fd2,
|
|
65656
|
+
return fs$readSync.call(fs15, fd2, buffer5, offset, length, position2);
|
|
65657
65657
|
} catch (er) {
|
|
65658
65658
|
if (er.code === "EAGAIN" && eagCounter < 10) {
|
|
65659
65659
|
eagCounter++;
|
|
@@ -66655,7 +66655,7 @@ var require_signal_exit = __commonJS({
|
|
|
66655
66655
|
};
|
|
66656
66656
|
sigListeners = {};
|
|
66657
66657
|
signals2.forEach(function(sig) {
|
|
66658
|
-
sigListeners[sig] = function
|
|
66658
|
+
sigListeners[sig] = function listener5() {
|
|
66659
66659
|
if (!processOk2(global.process)) {
|
|
66660
66660
|
return;
|
|
66661
66661
|
}
|
|
@@ -75461,8 +75461,8 @@ var require_react_reconciler_production = __commonJS({
|
|
|
75461
75461
|
value: null,
|
|
75462
75462
|
reason: null,
|
|
75463
75463
|
listeners: [],
|
|
75464
|
-
then: function(
|
|
75465
|
-
actionNode.listeners.push(
|
|
75464
|
+
then: function(listener5) {
|
|
75465
|
+
actionNode.listeners.push(listener5);
|
|
75466
75466
|
}
|
|
75467
75467
|
};
|
|
75468
75468
|
null !== ReactSharedInternals.T ? setPendingState(true) : actionNode.isTransition = false;
|
|
@@ -80641,14 +80641,14 @@ var require_react_reconciler_production = __commonJS({
|
|
|
80641
80641
|
}, hasOwnProperty16 = Object.prototype.hasOwnProperty, prefix, suffix, reentry = false, CapturedStacks = /* @__PURE__ */ new WeakMap(), forkStack = [], forkStackIndex = 0, treeForkProvider = null, treeForkCount = 0, idStack = [], idStackIndex = 0, treeContextProvider = null, treeContextId = 1, treeContextOverflow = "", contextStackCursor = createCursor(null), contextFiberStackCursor = createCursor(null), rootInstanceStackCursor = createCursor(null), hostTransitionProviderCursor = createCursor(null), hydrationParentFiber = null, nextHydratableInstance = null, isHydrating = false, hydrationErrors = null, rootOrSingletonContext = false, HydrationMismatchException = Error(formatProdErrorMessage(519)), valueCursor = createCursor(null), currentlyRenderingFiber$1 = null, lastContextDependency = null, AbortControllerLocal = "undefined" !== typeof AbortController ? AbortController : function() {
|
|
80642
80642
|
var listeners6 = [], signal = this.signal = {
|
|
80643
80643
|
aborted: false,
|
|
80644
|
-
addEventListener: function(type,
|
|
80645
|
-
listeners6.push(
|
|
80644
|
+
addEventListener: function(type, listener5) {
|
|
80645
|
+
listeners6.push(listener5);
|
|
80646
80646
|
}
|
|
80647
80647
|
};
|
|
80648
80648
|
this.abort = function() {
|
|
80649
80649
|
signal.aborted = true;
|
|
80650
|
-
listeners6.forEach(function(
|
|
80651
|
-
return
|
|
80650
|
+
listeners6.forEach(function(listener5) {
|
|
80651
|
+
return listener5();
|
|
80652
80652
|
});
|
|
80653
80653
|
};
|
|
80654
80654
|
}, scheduleCallback$2 = Scheduler.unstable_scheduleCallback, NormalPriority = Scheduler.unstable_NormalPriority, CacheContext = {
|
|
@@ -85669,8 +85669,8 @@ var require_react_reconciler_development = __commonJS({
|
|
|
85669
85669
|
value: null,
|
|
85670
85670
|
reason: null,
|
|
85671
85671
|
listeners: [],
|
|
85672
|
-
then: function(
|
|
85673
|
-
actionNode.listeners.push(
|
|
85672
|
+
then: function(listener5) {
|
|
85673
|
+
actionNode.listeners.push(listener5);
|
|
85674
85674
|
}
|
|
85675
85675
|
};
|
|
85676
85676
|
null !== ReactSharedInternals.T ? setPendingState(true) : actionNode.isTransition = false;
|
|
@@ -93267,14 +93267,14 @@ var require_react_reconciler_development = __commonJS({
|
|
|
93267
93267
|
var currentlyRenderingFiber$1 = null, lastContextDependency = null, isDisallowedContextReadInDEV = false, AbortControllerLocal = "undefined" !== typeof AbortController ? AbortController : function() {
|
|
93268
93268
|
var listeners6 = [], signal = this.signal = {
|
|
93269
93269
|
aborted: false,
|
|
93270
|
-
addEventListener: function(type,
|
|
93271
|
-
listeners6.push(
|
|
93270
|
+
addEventListener: function(type, listener5) {
|
|
93271
|
+
listeners6.push(listener5);
|
|
93272
93272
|
}
|
|
93273
93273
|
};
|
|
93274
93274
|
this.abort = function() {
|
|
93275
93275
|
signal.aborted = true;
|
|
93276
|
-
listeners6.forEach(function(
|
|
93277
|
-
return
|
|
93276
|
+
listeners6.forEach(function(listener5) {
|
|
93277
|
+
return listener5();
|
|
93278
93278
|
});
|
|
93279
93279
|
};
|
|
93280
93280
|
}, scheduleCallback$2 = Scheduler.unstable_scheduleCallback, NormalPriority = Scheduler.unstable_NormalPriority, CacheContext = {
|
|
@@ -101856,45 +101856,45 @@ function writeDiffToTerminal(terminal, diff2, skipSyncMarkers = false) {
|
|
|
101856
101856
|
const useSync = !skipSyncMarkers;
|
|
101857
101857
|
const _termRows = terminal.stdout.rows || 24;
|
|
101858
101858
|
const _yClamp = _termRows > 1 ? _termRows - 1 : void 0;
|
|
101859
|
-
let
|
|
101859
|
+
let buffer5 = useSync ? BSU : "";
|
|
101860
101860
|
for (const patch2 of diff2) {
|
|
101861
101861
|
switch (patch2.type) {
|
|
101862
101862
|
case "stdout":
|
|
101863
|
-
|
|
101863
|
+
buffer5 += patch2.content;
|
|
101864
101864
|
break;
|
|
101865
101865
|
case "clear":
|
|
101866
101866
|
if (patch2.count > 0) {
|
|
101867
|
-
|
|
101867
|
+
buffer5 += eraseLines(patch2.count);
|
|
101868
101868
|
}
|
|
101869
101869
|
break;
|
|
101870
101870
|
case "clearTerminal":
|
|
101871
|
-
|
|
101871
|
+
buffer5 += getClearTerminalSequence();
|
|
101872
101872
|
break;
|
|
101873
101873
|
case "cursorHide":
|
|
101874
|
-
|
|
101874
|
+
buffer5 += HIDE_CURSOR;
|
|
101875
101875
|
break;
|
|
101876
101876
|
case "cursorShow":
|
|
101877
|
-
|
|
101877
|
+
buffer5 += SHOW_CURSOR;
|
|
101878
101878
|
break;
|
|
101879
101879
|
case "cursorMove":
|
|
101880
|
-
|
|
101880
|
+
buffer5 += cursorMove(patch2.x, _yClamp !== void 0 ? Math.max(-_yClamp, Math.min(_yClamp, patch2.y)) : patch2.y);
|
|
101881
101881
|
break;
|
|
101882
101882
|
case "cursorTo":
|
|
101883
|
-
|
|
101883
|
+
buffer5 += cursorTo(patch2.col);
|
|
101884
101884
|
break;
|
|
101885
101885
|
case "carriageReturn":
|
|
101886
|
-
|
|
101886
|
+
buffer5 += "\r";
|
|
101887
101887
|
break;
|
|
101888
101888
|
case "hyperlink":
|
|
101889
|
-
|
|
101889
|
+
buffer5 += link(patch2.uri);
|
|
101890
101890
|
break;
|
|
101891
101891
|
case "styleStr":
|
|
101892
|
-
|
|
101892
|
+
buffer5 += patch2.str;
|
|
101893
101893
|
break;
|
|
101894
101894
|
}
|
|
101895
101895
|
}
|
|
101896
|
-
if (useSync)
|
|
101897
|
-
terminal.stdout.write(
|
|
101896
|
+
if (useSync) buffer5 += ESU;
|
|
101897
|
+
terminal.stdout.write(buffer5);
|
|
101898
101898
|
}
|
|
101899
101899
|
var import_semver, xtversionName, EXTENDED_KEYS_TERMINALS, SYNC_OUTPUT_SUPPORTED, ATLAS_RESET;
|
|
101900
101900
|
var init_terminal = __esm({
|
|
@@ -105225,14 +105225,14 @@ function styledCharsWithGraphemeClustering(chars, stylePool) {
|
|
|
105225
105225
|
}
|
|
105226
105226
|
return result;
|
|
105227
105227
|
}
|
|
105228
|
-
function flushBuffer(
|
|
105228
|
+
function flushBuffer(buffer5, styles5, stylePool, out6) {
|
|
105229
105229
|
const hyperlink = extractHyperlinkFromStyles(styles5) ?? void 0;
|
|
105230
105230
|
const hasOsc8Styles = hyperlink !== void 0 || styles5.some(
|
|
105231
105231
|
(s) => s.code.length >= OSC8_PREFIX.length && s.code.startsWith(OSC8_PREFIX)
|
|
105232
105232
|
);
|
|
105233
105233
|
const filteredStyles = hasOsc8Styles ? filterOutHyperlinkStyles(styles5) : styles5;
|
|
105234
105234
|
const styleId = stylePool.intern(filteredStyles);
|
|
105235
|
-
for (const { segment: grapheme } of getGraphemeSegmenter().segment(
|
|
105235
|
+
for (const { segment: grapheme } of getGraphemeSegmenter().segment(buffer5)) {
|
|
105236
105236
|
out6.push({
|
|
105237
105237
|
value: grapheme,
|
|
105238
105238
|
width: stringWidth(grapheme),
|
|
@@ -106906,12 +106906,12 @@ function suspendStdin(stdin, state3, log2 = () => {
|
|
|
106906
106906
|
log2(
|
|
106907
106907
|
`[stdin] suspendStdin: removing ${readableListeners.length} readable listener(s), wasRawMode=${stdin.isRaw ?? false}`
|
|
106908
106908
|
);
|
|
106909
|
-
readableListeners.forEach((
|
|
106909
|
+
readableListeners.forEach((listener5) => {
|
|
106910
106910
|
state3.listeners.push({
|
|
106911
106911
|
event: "readable",
|
|
106912
|
-
listener:
|
|
106912
|
+
listener: listener5
|
|
106913
106913
|
});
|
|
106914
|
-
stdin.removeListener("readable",
|
|
106914
|
+
stdin.removeListener("readable", listener5);
|
|
106915
106915
|
});
|
|
106916
106916
|
if (stdin.isRaw && stdin.setRawMode) {
|
|
106917
106917
|
stdin.setRawMode(false);
|
|
@@ -106933,8 +106933,8 @@ function resumeStdin(stdin, state3, log2 = () => {
|
|
|
106933
106933
|
log2(
|
|
106934
106934
|
`[stdin] resumeStdin: re-attaching ${state3.listeners.length} listener(s), wasRawMode=${state3.wasRawMode}`
|
|
106935
106935
|
);
|
|
106936
|
-
state3.listeners.forEach(({ event, listener:
|
|
106937
|
-
stdin.addListener(event,
|
|
106936
|
+
state3.listeners.forEach(({ event, listener: listener5 }) => {
|
|
106937
|
+
stdin.addListener(event, listener5);
|
|
106938
106938
|
});
|
|
106939
106939
|
state3.listeners = [];
|
|
106940
106940
|
if (state3.wasRawMode) {
|
|
@@ -111598,10 +111598,12 @@ function doneToSdkResult(ev, ctx) {
|
|
|
111598
111598
|
}
|
|
111599
111599
|
const rr = r;
|
|
111600
111600
|
const durationMs = elapsedMs(ctx);
|
|
111601
|
+
const errorCodeField = typeof rr.errorCode === "string" && rr.errorCode.length > 0 ? { errorCode: rr.errorCode } : {};
|
|
111601
111602
|
if (rr.status === "failed") {
|
|
111603
|
+
const failedSubtype = rr.errorCode === "budget.exceeded" || rr.errorCode === "budget.precall" ? "error_max_budget_usd" : rr.errorCode === "limit.max_turns" ? "error_max_turns" : rr.errorCode === "output.invalid" ? "error_max_structured_output_retries" : "error_during_execution";
|
|
111602
111604
|
return stamp(ctx, {
|
|
111603
111605
|
type: "result",
|
|
111604
|
-
subtype:
|
|
111606
|
+
subtype: failedSubtype,
|
|
111605
111607
|
duration_ms: durationMs,
|
|
111606
111608
|
// P1-5 real elapsed (stream-open → terminal)
|
|
111607
111609
|
duration_api_ms: durationMs,
|
|
@@ -111619,7 +111621,51 @@ function doneToSdkResult(ev, ctx) {
|
|
|
111619
111621
|
// 与 failedToSdkResult 的同款 append 对齐,message 后附 code 便于对账。
|
|
111620
111622
|
errors: [
|
|
111621
111623
|
typeof rr.errorCode === "string" && (rr.errorCode.startsWith("resume_at.") || rr.errorCode.startsWith("rewind_snapshot.")) && rr.errorMessage ? `${rr.errorMessage} (${rr.errorCode})` : rr.errorMessage ?? "run failed"
|
|
111622
|
-
]
|
|
111624
|
+
],
|
|
111625
|
+
...errorCodeField
|
|
111626
|
+
});
|
|
111627
|
+
}
|
|
111628
|
+
if (rr.status === "timeout") {
|
|
111629
|
+
const salvaged = typeof r.result === "string" && r.result.trim().length > 0 ? r.result : void 0;
|
|
111630
|
+
return stamp(ctx, {
|
|
111631
|
+
type: "result",
|
|
111632
|
+
subtype: "error_max_turns",
|
|
111633
|
+
duration_ms: durationMs,
|
|
111634
|
+
duration_api_ms: durationMs,
|
|
111635
|
+
is_error: true,
|
|
111636
|
+
num_turns: stats3?.turns ?? 0,
|
|
111637
|
+
stop_reason: null,
|
|
111638
|
+
total_cost_usd: costOrNull(stats3?.costUsd),
|
|
111639
|
+
usage,
|
|
111640
|
+
modelUsage,
|
|
111641
|
+
permission_denials: [],
|
|
111642
|
+
errors: [
|
|
111643
|
+
`${rr.errorMessage ?? "run hit its wall-clock deadline and was finalized by the engine"} (${rr.errorCode ?? "limit.timeout"})`
|
|
111644
|
+
],
|
|
111645
|
+
...errorCodeField,
|
|
111646
|
+
// 写出窗 salvage(additive seam 字段):deadline 前引擎救回的最终文本非空时随帧带出——
|
|
111647
|
+
// CC error 帧无 result 键,但静默丢弃已救回的答案对 -p 集成面是净损失(TB qe** 实证)。
|
|
111648
|
+
...salvaged !== void 0 ? { result: salvaged } : {}
|
|
111649
|
+
});
|
|
111650
|
+
}
|
|
111651
|
+
if (rr.status === "blocked") {
|
|
111652
|
+
const blockedReason = r.blockedReason;
|
|
111653
|
+
return stamp(ctx, {
|
|
111654
|
+
type: "result",
|
|
111655
|
+
subtype: "error_during_execution",
|
|
111656
|
+
duration_ms: durationMs,
|
|
111657
|
+
duration_api_ms: durationMs,
|
|
111658
|
+
is_error: true,
|
|
111659
|
+
num_turns: stats3?.turns ?? 0,
|
|
111660
|
+
stop_reason: null,
|
|
111661
|
+
total_cost_usd: costOrNull(stats3?.costUsd),
|
|
111662
|
+
usage,
|
|
111663
|
+
modelUsage,
|
|
111664
|
+
permission_denials: [],
|
|
111665
|
+
errors: [
|
|
111666
|
+
typeof blockedReason === "string" && blockedReason.length > 0 ? `Run blocked: ${blockedReason}` : "Run blocked (the agent reported it cannot proceed)"
|
|
111667
|
+
],
|
|
111668
|
+
...errorCodeField
|
|
111623
111669
|
});
|
|
111624
111670
|
}
|
|
111625
111671
|
if (rr.status === "suspended" || rr.status === "needs_review") {
|
|
@@ -111644,7 +111690,28 @@ function doneToSdkResult(ev, ctx) {
|
|
|
111644
111690
|
permission_denials: [],
|
|
111645
111691
|
errors: [
|
|
111646
111692
|
`Turn suspended awaiting ${awaiting} that no one can provide in -p (non-interactive) mode${runId ? ` (run ${runId})` : ""}. ${wayOut}`
|
|
111647
|
-
]
|
|
111693
|
+
],
|
|
111694
|
+
...errorCodeField
|
|
111695
|
+
// [909]B1 — needs_review 帧带 review.pending,原样透传
|
|
111696
|
+
});
|
|
111697
|
+
}
|
|
111698
|
+
if (typeof rr.status === "string" && rr.status.length > 0 && rr.status !== "completed") {
|
|
111699
|
+
return stamp(ctx, {
|
|
111700
|
+
type: "result",
|
|
111701
|
+
subtype: "error_during_execution",
|
|
111702
|
+
duration_ms: durationMs,
|
|
111703
|
+
duration_api_ms: durationMs,
|
|
111704
|
+
is_error: true,
|
|
111705
|
+
num_turns: stats3?.turns ?? 0,
|
|
111706
|
+
stop_reason: null,
|
|
111707
|
+
total_cost_usd: costOrNull(stats3?.costUsd),
|
|
111708
|
+
usage,
|
|
111709
|
+
modelUsage,
|
|
111710
|
+
permission_denials: [],
|
|
111711
|
+
errors: [
|
|
111712
|
+
rr.errorMessage ?? `run ended with terminal status "${rr.status}" (not a success; this CLI predates that status word)`
|
|
111713
|
+
],
|
|
111714
|
+
...errorCodeField
|
|
111648
111715
|
});
|
|
111649
111716
|
}
|
|
111650
111717
|
return stamp(ctx, {
|
|
@@ -111701,7 +111768,10 @@ function failedToSdkResult(ev, ctx) {
|
|
|
111701
111768
|
// 用户可自解的操作性错误(选错目标/回退过根/快照缺失),code 附在 message 后便于对账。
|
|
111702
111769
|
errors: [
|
|
111703
111770
|
typeof ev.errorCode === "string" && (ev.errorCode.startsWith("resume_at.") || ev.errorCode.startsWith("rewind_snapshot.")) && ev.errorMessage ? `${ev.errorMessage} (${ev.errorCode})` : ev.errorMessage ?? ev.errorCode ?? "run failed"
|
|
111704
|
-
]
|
|
111771
|
+
],
|
|
111772
|
+
// [909]B1 — errorCode 透传(additive seam 字段;done 臂同款):`failed` 事件的 cancelled/
|
|
111773
|
+
// budget.* 等引擎值原样给集成面。
|
|
111774
|
+
...typeof ev.errorCode === "string" && ev.errorCode.length > 0 ? { errorCode: ev.errorCode } : {}
|
|
111705
111775
|
});
|
|
111706
111776
|
}
|
|
111707
111777
|
function terminalToSdkResult(ev, ctx) {
|
|
@@ -113533,8 +113603,8 @@ var require_util = __commonJS({
|
|
|
113533
113603
|
}
|
|
113534
113604
|
return headers.map((x2) => Buffer.from(x2));
|
|
113535
113605
|
}
|
|
113536
|
-
function isBuffer3(
|
|
113537
|
-
return
|
|
113606
|
+
function isBuffer3(buffer5) {
|
|
113607
|
+
return buffer5 instanceof Uint8Array || Buffer.isBuffer(buffer5);
|
|
113538
113608
|
}
|
|
113539
113609
|
function assertRequestHandler(handler, method, upgrade2) {
|
|
113540
113610
|
if (!handler || typeof handler !== "object") {
|
|
@@ -113617,16 +113687,16 @@ var require_util = __commonJS({
|
|
|
113617
113687
|
function isFormDataLike(object5) {
|
|
113618
113688
|
return object5 && typeof object5 === "object" && typeof object5.append === "function" && typeof object5.delete === "function" && typeof object5.get === "function" && typeof object5.getAll === "function" && typeof object5.has === "function" && typeof object5.set === "function" && object5[Symbol.toStringTag] === "FormData";
|
|
113619
113689
|
}
|
|
113620
|
-
function addAbortListener(signal,
|
|
113690
|
+
function addAbortListener(signal, listener5) {
|
|
113621
113691
|
if (!signal || "aborted" in signal) {
|
|
113622
|
-
return addAbortListenerNative(signal,
|
|
113692
|
+
return addAbortListenerNative(signal, listener5)[Symbol.dispose];
|
|
113623
113693
|
}
|
|
113624
113694
|
if (typeof signal.addEventListener === "function") {
|
|
113625
|
-
signal.addEventListener("abort",
|
|
113626
|
-
return () => signal.removeEventListener("abort",
|
|
113695
|
+
signal.addEventListener("abort", listener5, { once: true });
|
|
113696
|
+
return () => signal.removeEventListener("abort", listener5);
|
|
113627
113697
|
}
|
|
113628
|
-
signal.once("abort",
|
|
113629
|
-
return () => signal.removeListener("abort",
|
|
113698
|
+
signal.once("abort", listener5);
|
|
113699
|
+
return () => signal.removeListener("abort", listener5);
|
|
113630
113700
|
}
|
|
113631
113701
|
var validTokenChars = new Uint8Array([
|
|
113632
113702
|
0,
|
|
@@ -113931,16 +114001,16 @@ var require_util = __commonJS({
|
|
|
113931
114001
|
size: m2[3] && m2[3] !== "*" ? parseInt(m2[3]) : null
|
|
113932
114002
|
} : null;
|
|
113933
114003
|
}
|
|
113934
|
-
function addListener(obj, name,
|
|
114004
|
+
function addListener(obj, name, listener5) {
|
|
113935
114005
|
const listeners6 = obj[kListeners] ??= [];
|
|
113936
|
-
listeners6.push([name,
|
|
113937
|
-
obj.on(name,
|
|
114006
|
+
listeners6.push([name, listener5]);
|
|
114007
|
+
obj.on(name, listener5);
|
|
113938
114008
|
return obj;
|
|
113939
114009
|
}
|
|
113940
114010
|
function removeAllListeners(obj) {
|
|
113941
114011
|
if (obj[kListeners] != null) {
|
|
113942
|
-
for (const [name,
|
|
113943
|
-
obj.removeListener(name,
|
|
114012
|
+
for (const [name, listener5] of obj[kListeners]) {
|
|
114013
|
+
obj.removeListener(name, listener5);
|
|
113944
114014
|
}
|
|
113945
114015
|
obj[kListeners] = null;
|
|
113946
114016
|
}
|
|
@@ -116037,14 +116107,14 @@ var require_encoding = __commonJS({
|
|
|
116037
116107
|
"node_modules/undici/lib/encoding/index.js"(exports2, module2) {
|
|
116038
116108
|
"use strict";
|
|
116039
116109
|
var textDecoder = new TextDecoder();
|
|
116040
|
-
function utf8DecodeBytes(
|
|
116041
|
-
if (
|
|
116110
|
+
function utf8DecodeBytes(buffer5) {
|
|
116111
|
+
if (buffer5.length === 0) {
|
|
116042
116112
|
return "";
|
|
116043
116113
|
}
|
|
116044
|
-
if (
|
|
116045
|
-
|
|
116114
|
+
if (buffer5[0] === 239 && buffer5[1] === 187 && buffer5[2] === 191) {
|
|
116115
|
+
buffer5 = buffer5.subarray(3);
|
|
116046
116116
|
}
|
|
116047
|
-
const output = textDecoder.decode(
|
|
116117
|
+
const output = textDecoder.decode(buffer5);
|
|
116048
116118
|
return output;
|
|
116049
116119
|
}
|
|
116050
116120
|
module2.exports = {
|
|
@@ -116095,8 +116165,8 @@ var require_infra = __commonJS({
|
|
|
116095
116165
|
if (/[^+/0-9A-Za-z]/.test(data.length === dataLength ? data : data.substring(0, dataLength))) {
|
|
116096
116166
|
return "failure";
|
|
116097
116167
|
}
|
|
116098
|
-
const
|
|
116099
|
-
return new Uint8Array(
|
|
116168
|
+
const buffer5 = Buffer.from(data, "base64");
|
|
116169
|
+
return new Uint8Array(buffer5.buffer, buffer5.byteOffset, buffer5.byteLength);
|
|
116100
116170
|
}
|
|
116101
116171
|
function isASCIIWhitespace(char) {
|
|
116102
116172
|
return char === 9 || // \t
|
|
@@ -118347,12 +118417,12 @@ var require_formdata_parser = __commonJS({
|
|
|
118347
118417
|
}
|
|
118348
118418
|
return lead === 0 && trail === buf.length - 1 ? buf : buf.subarray(lead, trail + 1);
|
|
118349
118419
|
}
|
|
118350
|
-
function bufferStartsWith(
|
|
118351
|
-
if (
|
|
118420
|
+
function bufferStartsWith(buffer5, start, position2) {
|
|
118421
|
+
if (buffer5.length < start.length) {
|
|
118352
118422
|
return false;
|
|
118353
118423
|
}
|
|
118354
118424
|
for (let i = 0; i < start.length; i++) {
|
|
118355
|
-
if (start[i] !==
|
|
118425
|
+
if (start[i] !== buffer5[position2.position + i]) {
|
|
118356
118426
|
return false;
|
|
118357
118427
|
}
|
|
118358
118428
|
}
|
|
@@ -119777,14 +119847,14 @@ upgrade: ${upgrade2}\r
|
|
|
119777
119847
|
if (contentLength != null && contentLength !== body.size) {
|
|
119778
119848
|
throw new RequestContentLengthMismatchError();
|
|
119779
119849
|
}
|
|
119780
|
-
const
|
|
119850
|
+
const buffer5 = Buffer.from(await body.arrayBuffer());
|
|
119781
119851
|
socket.cork();
|
|
119782
119852
|
socket.write(`${header}content-length: ${contentLength}\r
|
|
119783
119853
|
\r
|
|
119784
119854
|
`, "latin1");
|
|
119785
|
-
socket.write(
|
|
119855
|
+
socket.write(buffer5);
|
|
119786
119856
|
socket.uncork();
|
|
119787
|
-
request.onBodySent(
|
|
119857
|
+
request.onBodySent(buffer5);
|
|
119788
119858
|
request.onRequestSent();
|
|
119789
119859
|
if (!expectsPayload && request.reset !== false) {
|
|
119790
119860
|
socket[kReset] = true;
|
|
@@ -120984,12 +121054,12 @@ var require_client_h2 = __commonJS({
|
|
|
120984
121054
|
if (contentLength != null && contentLength !== body.size) {
|
|
120985
121055
|
throw new RequestContentLengthMismatchError();
|
|
120986
121056
|
}
|
|
120987
|
-
const
|
|
121057
|
+
const buffer5 = Buffer.from(await body.arrayBuffer());
|
|
120988
121058
|
h2stream.cork();
|
|
120989
|
-
h2stream.write(
|
|
121059
|
+
h2stream.write(buffer5);
|
|
120990
121060
|
h2stream.uncork();
|
|
120991
121061
|
h2stream.end();
|
|
120992
|
-
request.onBodySent(
|
|
121062
|
+
request.onBodySent(buffer5);
|
|
120993
121063
|
request.onRequestSent();
|
|
120994
121064
|
if (!expectsPayload) {
|
|
120995
121065
|
socket[kReset] = true;
|
|
@@ -122510,7 +122580,7 @@ var require_socks5_utils = __commonJS({
|
|
|
122510
122580
|
};
|
|
122511
122581
|
}
|
|
122512
122582
|
function parseIPv6(address) {
|
|
122513
|
-
const
|
|
122583
|
+
const buffer5 = Buffer8.alloc(16);
|
|
122514
122584
|
let normalizedAddress = address;
|
|
122515
122585
|
if (address.includes(".")) {
|
|
122516
122586
|
const lastColonIndex = address.lastIndexOf(":");
|
|
@@ -122530,21 +122600,21 @@ var require_socks5_utils = __commonJS({
|
|
|
122530
122600
|
const afterParts = after === "" ? [] : after.split(":");
|
|
122531
122601
|
let bufferIndex = 0;
|
|
122532
122602
|
for (const part of beforeParts) {
|
|
122533
|
-
|
|
122603
|
+
buffer5.writeUInt16BE(parseInt(part, 16), bufferIndex);
|
|
122534
122604
|
bufferIndex += 2;
|
|
122535
122605
|
}
|
|
122536
122606
|
bufferIndex = 16 - afterParts.length * 2;
|
|
122537
122607
|
for (const part of afterParts) {
|
|
122538
|
-
|
|
122608
|
+
buffer5.writeUInt16BE(parseInt(part, 16), bufferIndex);
|
|
122539
122609
|
bufferIndex += 2;
|
|
122540
122610
|
}
|
|
122541
122611
|
} else {
|
|
122542
122612
|
const parts = normalizedAddress.split(":");
|
|
122543
122613
|
for (let i = 0; i < parts.length; i++) {
|
|
122544
|
-
|
|
122614
|
+
buffer5.writeUInt16BE(parseInt(parts[i], 16), i * 2);
|
|
122545
122615
|
}
|
|
122546
122616
|
}
|
|
122547
|
-
return
|
|
122617
|
+
return buffer5;
|
|
122548
122618
|
}
|
|
122549
122619
|
function buildAddressBuffer(type, addressBuffer, port) {
|
|
122550
122620
|
const portBuffer = Buffer8.allocUnsafe(2);
|
|
@@ -122555,42 +122625,42 @@ var require_socks5_utils = __commonJS({
|
|
|
122555
122625
|
portBuffer
|
|
122556
122626
|
]);
|
|
122557
122627
|
}
|
|
122558
|
-
function parseResponseAddress(
|
|
122559
|
-
if (
|
|
122628
|
+
function parseResponseAddress(buffer5, offset = 0) {
|
|
122629
|
+
if (buffer5.length < offset + 1) {
|
|
122560
122630
|
throw new InvalidArgumentError2("Buffer too small to contain address type");
|
|
122561
122631
|
}
|
|
122562
|
-
const addressType =
|
|
122632
|
+
const addressType = buffer5[offset];
|
|
122563
122633
|
let address;
|
|
122564
122634
|
let currentOffset = offset + 1;
|
|
122565
122635
|
switch (addressType) {
|
|
122566
122636
|
case 1: {
|
|
122567
|
-
if (
|
|
122637
|
+
if (buffer5.length < currentOffset + 6) {
|
|
122568
122638
|
throw new InvalidArgumentError2("Buffer too small for IPv4 address");
|
|
122569
122639
|
}
|
|
122570
|
-
address = Array.from(
|
|
122640
|
+
address = Array.from(buffer5.subarray(currentOffset, currentOffset + 4)).join(".");
|
|
122571
122641
|
currentOffset += 4;
|
|
122572
122642
|
break;
|
|
122573
122643
|
}
|
|
122574
122644
|
case 3: {
|
|
122575
|
-
if (
|
|
122645
|
+
if (buffer5.length < currentOffset + 1) {
|
|
122576
122646
|
throw new InvalidArgumentError2("Buffer too small for domain length");
|
|
122577
122647
|
}
|
|
122578
|
-
const domainLength =
|
|
122648
|
+
const domainLength = buffer5[currentOffset];
|
|
122579
122649
|
currentOffset += 1;
|
|
122580
|
-
if (
|
|
122650
|
+
if (buffer5.length < currentOffset + domainLength + 2) {
|
|
122581
122651
|
throw new InvalidArgumentError2("Buffer too small for domain address");
|
|
122582
122652
|
}
|
|
122583
|
-
address =
|
|
122653
|
+
address = buffer5.subarray(currentOffset, currentOffset + domainLength).toString("utf8");
|
|
122584
122654
|
currentOffset += domainLength;
|
|
122585
122655
|
break;
|
|
122586
122656
|
}
|
|
122587
122657
|
case 4: {
|
|
122588
|
-
if (
|
|
122658
|
+
if (buffer5.length < currentOffset + 18) {
|
|
122589
122659
|
throw new InvalidArgumentError2("Buffer too small for IPv6 address");
|
|
122590
122660
|
}
|
|
122591
122661
|
const parts = [];
|
|
122592
122662
|
for (let i = 0; i < 8; i++) {
|
|
122593
|
-
const value =
|
|
122663
|
+
const value = buffer5.readUInt16BE(currentOffset + i * 2);
|
|
122594
122664
|
parts.push(value.toString(16));
|
|
122595
122665
|
}
|
|
122596
122666
|
address = parts.join(":");
|
|
@@ -122600,10 +122670,10 @@ var require_socks5_utils = __commonJS({
|
|
|
122600
122670
|
default:
|
|
122601
122671
|
throw new InvalidArgumentError2(`Invalid address type: ${addressType}`);
|
|
122602
122672
|
}
|
|
122603
|
-
if (
|
|
122673
|
+
if (buffer5.length < currentOffset + 2) {
|
|
122604
122674
|
throw new InvalidArgumentError2("Buffer too small for port");
|
|
122605
122675
|
}
|
|
122606
|
-
const port =
|
|
122676
|
+
const port = buffer5.readUInt16BE(currentOffset);
|
|
122607
122677
|
currentOffset += 2;
|
|
122608
122678
|
return {
|
|
122609
122679
|
address,
|
|
@@ -124042,28 +124112,28 @@ var require_readable = __commonJS({
|
|
|
124042
124112
|
* @param {(...args: any[]) => void} listener
|
|
124043
124113
|
* @returns {this}
|
|
124044
124114
|
*/
|
|
124045
|
-
on(event,
|
|
124115
|
+
on(event, listener5) {
|
|
124046
124116
|
if (event === "data" || event === "readable") {
|
|
124047
124117
|
this[kReading] = true;
|
|
124048
124118
|
this[kUsed] = true;
|
|
124049
124119
|
}
|
|
124050
|
-
return super.on(event,
|
|
124120
|
+
return super.on(event, listener5);
|
|
124051
124121
|
}
|
|
124052
124122
|
/**
|
|
124053
124123
|
* @param {string|symbol} event
|
|
124054
124124
|
* @param {(...args: any[]) => void} listener
|
|
124055
124125
|
* @returns {this}
|
|
124056
124126
|
*/
|
|
124057
|
-
addListener(event,
|
|
124058
|
-
return this.on(event,
|
|
124127
|
+
addListener(event, listener5) {
|
|
124128
|
+
return this.on(event, listener5);
|
|
124059
124129
|
}
|
|
124060
124130
|
/**
|
|
124061
124131
|
* @param {string|symbol} event
|
|
124062
124132
|
* @param {(...args: any[]) => void} listener
|
|
124063
124133
|
* @returns {this}
|
|
124064
124134
|
*/
|
|
124065
|
-
off(event,
|
|
124066
|
-
const ret = super.off(event,
|
|
124135
|
+
off(event, listener5) {
|
|
124136
|
+
const ret = super.off(event, listener5);
|
|
124067
124137
|
if (event === "data" || event === "readable") {
|
|
124068
124138
|
this[kReading] = this.listenerCount("data") > 0 || this.listenerCount("readable") > 0;
|
|
124069
124139
|
}
|
|
@@ -124074,8 +124144,8 @@ var require_readable = __commonJS({
|
|
|
124074
124144
|
* @param {(...args: any[]) => void} listener
|
|
124075
124145
|
* @returns {this}
|
|
124076
124146
|
*/
|
|
124077
|
-
removeListener(event,
|
|
124078
|
-
return this.off(event,
|
|
124147
|
+
removeListener(event, listener5) {
|
|
124148
|
+
return this.off(event, listener5);
|
|
124079
124149
|
}
|
|
124080
124150
|
/**
|
|
124081
124151
|
* @param {Buffer|null} chunk
|
|
@@ -124299,13 +124369,13 @@ var require_readable = __commonJS({
|
|
|
124299
124369
|
if (chunks.length === 0 || length === 0) {
|
|
124300
124370
|
return "";
|
|
124301
124371
|
}
|
|
124302
|
-
const
|
|
124303
|
-
const bufferLength =
|
|
124304
|
-
const start = bufferLength > 2 &&
|
|
124372
|
+
const buffer5 = chunks.length === 1 ? chunks[0] : Buffer.concat(chunks, length);
|
|
124373
|
+
const bufferLength = buffer5.length;
|
|
124374
|
+
const start = bufferLength > 2 && buffer5[0] === 239 && buffer5[1] === 187 && buffer5[2] === 191 ? 3 : 0;
|
|
124305
124375
|
if (!encoding || encoding === "utf8" || encoding === "utf-8") {
|
|
124306
|
-
return
|
|
124376
|
+
return buffer5.utf8Slice(start, bufferLength);
|
|
124307
124377
|
} else {
|
|
124308
|
-
return
|
|
124378
|
+
return buffer5.subarray(start, bufferLength).toString(encoding);
|
|
124309
124379
|
}
|
|
124310
124380
|
}
|
|
124311
124381
|
function chunksConcat(chunks, length) {
|
|
@@ -124315,14 +124385,14 @@ var require_readable = __commonJS({
|
|
|
124315
124385
|
if (chunks.length === 1) {
|
|
124316
124386
|
return new Uint8Array(chunks[0]);
|
|
124317
124387
|
}
|
|
124318
|
-
const
|
|
124388
|
+
const buffer5 = new Uint8Array(Buffer.allocUnsafeSlow(length).buffer);
|
|
124319
124389
|
let offset = 0;
|
|
124320
124390
|
for (let i = 0; i < chunks.length; ++i) {
|
|
124321
124391
|
const chunk2 = chunks[i];
|
|
124322
|
-
|
|
124392
|
+
buffer5.set(chunk2, offset);
|
|
124323
124393
|
offset += chunk2.length;
|
|
124324
124394
|
}
|
|
124325
|
-
return
|
|
124395
|
+
return buffer5;
|
|
124326
124396
|
}
|
|
124327
124397
|
function consumeEnd(consume2, encoding) {
|
|
124328
124398
|
const { type, body, resolve: resolve53, stream: stream5, length } = consume2;
|
|
@@ -133655,9 +133725,9 @@ var require_fetch = __commonJS({
|
|
|
133655
133725
|
fetchParams.controller.terminate(bytes);
|
|
133656
133726
|
return;
|
|
133657
133727
|
}
|
|
133658
|
-
const
|
|
133659
|
-
if (
|
|
133660
|
-
fetchParams.controller.controller.enqueue(
|
|
133728
|
+
const buffer5 = new Uint8Array(bytes);
|
|
133729
|
+
if (buffer5.byteLength) {
|
|
133730
|
+
fetchParams.controller.controller.enqueue(buffer5);
|
|
133661
133731
|
}
|
|
133662
133732
|
if (isErrored(stream5)) {
|
|
133663
133733
|
fetchParams.controller.terminate();
|
|
@@ -135338,11 +135408,11 @@ var require_util5 = __commonJS({
|
|
|
135338
135408
|
function websocketMessageReceived(handler, type, data) {
|
|
135339
135409
|
handler.onMessage(type, data);
|
|
135340
135410
|
}
|
|
135341
|
-
function toArrayBuffer(
|
|
135342
|
-
if (
|
|
135343
|
-
return
|
|
135411
|
+
function toArrayBuffer(buffer5) {
|
|
135412
|
+
if (buffer5.byteLength === buffer5.buffer.byteLength) {
|
|
135413
|
+
return buffer5.buffer;
|
|
135344
135414
|
}
|
|
135345
|
-
return new Uint8Array(
|
|
135415
|
+
return new Uint8Array(buffer5).buffer;
|
|
135346
135416
|
}
|
|
135347
135417
|
function isValidSubprotocol(protocol) {
|
|
135348
135418
|
if (protocol.length === 0) {
|
|
@@ -135458,9 +135528,9 @@ var require_util5 = __commonJS({
|
|
|
135458
135528
|
const fatalDecoder = new TextDecoder("utf-8", { fatal: true });
|
|
135459
135529
|
return fatalDecoder.decode.bind(fatalDecoder);
|
|
135460
135530
|
}
|
|
135461
|
-
return function(
|
|
135462
|
-
if (isUtf8(
|
|
135463
|
-
return
|
|
135531
|
+
return function(buffer5) {
|
|
135532
|
+
if (isUtf8(buffer5)) {
|
|
135533
|
+
return buffer5.toString("utf-8");
|
|
135464
135534
|
}
|
|
135465
135535
|
throw new TypeError("Invalid utf-8 received.");
|
|
135466
135536
|
};
|
|
@@ -135495,15 +135565,15 @@ var require_frame = __commonJS({
|
|
|
135495
135565
|
var { runtimeFeatures } = require_runtime_features();
|
|
135496
135566
|
var { maxUnsigned16Bit, opcodes } = require_constants7();
|
|
135497
135567
|
var BUFFER_SIZE = 8 * 1024;
|
|
135498
|
-
var
|
|
135568
|
+
var buffer5 = null;
|
|
135499
135569
|
var bufIdx = BUFFER_SIZE;
|
|
135500
135570
|
var randomFillSync = runtimeFeatures.has("crypto") ? __require("node:crypto").randomFillSync : null;
|
|
135501
135571
|
function generateMask() {
|
|
135502
135572
|
if (bufIdx === BUFFER_SIZE) {
|
|
135503
135573
|
bufIdx = 0;
|
|
135504
|
-
randomFillSync(
|
|
135574
|
+
randomFillSync(buffer5 ??= Buffer.allocUnsafeSlow(BUFFER_SIZE), 0, BUFFER_SIZE);
|
|
135505
135575
|
}
|
|
135506
|
-
return [
|
|
135576
|
+
return [buffer5[bufIdx++], buffer5[bufIdx++], buffer5[bufIdx++], buffer5[bufIdx++]];
|
|
135507
135577
|
}
|
|
135508
135578
|
var WebsocketFrameSend = class {
|
|
135509
135579
|
/**
|
|
@@ -135525,35 +135595,35 @@ var require_frame = __commonJS({
|
|
|
135525
135595
|
offset += 2;
|
|
135526
135596
|
payloadLength = 126;
|
|
135527
135597
|
}
|
|
135528
|
-
const
|
|
135529
|
-
|
|
135530
|
-
|
|
135531
|
-
|
|
135532
|
-
|
|
135533
|
-
|
|
135534
|
-
|
|
135535
|
-
|
|
135536
|
-
|
|
135598
|
+
const buffer6 = Buffer.allocUnsafe(bodyLength + offset);
|
|
135599
|
+
buffer6[0] = buffer6[1] = 0;
|
|
135600
|
+
buffer6[0] |= 128;
|
|
135601
|
+
buffer6[0] = (buffer6[0] & 240) + opcode;
|
|
135602
|
+
buffer6[offset - 4] = maskKey[0];
|
|
135603
|
+
buffer6[offset - 3] = maskKey[1];
|
|
135604
|
+
buffer6[offset - 2] = maskKey[2];
|
|
135605
|
+
buffer6[offset - 1] = maskKey[3];
|
|
135606
|
+
buffer6[1] = payloadLength;
|
|
135537
135607
|
if (payloadLength === 126) {
|
|
135538
|
-
|
|
135608
|
+
buffer6.writeUInt16BE(bodyLength, 2);
|
|
135539
135609
|
} else if (payloadLength === 127) {
|
|
135540
|
-
|
|
135541
|
-
|
|
135610
|
+
buffer6[2] = buffer6[3] = 0;
|
|
135611
|
+
buffer6.writeUIntBE(bodyLength, 4, 6);
|
|
135542
135612
|
}
|
|
135543
|
-
|
|
135613
|
+
buffer6[1] |= 128;
|
|
135544
135614
|
for (let i = 0; i < bodyLength; ++i) {
|
|
135545
|
-
|
|
135615
|
+
buffer6[offset + i] = frameData[i] ^ maskKey[i & 3];
|
|
135546
135616
|
}
|
|
135547
|
-
return
|
|
135617
|
+
return buffer6;
|
|
135548
135618
|
}
|
|
135549
135619
|
/**
|
|
135550
135620
|
* @param {Uint8Array} buffer
|
|
135551
135621
|
*/
|
|
135552
|
-
static createFastTextFrame(
|
|
135622
|
+
static createFastTextFrame(buffer6) {
|
|
135553
135623
|
const maskKey = generateMask();
|
|
135554
|
-
const bodyLength =
|
|
135624
|
+
const bodyLength = buffer6.length;
|
|
135555
135625
|
for (let i = 0; i < bodyLength; ++i) {
|
|
135556
|
-
|
|
135626
|
+
buffer6[i] ^= maskKey[i & 3];
|
|
135557
135627
|
}
|
|
135558
135628
|
let payloadLength = bodyLength;
|
|
135559
135629
|
let offset = 6;
|
|
@@ -135577,7 +135647,7 @@ var require_frame = __commonJS({
|
|
|
135577
135647
|
head[2] = head[3] = 0;
|
|
135578
135648
|
head.writeUIntBE(bodyLength, 4, 6);
|
|
135579
135649
|
}
|
|
135580
|
-
return [head,
|
|
135650
|
+
return [head, buffer6];
|
|
135581
135651
|
}
|
|
135582
135652
|
};
|
|
135583
135653
|
module2.exports = {
|
|
@@ -135904,15 +135974,15 @@ var require_receiver = __commonJS({
|
|
|
135904
135974
|
if (this.#byteOffset < 2) {
|
|
135905
135975
|
return callback();
|
|
135906
135976
|
}
|
|
135907
|
-
const
|
|
135908
|
-
const fin = (
|
|
135909
|
-
const opcode =
|
|
135910
|
-
const masked = (
|
|
135977
|
+
const buffer5 = this.consume(2);
|
|
135978
|
+
const fin = (buffer5[0] & 128) !== 0;
|
|
135979
|
+
const opcode = buffer5[0] & 15;
|
|
135980
|
+
const masked = (buffer5[1] & 128) === 128;
|
|
135911
135981
|
const fragmented = !fin && opcode !== opcodes.CONTINUATION;
|
|
135912
|
-
const payloadLength =
|
|
135913
|
-
const rsv1 =
|
|
135914
|
-
const rsv2 =
|
|
135915
|
-
const rsv3 =
|
|
135982
|
+
const payloadLength = buffer5[1] & 127;
|
|
135983
|
+
const rsv1 = buffer5[0] & 64;
|
|
135984
|
+
const rsv2 = buffer5[0] & 32;
|
|
135985
|
+
const rsv3 = buffer5[0] & 16;
|
|
135916
135986
|
if (!isValidOpcode(opcode)) {
|
|
135917
135987
|
failWebsocketConnection(this.#handler, 1002, "Invalid opcode received");
|
|
135918
135988
|
return callback();
|
|
@@ -135972,8 +136042,8 @@ var require_receiver = __commonJS({
|
|
|
135972
136042
|
if (this.#byteOffset < 2) {
|
|
135973
136043
|
return callback();
|
|
135974
136044
|
}
|
|
135975
|
-
const
|
|
135976
|
-
this.#info.payloadLength =
|
|
136045
|
+
const buffer5 = this.consume(2);
|
|
136046
|
+
this.#info.payloadLength = buffer5.readUInt16BE(0);
|
|
135977
136047
|
this.#state = parserStates.READ_DATA;
|
|
135978
136048
|
if (!this.#validatePayloadLength()) {
|
|
135979
136049
|
return;
|
|
@@ -135982,9 +136052,9 @@ var require_receiver = __commonJS({
|
|
|
135982
136052
|
if (this.#byteOffset < 8) {
|
|
135983
136053
|
return callback();
|
|
135984
136054
|
}
|
|
135985
|
-
const
|
|
135986
|
-
const upper =
|
|
135987
|
-
const lower =
|
|
136055
|
+
const buffer5 = this.consume(8);
|
|
136056
|
+
const upper = buffer5.readUInt32BE(0);
|
|
136057
|
+
const lower = buffer5.readUInt32BE(4);
|
|
135988
136058
|
if (upper !== 0 || lower > 2 ** 31 - 1) {
|
|
135989
136059
|
failWebsocketConnection(this.#handler, 1009, "Received payload length > 2^31 bytes.");
|
|
135990
136060
|
return;
|
|
@@ -136068,23 +136138,23 @@ var require_receiver = __commonJS({
|
|
|
136068
136138
|
return this.#buffers.shift();
|
|
136069
136139
|
} else {
|
|
136070
136140
|
let offset = 0;
|
|
136071
|
-
const
|
|
136141
|
+
const buffer5 = Buffer.allocUnsafeSlow(n2);
|
|
136072
136142
|
while (offset !== n2) {
|
|
136073
136143
|
const next = this.#buffers[0];
|
|
136074
136144
|
const length = next.length;
|
|
136075
136145
|
if (length + offset === n2) {
|
|
136076
|
-
|
|
136146
|
+
buffer5.set(this.#buffers.shift(), offset);
|
|
136077
136147
|
break;
|
|
136078
136148
|
} else if (length + offset > n2) {
|
|
136079
|
-
|
|
136149
|
+
buffer5.set(next.subarray(0, n2 - offset), offset);
|
|
136080
136150
|
this.#buffers[0] = next.subarray(n2 - offset);
|
|
136081
136151
|
break;
|
|
136082
136152
|
} else {
|
|
136083
|
-
|
|
136153
|
+
buffer5.set(this.#buffers.shift(), offset);
|
|
136084
136154
|
offset += length;
|
|
136085
136155
|
}
|
|
136086
136156
|
}
|
|
136087
|
-
return
|
|
136157
|
+
return buffer5;
|
|
136088
136158
|
}
|
|
136089
136159
|
}
|
|
136090
136160
|
writeFragments(fragment) {
|
|
@@ -136105,9 +136175,9 @@ var require_receiver = __commonJS({
|
|
|
136105
136175
|
let offset = 0;
|
|
136106
136176
|
const output = Buffer.allocUnsafeSlow(this.#fragmentsBytes);
|
|
136107
136177
|
for (let i = 0; i < fragments.length; ++i) {
|
|
136108
|
-
const
|
|
136109
|
-
output.set(
|
|
136110
|
-
offset +=
|
|
136178
|
+
const buffer5 = fragments[i];
|
|
136179
|
+
output.set(buffer5, offset);
|
|
136180
|
+
offset += buffer5.length;
|
|
136111
136181
|
}
|
|
136112
136182
|
this.#fragments = [];
|
|
136113
136183
|
this.#fragmentsBytes = 0;
|
|
@@ -136434,10 +136504,10 @@ var require_websocket = __commonJS({
|
|
|
136434
136504
|
return;
|
|
136435
136505
|
}
|
|
136436
136506
|
if (typeof data === "string") {
|
|
136437
|
-
const
|
|
136438
|
-
this.#bufferedAmount +=
|
|
136439
|
-
this.#sendQueue.add(
|
|
136440
|
-
this.#bufferedAmount -=
|
|
136507
|
+
const buffer5 = Buffer.from(data);
|
|
136508
|
+
this.#bufferedAmount += buffer5.byteLength;
|
|
136509
|
+
this.#sendQueue.add(buffer5, () => {
|
|
136510
|
+
this.#bufferedAmount -= buffer5.byteLength;
|
|
136441
136511
|
}, sendHints.text);
|
|
136442
136512
|
} else if (isArrayBuffer2(data)) {
|
|
136443
136513
|
this.#bufferedAmount += data.byteLength;
|
|
@@ -136485,9 +136555,9 @@ var require_websocket = __commonJS({
|
|
|
136485
136555
|
if (this.#events.open) {
|
|
136486
136556
|
this.removeEventListener("open", this.#events.open);
|
|
136487
136557
|
}
|
|
136488
|
-
const
|
|
136489
|
-
if (
|
|
136490
|
-
this.addEventListener("open",
|
|
136558
|
+
const listener5 = webidl.converters.EventHandlerNonNull(fn2);
|
|
136559
|
+
if (listener5 !== null) {
|
|
136560
|
+
this.addEventListener("open", listener5);
|
|
136491
136561
|
this.#events.open = fn2;
|
|
136492
136562
|
} else {
|
|
136493
136563
|
this.#events.open = null;
|
|
@@ -136502,9 +136572,9 @@ var require_websocket = __commonJS({
|
|
|
136502
136572
|
if (this.#events.error) {
|
|
136503
136573
|
this.removeEventListener("error", this.#events.error);
|
|
136504
136574
|
}
|
|
136505
|
-
const
|
|
136506
|
-
if (
|
|
136507
|
-
this.addEventListener("error",
|
|
136575
|
+
const listener5 = webidl.converters.EventHandlerNonNull(fn2);
|
|
136576
|
+
if (listener5 !== null) {
|
|
136577
|
+
this.addEventListener("error", listener5);
|
|
136508
136578
|
this.#events.error = fn2;
|
|
136509
136579
|
} else {
|
|
136510
136580
|
this.#events.error = null;
|
|
@@ -136519,9 +136589,9 @@ var require_websocket = __commonJS({
|
|
|
136519
136589
|
if (this.#events.close) {
|
|
136520
136590
|
this.removeEventListener("close", this.#events.close);
|
|
136521
136591
|
}
|
|
136522
|
-
const
|
|
136523
|
-
if (
|
|
136524
|
-
this.addEventListener("close",
|
|
136592
|
+
const listener5 = webidl.converters.EventHandlerNonNull(fn2);
|
|
136593
|
+
if (listener5 !== null) {
|
|
136594
|
+
this.addEventListener("close", listener5);
|
|
136525
136595
|
this.#events.close = fn2;
|
|
136526
136596
|
} else {
|
|
136527
136597
|
this.#events.close = null;
|
|
@@ -136536,9 +136606,9 @@ var require_websocket = __commonJS({
|
|
|
136536
136606
|
if (this.#events.message) {
|
|
136537
136607
|
this.removeEventListener("message", this.#events.message);
|
|
136538
136608
|
}
|
|
136539
|
-
const
|
|
136540
|
-
if (
|
|
136541
|
-
this.addEventListener("message",
|
|
136609
|
+
const listener5 = webidl.converters.EventHandlerNonNull(fn2);
|
|
136610
|
+
if (listener5 !== null) {
|
|
136611
|
+
this.addEventListener("message", listener5);
|
|
136542
136612
|
this.#events.message = fn2;
|
|
136543
136613
|
} else {
|
|
136544
136614
|
this.#events.message = null;
|
|
@@ -136660,17 +136730,17 @@ var require_websocket = __commonJS({
|
|
|
136660
136730
|
* @param {WebSocket} ws
|
|
136661
136731
|
* @param {Buffer|undefined} buffer
|
|
136662
136732
|
*/
|
|
136663
|
-
static ping(ws,
|
|
136664
|
-
if (Buffer.isBuffer(
|
|
136665
|
-
if (
|
|
136733
|
+
static ping(ws, buffer5) {
|
|
136734
|
+
if (Buffer.isBuffer(buffer5)) {
|
|
136735
|
+
if (buffer5.length > 125) {
|
|
136666
136736
|
throw new TypeError("A PING frame cannot have a body larger than 125 bytes.");
|
|
136667
136737
|
}
|
|
136668
|
-
} else if (
|
|
136738
|
+
} else if (buffer5 !== void 0) {
|
|
136669
136739
|
throw new TypeError("Expected buffer payload");
|
|
136670
136740
|
}
|
|
136671
136741
|
const readyState = ws.#handler.readyState;
|
|
136672
136742
|
if (isEstablished(readyState) && !isClosing(readyState) && !isClosed(readyState)) {
|
|
136673
|
-
const frame = new WebsocketFrameSend(
|
|
136743
|
+
const frame = new WebsocketFrameSend(buffer5);
|
|
136674
136744
|
ws.#handler.socket.write(frame.createFrame(opcodes.PING));
|
|
136675
136745
|
}
|
|
136676
136746
|
}
|
|
@@ -137206,20 +137276,20 @@ var require_eventsource_stream = __commonJS({
|
|
|
137206
137276
|
var EVENT = Buffer.from("event");
|
|
137207
137277
|
var ID = Buffer.from("id");
|
|
137208
137278
|
var RETRY = Buffer.from("retry");
|
|
137209
|
-
function isASCIINumberBytes(
|
|
137210
|
-
if (start >=
|
|
137279
|
+
function isASCIINumberBytes(buffer5, start) {
|
|
137280
|
+
if (start >= buffer5.length) {
|
|
137211
137281
|
return false;
|
|
137212
137282
|
}
|
|
137213
|
-
for (let i = start; i <
|
|
137214
|
-
if (
|
|
137283
|
+
for (let i = start; i < buffer5.length; i++) {
|
|
137284
|
+
if (buffer5[i] < 48 || buffer5[i] > 57) {
|
|
137215
137285
|
return false;
|
|
137216
137286
|
}
|
|
137217
137287
|
}
|
|
137218
137288
|
return true;
|
|
137219
137289
|
}
|
|
137220
|
-
function isValidLastEventIdBytes(
|
|
137221
|
-
for (let i = start; i <
|
|
137222
|
-
if (
|
|
137290
|
+
function isValidLastEventIdBytes(buffer5, start) {
|
|
137291
|
+
for (let i = start; i < buffer5.length; i++) {
|
|
137292
|
+
if (buffer5[i] === 0) {
|
|
137223
137293
|
return false;
|
|
137224
137294
|
}
|
|
137225
137295
|
}
|
|
@@ -137733,9 +137803,9 @@ var require_eventsource = __commonJS({
|
|
|
137733
137803
|
if (this.#events.open) {
|
|
137734
137804
|
this.removeEventListener("open", this.#events.open);
|
|
137735
137805
|
}
|
|
137736
|
-
const
|
|
137737
|
-
if (
|
|
137738
|
-
this.addEventListener("open",
|
|
137806
|
+
const listener5 = webidl.converters.EventHandlerNonNull(fn2);
|
|
137807
|
+
if (listener5 !== null) {
|
|
137808
|
+
this.addEventListener("open", listener5);
|
|
137739
137809
|
this.#events.open = fn2;
|
|
137740
137810
|
} else {
|
|
137741
137811
|
this.#events.open = null;
|
|
@@ -137748,9 +137818,9 @@ var require_eventsource = __commonJS({
|
|
|
137748
137818
|
if (this.#events.message) {
|
|
137749
137819
|
this.removeEventListener("message", this.#events.message);
|
|
137750
137820
|
}
|
|
137751
|
-
const
|
|
137752
|
-
if (
|
|
137753
|
-
this.addEventListener("message",
|
|
137821
|
+
const listener5 = webidl.converters.EventHandlerNonNull(fn2);
|
|
137822
|
+
if (listener5 !== null) {
|
|
137823
|
+
this.addEventListener("message", listener5);
|
|
137754
137824
|
this.#events.message = fn2;
|
|
137755
137825
|
} else {
|
|
137756
137826
|
this.#events.message = null;
|
|
@@ -137763,9 +137833,9 @@ var require_eventsource = __commonJS({
|
|
|
137763
137833
|
if (this.#events.error) {
|
|
137764
137834
|
this.removeEventListener("error", this.#events.error);
|
|
137765
137835
|
}
|
|
137766
|
-
const
|
|
137767
|
-
if (
|
|
137768
|
-
this.addEventListener("error",
|
|
137836
|
+
const listener5 = webidl.converters.EventHandlerNonNull(fn2);
|
|
137837
|
+
if (listener5 !== null) {
|
|
137838
|
+
this.addEventListener("error", listener5);
|
|
137769
137839
|
this.#events.error = fn2;
|
|
137770
137840
|
} else {
|
|
137771
137841
|
this.#events.error = null;
|
|
@@ -148221,10 +148291,10 @@ var require_binary = __commonJS({
|
|
|
148221
148291
|
return node_buffer.Buffer.from(src, "base64");
|
|
148222
148292
|
} else if (typeof atob === "function") {
|
|
148223
148293
|
const str3 = atob(src.replace(/[\n\r]/g, ""));
|
|
148224
|
-
const
|
|
148294
|
+
const buffer5 = new Uint8Array(str3.length);
|
|
148225
148295
|
for (let i = 0; i < str3.length; ++i)
|
|
148226
|
-
|
|
148227
|
-
return
|
|
148296
|
+
buffer5[i] = str3.charCodeAt(i);
|
|
148297
|
+
return buffer5;
|
|
148228
148298
|
} else {
|
|
148229
148299
|
onError("This environment does not support reading binary tags; either Buffer or atob is required");
|
|
148230
148300
|
return src;
|
|
@@ -154465,11 +154535,11 @@ function createStore(initialState, onChange) {
|
|
|
154465
154535
|
if (Object.is(next, prev)) return;
|
|
154466
154536
|
state3 = next;
|
|
154467
154537
|
onChange?.({ newState: next, oldState: prev });
|
|
154468
|
-
for (const
|
|
154538
|
+
for (const listener5 of listeners6) listener5();
|
|
154469
154539
|
},
|
|
154470
|
-
subscribe: (
|
|
154471
|
-
listeners6.add(
|
|
154472
|
-
return () => listeners6.delete(
|
|
154540
|
+
subscribe: (listener5) => {
|
|
154541
|
+
listeners6.add(listener5);
|
|
154542
|
+
return () => listeners6.delete(listener5);
|
|
154473
154543
|
}
|
|
154474
154544
|
};
|
|
154475
154545
|
}
|
|
@@ -154831,9 +154901,9 @@ import { watch as fs_watch, unwatchFile as unwatchFile3, watchFile as watchFile3
|
|
|
154831
154901
|
import { realpath as fsrealpath, lstat as lstat3, open as open6, stat as stat11 } from "node:fs/promises";
|
|
154832
154902
|
import { type as osType } from "node:os";
|
|
154833
154903
|
import * as sp from "node:path";
|
|
154834
|
-
function createFsWatchInstance(path27, options,
|
|
154904
|
+
function createFsWatchInstance(path27, options, listener5, errHandler, emitRaw) {
|
|
154835
154905
|
const handleEvent = (rawEvent, evPath) => {
|
|
154836
|
-
|
|
154906
|
+
listener5(path27);
|
|
154837
154907
|
emitRaw(rawEvent, evPath, { watchedPath: path27 });
|
|
154838
154908
|
if (evPath && path27 !== evPath) {
|
|
154839
154909
|
fsWatchBroadcast(sp.resolve(path27, evPath), KEY_LISTENERS, sp.join(path27, evPath));
|
|
@@ -155180,22 +155250,22 @@ var init_handler = __esm({
|
|
|
155180
155250
|
const cont = FsWatchInstances.get(fullPath);
|
|
155181
155251
|
if (!cont)
|
|
155182
155252
|
return;
|
|
155183
|
-
foreach(cont[listenerType], (
|
|
155184
|
-
|
|
155253
|
+
foreach(cont[listenerType], (listener5) => {
|
|
155254
|
+
listener5(val1, val2, val3);
|
|
155185
155255
|
});
|
|
155186
155256
|
};
|
|
155187
155257
|
setFsWatchListener = (path27, fullPath, options, handlers) => {
|
|
155188
|
-
const { listener:
|
|
155258
|
+
const { listener: listener5, errHandler, rawEmitter } = handlers;
|
|
155189
155259
|
let cont = FsWatchInstances.get(fullPath);
|
|
155190
155260
|
let watcher5;
|
|
155191
155261
|
if (!options.persistent) {
|
|
155192
|
-
watcher5 = createFsWatchInstance(path27, options,
|
|
155262
|
+
watcher5 = createFsWatchInstance(path27, options, listener5, errHandler, rawEmitter);
|
|
155193
155263
|
if (!watcher5)
|
|
155194
155264
|
return;
|
|
155195
155265
|
return watcher5.close.bind(watcher5);
|
|
155196
155266
|
}
|
|
155197
155267
|
if (cont) {
|
|
155198
|
-
addAndConvert(cont, KEY_LISTENERS,
|
|
155268
|
+
addAndConvert(cont, KEY_LISTENERS, listener5);
|
|
155199
155269
|
addAndConvert(cont, KEY_ERR, errHandler);
|
|
155200
155270
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
155201
155271
|
} else {
|
|
@@ -155225,7 +155295,7 @@ var init_handler = __esm({
|
|
|
155225
155295
|
}
|
|
155226
155296
|
});
|
|
155227
155297
|
cont = {
|
|
155228
|
-
listeners:
|
|
155298
|
+
listeners: listener5,
|
|
155229
155299
|
errHandlers: errHandler,
|
|
155230
155300
|
rawEmitters: rawEmitter,
|
|
155231
155301
|
watcher: watcher5
|
|
@@ -155233,7 +155303,7 @@ var init_handler = __esm({
|
|
|
155233
155303
|
FsWatchInstances.set(fullPath, cont);
|
|
155234
155304
|
}
|
|
155235
155305
|
return () => {
|
|
155236
|
-
delFromSet(cont, KEY_LISTENERS,
|
|
155306
|
+
delFromSet(cont, KEY_LISTENERS, listener5);
|
|
155237
155307
|
delFromSet(cont, KEY_ERR, errHandler);
|
|
155238
155308
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
155239
155309
|
if (isEmptySet(cont.listeners)) {
|
|
@@ -155247,7 +155317,7 @@ var init_handler = __esm({
|
|
|
155247
155317
|
};
|
|
155248
155318
|
FsWatchFileInstances = /* @__PURE__ */ new Map();
|
|
155249
155319
|
setFsWatchFileListener = (path27, fullPath, options, handlers) => {
|
|
155250
|
-
const { listener:
|
|
155320
|
+
const { listener: listener5, rawEmitter } = handlers;
|
|
155251
155321
|
let cont = FsWatchFileInstances.get(fullPath);
|
|
155252
155322
|
const copts = cont && cont.options;
|
|
155253
155323
|
if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
|
|
@@ -155255,11 +155325,11 @@ var init_handler = __esm({
|
|
|
155255
155325
|
cont = void 0;
|
|
155256
155326
|
}
|
|
155257
155327
|
if (cont) {
|
|
155258
|
-
addAndConvert(cont, KEY_LISTENERS,
|
|
155328
|
+
addAndConvert(cont, KEY_LISTENERS, listener5);
|
|
155259
155329
|
addAndConvert(cont, KEY_RAW, rawEmitter);
|
|
155260
155330
|
} else {
|
|
155261
155331
|
cont = {
|
|
155262
|
-
listeners:
|
|
155332
|
+
listeners: listener5,
|
|
155263
155333
|
rawEmitters: rawEmitter,
|
|
155264
155334
|
options,
|
|
155265
155335
|
watcher: watchFile3(fullPath, options, (curr, prev) => {
|
|
@@ -155268,14 +155338,14 @@ var init_handler = __esm({
|
|
|
155268
155338
|
});
|
|
155269
155339
|
const currmtime = curr.mtimeMs;
|
|
155270
155340
|
if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
|
|
155271
|
-
foreach(cont.listeners, (
|
|
155341
|
+
foreach(cont.listeners, (listener6) => listener6(path27, curr));
|
|
155272
155342
|
}
|
|
155273
155343
|
})
|
|
155274
155344
|
};
|
|
155275
155345
|
FsWatchFileInstances.set(fullPath, cont);
|
|
155276
155346
|
}
|
|
155277
155347
|
return () => {
|
|
155278
|
-
delFromSet(cont, KEY_LISTENERS,
|
|
155348
|
+
delFromSet(cont, KEY_LISTENERS, listener5);
|
|
155279
155349
|
delFromSet(cont, KEY_RAW, rawEmitter);
|
|
155280
155350
|
if (isEmptySet(cont.listeners)) {
|
|
155281
155351
|
FsWatchFileInstances.delete(fullPath);
|
|
@@ -155298,7 +155368,7 @@ var init_handler = __esm({
|
|
|
155298
155368
|
* @param listener on fs change
|
|
155299
155369
|
* @returns closer for the watcher instance
|
|
155300
155370
|
*/
|
|
155301
|
-
_watchWithNodeFs(path27,
|
|
155371
|
+
_watchWithNodeFs(path27, listener5) {
|
|
155302
155372
|
const opts = this.fsw.options;
|
|
155303
155373
|
const directory = sp.dirname(path27);
|
|
155304
155374
|
const basename69 = sp.basename(path27);
|
|
@@ -155308,19 +155378,19 @@ var init_handler = __esm({
|
|
|
155308
155378
|
const options = {
|
|
155309
155379
|
persistent: opts.persistent
|
|
155310
155380
|
};
|
|
155311
|
-
if (!
|
|
155312
|
-
|
|
155381
|
+
if (!listener5)
|
|
155382
|
+
listener5 = EMPTY_FN;
|
|
155313
155383
|
let closer;
|
|
155314
155384
|
if (opts.usePolling) {
|
|
155315
155385
|
const enableBin = opts.interval !== opts.binaryInterval;
|
|
155316
155386
|
options.interval = enableBin && isBinaryPath(basename69) ? opts.binaryInterval : opts.interval;
|
|
155317
155387
|
closer = setFsWatchFileListener(path27, absolutePath, options, {
|
|
155318
|
-
listener:
|
|
155388
|
+
listener: listener5,
|
|
155319
155389
|
rawEmitter: this.fsw._emitRaw
|
|
155320
155390
|
});
|
|
155321
155391
|
} else {
|
|
155322
155392
|
closer = setFsWatchListener(path27, absolutePath, options, {
|
|
155323
|
-
listener:
|
|
155393
|
+
listener: listener5,
|
|
155324
155394
|
errHandler: this._boundHandleError,
|
|
155325
155395
|
rawEmitter: this.fsw._emitRaw
|
|
155326
155396
|
});
|
|
@@ -155341,7 +155411,7 @@ var init_handler = __esm({
|
|
|
155341
155411
|
let prevStats = stats3;
|
|
155342
155412
|
if (parent2.has(basename69))
|
|
155343
155413
|
return;
|
|
155344
|
-
const
|
|
155414
|
+
const listener5 = async (path27, newStats) => {
|
|
155345
155415
|
if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
|
|
155346
155416
|
return;
|
|
155347
155417
|
if (!newStats || newStats.mtimeMs === 0) {
|
|
@@ -155357,7 +155427,7 @@ var init_handler = __esm({
|
|
|
155357
155427
|
if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
|
|
155358
155428
|
this.fsw._closeFile(path27);
|
|
155359
155429
|
prevStats = newStats2;
|
|
155360
|
-
const closer2 = this._watchWithNodeFs(file2,
|
|
155430
|
+
const closer2 = this._watchWithNodeFs(file2, listener5);
|
|
155361
155431
|
if (closer2)
|
|
155362
155432
|
this.fsw._addPathCloser(path27, closer2);
|
|
155363
155433
|
} else {
|
|
@@ -155375,7 +155445,7 @@ var init_handler = __esm({
|
|
|
155375
155445
|
prevStats = newStats;
|
|
155376
155446
|
}
|
|
155377
155447
|
};
|
|
155378
|
-
const closer = this._watchWithNodeFs(file2,
|
|
155448
|
+
const closer = this._watchWithNodeFs(file2, listener5);
|
|
155379
155449
|
if (!(initialAdd && this.fsw.options.ignoreInitial) && this.fsw._isntIgnored(file2)) {
|
|
155380
155450
|
if (!this.fsw._throttle(EV.ADD, file2, 0))
|
|
155381
155451
|
return;
|
|
@@ -156991,7 +157061,13 @@ function permissionModeField(mode, opts) {
|
|
|
156991
157061
|
var KNOWN;
|
|
156992
157062
|
var init_permissionWireCaps = __esm({
|
|
156993
157063
|
"build-src/src/sema/permissionWireCaps.ts"() {
|
|
156994
|
-
KNOWN = /* @__PURE__ */ new Set([
|
|
157064
|
+
KNOWN = /* @__PURE__ */ new Set([
|
|
157065
|
+
"default",
|
|
157066
|
+
"plan",
|
|
157067
|
+
"acceptEdits",
|
|
157068
|
+
"bypassPermissions",
|
|
157069
|
+
"auto"
|
|
157070
|
+
]);
|
|
156995
157071
|
}
|
|
156996
157072
|
});
|
|
156997
157073
|
|
|
@@ -157434,6 +157510,7 @@ __export(engineTarget_exports, {
|
|
|
157434
157510
|
recordTrustedEngineHost: () => recordTrustedEngineHost,
|
|
157435
157511
|
remoteResumeWarningActive: () => remoteResumeWarningActive,
|
|
157436
157512
|
resolveAutoSyncTarget: () => resolveAutoSyncTarget,
|
|
157513
|
+
resolveLiveAuthToken: () => resolveLiveAuthToken,
|
|
157437
157514
|
serviceAxisReading: () => serviceAxisReading,
|
|
157438
157515
|
storeAxisReading: () => storeAxisReading,
|
|
157439
157516
|
validateEngineUrlTransport: () => validateEngineUrlTransport
|
|
@@ -157479,6 +157556,11 @@ function validateEngineUrlTransport(url4) {
|
|
|
157479
157556
|
}
|
|
157480
157557
|
return null;
|
|
157481
157558
|
}
|
|
157559
|
+
function resolveLiveAuthToken(baseUrl, token = process.env.SEMA_LIVE_TOKEN) {
|
|
157560
|
+
if (token) return token;
|
|
157561
|
+
if (baseUrl && isLoopbackEngineUrl(baseUrl)) return { mode: "loopback-unauthed" };
|
|
157562
|
+
return "anon";
|
|
157563
|
+
}
|
|
157482
157564
|
function isLoopbackEngineUrl(url4) {
|
|
157483
157565
|
try {
|
|
157484
157566
|
const h = new URL(url4).hostname;
|
|
@@ -157770,11 +157852,18 @@ var init_engineTarget = __esm({
|
|
|
157770
157852
|
});
|
|
157771
157853
|
|
|
157772
157854
|
// build-src/src/sema/userMessageSelect.ts
|
|
157855
|
+
function isToolResultUserMessage(m2) {
|
|
157856
|
+
if (!m2 || typeof m2 !== "object") return false;
|
|
157857
|
+
const c2 = m2;
|
|
157858
|
+
const content = c2.message?.content ?? m2.content;
|
|
157859
|
+
return Array.isArray(content) && content[0]?.type === "tool_result";
|
|
157860
|
+
}
|
|
157773
157861
|
function isProjectableUserMessage(m2) {
|
|
157774
157862
|
if (!m2 || typeof m2 !== "object") return false;
|
|
157775
157863
|
const c2 = m2;
|
|
157776
157864
|
if (c2.type !== "user" && c2.type !== void 0) return false;
|
|
157777
157865
|
if (c2.isMeta === true || c2.isCompactSummary === true || c2.isVisibleInTranscriptOnly === true) return false;
|
|
157866
|
+
if (isToolResultUserMessage(m2)) return false;
|
|
157778
157867
|
return true;
|
|
157779
157868
|
}
|
|
157780
157869
|
function lastProjectableUserMessage(msgs) {
|
|
@@ -157783,6 +157872,26 @@ function lastProjectableUserMessage(msgs) {
|
|
|
157783
157872
|
}
|
|
157784
157873
|
return void 0;
|
|
157785
157874
|
}
|
|
157875
|
+
function trailingStandaloneMetaUserMessages(msgs) {
|
|
157876
|
+
let i = msgs.length - 1;
|
|
157877
|
+
const isRider = (m2) => {
|
|
157878
|
+
const t2 = m2?.type;
|
|
157879
|
+
return t2 === "attachment" || t2 === "system" || t2 === "progress";
|
|
157880
|
+
};
|
|
157881
|
+
while (i >= 0 && isRider(msgs[i])) i--;
|
|
157882
|
+
const run2 = [];
|
|
157883
|
+
while (i >= 0) {
|
|
157884
|
+
const m2 = msgs[i];
|
|
157885
|
+
const isMetaUser = !!m2 && typeof m2 === "object" && (m2.type === "user" || m2.type === void 0) && m2.isMeta === true;
|
|
157886
|
+
if (!isMetaUser) break;
|
|
157887
|
+
run2.unshift(msgs[i]);
|
|
157888
|
+
i--;
|
|
157889
|
+
}
|
|
157890
|
+
if (run2.length === 0) return [];
|
|
157891
|
+
while (i >= 0 && isRider(msgs[i])) i--;
|
|
157892
|
+
const boundary = i >= 0 ? msgs[i] : void 0;
|
|
157893
|
+
return boundary !== void 0 && isProjectableUserMessage(boundary) ? [] : run2;
|
|
157894
|
+
}
|
|
157786
157895
|
var init_userMessageSelect = __esm({
|
|
157787
157896
|
"build-src/src/sema/userMessageSelect.ts"() {
|
|
157788
157897
|
}
|
|
@@ -160541,10 +160650,10 @@ function setRetryStatus(next) {
|
|
|
160541
160650
|
current = next;
|
|
160542
160651
|
for (const l3 of listeners) l3();
|
|
160543
160652
|
}
|
|
160544
|
-
function subscribeRetryStatus(
|
|
160545
|
-
listeners.add(
|
|
160653
|
+
function subscribeRetryStatus(listener5) {
|
|
160654
|
+
listeners.add(listener5);
|
|
160546
160655
|
return () => {
|
|
160547
|
-
listeners.delete(
|
|
160656
|
+
listeners.delete(listener5);
|
|
160548
160657
|
};
|
|
160549
160658
|
}
|
|
160550
160659
|
function useRetryStatus() {
|
|
@@ -160656,6 +160765,63 @@ var init_engineAgentPanelStore = __esm({
|
|
|
160656
160765
|
}
|
|
160657
160766
|
});
|
|
160658
160767
|
|
|
160768
|
+
// build-src/src/sema/engineBgShellPanelStore.ts
|
|
160769
|
+
function detectEngineBgShellReceipt(rawInput, outputText) {
|
|
160770
|
+
if (typeof outputText !== "string") return null;
|
|
160771
|
+
const input = rawInput ?? {};
|
|
160772
|
+
if (input.run_in_background !== true) return null;
|
|
160773
|
+
const m2 = BG_RECEIPT_ANCHOR.exec(outputText);
|
|
160774
|
+
if (!m2) return null;
|
|
160775
|
+
const command8 = typeof input.command === "string" ? input.command : "(engine bash)";
|
|
160776
|
+
const description = typeof input.description === "string" ? input.description : void 0;
|
|
160777
|
+
return {
|
|
160778
|
+
kind: "register",
|
|
160779
|
+
taskId: m2[1],
|
|
160780
|
+
command: command8,
|
|
160781
|
+
...description !== void 0 ? { description } : {},
|
|
160782
|
+
receipt: outputText
|
|
160783
|
+
};
|
|
160784
|
+
}
|
|
160785
|
+
function publishEngineBgShellPanelEvent(ev) {
|
|
160786
|
+
if (listener2) {
|
|
160787
|
+
try {
|
|
160788
|
+
listener2(ev);
|
|
160789
|
+
} catch {
|
|
160790
|
+
}
|
|
160791
|
+
return;
|
|
160792
|
+
}
|
|
160793
|
+
if (buffer2.length < MAX_BUFFER2) buffer2.push(ev);
|
|
160794
|
+
else if (ev.kind === "settle") {
|
|
160795
|
+
const i = buffer2.findIndex((b3) => b3.kind === "register");
|
|
160796
|
+
if (i >= 0) buffer2.splice(i, 1);
|
|
160797
|
+
buffer2.push(ev);
|
|
160798
|
+
}
|
|
160799
|
+
}
|
|
160800
|
+
function subscribeEngineBgShellPanel(fn2) {
|
|
160801
|
+
listener2 = fn2;
|
|
160802
|
+
if (buffer2.length > 0) {
|
|
160803
|
+
const pending = buffer2.splice(0, buffer2.length);
|
|
160804
|
+
for (const ev of pending) {
|
|
160805
|
+
try {
|
|
160806
|
+
fn2(ev);
|
|
160807
|
+
} catch {
|
|
160808
|
+
}
|
|
160809
|
+
}
|
|
160810
|
+
}
|
|
160811
|
+
return () => {
|
|
160812
|
+
if (listener2 === fn2) listener2 = null;
|
|
160813
|
+
};
|
|
160814
|
+
}
|
|
160815
|
+
var BG_RECEIPT_ANCHOR, MAX_BUFFER2, listener2, buffer2;
|
|
160816
|
+
var init_engineBgShellPanelStore = __esm({
|
|
160817
|
+
"build-src/src/sema/engineBgShellPanelStore.ts"() {
|
|
160818
|
+
BG_RECEIPT_ANCHOR = /^(?:Started in background|Command running in background|Command moved to background); task_id=([A-Za-z0-9_-]+)/;
|
|
160819
|
+
MAX_BUFFER2 = 100;
|
|
160820
|
+
listener2 = null;
|
|
160821
|
+
buffer2 = [];
|
|
160822
|
+
}
|
|
160823
|
+
});
|
|
160824
|
+
|
|
160659
160825
|
// build-src/src/sema/engineInlineTaskStats.ts
|
|
160660
160826
|
function emit() {
|
|
160661
160827
|
for (const fn2 of listeners3) {
|
|
@@ -162805,7 +162971,7 @@ function wireOutputToBody(toolName2, output, isError, truncated) {
|
|
|
162805
162971
|
const name = (toolName2 || "").toLowerCase();
|
|
162806
162972
|
if (name === "bash") {
|
|
162807
162973
|
if (!isError) {
|
|
162808
|
-
const bg = /^(?:Started in background|Command moved to background); task_id=([A-Za-z0-9_-]+)/.exec(
|
|
162974
|
+
const bg = /^(?:Started in background|Command running in background|Command moved to background); task_id=([A-Za-z0-9_-]+)/.exec(
|
|
162809
162975
|
text2
|
|
162810
162976
|
);
|
|
162811
162977
|
if (bg) {
|
|
@@ -163406,6 +163572,13 @@ async function* sdkMessagesToCcEvents(sdk, meta4) {
|
|
|
163406
163572
|
function buildToolResult(p, end) {
|
|
163407
163573
|
const isError = end?.isError ?? false;
|
|
163408
163574
|
const body = end && end.output !== void 0 ? wireOutputToBody(p.name, end.output, isError, end.truncated === true) : synthesizeToolResultBody({ id: p.id, name: p.name, input: p.rawInput }, isError);
|
|
163575
|
+
if (p.name === "Bash" && !isError && end?.output !== void 0) {
|
|
163576
|
+
try {
|
|
163577
|
+
const reg = detectEngineBgShellReceipt(p.rawInput, flattenWireOutput(end.output));
|
|
163578
|
+
if (reg) publishEngineBgShellPanelEvent(reg);
|
|
163579
|
+
} catch {
|
|
163580
|
+
}
|
|
163581
|
+
}
|
|
163409
163582
|
let rich = end?.structured !== void 0 ? structuredToToolUseResult(
|
|
163410
163583
|
end.structured,
|
|
163411
163584
|
end.output !== void 0 ? flattenWireOutput(end.output) : void 0
|
|
@@ -163829,6 +164002,17 @@ async function* sdkMessagesToCcEvents(sdk, meta4) {
|
|
|
163829
164002
|
const taskId = typeof n2.task_id === "string" ? n2.task_id : void 0;
|
|
163830
164003
|
if (taskId === void 0) break;
|
|
163831
164004
|
const rawStatus = typeof n2.status === "string" ? n2.status : "completed";
|
|
164005
|
+
if (rawStatus === "completed" || rawStatus === "failed" || rawStatus === "killed") {
|
|
164006
|
+
try {
|
|
164007
|
+
publishEngineBgShellPanelEvent({
|
|
164008
|
+
kind: "settle",
|
|
164009
|
+
taskId,
|
|
164010
|
+
status: rawStatus,
|
|
164011
|
+
...typeof n2.output_file === "string" && n2.output_file.length > 0 ? { outputPath: n2.output_file } : {}
|
|
164012
|
+
});
|
|
164013
|
+
} catch {
|
|
164014
|
+
}
|
|
164015
|
+
}
|
|
163832
164016
|
const dedupKey = engineTaskNotificationDedupKey(n2);
|
|
163833
164017
|
if (renderedEngineTaskNotifications.has(dedupKey)) break;
|
|
163834
164018
|
renderedEngineTaskNotifications.add(dedupKey);
|
|
@@ -163965,6 +164149,7 @@ var init_upstreamBridge = __esm({
|
|
|
163965
164149
|
init_retryStatusStore();
|
|
163966
164150
|
init_thinkingActivityStore();
|
|
163967
164151
|
init_engineAgentPanelStore();
|
|
164152
|
+
init_engineBgShellPanelStore();
|
|
163968
164153
|
init_hooks6();
|
|
163969
164154
|
init_subagentContentStore();
|
|
163970
164155
|
init_engineInlineTaskStats();
|
|
@@ -168250,8 +168435,8 @@ var require_util7 = __commonJS({
|
|
|
168250
168435
|
}
|
|
168251
168436
|
return this.putInt(i, n2);
|
|
168252
168437
|
};
|
|
168253
|
-
util9.ByteStringBuffer.prototype.putBuffer = function(
|
|
168254
|
-
return this.putBytes(
|
|
168438
|
+
util9.ByteStringBuffer.prototype.putBuffer = function(buffer5) {
|
|
168439
|
+
return this.putBytes(buffer5.getBytes());
|
|
168255
168440
|
};
|
|
168256
168441
|
util9.ByteStringBuffer.prototype.getByte = function() {
|
|
168257
168442
|
return this.data.charCodeAt(this.read++);
|
|
@@ -168490,9 +168675,9 @@ var require_util7 = __commonJS({
|
|
|
168490
168675
|
}
|
|
168491
168676
|
throw Error("Invalid parameter: " + bytes);
|
|
168492
168677
|
};
|
|
168493
|
-
util9.DataBuffer.prototype.putBuffer = function(
|
|
168494
|
-
this.putBytes(
|
|
168495
|
-
|
|
168678
|
+
util9.DataBuffer.prototype.putBuffer = function(buffer5) {
|
|
168679
|
+
this.putBytes(buffer5);
|
|
168680
|
+
buffer5.clear();
|
|
168496
168681
|
return this;
|
|
168497
168682
|
};
|
|
168498
168683
|
util9.DataBuffer.prototype.putString = function(str3) {
|
|
@@ -172760,18 +172945,18 @@ var require_prng = __commonJS({
|
|
|
172760
172945
|
ctx.registerWorker = function(worker) {
|
|
172761
172946
|
if (worker === self) {
|
|
172762
172947
|
ctx.seedFile = function(needed, callback) {
|
|
172763
|
-
function
|
|
172948
|
+
function listener6(e) {
|
|
172764
172949
|
var data = e.data;
|
|
172765
172950
|
if (data.forge && data.forge.prng) {
|
|
172766
|
-
self.removeEventListener("message",
|
|
172951
|
+
self.removeEventListener("message", listener6);
|
|
172767
172952
|
callback(data.forge.prng.err, data.forge.prng.bytes);
|
|
172768
172953
|
}
|
|
172769
172954
|
}
|
|
172770
|
-
self.addEventListener("message",
|
|
172955
|
+
self.addEventListener("message", listener6);
|
|
172771
172956
|
self.postMessage({ forge: { prng: { needed } } });
|
|
172772
172957
|
};
|
|
172773
172958
|
} else {
|
|
172774
|
-
var
|
|
172959
|
+
var listener5 = function(e) {
|
|
172775
172960
|
var data = e.data;
|
|
172776
172961
|
if (data.forge && data.forge.prng) {
|
|
172777
172962
|
ctx.seedFile(data.forge.prng.needed, function(err8, bytes) {
|
|
@@ -172779,7 +172964,7 @@ var require_prng = __commonJS({
|
|
|
172779
172964
|
});
|
|
172780
172965
|
}
|
|
172781
172966
|
};
|
|
172782
|
-
worker.addEventListener("message",
|
|
172967
|
+
worker.addEventListener("message", listener5);
|
|
172783
172968
|
}
|
|
172784
172969
|
};
|
|
172785
172970
|
return ctx;
|
|
@@ -176246,11 +176431,11 @@ var require_rsa = __commonJS({
|
|
|
176246
176431
|
}
|
|
176247
176432
|
function _intToUint8Array(x2) {
|
|
176248
176433
|
var bytes = forge3.util.hexToBytes(x2.toString(16));
|
|
176249
|
-
var
|
|
176434
|
+
var buffer5 = new Uint8Array(bytes.length);
|
|
176250
176435
|
for (var i = 0; i < bytes.length; ++i) {
|
|
176251
|
-
|
|
176436
|
+
buffer5[i] = bytes.charCodeAt(i);
|
|
176252
176437
|
}
|
|
176253
|
-
return
|
|
176438
|
+
return buffer5;
|
|
176254
176439
|
}
|
|
176255
176440
|
}
|
|
176256
176441
|
});
|
|
@@ -183421,11 +183606,11 @@ var require_ed25519 = __commonJS({
|
|
|
183421
183606
|
'"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.'
|
|
183422
183607
|
);
|
|
183423
183608
|
}
|
|
183424
|
-
var
|
|
183425
|
-
for (var i = 0; i <
|
|
183426
|
-
|
|
183609
|
+
var buffer5 = new NativeBuffer(message.length());
|
|
183610
|
+
for (var i = 0; i < buffer5.length; ++i) {
|
|
183611
|
+
buffer5[i] = message.at(i);
|
|
183427
183612
|
}
|
|
183428
|
-
return
|
|
183613
|
+
return buffer5;
|
|
183429
183614
|
}
|
|
183430
183615
|
var gf0 = gf();
|
|
183431
183616
|
var gf1 = gf([1]);
|
|
@@ -183555,8 +183740,8 @@ var require_ed25519 = __commonJS({
|
|
|
183555
183740
|
]);
|
|
183556
183741
|
function sha5122(msg, msgLen) {
|
|
183557
183742
|
var md3 = forge3.md.sha512.create();
|
|
183558
|
-
var
|
|
183559
|
-
md3.update(
|
|
183743
|
+
var buffer5 = new ByteBuffer(msg);
|
|
183744
|
+
md3.update(buffer5.getBytes(msgLen), "binary");
|
|
183560
183745
|
var hash2 = md3.digest().getBytes();
|
|
183561
183746
|
if (typeof Buffer !== "undefined") {
|
|
183562
183747
|
return Buffer.from(hash2, "binary");
|
|
@@ -185643,11 +185828,11 @@ var require_ssh = __commonJS({
|
|
|
185643
185828
|
ssh.publicKeyToOpenSSH = function(key, comment) {
|
|
185644
185829
|
var type = "ssh-rsa";
|
|
185645
185830
|
comment = comment || "";
|
|
185646
|
-
var
|
|
185647
|
-
_addStringToBuffer(
|
|
185648
|
-
_addBigIntegerToBuffer(
|
|
185649
|
-
_addBigIntegerToBuffer(
|
|
185650
|
-
return type + " " + forge3.util.encode64(
|
|
185831
|
+
var buffer5 = forge3.util.createBuffer();
|
|
185832
|
+
_addStringToBuffer(buffer5, type);
|
|
185833
|
+
_addBigIntegerToBuffer(buffer5, key.e);
|
|
185834
|
+
_addBigIntegerToBuffer(buffer5, key.n);
|
|
185835
|
+
return type + " " + forge3.util.encode64(buffer5.bytes()) + " " + comment;
|
|
185651
185836
|
};
|
|
185652
185837
|
ssh.privateKeyToOpenSSH = function(privateKey, passphrase) {
|
|
185653
185838
|
if (!passphrase) {
|
|
@@ -185663,12 +185848,12 @@ var require_ssh = __commonJS({
|
|
|
185663
185848
|
options = options || {};
|
|
185664
185849
|
var md3 = options.md || forge3.md.md5.create();
|
|
185665
185850
|
var type = "ssh-rsa";
|
|
185666
|
-
var
|
|
185667
|
-
_addStringToBuffer(
|
|
185668
|
-
_addBigIntegerToBuffer(
|
|
185669
|
-
_addBigIntegerToBuffer(
|
|
185851
|
+
var buffer5 = forge3.util.createBuffer();
|
|
185852
|
+
_addStringToBuffer(buffer5, type);
|
|
185853
|
+
_addBigIntegerToBuffer(buffer5, key.e);
|
|
185854
|
+
_addBigIntegerToBuffer(buffer5, key.n);
|
|
185670
185855
|
md3.start();
|
|
185671
|
-
md3.update(
|
|
185856
|
+
md3.update(buffer5.getBytes());
|
|
185672
185857
|
var digest = md3.digest();
|
|
185673
185858
|
if (options.encoding === "hex") {
|
|
185674
185859
|
var hex3 = digest.toHex();
|
|
@@ -185683,18 +185868,18 @@ var require_ssh = __commonJS({
|
|
|
185683
185868
|
}
|
|
185684
185869
|
return digest;
|
|
185685
185870
|
};
|
|
185686
|
-
function _addBigIntegerToBuffer(
|
|
185871
|
+
function _addBigIntegerToBuffer(buffer5, val) {
|
|
185687
185872
|
var hexVal = val.toString(16);
|
|
185688
185873
|
if (hexVal[0] >= "8") {
|
|
185689
185874
|
hexVal = "00" + hexVal;
|
|
185690
185875
|
}
|
|
185691
185876
|
var bytes = forge3.util.hexToBytes(hexVal);
|
|
185692
|
-
|
|
185693
|
-
|
|
185877
|
+
buffer5.putInt32(bytes.length);
|
|
185878
|
+
buffer5.putBytes(bytes);
|
|
185694
185879
|
}
|
|
185695
|
-
function _addStringToBuffer(
|
|
185696
|
-
|
|
185697
|
-
|
|
185880
|
+
function _addStringToBuffer(buffer5, val) {
|
|
185881
|
+
buffer5.putInt32(val.length);
|
|
185882
|
+
buffer5.putString(val);
|
|
185698
185883
|
}
|
|
185699
185884
|
function _sha1() {
|
|
185700
185885
|
var sha = forge3.md.sha1.create();
|
|
@@ -189109,16 +189294,16 @@ var init_sandbox_violation_store = __esm({
|
|
|
189109
189294
|
this.violations = [];
|
|
189110
189295
|
this.notifyListeners();
|
|
189111
189296
|
}
|
|
189112
|
-
subscribe(
|
|
189113
|
-
this.listeners.add(
|
|
189114
|
-
|
|
189297
|
+
subscribe(listener5) {
|
|
189298
|
+
this.listeners.add(listener5);
|
|
189299
|
+
listener5(this.getViolations());
|
|
189115
189300
|
return () => {
|
|
189116
|
-
this.listeners.delete(
|
|
189301
|
+
this.listeners.delete(listener5);
|
|
189117
189302
|
};
|
|
189118
189303
|
}
|
|
189119
189304
|
notifyListeners() {
|
|
189120
189305
|
const violations = this.getViolations();
|
|
189121
|
-
this.listeners.forEach((
|
|
189306
|
+
this.listeners.forEach((listener5) => listener5(violations));
|
|
189122
189307
|
}
|
|
189123
189308
|
};
|
|
189124
189309
|
}
|
|
@@ -216101,7 +216286,7 @@ var init_systemPromptType = __esm({
|
|
|
216101
216286
|
});
|
|
216102
216287
|
|
|
216103
216288
|
// node_modules/sharp/dist/is.mjs
|
|
216104
|
-
var defined, object2, plainObject, fn, bool,
|
|
216289
|
+
var defined, object2, plainObject, fn, bool, buffer3, typedArray, arrayBuffer, string4, number4, integer2, inRange, inArray, invalidParameterError, nativeError, is_default2;
|
|
216105
216290
|
var init_is2 = __esm({
|
|
216106
216291
|
"node_modules/sharp/dist/is.mjs"() {
|
|
216107
216292
|
defined = (val) => typeof val !== "undefined" && val !== null;
|
|
@@ -216109,7 +216294,7 @@ var init_is2 = __esm({
|
|
|
216109
216294
|
plainObject = (val) => Object.prototype.toString.call(val) === "[object Object]";
|
|
216110
216295
|
fn = (val) => typeof val === "function";
|
|
216111
216296
|
bool = (val) => typeof val === "boolean";
|
|
216112
|
-
|
|
216297
|
+
buffer3 = (val) => val instanceof Buffer;
|
|
216113
216298
|
typedArray = (val) => {
|
|
216114
216299
|
if (defined(val)) {
|
|
216115
216300
|
switch (val.constructor) {
|
|
@@ -216146,7 +216331,7 @@ var init_is2 = __esm({
|
|
|
216146
216331
|
plainObject,
|
|
216147
216332
|
fn,
|
|
216148
216333
|
bool,
|
|
216149
|
-
buffer:
|
|
216334
|
+
buffer: buffer3,
|
|
216150
216335
|
typedArray,
|
|
216151
216336
|
arrayBuffer,
|
|
216152
216337
|
string: string4,
|
|
@@ -216193,20 +216378,20 @@ var require_filesystem = __commonJS({
|
|
|
216193
216378
|
var MAX_LENGTH = 2048;
|
|
216194
216379
|
var readFileSync54 = (path27) => {
|
|
216195
216380
|
const fd2 = fs15.openSync(path27, "r");
|
|
216196
|
-
const
|
|
216197
|
-
const bytesRead = fs15.readSync(fd2,
|
|
216381
|
+
const buffer5 = Buffer.alloc(MAX_LENGTH);
|
|
216382
|
+
const bytesRead = fs15.readSync(fd2, buffer5, 0, MAX_LENGTH, 0);
|
|
216198
216383
|
fs15.close(fd2, () => {
|
|
216199
216384
|
});
|
|
216200
|
-
return
|
|
216385
|
+
return buffer5.subarray(0, bytesRead);
|
|
216201
216386
|
};
|
|
216202
216387
|
var readFile59 = (path27) => new Promise((resolve53, reject2) => {
|
|
216203
216388
|
fs15.open(path27, "r", (err8, fd2) => {
|
|
216204
216389
|
if (err8) {
|
|
216205
216390
|
reject2(err8);
|
|
216206
216391
|
} else {
|
|
216207
|
-
const
|
|
216208
|
-
fs15.read(fd2,
|
|
216209
|
-
resolve53(
|
|
216392
|
+
const buffer5 = Buffer.alloc(MAX_LENGTH);
|
|
216393
|
+
fs15.read(fd2, buffer5, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
|
|
216394
|
+
resolve53(buffer5.subarray(0, bytesRead));
|
|
216210
216395
|
fs15.close(fd2, () => {
|
|
216211
216396
|
});
|
|
216212
216397
|
});
|
|
@@ -221963,10 +222148,10 @@ async function compressImageBlock(imageBlock, maxBytes = IMAGE_TARGET_RAW_SIZE)
|
|
|
221963
222148
|
}
|
|
221964
222149
|
};
|
|
221965
222150
|
}
|
|
221966
|
-
function createCompressedImageResult(
|
|
222151
|
+
function createCompressedImageResult(buffer5, mediaType, originalSize) {
|
|
221967
222152
|
const normalizedMediaType = mediaType === "jpg" ? "jpeg" : mediaType;
|
|
221968
222153
|
return {
|
|
221969
|
-
base64:
|
|
222154
|
+
base64: buffer5.toString("base64"),
|
|
221970
222155
|
mediaType: `image/${normalizedMediaType}`,
|
|
221971
222156
|
originalSize
|
|
221972
222157
|
};
|
|
@@ -222048,19 +222233,19 @@ async function createUltraCompressedJPEG(context3, sharp2) {
|
|
|
222048
222233
|
context3.originalSize
|
|
222049
222234
|
);
|
|
222050
222235
|
}
|
|
222051
|
-
function detectImageFormatFromBuffer(
|
|
222052
|
-
if (
|
|
222053
|
-
if (
|
|
222236
|
+
function detectImageFormatFromBuffer(buffer5) {
|
|
222237
|
+
if (buffer5.length < 4) return "image/png";
|
|
222238
|
+
if (buffer5[0] === 137 && buffer5[1] === 80 && buffer5[2] === 78 && buffer5[3] === 71) {
|
|
222054
222239
|
return "image/png";
|
|
222055
222240
|
}
|
|
222056
|
-
if (
|
|
222241
|
+
if (buffer5[0] === 255 && buffer5[1] === 216 && buffer5[2] === 255) {
|
|
222057
222242
|
return "image/jpeg";
|
|
222058
222243
|
}
|
|
222059
|
-
if (
|
|
222244
|
+
if (buffer5[0] === 71 && buffer5[1] === 73 && buffer5[2] === 70) {
|
|
222060
222245
|
return "image/gif";
|
|
222061
222246
|
}
|
|
222062
|
-
if (
|
|
222063
|
-
if (
|
|
222247
|
+
if (buffer5[0] === 82 && buffer5[1] === 73 && buffer5[2] === 70 && buffer5[3] === 70) {
|
|
222248
|
+
if (buffer5.length >= 12 && buffer5[8] === 87 && buffer5[9] === 69 && buffer5[10] === 66 && buffer5[11] === 80) {
|
|
222064
222249
|
return "image/webp";
|
|
222065
222250
|
}
|
|
222066
222251
|
}
|
|
@@ -222068,8 +222253,8 @@ function detectImageFormatFromBuffer(buffer4) {
|
|
|
222068
222253
|
}
|
|
222069
222254
|
function detectImageFormatFromBase64(base64Data) {
|
|
222070
222255
|
try {
|
|
222071
|
-
const
|
|
222072
|
-
return detectImageFormatFromBuffer(
|
|
222256
|
+
const buffer5 = Buffer.from(base64Data, "base64");
|
|
222257
|
+
return detectImageFormatFromBuffer(buffer5);
|
|
222073
222258
|
} catch {
|
|
222074
222259
|
return "image/png";
|
|
222075
222260
|
}
|
|
@@ -222487,7 +222672,7 @@ function extractRawUtilization(headers) {
|
|
|
222487
222672
|
}
|
|
222488
222673
|
function emitStatusChange(limits) {
|
|
222489
222674
|
currentLimits = limits;
|
|
222490
|
-
statusListeners.forEach((
|
|
222675
|
+
statusListeners.forEach((listener5) => listener5(limits));
|
|
222491
222676
|
const hoursTillReset = Math.round(
|
|
222492
222677
|
(limits.resetsAt ? limits.resetsAt - Date.now() / 1e3 : 0) / (60 * 60)
|
|
222493
222678
|
);
|
|
@@ -242059,18 +242244,18 @@ async function* withStreamingVCR(messages, f) {
|
|
|
242059
242244
|
if (!shouldUseVCR()) {
|
|
242060
242245
|
return yield* f();
|
|
242061
242246
|
}
|
|
242062
|
-
const
|
|
242247
|
+
const buffer5 = [];
|
|
242063
242248
|
const cachedBuffer = await withVCR(messages, async () => {
|
|
242064
242249
|
for await (const message of f()) {
|
|
242065
|
-
|
|
242250
|
+
buffer5.push(message);
|
|
242066
242251
|
}
|
|
242067
|
-
return
|
|
242252
|
+
return buffer5;
|
|
242068
242253
|
});
|
|
242069
242254
|
if (cachedBuffer.length > 0) {
|
|
242070
242255
|
yield* cachedBuffer;
|
|
242071
242256
|
return;
|
|
242072
242257
|
}
|
|
242073
|
-
yield*
|
|
242258
|
+
yield* buffer5;
|
|
242074
242259
|
}
|
|
242075
242260
|
async function withTokenCountVCR(messages, tools, f) {
|
|
242076
242261
|
const cwdSlug = getCwd().replace(/[^a-zA-Z0-9]/g, "-");
|
|
@@ -242697,8 +242882,8 @@ function getToolResultFromCell(cell) {
|
|
|
242697
242882
|
}
|
|
242698
242883
|
async function readNotebook(notebookPath, cellId) {
|
|
242699
242884
|
const fullPath = expandPath(notebookPath);
|
|
242700
|
-
const
|
|
242701
|
-
const content =
|
|
242885
|
+
const buffer5 = await getFsImplementation().readFileBytes(fullPath);
|
|
242886
|
+
const content = buffer5.toString("utf-8");
|
|
242702
242887
|
const notebook = jsonParse(content);
|
|
242703
242888
|
const language = notebook.metadata.language_info?.name ?? "python";
|
|
242704
242889
|
if (cellId) {
|
|
@@ -243446,10 +243631,10 @@ function getAlternateScreenshotPath(filePath) {
|
|
|
243446
243631
|
`${alternateSpace}${match[3]}${match[4]}`
|
|
243447
243632
|
);
|
|
243448
243633
|
}
|
|
243449
|
-
function registerFileReadListener(
|
|
243450
|
-
fileReadListeners.push(
|
|
243634
|
+
function registerFileReadListener(listener5) {
|
|
243635
|
+
fileReadListeners.push(listener5);
|
|
243451
243636
|
return () => {
|
|
243452
|
-
const i = fileReadListeners.indexOf(
|
|
243637
|
+
const i = fileReadListeners.indexOf(listener5);
|
|
243453
243638
|
if (i >= 0) fileReadListeners.splice(i, 1);
|
|
243454
243639
|
};
|
|
243455
243640
|
}
|
|
@@ -243492,11 +243677,11 @@ async function validateContentTokens(content, ext, maxTokens) {
|
|
|
243492
243677
|
throw new MaxFileReadTokenExceededError(effectiveCount, effectiveMaxTokens);
|
|
243493
243678
|
}
|
|
243494
243679
|
}
|
|
243495
|
-
function createImageResponse(
|
|
243680
|
+
function createImageResponse(buffer5, mediaType, originalSize, dimensions) {
|
|
243496
243681
|
return {
|
|
243497
243682
|
type: "image",
|
|
243498
243683
|
file: {
|
|
243499
|
-
base64:
|
|
243684
|
+
base64: buffer5.toString("base64"),
|
|
243500
243685
|
type: `image/${mediaType}`,
|
|
243501
243686
|
originalSize,
|
|
243502
243687
|
dimensions
|
|
@@ -243685,8 +243870,8 @@ async function callInner(file_path, fullFilePath, resolvedFilePath, ext, offset,
|
|
|
243685
243870
|
limit: limit2
|
|
243686
243871
|
});
|
|
243687
243872
|
context3.nestedMemoryAttachmentTriggers?.add(fullFilePath);
|
|
243688
|
-
for (const
|
|
243689
|
-
|
|
243873
|
+
for (const listener5 of fileReadListeners.slice()) {
|
|
243874
|
+
listener5(resolvedFilePath, content);
|
|
243690
243875
|
}
|
|
243691
243876
|
const data = {
|
|
243692
243877
|
type: "text",
|
|
@@ -250350,20 +250535,20 @@ var require_utils3 = __commonJS({
|
|
|
250350
250535
|
return acc;
|
|
250351
250536
|
}
|
|
250352
250537
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
250353
|
-
function consumeIsZone(
|
|
250354
|
-
|
|
250538
|
+
function consumeIsZone(buffer5) {
|
|
250539
|
+
buffer5.length = 0;
|
|
250355
250540
|
return true;
|
|
250356
250541
|
}
|
|
250357
|
-
function consumeHextets(
|
|
250358
|
-
if (
|
|
250359
|
-
const hex3 = stringArrayToHexStripped(
|
|
250542
|
+
function consumeHextets(buffer5, address, output) {
|
|
250543
|
+
if (buffer5.length) {
|
|
250544
|
+
const hex3 = stringArrayToHexStripped(buffer5);
|
|
250360
250545
|
if (hex3 !== "") {
|
|
250361
250546
|
address.push(hex3);
|
|
250362
250547
|
} else {
|
|
250363
250548
|
output.error = true;
|
|
250364
250549
|
return false;
|
|
250365
250550
|
}
|
|
250366
|
-
|
|
250551
|
+
buffer5.length = 0;
|
|
250367
250552
|
}
|
|
250368
250553
|
return true;
|
|
250369
250554
|
}
|
|
@@ -250371,7 +250556,7 @@ var require_utils3 = __commonJS({
|
|
|
250371
250556
|
let tokenCount = 0;
|
|
250372
250557
|
const output = { error: false, address: "", zone: "" };
|
|
250373
250558
|
const address = [];
|
|
250374
|
-
const
|
|
250559
|
+
const buffer5 = [];
|
|
250375
250560
|
let endipv6Encountered = false;
|
|
250376
250561
|
let endIpv6 = false;
|
|
250377
250562
|
let consume = consumeHextets;
|
|
@@ -250384,7 +250569,7 @@ var require_utils3 = __commonJS({
|
|
|
250384
250569
|
if (endipv6Encountered === true) {
|
|
250385
250570
|
endIpv6 = true;
|
|
250386
250571
|
}
|
|
250387
|
-
if (!consume(
|
|
250572
|
+
if (!consume(buffer5, address, output)) {
|
|
250388
250573
|
break;
|
|
250389
250574
|
}
|
|
250390
250575
|
if (++tokenCount > 7) {
|
|
@@ -250397,22 +250582,22 @@ var require_utils3 = __commonJS({
|
|
|
250397
250582
|
address.push(":");
|
|
250398
250583
|
continue;
|
|
250399
250584
|
} else if (cursor === "%") {
|
|
250400
|
-
if (!consume(
|
|
250585
|
+
if (!consume(buffer5, address, output)) {
|
|
250401
250586
|
break;
|
|
250402
250587
|
}
|
|
250403
250588
|
consume = consumeIsZone;
|
|
250404
250589
|
} else {
|
|
250405
|
-
|
|
250590
|
+
buffer5.push(cursor);
|
|
250406
250591
|
continue;
|
|
250407
250592
|
}
|
|
250408
250593
|
}
|
|
250409
|
-
if (
|
|
250594
|
+
if (buffer5.length) {
|
|
250410
250595
|
if (consume === consumeIsZone) {
|
|
250411
|
-
output.zone =
|
|
250596
|
+
output.zone = buffer5.join("");
|
|
250412
250597
|
} else if (endIpv6) {
|
|
250413
|
-
address.push(
|
|
250598
|
+
address.push(buffer5.join(""));
|
|
250414
250599
|
} else {
|
|
250415
|
-
address.push(stringArrayToHexStripped(
|
|
250600
|
+
address.push(stringArrayToHexStripped(buffer5));
|
|
250416
250601
|
}
|
|
250417
250602
|
}
|
|
250418
250603
|
output.address = address.join("");
|
|
@@ -255277,12 +255462,12 @@ var init_dist7 = __esm({
|
|
|
255277
255462
|
set onopen(value) {
|
|
255278
255463
|
__privateSet(this, _onOpen, value);
|
|
255279
255464
|
}
|
|
255280
|
-
addEventListener(type,
|
|
255281
|
-
const listen =
|
|
255465
|
+
addEventListener(type, listener5, options) {
|
|
255466
|
+
const listen = listener5;
|
|
255282
255467
|
super.addEventListener(type, listen, options);
|
|
255283
255468
|
}
|
|
255284
|
-
removeEventListener(type,
|
|
255285
|
-
const listen =
|
|
255469
|
+
removeEventListener(type, listener5, options) {
|
|
255470
|
+
const listen = listener5;
|
|
255286
255471
|
super.removeEventListener(type, listen, options);
|
|
255287
255472
|
}
|
|
255288
255473
|
/**
|
|
@@ -255419,8 +255604,8 @@ async function generateVerifier(length) {
|
|
|
255419
255604
|
return await random3(length);
|
|
255420
255605
|
}
|
|
255421
255606
|
async function generateChallenge(code_verifier) {
|
|
255422
|
-
const
|
|
255423
|
-
return btoa(String.fromCharCode(...new Uint8Array(
|
|
255607
|
+
const buffer5 = await (await crypto4).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
255608
|
+
return btoa(String.fromCharCode(...new Uint8Array(buffer5))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
255424
255609
|
}
|
|
255425
255610
|
async function pkceChallenge(length) {
|
|
255426
255611
|
if (!length)
|
|
@@ -265783,9 +265968,9 @@ var require_buffer_util = __commonJS({
|
|
|
265783
265968
|
output[offset + i] = source[i] ^ mask[i & 3];
|
|
265784
265969
|
}
|
|
265785
265970
|
}
|
|
265786
|
-
function _unmask(
|
|
265787
|
-
for (let i = 0; i <
|
|
265788
|
-
|
|
265971
|
+
function _unmask(buffer5, mask) {
|
|
265972
|
+
for (let i = 0; i < buffer5.length; i++) {
|
|
265973
|
+
buffer5[i] ^= mask[i & 3];
|
|
265789
265974
|
}
|
|
265790
265975
|
}
|
|
265791
265976
|
function toArrayBuffer(buf) {
|
|
@@ -265822,9 +266007,9 @@ var require_buffer_util = __commonJS({
|
|
|
265822
266007
|
if (length < 48) _mask(source, mask, output, offset, length);
|
|
265823
266008
|
else bufferUtil.mask(source, mask, output, offset, length);
|
|
265824
266009
|
};
|
|
265825
|
-
module2.exports.unmask = function(
|
|
265826
|
-
if (
|
|
265827
|
-
else bufferUtil.unmask(
|
|
266010
|
+
module2.exports.unmask = function(buffer5, mask) {
|
|
266011
|
+
if (buffer5.length < 32) _unmask(buffer5, mask);
|
|
266012
|
+
else bufferUtil.unmask(buffer5, mask);
|
|
265828
266013
|
};
|
|
265829
266014
|
} catch (e) {
|
|
265830
266015
|
}
|
|
@@ -267737,8 +267922,8 @@ var require_event_target = __commonJS({
|
|
|
267737
267922
|
* @public
|
|
267738
267923
|
*/
|
|
267739
267924
|
addEventListener(type, handler, options = {}) {
|
|
267740
|
-
for (const
|
|
267741
|
-
if (!options[kForOnEventAttribute] &&
|
|
267925
|
+
for (const listener5 of this.listeners(type)) {
|
|
267926
|
+
if (!options[kForOnEventAttribute] && listener5[kListener] === handler && !listener5[kForOnEventAttribute]) {
|
|
267742
267927
|
return;
|
|
267743
267928
|
}
|
|
267744
267929
|
}
|
|
@@ -267795,9 +267980,9 @@ var require_event_target = __commonJS({
|
|
|
267795
267980
|
* @public
|
|
267796
267981
|
*/
|
|
267797
267982
|
removeEventListener(type, handler) {
|
|
267798
|
-
for (const
|
|
267799
|
-
if (
|
|
267800
|
-
this.removeListener(type,
|
|
267983
|
+
for (const listener5 of this.listeners(type)) {
|
|
267984
|
+
if (listener5[kListener] === handler && !listener5[kForOnEventAttribute]) {
|
|
267985
|
+
this.removeListener(type, listener5);
|
|
267801
267986
|
break;
|
|
267802
267987
|
}
|
|
267803
267988
|
}
|
|
@@ -267810,11 +267995,11 @@ var require_event_target = __commonJS({
|
|
|
267810
267995
|
EventTarget: EventTarget2,
|
|
267811
267996
|
MessageEvent: MessageEvent2
|
|
267812
267997
|
};
|
|
267813
|
-
function callListener(
|
|
267814
|
-
if (typeof
|
|
267815
|
-
|
|
267998
|
+
function callListener(listener5, thisArg, event) {
|
|
267999
|
+
if (typeof listener5 === "object" && listener5.handleEvent) {
|
|
268000
|
+
listener5.handleEvent.call(listener5, event);
|
|
267816
268001
|
} else {
|
|
267817
|
-
|
|
268002
|
+
listener5.call(thisArg, event);
|
|
267818
268003
|
}
|
|
267819
268004
|
}
|
|
267820
268005
|
}
|
|
@@ -268432,15 +268617,15 @@ var require_websocket2 = __commonJS({
|
|
|
268432
268617
|
Object.defineProperty(WebSocket3.prototype, `on${method}`, {
|
|
268433
268618
|
enumerable: true,
|
|
268434
268619
|
get() {
|
|
268435
|
-
for (const
|
|
268436
|
-
if (
|
|
268620
|
+
for (const listener5 of this.listeners(method)) {
|
|
268621
|
+
if (listener5[kForOnEventAttribute]) return listener5[kListener];
|
|
268437
268622
|
}
|
|
268438
268623
|
return null;
|
|
268439
268624
|
},
|
|
268440
268625
|
set(handler) {
|
|
268441
|
-
for (const
|
|
268442
|
-
if (
|
|
268443
|
-
this.removeListener(method,
|
|
268626
|
+
for (const listener5 of this.listeners(method)) {
|
|
268627
|
+
if (listener5[kForOnEventAttribute]) {
|
|
268628
|
+
this.removeListener(method, listener5);
|
|
268444
268629
|
break;
|
|
268445
268630
|
}
|
|
268446
268631
|
}
|
|
@@ -331598,6 +331783,39 @@ var init_trustedDevice = __esm({
|
|
|
331598
331783
|
}
|
|
331599
331784
|
});
|
|
331600
331785
|
|
|
331786
|
+
// build-src/src/utils/stdoutDrain.ts
|
|
331787
|
+
var stdoutDrain_exports = {};
|
|
331788
|
+
__export(stdoutDrain_exports, {
|
|
331789
|
+
drainStdoutBounded: () => drainStdoutBounded,
|
|
331790
|
+
setPipedStdoutBlocking: () => setPipedStdoutBlocking
|
|
331791
|
+
});
|
|
331792
|
+
function setPipedStdoutBlocking() {
|
|
331793
|
+
try {
|
|
331794
|
+
if (process.stdout.isTTY) return false;
|
|
331795
|
+
const h = process.stdout._handle;
|
|
331796
|
+
if (h && typeof h.setBlocking === "function") {
|
|
331797
|
+
h.setBlocking(true);
|
|
331798
|
+
return true;
|
|
331799
|
+
}
|
|
331800
|
+
} catch {
|
|
331801
|
+
}
|
|
331802
|
+
return false;
|
|
331803
|
+
}
|
|
331804
|
+
async function drainStdoutBounded(maxMs = 2e3) {
|
|
331805
|
+
try {
|
|
331806
|
+
const s = process.stdout;
|
|
331807
|
+
const start = Date.now();
|
|
331808
|
+
while (!s.destroyed && typeof s.writableLength === "number" && s.writableLength > 0 && Date.now() - start < maxMs) {
|
|
331809
|
+
await new Promise((r) => setTimeout(r, 10));
|
|
331810
|
+
}
|
|
331811
|
+
} catch {
|
|
331812
|
+
}
|
|
331813
|
+
}
|
|
331814
|
+
var init_stdoutDrain = __esm({
|
|
331815
|
+
"build-src/src/utils/stdoutDrain.ts"() {
|
|
331816
|
+
}
|
|
331817
|
+
});
|
|
331818
|
+
|
|
331601
331819
|
// build-src/src/utils/gracefulShutdown.ts
|
|
331602
331820
|
import { writeSync as writeSync3 } from "fs";
|
|
331603
331821
|
function cleanupTerminalModes() {
|
|
@@ -331772,6 +331990,11 @@ async function gracefulShutdown(exitCode = 0, reason = "other", options) {
|
|
|
331772
331990
|
} catch {
|
|
331773
331991
|
}
|
|
331774
331992
|
}
|
|
331993
|
+
try {
|
|
331994
|
+
const { drainStdoutBounded: drainStdoutBounded2 } = await Promise.resolve().then(() => (init_stdoutDrain(), stdoutDrain_exports));
|
|
331995
|
+
await drainStdoutBounded2();
|
|
331996
|
+
} catch {
|
|
331997
|
+
}
|
|
331775
331998
|
forceExit(exitCode);
|
|
331776
331999
|
}
|
|
331777
332000
|
var resumeHintPrinted, setupGracefulShutdown, shutdownInProgress, failsafeTimer, orphanCheckInterval, pendingShutdown, CleanupTimeoutError;
|
|
@@ -332615,11 +332838,11 @@ async function getImageFromClipboard() {
|
|
|
332615
332838
|
if (!native) {
|
|
332616
332839
|
return null;
|
|
332617
332840
|
}
|
|
332618
|
-
const
|
|
332619
|
-
if (
|
|
332841
|
+
const buffer5 = native.png;
|
|
332842
|
+
if (buffer5.length > IMAGE_TARGET_RAW_SIZE2) {
|
|
332620
332843
|
const resized = await maybeResizeAndDownsampleImageBuffer(
|
|
332621
|
-
|
|
332622
|
-
|
|
332844
|
+
buffer5,
|
|
332845
|
+
buffer5.length,
|
|
332623
332846
|
"png"
|
|
332624
332847
|
);
|
|
332625
332848
|
return {
|
|
@@ -332635,7 +332858,7 @@ async function getImageFromClipboard() {
|
|
|
332635
332858
|
};
|
|
332636
332859
|
}
|
|
332637
332860
|
return {
|
|
332638
|
-
base64:
|
|
332861
|
+
base64: buffer5.toString("base64"),
|
|
332639
332862
|
mediaType: "image/png",
|
|
332640
332863
|
dimensions: {
|
|
332641
332864
|
originalWidth: native.originalWidth,
|
|
@@ -338207,8 +338430,8 @@ var init_auth_code_listener = __esm({
|
|
|
338207
338430
|
|
|
338208
338431
|
// build-src/src/services/oauth/crypto.ts
|
|
338209
338432
|
import { createHash as createHash18, randomBytes as randomBytes13 } from "crypto";
|
|
338210
|
-
function base64URLEncode(
|
|
338211
|
-
return
|
|
338433
|
+
function base64URLEncode(buffer5) {
|
|
338434
|
+
return buffer5.toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
|
|
338212
338435
|
}
|
|
338213
338436
|
function generateCodeVerifier() {
|
|
338214
338437
|
return base64URLEncode(randomBytes13(32));
|
|
@@ -352748,12 +352971,12 @@ var init_extra_usage2 = __esm({
|
|
|
352748
352971
|
function useClaudeAiLimits() {
|
|
352749
352972
|
const [limits, setLimits] = (0, import_react64.useState)({ ...currentLimits });
|
|
352750
352973
|
(0, import_react64.useEffect)(() => {
|
|
352751
|
-
const
|
|
352974
|
+
const listener5 = (newLimits) => {
|
|
352752
352975
|
setLimits({ ...newLimits });
|
|
352753
352976
|
};
|
|
352754
|
-
statusListeners.add(
|
|
352977
|
+
statusListeners.add(listener5);
|
|
352755
352978
|
return () => {
|
|
352756
|
-
statusListeners.delete(
|
|
352979
|
+
statusListeners.delete(listener5);
|
|
352757
352980
|
};
|
|
352758
352981
|
}, []);
|
|
352759
352982
|
return limits;
|
|
@@ -352761,7 +352984,7 @@ function useClaudeAiLimits() {
|
|
|
352761
352984
|
var import_react64;
|
|
352762
352985
|
var init_claudeAiLimitsHook = __esm({
|
|
352763
352986
|
"build-src/src/services/claudeAiLimitsHook.ts"() {
|
|
352764
|
-
import_react64 = __toESM(require_react()
|
|
352987
|
+
import_react64 = __toESM(require_react());
|
|
352765
352988
|
init_claudeAiLimits();
|
|
352766
352989
|
}
|
|
352767
352990
|
});
|
|
@@ -353285,7 +353508,7 @@ var init_classifierApprovalsHook = __esm({
|
|
|
353285
353508
|
var React29, SentryErrorBoundary;
|
|
353286
353509
|
var init_SentryErrorBoundary = __esm({
|
|
353287
353510
|
"build-src/src/components/SentryErrorBoundary.ts"() {
|
|
353288
|
-
React29 = __toESM(require_react()
|
|
353511
|
+
React29 = __toESM(require_react());
|
|
353289
353512
|
SentryErrorBoundary = class extends React29.Component {
|
|
353290
353513
|
constructor(props) {
|
|
353291
353514
|
super(props);
|
|
@@ -369056,20 +369279,20 @@ var require_events2 = __commonJS({
|
|
|
369056
369279
|
*/
|
|
369057
369280
|
get event() {
|
|
369058
369281
|
if (!this._event) {
|
|
369059
|
-
this._event = (
|
|
369282
|
+
this._event = (listener5, thisArgs, disposables) => {
|
|
369060
369283
|
if (!this._callbacks) {
|
|
369061
369284
|
this._callbacks = new CallbackList();
|
|
369062
369285
|
}
|
|
369063
369286
|
if (this._options && this._options.onFirstListenerAdd && this._callbacks.isEmpty()) {
|
|
369064
369287
|
this._options.onFirstListenerAdd(this);
|
|
369065
369288
|
}
|
|
369066
|
-
this._callbacks.add(
|
|
369289
|
+
this._callbacks.add(listener5, thisArgs);
|
|
369067
369290
|
const result = {
|
|
369068
369291
|
dispose: () => {
|
|
369069
369292
|
if (!this._callbacks) {
|
|
369070
369293
|
return;
|
|
369071
369294
|
}
|
|
369072
|
-
this._callbacks.remove(
|
|
369295
|
+
this._callbacks.remove(listener5, thisArgs);
|
|
369073
369296
|
result.dispose = _Emitter._noop;
|
|
369074
369297
|
if (this._options && this._options.onLastListenerRemove && this._callbacks.isEmpty()) {
|
|
369075
369298
|
this._options.onLastListenerRemove(this);
|
|
@@ -369254,18 +369477,18 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
369254
369477
|
if (request.id === null) {
|
|
369255
369478
|
return;
|
|
369256
369479
|
}
|
|
369257
|
-
const
|
|
369258
|
-
const data = new Int32Array(
|
|
369480
|
+
const buffer5 = new SharedArrayBuffer(4);
|
|
369481
|
+
const data = new Int32Array(buffer5, 0, 1);
|
|
369259
369482
|
data[0] = CancellationState.Continue;
|
|
369260
|
-
this.buffers.set(request.id,
|
|
369261
|
-
request.$cancellationData =
|
|
369483
|
+
this.buffers.set(request.id, buffer5);
|
|
369484
|
+
request.$cancellationData = buffer5;
|
|
369262
369485
|
}
|
|
369263
369486
|
async sendCancellation(_conn, id) {
|
|
369264
|
-
const
|
|
369265
|
-
if (
|
|
369487
|
+
const buffer5 = this.buffers.get(id);
|
|
369488
|
+
if (buffer5 === void 0) {
|
|
369266
369489
|
return;
|
|
369267
369490
|
}
|
|
369268
|
-
const data = new Int32Array(
|
|
369491
|
+
const data = new Int32Array(buffer5, 0, 1);
|
|
369269
369492
|
Atomics.store(data, 0, CancellationState.Cancelled);
|
|
369270
369493
|
}
|
|
369271
369494
|
cleanup(id) {
|
|
@@ -369278,8 +369501,8 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
369278
369501
|
exports2.SharedArraySenderStrategy = SharedArraySenderStrategy;
|
|
369279
369502
|
var SharedArrayBufferCancellationToken = class {
|
|
369280
369503
|
data;
|
|
369281
|
-
constructor(
|
|
369282
|
-
this.data = new Int32Array(
|
|
369504
|
+
constructor(buffer5) {
|
|
369505
|
+
this.data = new Int32Array(buffer5, 0, 1);
|
|
369283
369506
|
}
|
|
369284
369507
|
get isCancellationRequested() {
|
|
369285
369508
|
return Atomics.load(this.data, 0) === CancellationState.Cancelled;
|
|
@@ -369290,8 +369513,8 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
369290
369513
|
};
|
|
369291
369514
|
var SharedArrayBufferCancellationTokenSource = class {
|
|
369292
369515
|
token;
|
|
369293
|
-
constructor(
|
|
369294
|
-
this.token = new SharedArrayBufferCancellationToken(
|
|
369516
|
+
constructor(buffer5) {
|
|
369517
|
+
this.token = new SharedArrayBufferCancellationToken(buffer5);
|
|
369295
369518
|
}
|
|
369296
369519
|
cancel() {
|
|
369297
369520
|
}
|
|
@@ -369301,11 +369524,11 @@ var require_sharedArrayCancellation = __commonJS({
|
|
|
369301
369524
|
var SharedArrayReceiverStrategy = class {
|
|
369302
369525
|
kind = "request";
|
|
369303
369526
|
createCancellationTokenSource(request) {
|
|
369304
|
-
const
|
|
369305
|
-
if (
|
|
369527
|
+
const buffer5 = request.$cancellationData;
|
|
369528
|
+
if (buffer5 === void 0) {
|
|
369306
369529
|
return new cancellation_1.CancellationTokenSource();
|
|
369307
369530
|
}
|
|
369308
|
-
return new SharedArrayBufferCancellationTokenSource(
|
|
369531
|
+
return new SharedArrayBufferCancellationTokenSource(buffer5);
|
|
369309
369532
|
}
|
|
369310
369533
|
};
|
|
369311
369534
|
exports2.SharedArrayReceiverStrategy = SharedArrayReceiverStrategy;
|
|
@@ -369747,18 +369970,18 @@ var require_messageWriter = __commonJS({
|
|
|
369747
369970
|
}
|
|
369748
369971
|
async write(msg) {
|
|
369749
369972
|
return this.writeSemaphore.lock(async () => {
|
|
369750
|
-
const payload2 = this.options.contentTypeEncoder.encode(msg, this.options).then((
|
|
369973
|
+
const payload2 = this.options.contentTypeEncoder.encode(msg, this.options).then((buffer5) => {
|
|
369751
369974
|
if (this.options.contentEncoder !== void 0) {
|
|
369752
|
-
return this.options.contentEncoder.encode(
|
|
369975
|
+
return this.options.contentEncoder.encode(buffer5);
|
|
369753
369976
|
} else {
|
|
369754
|
-
return
|
|
369977
|
+
return buffer5;
|
|
369755
369978
|
}
|
|
369756
369979
|
});
|
|
369757
|
-
return payload2.then((
|
|
369980
|
+
return payload2.then((buffer5) => {
|
|
369758
369981
|
const headers = [];
|
|
369759
|
-
headers.push(ContentLength,
|
|
369982
|
+
headers.push(ContentLength, buffer5.byteLength.toString(), CRLF2);
|
|
369760
369983
|
headers.push(CRLF2);
|
|
369761
|
-
return this.doWrite(msg, headers,
|
|
369984
|
+
return this.doWrite(msg, headers, buffer5);
|
|
369762
369985
|
}, (error52) => {
|
|
369763
369986
|
this.fireError(error52);
|
|
369764
369987
|
throw error52;
|
|
@@ -369862,9 +370085,9 @@ var require_messageBuffer = __commonJS({
|
|
|
369862
370085
|
if (state3 !== 4) {
|
|
369863
370086
|
return void 0;
|
|
369864
370087
|
}
|
|
369865
|
-
const
|
|
370088
|
+
const buffer5 = this._read(chunkBytesRead + offset);
|
|
369866
370089
|
const result = /* @__PURE__ */ new Map();
|
|
369867
|
-
const headers = this.toString(
|
|
370090
|
+
const headers = this.toString(buffer5, "ascii").split(CRLF2);
|
|
369868
370091
|
if (headers.length < 2) {
|
|
369869
370092
|
return result;
|
|
369870
370093
|
}
|
|
@@ -371342,11 +371565,11 @@ var require_ril = __commonJS({
|
|
|
371342
371565
|
return new util_1.TextDecoder(encoding).decode(value);
|
|
371343
371566
|
}
|
|
371344
371567
|
}
|
|
371345
|
-
asNative(
|
|
371568
|
+
asNative(buffer5, length) {
|
|
371346
371569
|
if (length === void 0) {
|
|
371347
|
-
return
|
|
371570
|
+
return buffer5 instanceof Buffer ? buffer5 : Buffer.from(buffer5);
|
|
371348
371571
|
} else {
|
|
371349
|
-
return
|
|
371572
|
+
return buffer5 instanceof Buffer ? buffer5.slice(0, length) : Buffer.from(buffer5, 0, length);
|
|
371350
371573
|
}
|
|
371351
371574
|
}
|
|
371352
371575
|
allocNative(length) {
|
|
@@ -371358,21 +371581,21 @@ var require_ril = __commonJS({
|
|
|
371358
371581
|
constructor(stream5) {
|
|
371359
371582
|
this.stream = stream5;
|
|
371360
371583
|
}
|
|
371361
|
-
onClose(
|
|
371362
|
-
this.stream.on("close",
|
|
371363
|
-
return api_1.Disposable.create(() => this.stream.off("close",
|
|
371584
|
+
onClose(listener5) {
|
|
371585
|
+
this.stream.on("close", listener5);
|
|
371586
|
+
return api_1.Disposable.create(() => this.stream.off("close", listener5));
|
|
371364
371587
|
}
|
|
371365
|
-
onError(
|
|
371366
|
-
this.stream.on("error",
|
|
371367
|
-
return api_1.Disposable.create(() => this.stream.off("error",
|
|
371588
|
+
onError(listener5) {
|
|
371589
|
+
this.stream.on("error", listener5);
|
|
371590
|
+
return api_1.Disposable.create(() => this.stream.off("error", listener5));
|
|
371368
371591
|
}
|
|
371369
|
-
onEnd(
|
|
371370
|
-
this.stream.on("end",
|
|
371371
|
-
return api_1.Disposable.create(() => this.stream.off("end",
|
|
371592
|
+
onEnd(listener5) {
|
|
371593
|
+
this.stream.on("end", listener5);
|
|
371594
|
+
return api_1.Disposable.create(() => this.stream.off("end", listener5));
|
|
371372
371595
|
}
|
|
371373
|
-
onData(
|
|
371374
|
-
this.stream.on("data",
|
|
371375
|
-
return api_1.Disposable.create(() => this.stream.off("data",
|
|
371596
|
+
onData(listener5) {
|
|
371597
|
+
this.stream.on("data", listener5);
|
|
371598
|
+
return api_1.Disposable.create(() => this.stream.off("data", listener5));
|
|
371376
371599
|
}
|
|
371377
371600
|
};
|
|
371378
371601
|
var WritableStreamWrapper = class {
|
|
@@ -371380,17 +371603,17 @@ var require_ril = __commonJS({
|
|
|
371380
371603
|
constructor(stream5) {
|
|
371381
371604
|
this.stream = stream5;
|
|
371382
371605
|
}
|
|
371383
|
-
onClose(
|
|
371384
|
-
this.stream.on("close",
|
|
371385
|
-
return api_1.Disposable.create(() => this.stream.off("close",
|
|
371606
|
+
onClose(listener5) {
|
|
371607
|
+
this.stream.on("close", listener5);
|
|
371608
|
+
return api_1.Disposable.create(() => this.stream.off("close", listener5));
|
|
371386
371609
|
}
|
|
371387
|
-
onError(
|
|
371388
|
-
this.stream.on("error",
|
|
371389
|
-
return api_1.Disposable.create(() => this.stream.off("error",
|
|
371610
|
+
onError(listener5) {
|
|
371611
|
+
this.stream.on("error", listener5);
|
|
371612
|
+
return api_1.Disposable.create(() => this.stream.off("error", listener5));
|
|
371390
371613
|
}
|
|
371391
|
-
onEnd(
|
|
371392
|
-
this.stream.on("end",
|
|
371393
|
-
return api_1.Disposable.create(() => this.stream.off("end",
|
|
371614
|
+
onEnd(listener5) {
|
|
371615
|
+
this.stream.on("end", listener5);
|
|
371616
|
+
return api_1.Disposable.create(() => this.stream.off("end", listener5));
|
|
371394
371617
|
}
|
|
371395
371618
|
write(data, encoding) {
|
|
371396
371619
|
return new Promise((resolve53, reject2) => {
|
|
@@ -371429,12 +371652,12 @@ var require_ril = __commonJS({
|
|
|
371429
371652
|
}),
|
|
371430
371653
|
decoder: Object.freeze({
|
|
371431
371654
|
name: "application/json",
|
|
371432
|
-
decode: (
|
|
371655
|
+
decode: (buffer5, options) => {
|
|
371433
371656
|
try {
|
|
371434
|
-
if (
|
|
371435
|
-
return Promise.resolve(JSON.parse(
|
|
371657
|
+
if (buffer5 instanceof Buffer) {
|
|
371658
|
+
return Promise.resolve(JSON.parse(buffer5.toString(options.charset)));
|
|
371436
371659
|
} else {
|
|
371437
|
-
return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(
|
|
371660
|
+
return Promise.resolve(JSON.parse(new util_1.TextDecoder(options.charset).decode(buffer5)));
|
|
371438
371661
|
}
|
|
371439
371662
|
} catch (err8) {
|
|
371440
371663
|
return Promise.reject(err8);
|
|
@@ -379110,29 +379333,29 @@ var require_EventTarget = __commonJS({
|
|
|
379110
379333
|
// And update the counter when nodes are added and removed from the
|
|
379111
379334
|
// tree as well. Then, in dispatch event, the capturing phase can
|
|
379112
379335
|
// abort if it sees any node with a zero count.
|
|
379113
|
-
addEventListener: function addEventListener(type,
|
|
379114
|
-
if (!
|
|
379336
|
+
addEventListener: function addEventListener(type, listener5, capture) {
|
|
379337
|
+
if (!listener5) return;
|
|
379115
379338
|
if (capture === void 0) capture = false;
|
|
379116
379339
|
if (!this._listeners) this._listeners = /* @__PURE__ */ Object.create(null);
|
|
379117
379340
|
if (!this._listeners[type]) this._listeners[type] = [];
|
|
379118
379341
|
var list = this._listeners[type];
|
|
379119
379342
|
for (var i = 0, n2 = list.length; i < n2; i++) {
|
|
379120
379343
|
var l3 = list[i];
|
|
379121
|
-
if (l3.listener ===
|
|
379344
|
+
if (l3.listener === listener5 && l3.capture === capture)
|
|
379122
379345
|
return;
|
|
379123
379346
|
}
|
|
379124
|
-
var obj = { listener:
|
|
379125
|
-
if (typeof
|
|
379347
|
+
var obj = { listener: listener5, capture };
|
|
379348
|
+
if (typeof listener5 === "function") obj.f = listener5;
|
|
379126
379349
|
list.push(obj);
|
|
379127
379350
|
},
|
|
379128
|
-
removeEventListener: function removeEventListener(type,
|
|
379351
|
+
removeEventListener: function removeEventListener(type, listener5, capture) {
|
|
379129
379352
|
if (capture === void 0) capture = false;
|
|
379130
379353
|
if (this._listeners) {
|
|
379131
379354
|
var list = this._listeners[type];
|
|
379132
379355
|
if (list) {
|
|
379133
379356
|
for (var i = 0, n2 = list.length; i < n2; i++) {
|
|
379134
379357
|
var l3 = list[i];
|
|
379135
|
-
if (l3.listener ===
|
|
379358
|
+
if (l3.listener === listener5 && l3.capture === capture) {
|
|
379136
379359
|
if (list.length === 1) {
|
|
379137
379360
|
this._listeners[type] = void 0;
|
|
379138
379361
|
} else {
|
|
@@ -400174,10 +400397,10 @@ function getSymbolAtPosition(filePath, line, character) {
|
|
|
400174
400397
|
try {
|
|
400175
400398
|
const fs15 = getFsImplementation();
|
|
400176
400399
|
const absolutePath = expandPath(filePath);
|
|
400177
|
-
const { buffer:
|
|
400400
|
+
const { buffer: buffer5, bytesRead } = fs15.readSync(absolutePath, {
|
|
400178
400401
|
length: MAX_READ_BYTES
|
|
400179
400402
|
});
|
|
400180
|
-
const content =
|
|
400403
|
+
const content = buffer5.toString("utf-8", 0, bytesRead);
|
|
400181
400404
|
const lines = content.split("\n");
|
|
400182
400405
|
if (line < 0 || line >= lines.length) {
|
|
400183
400406
|
return null;
|
|
@@ -431874,13 +432097,29 @@ function toTaskRequest(params) {
|
|
|
431874
432097
|
}
|
|
431875
432098
|
}
|
|
431876
432099
|
}
|
|
432100
|
+
const standaloneMeta = trailingStandaloneMetaUserMessages(msgs);
|
|
432101
|
+
let metaIsSubmission = false;
|
|
432102
|
+
if (standaloneMeta.length > 0) {
|
|
432103
|
+
const metaTexts = standaloneMeta.map((m2) => objectiveFromMessage(m2)).filter((t2) => t2.length > 0);
|
|
432104
|
+
if (metaTexts.length > 0) {
|
|
432105
|
+
objective = metaTexts.join("\n");
|
|
432106
|
+
metaIsSubmission = true;
|
|
432107
|
+
if (process.env.SEMA_DEBUG) {
|
|
432108
|
+
console.error(`[sema][seamQuery] injected-meta wire: ${metaTexts.length} standalone meta message(s) (${objective.length} chars) \u2192 objective`);
|
|
432109
|
+
}
|
|
432110
|
+
}
|
|
432111
|
+
}
|
|
431877
432112
|
if (objective.length === 0 && !submitted && msgs.length > 0) {
|
|
431878
432113
|
objective = objectiveFromMessage(msgs[msgs.length - 1]);
|
|
431879
432114
|
}
|
|
431880
|
-
const images = submitted ? imagesFromMessage(submitted) : [];
|
|
432115
|
+
const images = submitted && !metaIsSubmission ? imagesFromMessage(submitted) : [];
|
|
431881
432116
|
if (images.length > 0 && process.env.SEMA_DEBUG) {
|
|
431882
432117
|
console.error(`[sema][seamQuery] images wire: ${images.length} image(s) \u2192 TaskRequest.images`);
|
|
431883
432118
|
}
|
|
432119
|
+
if (objective.trim().length === 0 && images.length === 0) {
|
|
432120
|
+
console.error("[sema][seamQuery] EMPTY objective guard tripped \u2014 substituting NO_CONTENT_MESSAGE (a submission path produced no text; report this)");
|
|
432121
|
+
objective = NO_CONTENT_MESSAGE;
|
|
432122
|
+
}
|
|
431884
432123
|
const sysPrompt = params.systemPrompt;
|
|
431885
432124
|
const scenario2 = selectScenario(objective);
|
|
431886
432125
|
let reasoningEffort;
|
|
@@ -432114,9 +432353,9 @@ Fix: run \`sema doctor\` to diagnose, or restart sema to retry.`,
|
|
|
432114
432353
|
if (isLocalEngineActive2()) {
|
|
432115
432354
|
const { hasOwnModelConfig: hasOwnModelConfig2, computeCcFallbackEnv: computeCcFallbackEnv2 } = await Promise.resolve().then(() => (init_ccConfigFallback(), ccConfigFallback_exports));
|
|
432116
432355
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
|
|
432117
|
-
const { existsSync:
|
|
432356
|
+
const { existsSync: existsSync36 } = await import("node:fs");
|
|
432118
432357
|
const { join: join206 } = await import("node:path");
|
|
432119
|
-
const hasCatalog =
|
|
432358
|
+
const hasCatalog = existsSync36(join206(getClaudeConfigHomeDir3(), "config.d", "models.json"));
|
|
432120
432359
|
if (!hasOwnModelConfig2(process.env) && !hasCatalog && !computeCcFallbackEnv2(process.env)) {
|
|
432121
432360
|
yield createAssistantAPIErrorMessage({
|
|
432122
432361
|
content: `Model not configured \u2014 this message was NOT sent.
|
|
@@ -432142,9 +432381,8 @@ Setup looks unfinished (no model was saved). Run \`sema onboard\` to finish setu
|
|
|
432142
432381
|
noteEngineTurnStart();
|
|
432143
432382
|
const sessionId = req.sessionId ?? mockClientIds.sessionId;
|
|
432144
432383
|
try {
|
|
432145
|
-
const
|
|
432146
|
-
|
|
432147
|
-
);
|
|
432384
|
+
const metaRun = trailingStandaloneMetaUserMessages(params.messages);
|
|
432385
|
+
const submitted = metaRun.length > 0 ? void 0 : lastProjectableUserMessage(params.messages);
|
|
432148
432386
|
if (submitted && typeof submitted.uuid === "string") recordPendingUserMessage(submitted.uuid);
|
|
432149
432387
|
if (process.env.SEMA_LIVE_BASEURL) {
|
|
432150
432388
|
disarmAssistantCommit();
|
|
@@ -432352,6 +432590,7 @@ var init_seamQuery = __esm({
|
|
|
432352
432590
|
init_engineTarget();
|
|
432353
432591
|
init_userMessageSelect();
|
|
432354
432592
|
init_rewindAnchorStore();
|
|
432593
|
+
init_messages3();
|
|
432355
432594
|
init_sessionStorage();
|
|
432356
432595
|
init_turnCommitSignal();
|
|
432357
432596
|
init_mockClient();
|
|
@@ -438337,9 +438576,9 @@ function ScrollBox({
|
|
|
438337
438576
|
if (!el) return false;
|
|
438338
438577
|
return el.stickyScroll ?? Boolean(el.attributes["stickyScroll"]);
|
|
438339
438578
|
},
|
|
438340
|
-
subscribe(
|
|
438341
|
-
listenersRef.current.add(
|
|
438342
|
-
return () => listenersRef.current.delete(
|
|
438579
|
+
subscribe(listener5) {
|
|
438580
|
+
listenersRef.current.add(listener5);
|
|
438581
|
+
return () => listenersRef.current.delete(listener5);
|
|
438343
438582
|
},
|
|
438344
438583
|
setClampBounds(min, max2) {
|
|
438345
438584
|
const el = domRef.current;
|
|
@@ -439252,8 +439491,8 @@ ${sanitizedDescription}
|
|
|
439252
439491
|
const spaceForErrors = GITHUB_URL_LIMIT - baseUrl.length - encodedPrefix.length - encodedSuffix.length - encodedNote.length;
|
|
439253
439492
|
if (spaceForErrors <= 0) {
|
|
439254
439493
|
const ellipsis2 = encodeURIComponent("\u2026");
|
|
439255
|
-
const
|
|
439256
|
-
const maxEncodedLength = GITHUB_URL_LIMIT - baseUrl.length - ellipsis2.length - encodedNote.length -
|
|
439494
|
+
const buffer6 = 50;
|
|
439495
|
+
const maxEncodedLength = GITHUB_URL_LIMIT - baseUrl.length - ellipsis2.length - encodedNote.length - buffer6;
|
|
439257
439496
|
const fullBody = bodyPrefix + errorsJson + errorSuffix;
|
|
439258
439497
|
let encodedFullBody = encodeURIComponent(fullBody);
|
|
439259
439498
|
if (encodedFullBody.length > maxEncodedLength) {
|
|
@@ -439269,8 +439508,8 @@ ${sanitizedDescription}
|
|
|
439269
439508
|
return baseUrl + encodedPrefix + encodedErrors + encodedSuffix;
|
|
439270
439509
|
}
|
|
439271
439510
|
const ellipsis = encodeURIComponent("\u2026");
|
|
439272
|
-
const
|
|
439273
|
-
let truncatedEncodedErrors = encodedErrors.slice(0, spaceForErrors - ellipsis.length -
|
|
439511
|
+
const buffer5 = 50;
|
|
439512
|
+
let truncatedEncodedErrors = encodedErrors.slice(0, spaceForErrors - ellipsis.length - buffer5);
|
|
439274
439513
|
const lastPercent = truncatedEncodedErrors.lastIndexOf("%");
|
|
439275
439514
|
if (lastPercent >= truncatedEncodedErrors.length - 2) {
|
|
439276
439515
|
truncatedEncodedErrors = truncatedEncodedErrors.slice(0, lastPercent);
|
|
@@ -449274,7 +449513,7 @@ function Settings({
|
|
|
449274
449513
|
var import_react113, import_jsx_runtime191;
|
|
449275
449514
|
var init_cmd_config = __esm({
|
|
449276
449515
|
"build-src/src/sema/overrides/cmd-config.tsx"() {
|
|
449277
|
-
import_react113 = __toESM(require_react()
|
|
449516
|
+
import_react113 = __toESM(require_react());
|
|
449278
449517
|
init_useKeybinding();
|
|
449279
449518
|
init_useExitOnCtrlCDWithKeybindings();
|
|
449280
449519
|
init_useTerminalSize();
|
|
@@ -449285,7 +449524,7 @@ var init_cmd_config = __esm({
|
|
|
449285
449524
|
init_Config();
|
|
449286
449525
|
init_settings_usage();
|
|
449287
449526
|
init_Stats();
|
|
449288
|
-
import_jsx_runtime191 = __toESM(require_jsx_runtime()
|
|
449527
|
+
import_jsx_runtime191 = __toESM(require_jsx_runtime());
|
|
449289
449528
|
}
|
|
449290
449529
|
});
|
|
449291
449530
|
|
|
@@ -471074,26 +471313,26 @@ var require_qrcode = __commonJS({
|
|
|
471074
471313
|
}
|
|
471075
471314
|
}
|
|
471076
471315
|
function createData(version5, errorCorrectionLevel, segments) {
|
|
471077
|
-
const
|
|
471316
|
+
const buffer5 = new BitBuffer();
|
|
471078
471317
|
segments.forEach(function(data) {
|
|
471079
|
-
|
|
471080
|
-
|
|
471081
|
-
data.write(
|
|
471318
|
+
buffer5.put(data.mode.bit, 4);
|
|
471319
|
+
buffer5.put(data.getLength(), Mode.getCharCountIndicator(data.mode, version5));
|
|
471320
|
+
data.write(buffer5);
|
|
471082
471321
|
});
|
|
471083
471322
|
const totalCodewords = Utils.getSymbolTotalCodewords(version5);
|
|
471084
471323
|
const ecTotalCodewords = ECCode.getTotalCodewordsCount(version5, errorCorrectionLevel);
|
|
471085
471324
|
const dataTotalCodewordsBits = (totalCodewords - ecTotalCodewords) * 8;
|
|
471086
|
-
if (
|
|
471087
|
-
|
|
471325
|
+
if (buffer5.getLengthInBits() + 4 <= dataTotalCodewordsBits) {
|
|
471326
|
+
buffer5.put(0, 4);
|
|
471088
471327
|
}
|
|
471089
|
-
while (
|
|
471090
|
-
|
|
471328
|
+
while (buffer5.getLengthInBits() % 8 !== 0) {
|
|
471329
|
+
buffer5.putBit(0);
|
|
471091
471330
|
}
|
|
471092
|
-
const remainingByte = (dataTotalCodewordsBits -
|
|
471331
|
+
const remainingByte = (dataTotalCodewordsBits - buffer5.getLengthInBits()) / 8;
|
|
471093
471332
|
for (let i = 0; i < remainingByte; i++) {
|
|
471094
|
-
|
|
471333
|
+
buffer5.put(i % 2 ? 17 : 236, 8);
|
|
471095
471334
|
}
|
|
471096
|
-
return createCodewords(
|
|
471335
|
+
return createCodewords(buffer5, version5, errorCorrectionLevel);
|
|
471097
471336
|
}
|
|
471098
471337
|
function createCodewords(bitBuffer, version5, errorCorrectionLevel) {
|
|
471099
471338
|
const totalCodewords = Utils.getSymbolTotalCodewords(version5);
|
|
@@ -471111,10 +471350,10 @@ var require_qrcode = __commonJS({
|
|
|
471111
471350
|
const dcData = new Array(ecTotalBlocks);
|
|
471112
471351
|
const ecData = new Array(ecTotalBlocks);
|
|
471113
471352
|
let maxDataSize = 0;
|
|
471114
|
-
const
|
|
471353
|
+
const buffer5 = new Uint8Array(bitBuffer.buffer);
|
|
471115
471354
|
for (let b3 = 0; b3 < ecTotalBlocks; b3++) {
|
|
471116
471355
|
const dataSize = b3 < blocksInGroup1 ? dataCodewordsInGroup1 : dataCodewordsInGroup2;
|
|
471117
|
-
dcData[b3] =
|
|
471356
|
+
dcData[b3] = buffer5.slice(offset, offset + dataSize);
|
|
471118
471357
|
ecData[b3] = rs.encode(dcData[b3]);
|
|
471119
471358
|
offset += dataSize;
|
|
471120
471359
|
maxDataSize = Math.max(maxDataSize, dataSize);
|
|
@@ -471603,8 +471842,8 @@ var require_filter_parse_async = __commonJS({
|
|
|
471603
471842
|
let that = this;
|
|
471604
471843
|
this._filter = new Filter(bitmapInfo, {
|
|
471605
471844
|
read: this.read.bind(this),
|
|
471606
|
-
write: function(
|
|
471607
|
-
buffers.push(
|
|
471845
|
+
write: function(buffer5) {
|
|
471846
|
+
buffers.push(buffer5);
|
|
471608
471847
|
},
|
|
471609
471848
|
complete: function() {
|
|
471610
471849
|
that.emit("complete", Buffer.concat(buffers));
|
|
@@ -472378,14 +472617,14 @@ var require_bitpacker = __commonJS({
|
|
|
472378
472617
|
) !== -1;
|
|
472379
472618
|
if (options.colorType === options.inputColorType) {
|
|
472380
472619
|
let bigEndian = (function() {
|
|
472381
|
-
let
|
|
472382
|
-
new DataView(
|
|
472620
|
+
let buffer5 = new ArrayBuffer(2);
|
|
472621
|
+
new DataView(buffer5).setInt16(
|
|
472383
472622
|
0,
|
|
472384
472623
|
256,
|
|
472385
472624
|
true
|
|
472386
472625
|
/* littleEndian */
|
|
472387
472626
|
);
|
|
472388
|
-
return new Int16Array(
|
|
472627
|
+
return new Int16Array(buffer5)[0] !== 256;
|
|
472389
472628
|
})();
|
|
472390
472629
|
if (options.bitDepth === 8 || options.bitDepth === 16 && bigEndian) {
|
|
472391
472630
|
return dataIn;
|
|
@@ -472915,21 +473154,21 @@ var require_sync_inflate = __commonJS({
|
|
|
472915
473154
|
return buf;
|
|
472916
473155
|
};
|
|
472917
473156
|
util9.inherits(Inflate2, zlib3.Inflate);
|
|
472918
|
-
function zlibBufferSync(engine,
|
|
472919
|
-
if (typeof
|
|
472920
|
-
|
|
473157
|
+
function zlibBufferSync(engine, buffer5) {
|
|
473158
|
+
if (typeof buffer5 === "string") {
|
|
473159
|
+
buffer5 = Buffer.from(buffer5);
|
|
472921
473160
|
}
|
|
472922
|
-
if (!(
|
|
473161
|
+
if (!(buffer5 instanceof Buffer)) {
|
|
472923
473162
|
throw new TypeError("Not a string or buffer");
|
|
472924
473163
|
}
|
|
472925
473164
|
let flushFlag = engine._finishFlushFlag;
|
|
472926
473165
|
if (flushFlag == null) {
|
|
472927
473166
|
flushFlag = zlib3.Z_FINISH;
|
|
472928
473167
|
}
|
|
472929
|
-
return engine._processChunk(
|
|
473168
|
+
return engine._processChunk(buffer5, flushFlag);
|
|
472930
473169
|
}
|
|
472931
|
-
function inflateSync2(
|
|
472932
|
-
return zlibBufferSync(new Inflate2(opts),
|
|
473170
|
+
function inflateSync2(buffer5, opts) {
|
|
473171
|
+
return zlibBufferSync(new Inflate2(opts), buffer5);
|
|
472933
473172
|
}
|
|
472934
473173
|
module2.exports = exports2 = inflateSync2;
|
|
472935
473174
|
exports2.Inflate = Inflate2;
|
|
@@ -472942,8 +473181,8 @@ var require_sync_inflate = __commonJS({
|
|
|
472942
473181
|
var require_sync_reader = __commonJS({
|
|
472943
473182
|
"node_modules/pngjs/lib/sync-reader.js"(exports2, module2) {
|
|
472944
473183
|
"use strict";
|
|
472945
|
-
var SyncReader = module2.exports = function(
|
|
472946
|
-
this._buffer =
|
|
473184
|
+
var SyncReader = module2.exports = function(buffer5) {
|
|
473185
|
+
this._buffer = buffer5;
|
|
472947
473186
|
this._reads = [];
|
|
472948
473187
|
};
|
|
472949
473188
|
SyncReader.prototype.read = function(length, callback) {
|
|
@@ -473015,7 +473254,7 @@ var require_parser_sync = __commonJS({
|
|
|
473015
473254
|
var Parser3 = require_parser4();
|
|
473016
473255
|
var bitmapper = require_bitmapper();
|
|
473017
473256
|
var formatNormaliser = require_format_normaliser();
|
|
473018
|
-
module2.exports = function(
|
|
473257
|
+
module2.exports = function(buffer5, options) {
|
|
473019
473258
|
if (!hasSyncZlib) {
|
|
473020
473259
|
throw new Error(
|
|
473021
473260
|
"To use the sync capability of this library in old node versions, please pin pngjs to v2.3.0"
|
|
@@ -473046,7 +473285,7 @@ var require_parser_sync = __commonJS({
|
|
|
473046
473285
|
function handleInflateData(inflatedData2) {
|
|
473047
473286
|
inflateDataList.push(inflatedData2);
|
|
473048
473287
|
}
|
|
473049
|
-
let reader = new SyncReader(
|
|
473288
|
+
let reader = new SyncReader(buffer5);
|
|
473050
473289
|
let parser = new Parser3(options, {
|
|
473051
473290
|
read: reader.read.bind(reader),
|
|
473052
473291
|
error: handleError,
|
|
@@ -473142,8 +473381,8 @@ var require_png_sync = __commonJS({
|
|
|
473142
473381
|
"use strict";
|
|
473143
473382
|
var parse14 = require_parser_sync();
|
|
473144
473383
|
var pack = require_packer_sync();
|
|
473145
|
-
exports2.read = function(
|
|
473146
|
-
return parse14(
|
|
473384
|
+
exports2.read = function(buffer5, options) {
|
|
473385
|
+
return parse14(buffer5, options || {});
|
|
473147
473386
|
};
|
|
473148
473387
|
exports2.write = function(png2, options) {
|
|
473149
473388
|
return pack(png2, options);
|
|
@@ -473402,13 +473641,13 @@ var require_png2 = __commonJS({
|
|
|
473402
473641
|
options = void 0;
|
|
473403
473642
|
}
|
|
473404
473643
|
const png2 = exports2.render(qrData, options);
|
|
473405
|
-
const
|
|
473644
|
+
const buffer5 = [];
|
|
473406
473645
|
png2.on("error", cb);
|
|
473407
473646
|
png2.on("data", function(data) {
|
|
473408
|
-
|
|
473647
|
+
buffer5.push(data);
|
|
473409
473648
|
});
|
|
473410
473649
|
png2.on("end", function() {
|
|
473411
|
-
cb(null, Buffer.concat(
|
|
473650
|
+
cb(null, Buffer.concat(buffer5));
|
|
473412
473651
|
});
|
|
473413
473652
|
png2.pack();
|
|
473414
473653
|
};
|
|
@@ -478135,8 +478374,8 @@ var init_sema_brand = __esm({
|
|
|
478135
478374
|
"Slash-command gating wired to the fleet capability handshake"
|
|
478136
478375
|
]
|
|
478137
478376
|
},
|
|
478138
|
-
productVersion: "1.0.
|
|
478139
|
-
announcement: "sema 1.0.
|
|
478377
|
+
productVersion: "1.0.9",
|
|
478378
|
+
announcement: "sema 1.0.9 \u2014 a poisoned session heals itself on the next turn (engine-side empty-frame repair), prompt cache survives midnight (date pinned per session), ctrl+B now shows engine-side background shells, and tokenless local engines get full run access"
|
|
478140
478379
|
};
|
|
478141
478380
|
}
|
|
478142
478381
|
});
|
|
@@ -479490,7 +479729,7 @@ function useVirtualScroll(scrollRef, itemKeys, columns) {
|
|
|
479490
479729
|
const listOriginRef = (0, import_react158.useRef)(0);
|
|
479491
479730
|
const spacerRef = (0, import_react158.useRef)(null);
|
|
479492
479731
|
const subscribe3 = (0, import_react158.useCallback)(
|
|
479493
|
-
(
|
|
479732
|
+
(listener5) => scrollRef.current?.subscribe(listener5) ?? NOOP_UNSUB,
|
|
479494
479733
|
[scrollRef]
|
|
479495
479734
|
);
|
|
479496
479735
|
(0, import_react158.useSyncExternalStore)(subscribe3, () => {
|
|
@@ -479957,7 +480196,7 @@ function FullscreenLayout(t0) {
|
|
|
479957
480196
|
const chromeCtx = t4;
|
|
479958
480197
|
let t5;
|
|
479959
480198
|
if ($3[1] !== scrollRef) {
|
|
479960
|
-
t5 = (
|
|
480199
|
+
t5 = (listener5) => scrollRef?.current?.subscribe(listener5) ?? _temp93;
|
|
479961
480200
|
$3[1] = scrollRef;
|
|
479962
480201
|
$3[2] = t5;
|
|
479963
480202
|
} else {
|
|
@@ -480931,7 +481170,7 @@ function StickyTracker({
|
|
|
480931
481170
|
const {
|
|
480932
481171
|
setStickyPrompt
|
|
480933
481172
|
} = (0, import_react161.useContext)(ScrollChromeContext);
|
|
480934
|
-
const subscribe3 = (0, import_react161.useCallback)((
|
|
481173
|
+
const subscribe3 = (0, import_react161.useCallback)((listener5) => scrollRef.current?.subscribe(listener5) ?? NOOP_UNSUB2, [scrollRef]);
|
|
480935
481174
|
(0, import_react161.useSyncExternalStore)(subscribe3, () => {
|
|
480936
481175
|
const s = scrollRef.current;
|
|
480937
481176
|
if (!s) return NaN;
|
|
@@ -481075,8 +481314,8 @@ var require_sema_brand = __commonJS({
|
|
|
481075
481314
|
"Slash-command gating wired to the fleet capability handshake"
|
|
481076
481315
|
]
|
|
481077
481316
|
},
|
|
481078
|
-
productVersion: "1.0.
|
|
481079
|
-
announcement: "sema 1.0.
|
|
481317
|
+
productVersion: "1.0.9",
|
|
481318
|
+
announcement: "sema 1.0.9 \u2014 a poisoned session heals itself on the next turn (engine-side empty-frame repair), prompt cache survives midnight (date pinned per session), ctrl+B now shows engine-side background shells, and tokenless local engines get full run access"
|
|
481080
481319
|
};
|
|
481081
481320
|
}
|
|
481082
481321
|
});
|
|
@@ -483747,8 +483986,8 @@ ${rule}` : rule;
|
|
|
483747
483986
|
if (!onLoadMore) {
|
|
483748
483987
|
return;
|
|
483749
483988
|
}
|
|
483750
|
-
const
|
|
483751
|
-
if (focusedIndex +
|
|
483989
|
+
const buffer5 = visibleCount * 2;
|
|
483990
|
+
if (focusedIndex + buffer5 >= displayedLogs.length) {
|
|
483752
483991
|
onLoadMore(visibleCount * 3);
|
|
483753
483992
|
}
|
|
483754
483993
|
};
|
|
@@ -489514,15 +489753,28 @@ var init_RemoteSessionDetailDialog = __esm({
|
|
|
489514
489753
|
});
|
|
489515
489754
|
|
|
489516
489755
|
// build-src/src/components/tasks/ShellDetailDialog.tsx
|
|
489756
|
+
import { existsSync as existsSync21 } from "fs";
|
|
489517
489757
|
async function getTaskOutput2(shell) {
|
|
489518
|
-
const
|
|
489758
|
+
const engineSide = shell.engineSide === true;
|
|
489759
|
+
const path27 = engineSide ? shell.outputFile : getTaskOutputPath(shell.id);
|
|
489519
489760
|
try {
|
|
489761
|
+
if (engineSide && (!path27 || !existsSync21(path27))) throw new Error("engine output not locally readable");
|
|
489520
489762
|
const result = await tailFile(path27, SHELL_DETAIL_TAIL_BYTES);
|
|
489521
489763
|
return {
|
|
489522
489764
|
content: result.content,
|
|
489523
489765
|
bytesTotal: result.bytesTotal
|
|
489524
489766
|
};
|
|
489525
489767
|
} catch {
|
|
489768
|
+
if (engineSide) {
|
|
489769
|
+
const pathLine = path27 ? `Output file (engine-side): ${path27}
|
|
489770
|
+
(not readable from this shell \u2014 a remote engine's files live on its machine; copy the path to read it there.)` : "";
|
|
489771
|
+
const receipt = shell.engineReceipt ? shell.engineReceipt.replace(" Output file: ", "\nOutput file: ").replace(" (full output is appended there", "\n(full output is appended there").replace(/ (You will be notified|Use TaskOutput\(|TaskStop\(|Time budget:)/g, "\n$1") : "";
|
|
489772
|
+
const content = [receipt, pathLine].filter(Boolean).join("\n\n");
|
|
489773
|
+
return {
|
|
489774
|
+
content: content || "Output lives on the engine \u2014 poll it with the TaskOutput tool.",
|
|
489775
|
+
bytesTotal: 0
|
|
489776
|
+
};
|
|
489777
|
+
}
|
|
489526
489778
|
return {
|
|
489527
489779
|
content: "",
|
|
489528
489780
|
bytesTotal: 0
|
|
@@ -490068,7 +490320,7 @@ function BackgroundTasksDialog({
|
|
|
490068
490320
|
if (!currentSelection_0) return;
|
|
490069
490321
|
if (e.key === "x") {
|
|
490070
490322
|
e.preventDefault();
|
|
490071
|
-
if (currentSelection_0.type === "local_bash" && currentSelection_0.status === "running") {
|
|
490323
|
+
if (currentSelection_0.type === "local_bash" && currentSelection_0.status === "running" && currentSelection_0.task.engineSide !== true) {
|
|
490072
490324
|
void killShellTask(currentSelection_0.id);
|
|
490073
490325
|
} else if (currentSelection_0.type === "local_agent" && currentSelection_0.status === "running") {
|
|
490074
490326
|
void killAgentTask(currentSelection_0.id);
|
|
@@ -490159,7 +490411,7 @@ function BackgroundTasksDialog({
|
|
|
490159
490411
|
}
|
|
490160
490412
|
switch (task_0.type) {
|
|
490161
490413
|
case "local_bash":
|
|
490162
|
-
return /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(ShellDetailDialog, { shell: task_0, onDone, onKillShell: () => void killShellTask(task_0.id), onBack: goBackToList }, `shell-${task_0.id}`);
|
|
490414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(ShellDetailDialog, { shell: task_0, onDone, onKillShell: task_0.engineSide === true ? void 0 : () => void killShellTask(task_0.id), onBack: goBackToList }, `shell-${task_0.id}`);
|
|
490163
490415
|
case "local_agent":
|
|
490164
490416
|
return /* @__PURE__ */ (0, import_jsx_runtime294.jsx)(AsyncAgentDetailDialog, { agent: task_0, onDone, onKillAgent: () => void killAgentTask(task_0.id), onBack: goBackToList }, `agent-${task_0.id}`);
|
|
490165
490417
|
case "remote_agent":
|
|
@@ -498209,6 +498461,11 @@ var init_thinkback_play2 = __esm({
|
|
|
498209
498461
|
});
|
|
498210
498462
|
|
|
498211
498463
|
// build-src/src/utils/autoModeDenials.ts
|
|
498464
|
+
var autoModeDenials_exports = {};
|
|
498465
|
+
__export(autoModeDenials_exports, {
|
|
498466
|
+
getAutoModeDenials: () => getAutoModeDenials,
|
|
498467
|
+
recordAutoModeDenial: () => recordAutoModeDenial
|
|
498468
|
+
});
|
|
498212
498469
|
function recordAutoModeDenial(denial) {
|
|
498213
498470
|
if (false) return;
|
|
498214
498471
|
DENIALS = [denial, ...DENIALS.slice(0, MAX_DENIALS - 1)];
|
|
@@ -503951,7 +504208,7 @@ function resolveDurable() {
|
|
|
503951
504208
|
if (!baseUrl || !sessionId) return null;
|
|
503952
504209
|
const client4 = new AgentClient2({
|
|
503953
504210
|
baseUrl,
|
|
503954
|
-
authToken:
|
|
504211
|
+
authToken: resolveLiveAuthToken(baseUrl),
|
|
503955
504212
|
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
503956
504213
|
});
|
|
503957
504214
|
return {
|
|
@@ -503968,6 +504225,7 @@ function makeLiveBranchDeps() {
|
|
|
503968
504225
|
var init_branchDurableLive = __esm({
|
|
503969
504226
|
"build-src/src/commands/branch/branchDurableLive.ts"() {
|
|
503970
504227
|
init_branch();
|
|
504228
|
+
init_engineTarget();
|
|
503971
504229
|
init_liveSessionStore();
|
|
503972
504230
|
}
|
|
503973
504231
|
});
|
|
@@ -511042,7 +511300,7 @@ var init_export2 = __esm({
|
|
|
511042
511300
|
});
|
|
511043
511301
|
|
|
511044
511302
|
// build-src/src/sema/modelCtxOverride.ts
|
|
511045
|
-
import { existsSync as
|
|
511303
|
+
import { existsSync as existsSync22, readFileSync as readFileSync30, writeFileSync as writeFileSync17 } from "node:fs";
|
|
511046
511304
|
import { join as join159 } from "node:path";
|
|
511047
511305
|
function nextStep(current3, steps) {
|
|
511048
511306
|
if (typeof current3 === "number") {
|
|
@@ -511079,7 +511337,7 @@ function applyModelOverride(modelName, field, value) {
|
|
|
511079
511337
|
}
|
|
511080
511338
|
try {
|
|
511081
511339
|
const path27 = configDModelsPath();
|
|
511082
|
-
if (
|
|
511340
|
+
if (existsSync22(path27)) {
|
|
511083
511341
|
const n2 = normalizeModelsDocShape(JSON.parse(readFileSync30(path27, "utf-8")));
|
|
511084
511342
|
const doc = n2?.doc ?? {};
|
|
511085
511343
|
const row2 = (doc.models ?? []).find((m2) => m2.id === name || m2.name === name);
|
|
@@ -511117,7 +511375,7 @@ function readModelConfigOverride(modelName, field) {
|
|
|
511117
511375
|
}
|
|
511118
511376
|
try {
|
|
511119
511377
|
const path27 = configDModelsPath();
|
|
511120
|
-
if (!
|
|
511378
|
+
if (!existsSync22(path27)) return null;
|
|
511121
511379
|
const n2 = normalizeModelsDocShape(JSON.parse(readFileSync30(path27, "utf-8")));
|
|
511122
511380
|
const doc = n2?.doc ?? {};
|
|
511123
511381
|
const row2 = (doc.models ?? []).find((m2) => m2.id === name || m2.name === name);
|
|
@@ -521226,12 +521484,12 @@ var init_diskOutput = __esm({
|
|
|
521226
521484
|
for (const str3 of queue3) {
|
|
521227
521485
|
totalLength += Buffer.byteLength(str3, "utf8");
|
|
521228
521486
|
}
|
|
521229
|
-
const
|
|
521487
|
+
const buffer5 = Buffer.allocUnsafe(totalLength);
|
|
521230
521488
|
let offset = 0;
|
|
521231
521489
|
for (const str3 of queue3) {
|
|
521232
|
-
offset +=
|
|
521490
|
+
offset += buffer5.write(str3, offset, "utf8");
|
|
521233
521491
|
}
|
|
521234
|
-
return
|
|
521492
|
+
return buffer5;
|
|
521235
521493
|
}
|
|
521236
521494
|
async #drain() {
|
|
521237
521495
|
try {
|
|
@@ -537620,7 +537878,7 @@ async function* runStreamInner(events3, ctx, handle = {}) {
|
|
|
537620
537878
|
}
|
|
537621
537879
|
if (ev.type === "done" || ev.type === "failed") {
|
|
537622
537880
|
const failedResult = ev.type === "done" ? ev.result : null;
|
|
537623
|
-
const errText = ev.type === "failed" ? ev.errorMessage ?? ev.errorCode ?? "run failed" : failedResult?.status === "failed" ? failedResult.errorMessage ?? failedResult.errorCode ?? "run failed" : null;
|
|
537881
|
+
const errText = ev.type === "failed" ? ev.errorMessage ?? ev.errorCode ?? "run failed" : failedResult?.status === "failed" ? failedResult.errorMessage ?? failedResult.errorCode ?? "run failed" : failedResult?.status === "timeout" ? failedResult.errorMessage ?? "run hit its wall-clock deadline and was finalized by the engine" : failedResult?.status === "blocked" ? failedResult.blockedReason ? `Run blocked: ${failedResult.blockedReason}` : "Run blocked (the agent reported it cannot proceed)" : null;
|
|
537624
537882
|
if (errText) {
|
|
537625
537883
|
const activeTaskId = failedResult?.activeTaskId ?? (ev.type === "failed" ? ev.activeTaskId : void 0);
|
|
537626
537884
|
const isActiveRunBusy = errText === "session already has an active run" || typeof activeTaskId === "string";
|
|
@@ -537992,7 +538250,7 @@ var init_controlRouter = __esm({
|
|
|
537992
538250
|
/** Project the session context + the typed turn into the `@sema-ai` `TaskRequest` wire shape. Secret
|
|
537993
538251
|
* discipline (types.ts:54-58): NEVER put tokens in `objective`/`systemPrompt`. */
|
|
537994
538252
|
buildTaskRequest(text2) {
|
|
537995
|
-
const req = { objective: text2 };
|
|
538253
|
+
const req = { objective: text2.trim().length > 0 ? text2 : "(no content)" };
|
|
537996
538254
|
if (this.sessionId !== void 0) req.sessionId = this.sessionId;
|
|
537997
538255
|
if (this.jobId !== void 0) req.jobId = this.jobId;
|
|
537998
538256
|
if (this.scenario !== void 0) req.scenario = this.scenario;
|
|
@@ -539462,9 +539720,9 @@ function FromSymbol(value) {
|
|
|
539462
539720
|
}
|
|
539463
539721
|
function FromTypeArray(value) {
|
|
539464
539722
|
FNV1A64_OP(ByteMarker.TypeArray);
|
|
539465
|
-
const
|
|
539466
|
-
for (let i = 0; i <
|
|
539467
|
-
FNV1A64_OP(
|
|
539723
|
+
const buffer5 = new Uint8Array(value.buffer);
|
|
539724
|
+
for (let i = 0; i < buffer5.length; i++) {
|
|
539725
|
+
FNV1A64_OP(buffer5[i]);
|
|
539468
539726
|
}
|
|
539469
539727
|
}
|
|
539470
539728
|
function FromUndefined(_value) {
|
|
@@ -562576,20 +562834,20 @@ var require_utils7 = __commonJS({
|
|
|
562576
562834
|
return acc;
|
|
562577
562835
|
}
|
|
562578
562836
|
var nonSimpleDomain = RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);
|
|
562579
|
-
function consumeIsZone(
|
|
562580
|
-
|
|
562837
|
+
function consumeIsZone(buffer5) {
|
|
562838
|
+
buffer5.length = 0;
|
|
562581
562839
|
return true;
|
|
562582
562840
|
}
|
|
562583
|
-
function consumeHextets(
|
|
562584
|
-
if (
|
|
562585
|
-
const hex3 = stringArrayToHexStripped(
|
|
562841
|
+
function consumeHextets(buffer5, address, output) {
|
|
562842
|
+
if (buffer5.length) {
|
|
562843
|
+
const hex3 = stringArrayToHexStripped(buffer5);
|
|
562586
562844
|
if (hex3 !== "") {
|
|
562587
562845
|
address.push(hex3);
|
|
562588
562846
|
} else {
|
|
562589
562847
|
output.error = true;
|
|
562590
562848
|
return false;
|
|
562591
562849
|
}
|
|
562592
|
-
|
|
562850
|
+
buffer5.length = 0;
|
|
562593
562851
|
}
|
|
562594
562852
|
return true;
|
|
562595
562853
|
}
|
|
@@ -562597,7 +562855,7 @@ var require_utils7 = __commonJS({
|
|
|
562597
562855
|
let tokenCount = 0;
|
|
562598
562856
|
const output = { error: false, address: "", zone: "" };
|
|
562599
562857
|
const address = [];
|
|
562600
|
-
const
|
|
562858
|
+
const buffer5 = [];
|
|
562601
562859
|
let endipv6Encountered = false;
|
|
562602
562860
|
let endIpv6 = false;
|
|
562603
562861
|
let consume = consumeHextets;
|
|
@@ -562610,7 +562868,7 @@ var require_utils7 = __commonJS({
|
|
|
562610
562868
|
if (endipv6Encountered === true) {
|
|
562611
562869
|
endIpv6 = true;
|
|
562612
562870
|
}
|
|
562613
|
-
if (!consume(
|
|
562871
|
+
if (!consume(buffer5, address, output)) {
|
|
562614
562872
|
break;
|
|
562615
562873
|
}
|
|
562616
562874
|
if (++tokenCount > 7) {
|
|
@@ -562623,22 +562881,22 @@ var require_utils7 = __commonJS({
|
|
|
562623
562881
|
address.push(":");
|
|
562624
562882
|
continue;
|
|
562625
562883
|
} else if (cursor === "%") {
|
|
562626
|
-
if (!consume(
|
|
562884
|
+
if (!consume(buffer5, address, output)) {
|
|
562627
562885
|
break;
|
|
562628
562886
|
}
|
|
562629
562887
|
consume = consumeIsZone;
|
|
562630
562888
|
} else {
|
|
562631
|
-
|
|
562889
|
+
buffer5.push(cursor);
|
|
562632
562890
|
continue;
|
|
562633
562891
|
}
|
|
562634
562892
|
}
|
|
562635
|
-
if (
|
|
562893
|
+
if (buffer5.length) {
|
|
562636
562894
|
if (consume === consumeIsZone) {
|
|
562637
|
-
output.zone =
|
|
562895
|
+
output.zone = buffer5.join("");
|
|
562638
562896
|
} else if (endIpv6) {
|
|
562639
|
-
address.push(
|
|
562897
|
+
address.push(buffer5.join(""));
|
|
562640
562898
|
} else {
|
|
562641
|
-
address.push(stringArrayToHexStripped(
|
|
562899
|
+
address.push(stringArrayToHexStripped(buffer5));
|
|
562642
562900
|
}
|
|
562643
562901
|
}
|
|
562644
562902
|
output.address = address.join("");
|
|
@@ -566705,15 +566963,15 @@ var require_readShebang2 = __commonJS({
|
|
|
566705
566963
|
var shebangCommand = require_shebang_command2();
|
|
566706
566964
|
function readShebang(command8) {
|
|
566707
566965
|
const size = 150;
|
|
566708
|
-
const
|
|
566966
|
+
const buffer5 = Buffer.alloc(size);
|
|
566709
566967
|
let fd2;
|
|
566710
566968
|
try {
|
|
566711
566969
|
fd2 = fs15.openSync(command8, "r");
|
|
566712
|
-
fs15.readSync(fd2,
|
|
566970
|
+
fs15.readSync(fd2, buffer5, 0, size, 0);
|
|
566713
566971
|
fs15.closeSync(fd2);
|
|
566714
566972
|
} catch (e) {
|
|
566715
566973
|
}
|
|
566716
|
-
return shebangCommand(
|
|
566974
|
+
return shebangCommand(buffer5.toString());
|
|
566717
566975
|
}
|
|
566718
566976
|
module2.exports = readShebang;
|
|
566719
566977
|
}
|
|
@@ -573392,10 +573650,10 @@ function createFleetFooterNav() {
|
|
|
573392
573650
|
}
|
|
573393
573651
|
emit4();
|
|
573394
573652
|
},
|
|
573395
|
-
subscribe(
|
|
573396
|
-
listeners6.add(
|
|
573653
|
+
subscribe(listener5) {
|
|
573654
|
+
listeners6.add(listener5);
|
|
573397
573655
|
return () => {
|
|
573398
|
-
listeners6.delete(
|
|
573656
|
+
listeners6.delete(listener5);
|
|
573399
573657
|
};
|
|
573400
573658
|
}
|
|
573401
573659
|
};
|
|
@@ -573439,10 +573697,10 @@ function createFleetViewControl() {
|
|
|
573439
573697
|
isOpen() {
|
|
573440
573698
|
return _isOpen;
|
|
573441
573699
|
},
|
|
573442
|
-
subscribe(
|
|
573443
|
-
listeners6.add(
|
|
573700
|
+
subscribe(listener5) {
|
|
573701
|
+
listeners6.add(listener5);
|
|
573444
573702
|
return () => {
|
|
573445
|
-
listeners6.delete(
|
|
573703
|
+
listeners6.delete(listener5);
|
|
573446
573704
|
};
|
|
573447
573705
|
},
|
|
573448
573706
|
open() {
|
|
@@ -577595,16 +577853,16 @@ var init_command3 = __esm({
|
|
|
577595
577853
|
* @param {Function} listener
|
|
577596
577854
|
* @return {Command} `this` command for chaining
|
|
577597
577855
|
*/
|
|
577598
|
-
hook(event,
|
|
577856
|
+
hook(event, listener5) {
|
|
577599
577857
|
const allowedValues = ["preSubcommand", "preAction", "postAction"];
|
|
577600
577858
|
if (!allowedValues.includes(event)) {
|
|
577601
577859
|
throw new Error(`Unexpected value for event passed to hook : '${event}'.
|
|
577602
577860
|
Expecting one of '${allowedValues.join("', '")}'`);
|
|
577603
577861
|
}
|
|
577604
577862
|
if (this._lifeCycleHooks[event]) {
|
|
577605
|
-
this._lifeCycleHooks[event].push(
|
|
577863
|
+
this._lifeCycleHooks[event].push(listener5);
|
|
577606
577864
|
} else {
|
|
577607
|
-
this._lifeCycleHooks[event] = [
|
|
577865
|
+
this._lifeCycleHooks[event] = [listener5];
|
|
577608
577866
|
}
|
|
577609
577867
|
return this;
|
|
577610
577868
|
}
|
|
@@ -577657,7 +577915,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
577657
577915
|
* @return {Command} `this` command for chaining
|
|
577658
577916
|
*/
|
|
577659
577917
|
action(fn2) {
|
|
577660
|
-
const
|
|
577918
|
+
const listener5 = (args) => {
|
|
577661
577919
|
const expectedArgsCount = this.registeredArguments.length;
|
|
577662
577920
|
const actionArgs = args.slice(0, expectedArgsCount);
|
|
577663
577921
|
if (this._storeOptionsAsProperties) {
|
|
@@ -577668,7 +577926,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
577668
577926
|
actionArgs.push(this);
|
|
577669
577927
|
return fn2.apply(this, actionArgs);
|
|
577670
577928
|
};
|
|
577671
|
-
this._actionHandler =
|
|
577929
|
+
this._actionHandler = listener5;
|
|
577672
577930
|
return this;
|
|
577673
577931
|
}
|
|
577674
577932
|
/**
|
|
@@ -595400,7 +595658,7 @@ function useInputBuffer({
|
|
|
595400
595658
|
maxBufferSize,
|
|
595401
595659
|
debounceMs
|
|
595402
595660
|
}) {
|
|
595403
|
-
const [
|
|
595661
|
+
const [buffer5, setBuffer] = (0, import_react246.useState)([]);
|
|
595404
595662
|
const [currentIndex, setCurrentIndex] = (0, import_react246.useState)(-1);
|
|
595405
595663
|
const lastPushTime = (0, import_react246.useRef)(0);
|
|
595406
595664
|
const pendingPush = (0, import_react246.useRef)(null);
|
|
@@ -595438,24 +595696,24 @@ function useInputBuffer({
|
|
|
595438
595696
|
return updatedBuffer;
|
|
595439
595697
|
});
|
|
595440
595698
|
setCurrentIndex((prev) => {
|
|
595441
|
-
const newIndex = prev >= 0 ? prev + 1 :
|
|
595699
|
+
const newIndex = prev >= 0 ? prev + 1 : buffer5.length;
|
|
595442
595700
|
return Math.min(newIndex, maxBufferSize - 1);
|
|
595443
595701
|
});
|
|
595444
595702
|
},
|
|
595445
|
-
[debounceMs, maxBufferSize, currentIndex,
|
|
595703
|
+
[debounceMs, maxBufferSize, currentIndex, buffer5.length]
|
|
595446
595704
|
);
|
|
595447
595705
|
const undo = (0, import_react246.useCallback)(() => {
|
|
595448
|
-
if (currentIndex < 0 ||
|
|
595706
|
+
if (currentIndex < 0 || buffer5.length === 0) {
|
|
595449
595707
|
return void 0;
|
|
595450
595708
|
}
|
|
595451
595709
|
const targetIndex = Math.max(0, currentIndex - 1);
|
|
595452
|
-
const entry =
|
|
595710
|
+
const entry = buffer5[targetIndex];
|
|
595453
595711
|
if (entry) {
|
|
595454
595712
|
setCurrentIndex(targetIndex);
|
|
595455
595713
|
return entry;
|
|
595456
595714
|
}
|
|
595457
595715
|
return void 0;
|
|
595458
|
-
}, [
|
|
595716
|
+
}, [buffer5, currentIndex]);
|
|
595459
595717
|
const clearBuffer = (0, import_react246.useCallback)(() => {
|
|
595460
595718
|
setBuffer([]);
|
|
595461
595719
|
setCurrentIndex(-1);
|
|
@@ -595465,7 +595723,7 @@ function useInputBuffer({
|
|
|
595465
595723
|
pendingPush.current = null;
|
|
595466
595724
|
}
|
|
595467
595725
|
}, [lastPushTime, pendingPush]);
|
|
595468
|
-
const canUndo = currentIndex > 0 &&
|
|
595726
|
+
const canUndo = currentIndex > 0 && buffer5.length > 1;
|
|
595469
595727
|
return {
|
|
595470
595728
|
pushToBuffer,
|
|
595471
595729
|
undo,
|
|
@@ -599853,6 +600111,50 @@ function useEngineAgentPanelBridge(setAppState) {
|
|
|
599853
600111
|
[setAppState]
|
|
599854
600112
|
);
|
|
599855
600113
|
}
|
|
600114
|
+
function useEngineBgShellPanelBridge(setAppState) {
|
|
600115
|
+
React141.useEffect(
|
|
600116
|
+
() => subscribeEngineBgShellPanel((ev) => {
|
|
600117
|
+
if (ev.kind === "register") {
|
|
600118
|
+
setAppState((prev) => {
|
|
600119
|
+
if (prev.tasks[ev.taskId]) return prev;
|
|
600120
|
+
const row2 = {
|
|
600121
|
+
...createTaskStateBase(ev.taskId, "local_bash", ev.description ?? ev.command),
|
|
600122
|
+
type: "local_bash",
|
|
600123
|
+
status: "running",
|
|
600124
|
+
command: ev.command,
|
|
600125
|
+
// The ENGINE owns the model-facing completion notification (G2b steer-inject) — the
|
|
600126
|
+
// shell must never attach a second one.
|
|
600127
|
+
completionStatusSentInAttachment: true,
|
|
600128
|
+
shellCommand: null,
|
|
600129
|
+
lastReportedTotalLines: 0,
|
|
600130
|
+
isBackgrounded: true,
|
|
600131
|
+
// No shell runner ever notifies this row — pre-mark, or the eviction pipeline leaks it
|
|
600132
|
+
// (the useEngineAgentPanelBridge #2b/#5 precedent).
|
|
600133
|
+
notified: true,
|
|
600134
|
+
engineSide: true,
|
|
600135
|
+
engineReceipt: ev.receipt,
|
|
600136
|
+
outputFile: ""
|
|
600137
|
+
// unknown at register (prose-only receipt); settle late-binds the structured path
|
|
600138
|
+
};
|
|
600139
|
+
return { ...prev, tasks: { ...prev.tasks, [ev.taskId]: row2 } };
|
|
600140
|
+
});
|
|
600141
|
+
} else {
|
|
600142
|
+
updateTaskState(ev.taskId, setAppState, (task) => {
|
|
600143
|
+
if (!isLocalShellTask(task) || task.engineSide !== true) return task;
|
|
600144
|
+
if (task.status !== "running") return task;
|
|
600145
|
+
return {
|
|
600146
|
+
...task,
|
|
600147
|
+
status: ev.status,
|
|
600148
|
+
endTime: Date.now(),
|
|
600149
|
+
notified: true,
|
|
600150
|
+
...ev.outputPath && task.outputFile === "" ? { outputFile: ev.outputPath } : {}
|
|
600151
|
+
};
|
|
600152
|
+
});
|
|
600153
|
+
}
|
|
600154
|
+
}),
|
|
600155
|
+
[setAppState]
|
|
600156
|
+
);
|
|
600157
|
+
}
|
|
599856
600158
|
var React141, import_jsx_runtime418;
|
|
599857
600159
|
var init_chrome_agentprogress = __esm({
|
|
599858
600160
|
"build-src/src/sema/overrides/chrome-agentprogress.tsx"() {
|
|
@@ -599870,6 +600172,8 @@ var init_chrome_agentprogress = __esm({
|
|
|
599870
600172
|
init_Task();
|
|
599871
600173
|
init_messages4();
|
|
599872
600174
|
init_engineAgentPanelStore();
|
|
600175
|
+
init_engineBgShellPanelStore();
|
|
600176
|
+
init_guards();
|
|
599873
600177
|
init_engineAgentView();
|
|
599874
600178
|
init_subagentContentStore();
|
|
599875
600179
|
init_CoordinatorAgentStatus();
|
|
@@ -604282,6 +604586,7 @@ function PromptInputFooterWithFleet(props) {
|
|
|
604282
604586
|
setAppStateStoreRef(store);
|
|
604283
604587
|
useEngineAgentViewSeeder(store);
|
|
604284
604588
|
useEngineAgentPanelBridge(store.setState);
|
|
604589
|
+
useEngineBgShellPanelBridge(store.setState);
|
|
604285
604590
|
const upgrade2 = React145.useSyncExternalStore(subscribeUpgradeState, getUpgradeState);
|
|
604286
604591
|
const engineRt = React145.useSyncExternalStore(subscribeEngineRuntimeStatus, getEngineRuntimeStatus);
|
|
604287
604592
|
const [nowTick, setNowTick] = React145.useState(() => Date.now());
|
|
@@ -612727,6 +613032,23 @@ var init_processUserInput = __esm({
|
|
|
612727
613032
|
}
|
|
612728
613033
|
});
|
|
612729
613034
|
|
|
613035
|
+
// build-src/src/sema/scheduler/wakeupMarker.ts
|
|
613036
|
+
var wakeupMarker_exports = {};
|
|
613037
|
+
__export(wakeupMarker_exports, {
|
|
613038
|
+
formatScheduledFireTime: () => formatScheduledFireTime,
|
|
613039
|
+
scheduledFireMarkerText: () => scheduledFireMarkerText
|
|
613040
|
+
});
|
|
613041
|
+
function formatScheduledFireTime(d2) {
|
|
613042
|
+
return d2.toLocaleString("en-US", { month: "short", day: "numeric", hour: "numeric", minute: "2-digit" }).replace(/,? at |, /, " ").replace(/ ([AP]M)/, (_m, r) => r.toLowerCase());
|
|
613043
|
+
}
|
|
613044
|
+
function scheduledFireMarkerText(kind, now2 = /* @__PURE__ */ new Date()) {
|
|
613045
|
+
return kind === "loop" ? `Sema resuming /loop wakeup (${formatScheduledFireTime(now2)})` : `Running scheduled task (${formatScheduledFireTime(now2)})`;
|
|
613046
|
+
}
|
|
613047
|
+
var init_wakeupMarker = __esm({
|
|
613048
|
+
"build-src/src/sema/scheduler/wakeupMarker.ts"() {
|
|
613049
|
+
}
|
|
613050
|
+
});
|
|
613051
|
+
|
|
612730
613052
|
// build-src/src/utils/handlePromptSubmit.ts
|
|
612731
613053
|
function exit2() {
|
|
612732
613054
|
gracefulShutdownSync(0);
|
|
@@ -612994,6 +613316,15 @@ async function executeUserInput(params) {
|
|
|
612994
613316
|
if (m2.type === "user") m2.origin = origin2;
|
|
612995
613317
|
}
|
|
612996
613318
|
}
|
|
613319
|
+
if (isFirst && origin2?.kind === "scheduled-task") {
|
|
613320
|
+
try {
|
|
613321
|
+
const cronKind = origin2.cronKind === "loop" ? "loop" : "task";
|
|
613322
|
+
const { createScheduledTaskFireMessage: createScheduledTaskFireMessage2 } = await Promise.resolve().then(() => (init_messages4(), messages_exports2));
|
|
613323
|
+
const { scheduledFireMarkerText: scheduledFireMarkerText2 } = await Promise.resolve().then(() => (init_wakeupMarker(), wakeupMarker_exports));
|
|
613324
|
+
newMessages.push(createScheduledTaskFireMessage2(scheduledFireMarkerText2(cronKind)));
|
|
613325
|
+
} catch {
|
|
613326
|
+
}
|
|
613327
|
+
}
|
|
612997
613328
|
newMessages.push(...result.messages);
|
|
612998
613329
|
if (isFirst) {
|
|
612999
613330
|
shouldQuery = result.shouldQuery;
|
|
@@ -614119,16 +614450,16 @@ __export(sessionAutoSync_exports, {
|
|
|
614119
614450
|
});
|
|
614120
614451
|
import { readFileSync as readFileSync34 } from "node:fs";
|
|
614121
614452
|
function onAutoSyncEvent(cb) {
|
|
614122
|
-
|
|
614453
|
+
listener3 = cb;
|
|
614123
614454
|
for (const ev of pendingEvents2) cb(ev);
|
|
614124
614455
|
pendingEvents2 = [];
|
|
614125
614456
|
return () => {
|
|
614126
|
-
|
|
614457
|
+
listener3 = null;
|
|
614127
614458
|
};
|
|
614128
614459
|
}
|
|
614129
614460
|
function emit3(ev) {
|
|
614130
614461
|
logForDebugging(`sessionAutoSync: ${JSON.stringify(ev)}`);
|
|
614131
|
-
if (
|
|
614462
|
+
if (listener3) listener3(ev);
|
|
614132
614463
|
else if (ev.kind !== "pushed") pendingEvents2.push(ev);
|
|
614133
614464
|
}
|
|
614134
614465
|
function maybeQueueAutoSyncPushAfterTurn() {
|
|
@@ -614298,11 +614629,11 @@ function _resetAutoSyncForTests() {
|
|
|
614298
614629
|
consecutiveFailures = 0;
|
|
614299
614630
|
latchCount = 0;
|
|
614300
614631
|
backoffTurnsRemaining = 0;
|
|
614301
|
-
|
|
614632
|
+
listener3 = null;
|
|
614302
614633
|
pendingEvents2 = [];
|
|
614303
614634
|
transportOverride = null;
|
|
614304
614635
|
}
|
|
614305
|
-
var AUTO_SYNC_SETTINGS_KEY, TRANSIENT_FAILURE_LATCH, MAX_BACKOFF_TURNS,
|
|
614636
|
+
var AUTO_SYNC_SETTINGS_KEY, TRANSIENT_FAILURE_LATCH, MAX_BACKOFF_TURNS, listener3, pendingEvents2, inflight3, dirty, capsCache, degradedTargets, orgMirrorNotified, consecutiveFailures, latchCount, backoffTurnsRemaining, transportOverride;
|
|
614306
614637
|
var init_sessionAutoSync = __esm({
|
|
614307
614638
|
"build-src/src/sema/sessionAutoSync.ts"() {
|
|
614308
614639
|
init_debug();
|
|
@@ -614311,7 +614642,7 @@ var init_sessionAutoSync = __esm({
|
|
|
614311
614642
|
AUTO_SYNC_SETTINGS_KEY = "cloudSessionAutoSync";
|
|
614312
614643
|
TRANSIENT_FAILURE_LATCH = 5;
|
|
614313
614644
|
MAX_BACKOFF_TURNS = 64;
|
|
614314
|
-
|
|
614645
|
+
listener3 = null;
|
|
614315
614646
|
pendingEvents2 = [];
|
|
614316
614647
|
inflight3 = null;
|
|
614317
614648
|
dirty = false;
|
|
@@ -614332,7 +614663,7 @@ __export(sessionPersistenceWire_exports, {
|
|
|
614332
614663
|
journalAssistantCommittedAfterTurn: () => journalAssistantCommittedAfterTurn,
|
|
614333
614664
|
reconcileResumeJournal: () => reconcileResumeJournal
|
|
614334
614665
|
});
|
|
614335
|
-
import { existsSync as
|
|
614666
|
+
import { existsSync as existsSync23 } from "node:fs";
|
|
614336
614667
|
function bindSessionPersistencePaths() {
|
|
614337
614668
|
try {
|
|
614338
614669
|
setRewindAnchorPath(getRewindAnchorSidecarPath());
|
|
@@ -614345,7 +614676,7 @@ function bindSessionPersistencePaths() {
|
|
|
614345
614676
|
const engineSid = restoreLiveSessionId();
|
|
614346
614677
|
try {
|
|
614347
614678
|
const marker = mapPath.replace(/\.session-map\.json$/, IMPORT_SEED_MARKER_SUFFIX);
|
|
614348
|
-
const pending = !engineSid && marker !== mapPath &&
|
|
614679
|
+
const pending = !engineSid && marker !== mapPath && existsSync23(marker);
|
|
614349
614680
|
setSeamHistorySeedPending(pending);
|
|
614350
614681
|
if (pending) {
|
|
614351
614682
|
logForDebugging(`sessionPersistenceWire: import-seed marker found (${marker}) + no engine continuity \u2192 history seed armed`);
|
|
@@ -618142,8 +618473,8 @@ function _temp158() {
|
|
|
618142
618473
|
var import_compiler_runtime312, import_react309, import_jsx_runtime454, DESKTOP_UPSELL_DEFAULT;
|
|
618143
618474
|
var init_DesktopUpsellStartup = __esm({
|
|
618144
618475
|
"build-src/src/components/DesktopUpsell/DesktopUpsellStartup.tsx"() {
|
|
618145
|
-
import_compiler_runtime312 = __toESM(require_compiler_runtime()
|
|
618146
|
-
import_react309 = __toESM(require_react()
|
|
618476
|
+
import_compiler_runtime312 = __toESM(require_compiler_runtime());
|
|
618477
|
+
import_react309 = __toESM(require_react());
|
|
618147
618478
|
init_ink2();
|
|
618148
618479
|
init_growthbook_advisor_flag();
|
|
618149
618480
|
init_analytics_index();
|
|
@@ -618151,7 +618482,7 @@ var init_DesktopUpsellStartup = __esm({
|
|
|
618151
618482
|
init_select();
|
|
618152
618483
|
init_DesktopHandoff();
|
|
618153
618484
|
init_PermissionDialog();
|
|
618154
|
-
import_jsx_runtime454 = __toESM(require_jsx_runtime()
|
|
618485
|
+
import_jsx_runtime454 = __toESM(require_jsx_runtime());
|
|
618155
618486
|
DESKTOP_UPSELL_DEFAULT = {
|
|
618156
618487
|
enable_shortcut_tip: false,
|
|
618157
618488
|
enable_startup_dialog: false
|
|
@@ -619491,15 +619822,15 @@ var init_PermissionPromptToolResultSchema = __esm({
|
|
|
619491
619822
|
|
|
619492
619823
|
// build-src/src/utils/commandLifecycle.ts
|
|
619493
619824
|
function setCommandLifecycleListener(cb) {
|
|
619494
|
-
|
|
619825
|
+
listener4 = cb;
|
|
619495
619826
|
}
|
|
619496
619827
|
function notifyCommandLifecycle(uuid10, state3) {
|
|
619497
|
-
|
|
619828
|
+
listener4?.(uuid10, state3);
|
|
619498
619829
|
}
|
|
619499
|
-
var
|
|
619830
|
+
var listener4;
|
|
619500
619831
|
var init_commandLifecycle = __esm({
|
|
619501
619832
|
"build-src/src/utils/commandLifecycle.ts"() {
|
|
619502
|
-
|
|
619833
|
+
listener4 = null;
|
|
619503
619834
|
}
|
|
619504
619835
|
});
|
|
619505
619836
|
|
|
@@ -620504,8 +620835,8 @@ function _temp161() {
|
|
|
620504
620835
|
var import_compiler_runtime316, import_react313, SETTINGS_ERRORS_NOTIFICATION_KEY;
|
|
620505
620836
|
var init_useSettingsErrors = __esm({
|
|
620506
620837
|
"build-src/src/hooks/notifs/useSettingsErrors.tsx"() {
|
|
620507
|
-
import_compiler_runtime316 = __toESM(require_compiler_runtime()
|
|
620508
|
-
import_react313 = __toESM(require_react()
|
|
620838
|
+
import_compiler_runtime316 = __toESM(require_compiler_runtime());
|
|
620839
|
+
import_react313 = __toESM(require_react());
|
|
620509
620840
|
init_notifications();
|
|
620510
620841
|
init_state();
|
|
620511
620842
|
init_allErrors();
|
|
@@ -630176,8 +630507,8 @@ function LogSelector2(t0) {
|
|
|
630176
630507
|
if (!onLoadMore) {
|
|
630177
630508
|
return;
|
|
630178
630509
|
}
|
|
630179
|
-
const
|
|
630180
|
-
if (focusedIndex +
|
|
630510
|
+
const buffer5 = visibleCount * 2;
|
|
630511
|
+
if (focusedIndex + buffer5 >= displayedLogs.length) {
|
|
630181
630512
|
onLoadMore(visibleCount * 3);
|
|
630182
630513
|
}
|
|
630183
630514
|
};
|
|
@@ -631389,7 +631720,7 @@ IMPORTANT: Start by calling mcp__claude-in-chrome__tabs_context_mcp to get infor
|
|
|
631389
631720
|
});
|
|
631390
631721
|
|
|
631391
631722
|
// build-src/src/sema/engineReportFindingsFace.ts
|
|
631392
|
-
import { existsSync as
|
|
631723
|
+
import { existsSync as existsSync24, readFileSync as readFileSync35 } from "fs";
|
|
631393
631724
|
import { basename as basename64, dirname as dirname78, join as join178 } from "path";
|
|
631394
631725
|
function isLiveEngineSession() {
|
|
631395
631726
|
return typeof process.env.SEMA_LIVE_BASEURL === "string" && process.env.SEMA_LIVE_BASEURL.length > 0;
|
|
@@ -631418,7 +631749,7 @@ function localEngineCoreVersion() {
|
|
|
631418
631749
|
}
|
|
631419
631750
|
for (const p of candidates) {
|
|
631420
631751
|
try {
|
|
631421
|
-
if (!
|
|
631752
|
+
if (!existsSync24(p)) continue;
|
|
631422
631753
|
const pkg = JSON.parse(readFileSync35(p, "utf8"));
|
|
631423
631754
|
if (typeof pkg.version === "string" && pkg.version.length > 0) return pkg.version;
|
|
631424
631755
|
} catch {
|
|
@@ -632788,11 +633119,11 @@ function registerDebugSkill() {
|
|
|
632788
633119
|
const startOffset = stats3.size - readSize;
|
|
632789
633120
|
const fd2 = await open19(debugLogPath, "r");
|
|
632790
633121
|
try {
|
|
632791
|
-
const { buffer:
|
|
633122
|
+
const { buffer: buffer5, bytesRead } = await fd2.read({
|
|
632792
633123
|
buffer: Buffer.alloc(readSize),
|
|
632793
633124
|
position: startOffset
|
|
632794
633125
|
});
|
|
632795
|
-
const tail =
|
|
633126
|
+
const tail = buffer5.toString("utf-8", 0, bytesRead).split("\n").slice(-DEFAULT_DEBUG_LINES_READ).join("\n");
|
|
632796
633127
|
logInfo = `Log size: ${formatFileSize(stats3.size)}
|
|
632797
633128
|
|
|
632798
633129
|
### Last ${DEFAULT_DEBUG_LINES_READ} lines
|
|
@@ -633165,7 +633496,7 @@ var init_semaUpdater = __esm({
|
|
|
633165
633496
|
});
|
|
633166
633497
|
|
|
633167
633498
|
// build-src/src/commands/doctor/semaSections.tsx
|
|
633168
|
-
import { existsSync as
|
|
633499
|
+
import { existsSync as existsSync25, readFileSync as readFileSync37 } from "node:fs";
|
|
633169
633500
|
function SemaVersionLines({
|
|
633170
633501
|
installationType,
|
|
633171
633502
|
ccVersion
|
|
@@ -633305,7 +633636,7 @@ async function collectEngineRows() {
|
|
|
633305
633636
|
const portFilePath = getEnginePortFilePath();
|
|
633306
633637
|
let anchor = null;
|
|
633307
633638
|
try {
|
|
633308
|
-
if (
|
|
633639
|
+
if (existsSync25(portFilePath)) {
|
|
633309
633640
|
const parsed = JSON.parse(readFileSync37(portFilePath, "utf8"));
|
|
633310
633641
|
if (typeof parsed.port === "number" && typeof parsed.pid === "number") anchor = parsed;
|
|
633311
633642
|
}
|
|
@@ -633350,7 +633681,7 @@ async function collectEngineRows() {
|
|
|
633350
633681
|
const tokenPath = getEngineTokenFilePath();
|
|
633351
633682
|
let hasToken = false;
|
|
633352
633683
|
try {
|
|
633353
|
-
hasToken =
|
|
633684
|
+
hasToken = existsSync25(tokenPath) && readFileSync37(tokenPath, "utf8").trim().length > 0;
|
|
633354
633685
|
} catch {
|
|
633355
633686
|
}
|
|
633356
633687
|
if (anchor && isProcessAlive(anchor.pid ?? -1)) {
|
|
@@ -637530,10 +637861,10 @@ function createStreamAccumulator() {
|
|
|
637530
637861
|
function scopeKey(m2) {
|
|
637531
637862
|
return `${m2.session_id}:${m2.parent_tool_use_id ?? ""}`;
|
|
637532
637863
|
}
|
|
637533
|
-
function accumulateStreamEvents(
|
|
637864
|
+
function accumulateStreamEvents(buffer5, state3) {
|
|
637534
637865
|
const out6 = [];
|
|
637535
637866
|
const touched = /* @__PURE__ */ new Map();
|
|
637536
|
-
for (const msg of
|
|
637867
|
+
for (const msg of buffer5) {
|
|
637537
637868
|
switch (msg.event.type) {
|
|
637538
637869
|
case "message_start": {
|
|
637539
637870
|
const id = msg.event.message.id;
|
|
@@ -638224,12 +638555,12 @@ var init_ccrClient = __esm({
|
|
|
638224
638555
|
function alwaysValidStatus2() {
|
|
638225
638556
|
return true;
|
|
638226
638557
|
}
|
|
638227
|
-
function parseSSEFrames(
|
|
638558
|
+
function parseSSEFrames(buffer5) {
|
|
638228
638559
|
const frames = [];
|
|
638229
638560
|
let pos = 0;
|
|
638230
638561
|
let idx;
|
|
638231
|
-
while ((idx =
|
|
638232
|
-
const rawFrame =
|
|
638562
|
+
while ((idx = buffer5.indexOf("\n\n", pos)) !== -1) {
|
|
638563
|
+
const rawFrame = buffer5.slice(pos, idx);
|
|
638233
638564
|
pos = idx + 2;
|
|
638234
638565
|
if (!rawFrame.trim()) continue;
|
|
638235
638566
|
const frame = {};
|
|
@@ -638259,7 +638590,7 @@ function parseSSEFrames(buffer4) {
|
|
|
638259
638590
|
frames.push(frame);
|
|
638260
638591
|
}
|
|
638261
638592
|
}
|
|
638262
|
-
return { frames, remaining:
|
|
638593
|
+
return { frames, remaining: buffer5.slice(pos) };
|
|
638263
638594
|
}
|
|
638264
638595
|
function convertSSEUrlToPostUrl(sseUrl) {
|
|
638265
638596
|
let pathname = sseUrl.pathname;
|
|
@@ -638421,14 +638752,14 @@ var init_SSETransport = __esm({
|
|
|
638421
638752
|
async readStream(body) {
|
|
638422
638753
|
const reader = body.getReader();
|
|
638423
638754
|
const decoder = new TextDecoder();
|
|
638424
|
-
let
|
|
638755
|
+
let buffer5 = "";
|
|
638425
638756
|
try {
|
|
638426
638757
|
while (true) {
|
|
638427
638758
|
const { done, value } = await reader.read();
|
|
638428
638759
|
if (done) break;
|
|
638429
|
-
|
|
638430
|
-
const { frames, remaining } = parseSSEFrames(
|
|
638431
|
-
|
|
638760
|
+
buffer5 += decoder.decode(value, STREAM_DECODE_OPTS);
|
|
638761
|
+
const { frames, remaining } = parseSSEFrames(buffer5);
|
|
638762
|
+
buffer5 = remaining;
|
|
638432
638763
|
for (const frame of frames) {
|
|
638433
638764
|
this.resetLivenessTimer();
|
|
638434
638765
|
if (frame.id) {
|
|
@@ -639746,12 +640077,12 @@ function installStreamJsonStdoutGuard() {
|
|
|
639746
640077
|
);
|
|
639747
640078
|
process.stdout.write = function(chunk2, encodingOrCb, cb) {
|
|
639748
640079
|
const text2 = typeof chunk2 === "string" ? chunk2 : Buffer.from(chunk2).toString("utf-8");
|
|
639749
|
-
|
|
640080
|
+
buffer4 += text2;
|
|
639750
640081
|
let newlineIdx;
|
|
639751
640082
|
let wrote = true;
|
|
639752
|
-
while ((newlineIdx =
|
|
639753
|
-
const line =
|
|
639754
|
-
|
|
640083
|
+
while ((newlineIdx = buffer4.indexOf("\n")) !== -1) {
|
|
640084
|
+
const line = buffer4.slice(0, newlineIdx);
|
|
640085
|
+
buffer4 = buffer4.slice(newlineIdx + 1);
|
|
639755
640086
|
if (isJsonLine(line)) {
|
|
639756
640087
|
wrote = originalWrite(line + "\n");
|
|
639757
640088
|
} else {
|
|
@@ -639769,14 +640100,14 @@ function installStreamJsonStdoutGuard() {
|
|
|
639769
640100
|
return wrote;
|
|
639770
640101
|
};
|
|
639771
640102
|
registerCleanup(async () => {
|
|
639772
|
-
if (
|
|
639773
|
-
if (originalWrite && isJsonLine(
|
|
639774
|
-
originalWrite(
|
|
640103
|
+
if (buffer4.length > 0) {
|
|
640104
|
+
if (originalWrite && isJsonLine(buffer4)) {
|
|
640105
|
+
originalWrite(buffer4 + "\n");
|
|
639775
640106
|
} else {
|
|
639776
|
-
process.stderr.write(`${STDOUT_GUARD_MARKER} ${
|
|
640107
|
+
process.stderr.write(`${STDOUT_GUARD_MARKER} ${buffer4}
|
|
639777
640108
|
`);
|
|
639778
640109
|
}
|
|
639779
|
-
|
|
640110
|
+
buffer4 = "";
|
|
639780
640111
|
}
|
|
639781
640112
|
if (originalWrite) {
|
|
639782
640113
|
process.stdout.write = originalWrite;
|
|
@@ -639785,14 +640116,14 @@ function installStreamJsonStdoutGuard() {
|
|
|
639785
640116
|
installed2 = false;
|
|
639786
640117
|
});
|
|
639787
640118
|
}
|
|
639788
|
-
var STDOUT_GUARD_MARKER, installed2,
|
|
640119
|
+
var STDOUT_GUARD_MARKER, installed2, buffer4, originalWrite;
|
|
639789
640120
|
var init_streamJsonStdoutGuard = __esm({
|
|
639790
640121
|
"build-src/src/utils/streamJsonStdoutGuard.ts"() {
|
|
639791
640122
|
init_cleanupRegistry();
|
|
639792
640123
|
init_debug();
|
|
639793
640124
|
STDOUT_GUARD_MARKER = "[stdout-guard]";
|
|
639794
640125
|
installed2 = false;
|
|
639795
|
-
|
|
640126
|
+
buffer4 = "";
|
|
639796
640127
|
originalWrite = null;
|
|
639797
640128
|
}
|
|
639798
640129
|
});
|
|
@@ -640031,6 +640362,88 @@ var init_liveToolApprovalWire = __esm({
|
|
|
640031
640362
|
}
|
|
640032
640363
|
});
|
|
640033
640364
|
|
|
640365
|
+
// build-src/src/sema/classifierVerdictWire.ts
|
|
640366
|
+
function textFromWireOutput(output) {
|
|
640367
|
+
if (typeof output === "string") return output;
|
|
640368
|
+
const blocks = Array.isArray(output) ? output : output !== null && typeof output === "object" && Array.isArray(output.content) ? output.content : void 0;
|
|
640369
|
+
if (!blocks) return void 0;
|
|
640370
|
+
const texts = blocks.map((b3) => b3 !== null && typeof b3 === "object" && typeof b3.text === "string" ? b3.text : void 0).filter((t2) => t2 !== void 0);
|
|
640371
|
+
return texts.length > 0 ? texts.join("\n") : void 0;
|
|
640372
|
+
}
|
|
640373
|
+
function unwrapSystemReminder(text2) {
|
|
640374
|
+
const m2 = /^\s*<system-reminder>\s*\n?([\s\S]*?)\n?\s*<\/system-reminder>\s*$/.exec(text2);
|
|
640375
|
+
return m2 ? m2[1] : text2;
|
|
640376
|
+
}
|
|
640377
|
+
function classifierDenyFromToolEnd(ev) {
|
|
640378
|
+
if (!ev || ev.type !== "tool_end" || ev.isError !== true) return void 0;
|
|
640379
|
+
const raw2 = textFromWireOutput(ev.output);
|
|
640380
|
+
if (raw2 === void 0) return void 0;
|
|
640381
|
+
const message = unwrapSystemReminder(raw2).trim();
|
|
640382
|
+
if (!message.startsWith(CLASSIFIER_DENY_SIGNATURE)) return void 0;
|
|
640383
|
+
const tail = message.slice(CLASSIFIER_DENY_SIGNATURE.length);
|
|
640384
|
+
const reason = tail.startsWith(": ") ? tail.slice(2).trim() : void 0;
|
|
640385
|
+
return { message, ...reason !== void 0 && reason.length > 0 ? { reason } : {} };
|
|
640386
|
+
}
|
|
640387
|
+
function classifierDenyNoticeText(toolName2, reason) {
|
|
640388
|
+
let r = reason ?? "";
|
|
640389
|
+
if (r.length > NOTICE_REASON_MAX) r = `${r.slice(0, NOTICE_REASON_MAX - 1)}\u2026`;
|
|
640390
|
+
const name = toolName2.length > 0 ? toolName2.toLowerCase() : "tool";
|
|
640391
|
+
return `${name} denied by auto mode${r ? ` \xB7 ${r}` : ""} \xB7 /permissions`;
|
|
640392
|
+
}
|
|
640393
|
+
function surfaceClassifierDeny(toolName2, verdict) {
|
|
640394
|
+
try {
|
|
640395
|
+
const denials = (init_autoModeDenials(), __toCommonJS(autoModeDenials_exports));
|
|
640396
|
+
denials.recordAutoModeDenial?.({
|
|
640397
|
+
toolName: toolName2,
|
|
640398
|
+
// display:wire 的 tool_end 不带 args(args 在 tool_start;本桥只为 ask/fs 工具留存),
|
|
640399
|
+
// 克制起见用 toolName 兜底 —— 裁决 reason 单列一栏,信息不丢。
|
|
640400
|
+
display: toolName2,
|
|
640401
|
+
reason: verdict.reason ?? verdict.message,
|
|
640402
|
+
timestamp: Date.now()
|
|
640403
|
+
});
|
|
640404
|
+
} catch (e) {
|
|
640405
|
+
logForDebugging(`classifierVerdictWire: recordAutoModeDenial failed (fail-soft): ${String(e)}`);
|
|
640406
|
+
}
|
|
640407
|
+
try {
|
|
640408
|
+
const store = getAppStateStoreRef();
|
|
640409
|
+
if (!store) return;
|
|
640410
|
+
store.setState((prev) => ({
|
|
640411
|
+
...prev,
|
|
640412
|
+
notifications: {
|
|
640413
|
+
current: {
|
|
640414
|
+
key: NOTICE_KEY,
|
|
640415
|
+
text: classifierDenyNoticeText(toolName2, verdict.reason),
|
|
640416
|
+
color: "warning",
|
|
640417
|
+
priority: "immediate",
|
|
640418
|
+
timeoutMs: NOTICE_TIMEOUT_MS
|
|
640419
|
+
},
|
|
640420
|
+
queue: prev.notifications.queue
|
|
640421
|
+
}
|
|
640422
|
+
}));
|
|
640423
|
+
const timer2 = setTimeout(() => {
|
|
640424
|
+
try {
|
|
640425
|
+
store.setState(
|
|
640426
|
+
(prev) => prev.notifications.current?.key === NOTICE_KEY ? { ...prev, notifications: { current: null, queue: prev.notifications.queue } } : prev
|
|
640427
|
+
);
|
|
640428
|
+
} catch {
|
|
640429
|
+
}
|
|
640430
|
+
}, NOTICE_TIMEOUT_MS);
|
|
640431
|
+
timer2.unref?.();
|
|
640432
|
+
} catch {
|
|
640433
|
+
}
|
|
640434
|
+
}
|
|
640435
|
+
var CLASSIFIER_DENY_SIGNATURE, NOTICE_REASON_MAX, NOTICE_KEY, NOTICE_TIMEOUT_MS;
|
|
640436
|
+
var init_classifierVerdictWire = __esm({
|
|
640437
|
+
"build-src/src/sema/classifierVerdictWire.ts"() {
|
|
640438
|
+
init_appStateRef();
|
|
640439
|
+
init_debug();
|
|
640440
|
+
CLASSIFIER_DENY_SIGNATURE = "auto-mode classifier blocked this call";
|
|
640441
|
+
NOTICE_REASON_MAX = 80;
|
|
640442
|
+
NOTICE_KEY = "auto-mode-denied";
|
|
640443
|
+
NOTICE_TIMEOUT_MS = 1e4;
|
|
640444
|
+
}
|
|
640445
|
+
});
|
|
640446
|
+
|
|
640034
640447
|
// build-src/src/sema/liveHitlAskWire.ts
|
|
640035
640448
|
function rejectMessageForRender() {
|
|
640036
640449
|
try {
|
|
@@ -640255,6 +640668,19 @@ async function* bridgeAskUserQuestionGates(source, deps2, opts) {
|
|
|
640255
640668
|
const pi = pendingFsCalls.indexOf(ev.toolCallId);
|
|
640256
640669
|
if (pi !== -1) pendingFsCalls.splice(pi, 1);
|
|
640257
640670
|
}
|
|
640671
|
+
if (ev.isError === true && !deniedCalls.has(ev.toolCallId)) {
|
|
640672
|
+
const verdict = classifierDenyFromToolEnd(ev);
|
|
640673
|
+
if (verdict) {
|
|
640674
|
+
endedCalls.add(ev.toolCallId);
|
|
640675
|
+
heldAskEnds.delete(ev.toolCallId);
|
|
640676
|
+
surfaceClassifierDeny(typeof ev.toolName === "string" ? ev.toolName : "tool", verdict);
|
|
640677
|
+
logForDebugging(
|
|
640678
|
+
`liveHitlAskWire: classifier deny verdict on ${ev.toolCallId} (${String(ev.toolName)}) \u2014 labeled render + notice`
|
|
640679
|
+
);
|
|
640680
|
+
yield { ...ev, output: verdict.message, structured: void 0 };
|
|
640681
|
+
continue;
|
|
640682
|
+
}
|
|
640683
|
+
}
|
|
640258
640684
|
if (ev.isError === true && typeof ev.toolName === "string" && toolNameIsFsWrite(ev.toolName) && denyStampNextFsEnd && !deniedCalls.has(ev.toolCallId)) {
|
|
640259
640685
|
denyStampNextFsEnd = false;
|
|
640260
640686
|
endedCalls.add(ev.toolCallId);
|
|
@@ -640381,6 +640807,7 @@ var init_liveHitlAskWire = __esm({
|
|
|
640381
640807
|
init_debug();
|
|
640382
640808
|
init_appStateRef();
|
|
640383
640809
|
init_liveToolApprovalWire();
|
|
640810
|
+
init_classifierVerdictWire();
|
|
640384
640811
|
MAX_GATE_HOPS = 24;
|
|
640385
640812
|
CANCEL_DENY_BUDGET_MS = 2e3;
|
|
640386
640813
|
CANCEL_DENY_WARN_TEXT = "could not cancel the pending question \u2014 the session may stay locked; the run may need engine-side recovery";
|
|
@@ -640944,7 +641371,7 @@ function fireBestEffortDetachCancel(fetchImpl = fetch) {
|
|
|
640944
641371
|
void fetchImpl(`${arm.baseUrl.replace(/\/+$/, "")}/v1/runs/${encodeURIComponent(taskId)}/cancel`, {
|
|
640945
641372
|
method: "POST",
|
|
640946
641373
|
headers: {
|
|
640947
|
-
authorization: `Bearer ${arm.authToken}
|
|
641374
|
+
...typeof arm.authToken === "string" ? { authorization: `Bearer ${arm.authToken}` } : {},
|
|
640948
641375
|
"x-agent-principal": arm.principal
|
|
640949
641376
|
},
|
|
640950
641377
|
signal: controller.signal
|
|
@@ -640976,7 +641403,7 @@ function debugLog(msg) {
|
|
|
640976
641403
|
}
|
|
640977
641404
|
function terminalEventFromRunRow(row2) {
|
|
640978
641405
|
if (!row2 || typeof row2.status !== "string") return null;
|
|
640979
|
-
if (
|
|
641406
|
+
if (RUN_ROW_TERMINAL_STATUSES.has(row2.status)) {
|
|
640980
641407
|
if (row2.result && typeof row2.result === "object") {
|
|
640981
641408
|
return { type: "done", result: row2.result };
|
|
640982
641409
|
}
|
|
@@ -641052,11 +641479,19 @@ async function* withHeadlessR1Reconnect(live, deps2) {
|
|
|
641052
641479
|
}
|
|
641053
641480
|
}
|
|
641054
641481
|
}
|
|
641055
|
-
var HEADLESS_RECONNECT_MAX;
|
|
641482
|
+
var HEADLESS_RECONNECT_MAX, RUN_ROW_TERMINAL_STATUSES;
|
|
641056
641483
|
var init_headlessReconnectWire = __esm({
|
|
641057
641484
|
"build-src/src/sema/headlessReconnectWire.ts"() {
|
|
641058
641485
|
init_sseIdleTriage();
|
|
641059
641486
|
HEADLESS_RECONNECT_MAX = 2;
|
|
641487
|
+
RUN_ROW_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
641488
|
+
"completed",
|
|
641489
|
+
"failed",
|
|
641490
|
+
"timeout",
|
|
641491
|
+
"blocked",
|
|
641492
|
+
"suspended",
|
|
641493
|
+
"needs_review"
|
|
641494
|
+
]);
|
|
641060
641495
|
}
|
|
641061
641496
|
});
|
|
641062
641497
|
|
|
@@ -641174,7 +641609,8 @@ function createLiveConversationClient(config5) {
|
|
|
641174
641609
|
});
|
|
641175
641610
|
void prepareTaskAgentsWire({
|
|
641176
641611
|
baseUrl: config5.baseUrl,
|
|
641177
|
-
|
|
641612
|
+
// loopback-unauthed = 不传 token(agentsWireCaps 对缺省 token 自然零 Authorization 头)。
|
|
641613
|
+
authToken: typeof config5.authToken === "string" ? config5.authToken : void 0,
|
|
641178
641614
|
principal: config5.principal
|
|
641179
641615
|
});
|
|
641180
641616
|
const questionsRes = client4.questions;
|
|
@@ -641186,7 +641622,8 @@ function createLiveConversationClient(config5) {
|
|
|
641186
641622
|
const res = await fetch(`${baseUrlTrimmed}/v1/tool-approvals/${encodeURIComponent(approvalId)}/respond`, {
|
|
641187
641623
|
method: "POST",
|
|
641188
641624
|
headers: {
|
|
641189
|
-
|
|
641625
|
+
// loopback-unauthed = 零 Authorization 头(与 SDK Transport 对 object-token 的姿势逐字一致)。
|
|
641626
|
+
...typeof config5.authToken === "string" ? { authorization: `Bearer ${config5.authToken}` } : {},
|
|
641190
641627
|
"x-agent-principal": config5.principal,
|
|
641191
641628
|
"content-type": "application/json"
|
|
641192
641629
|
},
|
|
@@ -641618,12 +642055,70 @@ var init_headlessPermissionModeWire = __esm({
|
|
|
641618
642055
|
"default",
|
|
641619
642056
|
"plan",
|
|
641620
642057
|
"acceptEdits",
|
|
641621
|
-
"bypassPermissions"
|
|
642058
|
+
"bypassPermissions",
|
|
642059
|
+
"auto"
|
|
641622
642060
|
];
|
|
641623
642061
|
warnedInvalidEnv = false;
|
|
641624
642062
|
}
|
|
641625
642063
|
});
|
|
641626
642064
|
|
|
642065
|
+
// build-src/src/sema/interactiveToolsWire.ts
|
|
642066
|
+
var interactiveToolsWire_exports = {};
|
|
642067
|
+
__export(interactiveToolsWire_exports, {
|
|
642068
|
+
HEADLESS_INTERACTIVE_TOOLS_ENV: () => HEADLESS_INTERACTIVE_TOOLS_ENV,
|
|
642069
|
+
_resetInteractiveToolsWireForTest: () => _resetInteractiveToolsWireForTest,
|
|
642070
|
+
planModeExplicitlyRequested: () => planModeExplicitlyRequested,
|
|
642071
|
+
resolveHeadlessInteractiveTools: () => resolveHeadlessInteractiveTools
|
|
642072
|
+
});
|
|
642073
|
+
function planModeExplicitlyRequested(argv) {
|
|
642074
|
+
let mode;
|
|
642075
|
+
for (let i = 0; i < argv.length; i++) {
|
|
642076
|
+
const a = argv[i];
|
|
642077
|
+
if (a === "--permission-mode") {
|
|
642078
|
+
const v2 = argv[i + 1];
|
|
642079
|
+
if (typeof v2 === "string" && !v2.startsWith("-")) {
|
|
642080
|
+
mode = v2;
|
|
642081
|
+
i++;
|
|
642082
|
+
}
|
|
642083
|
+
} else if (a?.startsWith("--permission-mode=")) {
|
|
642084
|
+
mode = a.slice("--permission-mode=".length);
|
|
642085
|
+
} else if (a === "--") {
|
|
642086
|
+
break;
|
|
642087
|
+
}
|
|
642088
|
+
}
|
|
642089
|
+
return mode === "plan";
|
|
642090
|
+
}
|
|
642091
|
+
function resolveHeadlessInteractiveTools(argv, env5 = process.env) {
|
|
642092
|
+
if (planModeExplicitlyRequested(argv)) {
|
|
642093
|
+
return { fields: {}, source: "plan-flag" };
|
|
642094
|
+
}
|
|
642095
|
+
const raw2 = env5[HEADLESS_INTERACTIVE_TOOLS_ENV]?.trim();
|
|
642096
|
+
if (raw2 !== void 0 && raw2 !== "") {
|
|
642097
|
+
if (raw2 === "true" || raw2 === "1") return { fields: {}, source: "env" };
|
|
642098
|
+
if (raw2 === "false" || raw2 === "0") return { fields: { interactiveTools: false }, source: "env" };
|
|
642099
|
+
const resolution = {
|
|
642100
|
+
fields: { interactiveTools: false },
|
|
642101
|
+
source: "default"
|
|
642102
|
+
};
|
|
642103
|
+
if (!warnedInvalidEnv2) {
|
|
642104
|
+
warnedInvalidEnv2 = true;
|
|
642105
|
+
resolution.warning = `sema: ${HEADLESS_INTERACTIVE_TOOLS_ENV}="${raw2}" is not a boolean (expected true/1/false/0) \u2014 ignoring it, headless -p keeps interactive tools OFF by default`;
|
|
642106
|
+
}
|
|
642107
|
+
return resolution;
|
|
642108
|
+
}
|
|
642109
|
+
return { fields: { interactiveTools: false }, source: "default" };
|
|
642110
|
+
}
|
|
642111
|
+
function _resetInteractiveToolsWireForTest() {
|
|
642112
|
+
warnedInvalidEnv2 = false;
|
|
642113
|
+
}
|
|
642114
|
+
var HEADLESS_INTERACTIVE_TOOLS_ENV, warnedInvalidEnv2;
|
|
642115
|
+
var init_interactiveToolsWire = __esm({
|
|
642116
|
+
"build-src/src/sema/interactiveToolsWire.ts"() {
|
|
642117
|
+
HEADLESS_INTERACTIVE_TOOLS_ENV = "SEMA_HEADLESS_INTERACTIVE_TOOLS";
|
|
642118
|
+
warnedInvalidEnv2 = false;
|
|
642119
|
+
}
|
|
642120
|
+
});
|
|
642121
|
+
|
|
641627
642122
|
// build-src/src/sema/printStreamJsonContract.ts
|
|
641628
642123
|
var printStreamJsonContract_exports = {};
|
|
641629
642124
|
__export(printStreamJsonContract_exports, {
|
|
@@ -641875,6 +642370,62 @@ var init_printStreamJsonContract = __esm({
|
|
|
641875
642370
|
}
|
|
641876
642371
|
});
|
|
641877
642372
|
|
|
642373
|
+
// build-src/src/sema/printToolResultFrame.ts
|
|
642374
|
+
var printToolResultFrame_exports = {};
|
|
642375
|
+
__export(printToolResultFrame_exports, {
|
|
642376
|
+
flattenToolOutput: () => flattenToolOutput,
|
|
642377
|
+
toolEndResultToUserFrame: () => toolEndResultToUserFrame
|
|
642378
|
+
});
|
|
642379
|
+
function flattenToolOutput(output) {
|
|
642380
|
+
if (typeof output === "string") return output;
|
|
642381
|
+
if (Array.isArray(output)) {
|
|
642382
|
+
const parts = [];
|
|
642383
|
+
for (const block2 of output) {
|
|
642384
|
+
if (block2 && typeof block2 === "object") {
|
|
642385
|
+
const b3 = block2;
|
|
642386
|
+
if (b3.type === "text" && typeof b3.text === "string") parts.push(b3.text);
|
|
642387
|
+
else if (b3.type === "image") parts.push("[image]");
|
|
642388
|
+
}
|
|
642389
|
+
}
|
|
642390
|
+
return parts.join("");
|
|
642391
|
+
}
|
|
642392
|
+
return "";
|
|
642393
|
+
}
|
|
642394
|
+
function bashExitCodeFailed(toolName2, text2) {
|
|
642395
|
+
if (typeof toolName2 !== "string" || toolName2.toLowerCase() !== "bash") return false;
|
|
642396
|
+
const m2 = /^exit code: (\d+)\b/.exec(text2);
|
|
642397
|
+
return m2 !== null && m2[1] !== "0";
|
|
642398
|
+
}
|
|
642399
|
+
function toolEndResultToUserFrame(arm) {
|
|
642400
|
+
if (typeof arm.toolCallId !== "string" || arm.toolCallId.length === 0) return null;
|
|
642401
|
+
const text2 = flattenToolOutput(arm.output);
|
|
642402
|
+
return {
|
|
642403
|
+
type: "user",
|
|
642404
|
+
message: {
|
|
642405
|
+
role: "user",
|
|
642406
|
+
content: [
|
|
642407
|
+
{
|
|
642408
|
+
type: "tool_result",
|
|
642409
|
+
tool_use_id: arm.toolCallId,
|
|
642410
|
+
// truncated 输出如实标注(观察面注记;截断体绝不回喂模型——upstreamBridge 同款)。
|
|
642411
|
+
content: arm.truncated === true ? `${text2}
|
|
642412
|
+
\u2026(truncated)` : text2,
|
|
642413
|
+
is_error: arm.isError === true || bashExitCodeFailed(arm.toolName, text2)
|
|
642414
|
+
}
|
|
642415
|
+
]
|
|
642416
|
+
},
|
|
642417
|
+
parent_tool_use_id: typeof arm.parentToolCallId === "string" ? arm.parentToolCallId : null,
|
|
642418
|
+
// eventToSdkMessage 已 stamp 的 uuid/session_id 原样骑帧(uuid = core-minted eventId 优先级
|
|
642419
|
+
// 在 stamp 里已定);缺失时留 undefined,print 面容忍(CC 消费者按可选读)。
|
|
642420
|
+
uuid: arm.uuid,
|
|
642421
|
+
session_id: arm.session_id
|
|
642422
|
+
};
|
|
642423
|
+
}
|
|
642424
|
+
var init_printToolResultFrame = __esm({
|
|
642425
|
+
"build-src/src/sema/printToolResultFrame.ts"() {
|
|
642426
|
+
}
|
|
642427
|
+
});
|
|
642428
|
+
|
|
641878
642429
|
// build-src/src/sema/seamQueryEngine.ts
|
|
641879
642430
|
var seamQueryEngine_exports = {};
|
|
641880
642431
|
__export(seamQueryEngine_exports, {
|
|
@@ -641906,7 +642457,8 @@ async function resolveClient() {
|
|
|
641906
642457
|
} catch {
|
|
641907
642458
|
}
|
|
641908
642459
|
const { createLiveConversationClient: createLiveConversationClient2 } = await Promise.resolve().then(() => (init_liveClient(), liveClient_exports));
|
|
641909
|
-
const
|
|
642460
|
+
const { resolveLiveAuthToken: resolveLiveAuthToken2 } = await Promise.resolve().then(() => (init_engineTarget(), engineTarget_exports));
|
|
642461
|
+
const authToken = resolveLiveAuthToken2(baseUrl);
|
|
641910
642462
|
const live = createLiveConversationClient2({
|
|
641911
642463
|
baseUrl,
|
|
641912
642464
|
authToken,
|
|
@@ -641952,7 +642504,8 @@ async function* ask(params) {
|
|
|
641952
642504
|
);
|
|
641953
642505
|
process.exit(1);
|
|
641954
642506
|
}
|
|
641955
|
-
const
|
|
642507
|
+
const rawObjective = promptToObjective(params?.prompt);
|
|
642508
|
+
const objective = rawObjective.trim().length > 0 ? rawObjective : "(no content)";
|
|
641956
642509
|
const webSearch = process.env.SEMA_LIVE_BASEURL ? webSearchFromEnv() : void 0;
|
|
641957
642510
|
if (webSearch && process.env.SEMA_DEBUG) {
|
|
641958
642511
|
console.error(
|
|
@@ -642081,6 +642634,24 @@ async function* ask(params) {
|
|
|
642081
642634
|
if (process.env.SEMA_DEBUG) console.error("[sema] print-mode ask permission wire soft-failed:", ePerm);
|
|
642082
642635
|
}
|
|
642083
642636
|
}
|
|
642637
|
+
let interactiveToolsField = {};
|
|
642638
|
+
if (process.env.SEMA_LIVE_BASEURL) {
|
|
642639
|
+
try {
|
|
642640
|
+
const itw = await Promise.resolve().then(() => (init_interactiveToolsWire(), interactiveToolsWire_exports));
|
|
642641
|
+
const r = itw.resolveHeadlessInteractiveTools(process.argv.slice(2), process.env);
|
|
642642
|
+
if (r.warning) {
|
|
642643
|
+
console.error(r.warning);
|
|
642644
|
+
}
|
|
642645
|
+
interactiveToolsField = r.fields;
|
|
642646
|
+
if (process.env.SEMA_DEBUG) {
|
|
642647
|
+
console.error(
|
|
642648
|
+
`[sema] print-mode ask: interactive-tools wire \u2192 ${r.fields.interactiveTools === false ? "TaskRequest.interactiveTools=false" : "not stamped"} (source=${r.source})`
|
|
642649
|
+
);
|
|
642650
|
+
}
|
|
642651
|
+
} catch (eIt) {
|
|
642652
|
+
if (process.env.SEMA_DEBUG) console.error("[sema] print-mode ask interactive-tools wire soft-failed:", eIt);
|
|
642653
|
+
}
|
|
642654
|
+
}
|
|
642084
642655
|
let detachHeaders;
|
|
642085
642656
|
if (process.env.SEMA_LIVE_BASEURL) {
|
|
642086
642657
|
try {
|
|
@@ -642089,9 +642660,11 @@ async function* ask(params) {
|
|
|
642089
642660
|
if (d2.on) {
|
|
642090
642661
|
detachHeaders = { [dw.DETACH_HEADER]: "true" };
|
|
642091
642662
|
const { getActiveEngineTaskId: getActiveEngineTaskId2 } = await Promise.resolve().then(() => (init_engineToolDetach(), engineToolDetach_exports));
|
|
642663
|
+
const { resolveLiveAuthToken: resolveDetachAuth } = await Promise.resolve().then(() => (init_engineTarget(), engineTarget_exports));
|
|
642092
642664
|
dw.armDetachCancel({
|
|
642093
642665
|
baseUrl: process.env.SEMA_LIVE_BASEURL,
|
|
642094
|
-
|
|
642666
|
+
// #118:无 token loopback = loopback-unauthed(cancel 兜底不伪造 'anon' Bearer,server 走 owner=null)。
|
|
642667
|
+
authToken: resolveDetachAuth(process.env.SEMA_LIVE_BASEURL),
|
|
642095
642668
|
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-print",
|
|
642096
642669
|
getTaskId: getActiveEngineTaskId2
|
|
642097
642670
|
});
|
|
@@ -642129,6 +642702,9 @@ async function* ask(params) {
|
|
|
642129
642702
|
...sandboxFields,
|
|
642130
642703
|
// SEMA_HEADLESS_PERMISSION_MODE 旋钮(flag > env > absent;live-gated;空 = 现状 absent-mode)。
|
|
642131
642704
|
...headlessPermissionField,
|
|
642705
|
+
// [909]B 件3:interactiveTools:false(live-gated;SDK TaskRequest 类型暂无此字段 ——
|
|
642706
|
+
// limits/finalVerification 同款短期窄 cast;server 白名单半场已另行派单)。
|
|
642707
|
+
...interactiveToolsField.interactiveTools === false ? { interactiveTools: false } : {},
|
|
642132
642708
|
...webSearch || wireHooks ? { settings: { ...webSearch ? { webSearch } : {}, ...wireHooks ? { hooks: wireHooks } : {} } } : {},
|
|
642133
642709
|
...selfOrchestration ? { selfOrchestration } : {},
|
|
642134
642710
|
...enableFork !== void 0 ? { enableFork } : {},
|
|
@@ -642152,7 +642728,13 @@ async function* ask(params) {
|
|
|
642152
642728
|
for await (const msg of sdk) {
|
|
642153
642729
|
if (signal?.aborted) break;
|
|
642154
642730
|
const t2 = msg.type;
|
|
642155
|
-
if (t2 === "tool_end_result"
|
|
642731
|
+
if (t2 === "tool_end_result") {
|
|
642732
|
+
const { toolEndResultToUserFrame: toolEndResultToUserFrame2 } = await Promise.resolve().then(() => (init_printToolResultFrame(), printToolResultFrame_exports));
|
|
642733
|
+
const frame = toolEndResultToUserFrame2(msg);
|
|
642734
|
+
if (frame) yield frame;
|
|
642735
|
+
continue;
|
|
642736
|
+
}
|
|
642737
|
+
if (t2 === "retry_status" || t2 === "turn_usage" || t2 === "task_progress") {
|
|
642156
642738
|
continue;
|
|
642157
642739
|
}
|
|
642158
642740
|
if (t2 === "workflow_complete") {
|
|
@@ -645820,6 +646402,8 @@ Startup time: ${Math.round(process.uptime() * 1e3)}ms
|
|
|
645820
646402
|
if (options.outputFormat === "stream-json") {
|
|
645821
646403
|
installStreamJsonSignalTailFrame();
|
|
645822
646404
|
}
|
|
646405
|
+
const { setPipedStdoutBlocking: setPipedStdoutBlocking2 } = await Promise.resolve().then(() => (init_stdoutDrain(), stdoutDrain_exports));
|
|
646406
|
+
setPipedStdoutBlocking2();
|
|
645823
646407
|
if (false) {
|
|
645824
646408
|
void downloadUserSettings();
|
|
645825
646409
|
}
|
|
@@ -646145,16 +646729,22 @@ Error: sandbox required but unavailable: ${sandboxUnavailableReason}
|
|
|
646145
646729
|
);
|
|
646146
646730
|
break;
|
|
646147
646731
|
}
|
|
646732
|
+
// [909]B2 nit + B1 语义:这三臂此前 (a) 缺尾换行(TB「exit rc= 标记与上一行粘连」的
|
|
646733
|
+
// 文本形态源之一),(b) 只会渲本地 loop 语义的模板句 —— 引擎终帧(timeout→error_max_turns、
|
|
646734
|
+
// budget、output.invalid)带 errors[] 引擎原话时优先如实渲它(--deadline 的 timeout 若渲
|
|
646735
|
+
// "Reached max turns (undefined)" 是撒谎)。errors[] 缺席时维持 CC 模板句(补 \n)。
|
|
646148
646736
|
case "error_max_turns":
|
|
646149
|
-
writeToStdout(`Error: Reached max turns (${options.maxTurns})`);
|
|
646150
|
-
break;
|
|
646151
646737
|
case "error_max_budget_usd":
|
|
646152
|
-
|
|
646738
|
+
case "error_max_structured_output_retries": {
|
|
646739
|
+
const engineErrors = lastMessage.errors;
|
|
646740
|
+
if (Array.isArray(engineErrors) && engineErrors.length > 0) {
|
|
646741
|
+
process.stderr.write(formatTextModeExecutionError(engineErrors) + "\n");
|
|
646742
|
+
break;
|
|
646743
|
+
}
|
|
646744
|
+
const template = lastMessage.subtype === "error_max_turns" ? `Error: Reached max turns (${options.maxTurns})` : lastMessage.subtype === "error_max_budget_usd" ? `Error: Exceeded USD budget (${options.maxBudgetUsd})` : `Error: Failed to provide valid structured output after maximum retries`;
|
|
646745
|
+
writeToStdout(template + "\n");
|
|
646153
646746
|
break;
|
|
646154
|
-
|
|
646155
|
-
writeToStdout(
|
|
646156
|
-
`Error: Failed to provide valid structured output after maximum retries`
|
|
646157
|
-
);
|
|
646747
|
+
}
|
|
646158
646748
|
}
|
|
646159
646749
|
}
|
|
646160
646750
|
logHeadlessProfilerTurn();
|
|
@@ -652798,7 +653388,7 @@ __export(tlsTrust_exports, {
|
|
|
652798
653388
|
});
|
|
652799
653389
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
652800
653390
|
import { X509Certificate } from "node:crypto";
|
|
652801
|
-
import { existsSync as
|
|
653391
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync19, readFileSync as readFileSync39, writeFileSync as writeFileSync18 } from "node:fs";
|
|
652802
653392
|
import { homedir as homedir49 } from "node:os";
|
|
652803
653393
|
import { join as join187 } from "node:path";
|
|
652804
653394
|
function isCertError(detail) {
|
|
@@ -652865,7 +653455,7 @@ async function injectDispatcher(extra) {
|
|
|
652865
653455
|
}
|
|
652866
653456
|
async function applyPersistedTlsTrust() {
|
|
652867
653457
|
try {
|
|
652868
|
-
if (!
|
|
653458
|
+
if (!existsSync26(CA_PATH)) return false;
|
|
652869
653459
|
const raw2 = readFileSync39(CA_PATH, "utf8");
|
|
652870
653460
|
if (!raw2.includes("BEGIN CERTIFICATE")) return false;
|
|
652871
653461
|
const kept = filterCaCertificates(raw2);
|
|
@@ -653195,7 +653785,7 @@ __export(cloudSessions_exports, {
|
|
|
653195
653785
|
cloudSessionPush: () => cloudSessionPush,
|
|
653196
653786
|
cloudSyncCommand: () => cloudSyncCommand
|
|
653197
653787
|
});
|
|
653198
|
-
import { existsSync as
|
|
653788
|
+
import { existsSync as existsSync27, mkdirSync as mkdirSync20, readFileSync as readFileSync41, writeFileSync as writeFileSync19, copyFileSync as copyFileSync5 } from "node:fs";
|
|
653199
653789
|
import { join as join189 } from "node:path";
|
|
653200
653790
|
import { realpathSync as realpathSync10 } from "node:fs";
|
|
653201
653791
|
function fail3(e) {
|
|
@@ -653384,7 +653974,7 @@ async function cloudSessionPush(sessionIdArg, opts = {}) {
|
|
|
653384
653974
|
if (!engineId) {
|
|
653385
653975
|
const marker = join189(projectDir(), `${shellId}.import-seed.json`);
|
|
653386
653976
|
err5(`Error: no engine-side record for session ${shellId} \u2014 there is nothing to push.`);
|
|
653387
|
-
if (
|
|
653977
|
+
if (existsSync27(marker)) {
|
|
653388
653978
|
err5(" This session was imported from Sema and has not run a turn here yet.");
|
|
653389
653979
|
}
|
|
653390
653980
|
err5(' Run one turn in it first (`sema -r` or `sema -p --resume <id> "\u2026"`), which seeds the engine, then push again.');
|
|
@@ -653488,7 +654078,7 @@ async function cloudSessionPull(sessionIdArg, opts = {}) {
|
|
|
653488
654078
|
const version5 = "0.0.0-sync";
|
|
653489
654079
|
let appended = 0;
|
|
653490
654080
|
let skippedNonMessage = 0;
|
|
653491
|
-
if (!
|
|
654081
|
+
if (!existsSync27(jsonlPath)) {
|
|
653492
654082
|
const conv = syncEntriesToTranscriptLines2(pulled.bundle.entries, { sessionId: id, cwd: cwd5, version: version5 });
|
|
653493
654083
|
writeFileSync19(jsonlPath, conv.lines.map((l3) => JSON.stringify(l3)).join("\n") + (conv.lines.length ? "\n" : ""));
|
|
653494
654084
|
appended = conv.lines.length;
|
|
@@ -653791,7 +654381,7 @@ __export(cloudResources_exports, {
|
|
|
653791
654381
|
cloudResourceSync: () => cloudResourceSync
|
|
653792
654382
|
});
|
|
653793
654383
|
import { createHash as createHash26 } from "node:crypto";
|
|
653794
|
-
import { existsSync as
|
|
654384
|
+
import { existsSync as existsSync28, readdirSync as readdirSync11, readFileSync as readFileSync42, statSync as statSync13 } from "node:fs";
|
|
653795
654385
|
import { basename as basename66, dirname as dirname82, isAbsolute as isAbsolute33, join as join190, resolve as resolve47 } from "node:path";
|
|
653796
654386
|
function fail4(e) {
|
|
653797
654387
|
err6(`Error: ${e instanceof Error ? e.message : String(e)}`);
|
|
@@ -654349,14 +654939,14 @@ async function skillRoots() {
|
|
|
654349
654939
|
async function resolveSkillFile(target) {
|
|
654350
654940
|
const tryFile = (p) => {
|
|
654351
654941
|
try {
|
|
654352
|
-
if (!
|
|
654353
|
-
return statSync13(p).isDirectory() ?
|
|
654942
|
+
if (!existsSync28(p)) return null;
|
|
654943
|
+
return statSync13(p).isDirectory() ? existsSync28(join190(p, "SKILL.md")) ? join190(p, "SKILL.md") : null : p;
|
|
654354
654944
|
} catch {
|
|
654355
654945
|
return null;
|
|
654356
654946
|
}
|
|
654357
654947
|
};
|
|
654358
654948
|
const looksLikePath = target.includes("/") || isAbsolute33(target) || target.endsWith(".md");
|
|
654359
|
-
if (looksLikePath ||
|
|
654949
|
+
if (looksLikePath || existsSync28(target)) {
|
|
654360
654950
|
const f = tryFile(resolve47(target));
|
|
654361
654951
|
if (!f) return { error: `no SKILL.md at '${target}' (expected a skill directory or the SKILL.md file itself)` };
|
|
654362
654952
|
return { file: f, fallbackName: basename66(dirname82(f)) };
|
|
@@ -654404,7 +654994,7 @@ async function loadLocalSkillEntries() {
|
|
|
654404
654994
|
try {
|
|
654405
654995
|
dirs = readdirSync11(root2).filter((d2) => {
|
|
654406
654996
|
try {
|
|
654407
|
-
return statSync13(join190(root2, d2)).isDirectory() &&
|
|
654997
|
+
return statSync13(join190(root2, d2)).isDirectory() && existsSync28(join190(root2, d2, "SKILL.md"));
|
|
654408
654998
|
} catch {
|
|
654409
654999
|
return false;
|
|
654410
655000
|
}
|
|
@@ -654679,7 +655269,7 @@ async function resolveInstallTarget(kind, target) {
|
|
|
654679
655269
|
}
|
|
654680
655270
|
if (kind === "mcp") {
|
|
654681
655271
|
const looksLikePath = target.includes("/") || isAbsolute33(target) || target.endsWith(".json");
|
|
654682
|
-
if (looksLikePath ||
|
|
655272
|
+
if (looksLikePath || existsSync28(target) && statSync13(target).isFile()) return readMcpFromFile(target);
|
|
654683
655273
|
const local2 = await loadLocalMcpEntries();
|
|
654684
655274
|
const hit2 = local2.find((l3) => l3.name === target);
|
|
654685
655275
|
if (!hit2) return { error: `no local MCP server named '${target}' in .mcp.json. Known: ${local2.map((l3) => l3.name).join(", ") || "(none)"} \u2014 or pass a json file path.` };
|
|
@@ -655143,7 +655733,7 @@ __export(cloudOps_exports, {
|
|
|
655143
655733
|
cloudSmoke: () => cloudSmoke
|
|
655144
655734
|
});
|
|
655145
655735
|
import { execFileSync as execFileSync6, spawn as spawn15 } from "child_process";
|
|
655146
|
-
import { existsSync as
|
|
655736
|
+
import { existsSync as existsSync29, statSync as statSync14 } from "fs";
|
|
655147
655737
|
import { createRequire as createRequire4 } from "module";
|
|
655148
655738
|
import { createInterface as createInterface3 } from "readline";
|
|
655149
655739
|
import { dirname as dirname83, join as join191, resolve as resolve48 } from "path";
|
|
@@ -655154,7 +655744,7 @@ function fail5(e) {
|
|
|
655154
655744
|
function firstExistingFile(candidates) {
|
|
655155
655745
|
for (const c2 of candidates) {
|
|
655156
655746
|
try {
|
|
655157
|
-
if (
|
|
655747
|
+
if (existsSync29(c2) && statSync14(c2).isFile()) return c2;
|
|
655158
655748
|
} catch {
|
|
655159
655749
|
}
|
|
655160
655750
|
}
|
|
@@ -659217,7 +659807,7 @@ __export(configSync_exports, {
|
|
|
659217
659807
|
import { homedir as homedir51 } from "node:os";
|
|
659218
659808
|
import {
|
|
659219
659809
|
copyFileSync as copyFileSync6,
|
|
659220
|
-
existsSync as
|
|
659810
|
+
existsSync as existsSync30,
|
|
659221
659811
|
mkdirSync as mkdirSync21,
|
|
659222
659812
|
readdirSync as readdirSync12,
|
|
659223
659813
|
readFileSync as readFileSync43,
|
|
@@ -659278,8 +659868,8 @@ function ensureDir2(filePath) {
|
|
|
659278
659868
|
mkdirSync21(dirname85(filePath), { recursive: true });
|
|
659279
659869
|
}
|
|
659280
659870
|
function syncPlainFile(src, dest, label, opts, report) {
|
|
659281
|
-
if (!
|
|
659282
|
-
if (!
|
|
659871
|
+
if (!existsSync30(src)) return;
|
|
659872
|
+
if (!existsSync30(dest)) {
|
|
659283
659873
|
if (!opts.dryRun) {
|
|
659284
659874
|
ensureDir2(dest);
|
|
659285
659875
|
copyFileSync6(src, dest);
|
|
@@ -659302,9 +659892,9 @@ function syncPlainFile(src, dest, label, opts, report) {
|
|
|
659302
659892
|
recordAction(report, { action: "conflict", label });
|
|
659303
659893
|
}
|
|
659304
659894
|
function syncJsonFile(src, dest, label, opts, report) {
|
|
659305
|
-
if (!
|
|
659895
|
+
if (!existsSync30(src)) return;
|
|
659306
659896
|
const srcText = readFileSync43(src, "utf-8");
|
|
659307
|
-
if (!
|
|
659897
|
+
if (!existsSync30(dest)) {
|
|
659308
659898
|
if (!opts.dryRun) {
|
|
659309
659899
|
ensureDir2(dest);
|
|
659310
659900
|
writeFileSyncAndFlush_DEPRECATED(dest, srcText, { encoding: "utf-8" });
|
|
@@ -659355,7 +659945,7 @@ function syncJsonFile(src, dest, label, opts, report) {
|
|
|
659355
659945
|
recordAction(report, { action: "conflict", label });
|
|
659356
659946
|
}
|
|
659357
659947
|
function syncTree(srcDir, destDir, labelBase, opts, report) {
|
|
659358
|
-
if (!
|
|
659948
|
+
if (!existsSync30(srcDir)) return;
|
|
659359
659949
|
let stat55;
|
|
659360
659950
|
try {
|
|
659361
659951
|
stat55 = statSync15(srcDir);
|
|
@@ -659390,7 +659980,7 @@ function syncTree(srcDir, destDir, labelBase, opts, report) {
|
|
|
659390
659980
|
}
|
|
659391
659981
|
}
|
|
659392
659982
|
function syncRoot(srcRoot, destRoot, manifest, scopeLabel, opts, report) {
|
|
659393
|
-
if (!
|
|
659983
|
+
if (!existsSync30(srcRoot)) {
|
|
659394
659984
|
process.stdout.write(
|
|
659395
659985
|
source_default.dim(` (${scopeLabel}) no ${display(srcRoot)} \u2014 skipping
|
|
659396
659986
|
`)
|
|
@@ -659477,7 +660067,7 @@ user: ${display(userSrc)} \u2192 ${display(userDest)}
|
|
|
659477
660067
|
);
|
|
659478
660068
|
const globalSrc = join193(homedir51(), LEGACY_GLOBAL_FILE);
|
|
659479
660069
|
const globalDest = getGlobalClaudeFile();
|
|
659480
|
-
if (
|
|
660070
|
+
if (existsSync30(globalSrc) && globalSrc !== globalDest) {
|
|
659481
660071
|
syncJsonFile(globalSrc, globalDest, display(globalDest), opts, report);
|
|
659482
660072
|
}
|
|
659483
660073
|
flushEntries(report, userStart, opts);
|
|
@@ -660187,7 +660777,7 @@ var init_navStack = __esm({
|
|
|
660187
660777
|
});
|
|
660188
660778
|
|
|
660189
660779
|
// build-src/src/sema/config/skillsChannels.ts
|
|
660190
|
-
import { existsSync as
|
|
660780
|
+
import { existsSync as existsSync31, mkdirSync as mkdirSync22, readdirSync as readdirSync13, readFileSync as readFileSync46, realpathSync as realpathSync11, renameSync as renameSync9, statSync as statSync16 } from "node:fs";
|
|
660191
660781
|
import { basename as basename68, dirname as dirname86, join as join196 } from "node:path";
|
|
660192
660782
|
function skillsDirFor(source) {
|
|
660193
660783
|
return source === "user" ? join196(getClaudeConfigHomeDir(), "skills") : join196(getCwd(), ".sema", "skills");
|
|
@@ -660274,7 +660864,7 @@ function removeSkillWithBackup(skill) {
|
|
|
660274
660864
|
);
|
|
660275
660865
|
mkdirSync22(removedDir, { recursive: true });
|
|
660276
660866
|
let target = join196(removedDir, basename68(skill.root));
|
|
660277
|
-
if (
|
|
660867
|
+
if (existsSync31(target)) target = `${target}-${Date.now()}`;
|
|
660278
660868
|
renameSync9(skill.root, target);
|
|
660279
660869
|
const nameStillPresent = listInstalledSkills().some((s) => s.name === skill.name);
|
|
660280
660870
|
if (!nameStillPresent && (getSettingsForSource("localSettings")?.skillOverrides ?? {})[skill.name] !== void 0) {
|
|
@@ -666219,7 +666809,7 @@ Auth: unix socket -R \u2192 local proxy`, "info");
|
|
|
666219
666809
|
pendingHookMessages
|
|
666220
666810
|
}, renderAndRun);
|
|
666221
666811
|
}
|
|
666222
|
-
}).version("sema 1.0.
|
|
666812
|
+
}).version("sema 1.0.9", "-v, --version", "Output the version number");
|
|
666223
666813
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
666224
666814
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
666225
666815
|
if (canUserConfigureAdvisor()) {
|
|
@@ -669721,7 +670311,7 @@ __export(claudeImportHint_exports, {
|
|
|
669721
670311
|
maybeEmitClaudeImportHint: () => maybeEmitClaudeImportHint,
|
|
669722
670312
|
shouldShowClaudeImportHint: () => shouldShowClaudeImportHint
|
|
669723
670313
|
});
|
|
669724
|
-
import { existsSync as
|
|
670314
|
+
import { existsSync as existsSync32 } from "node:fs";
|
|
669725
670315
|
import { homedir as homedir56 } from "node:os";
|
|
669726
670316
|
import { join as join199 } from "node:path";
|
|
669727
670317
|
function shouldShowClaudeImportHint() {
|
|
@@ -669729,8 +670319,8 @@ function shouldShowClaudeImportHint() {
|
|
|
669729
670319
|
const claudeEnvKey = "CLAUDE_CONFIG_DIR";
|
|
669730
670320
|
if (process.env.SEMA_CONFIG_DIR || process.env[claudeEnvKey]) return false;
|
|
669731
670321
|
const legacyDir = join199(homedir56(), ".claude");
|
|
669732
|
-
if (!
|
|
669733
|
-
if (
|
|
670322
|
+
if (!existsSync32(legacyDir)) return false;
|
|
670323
|
+
if (existsSync32(join199(homedir56(), ".sema"))) return false;
|
|
669734
670324
|
if (getGlobalConfig().hasSeenClaudeImportHint) return false;
|
|
669735
670325
|
return true;
|
|
669736
670326
|
} catch {
|
|
@@ -669766,14 +670356,14 @@ var semaSettingsSeed_exports = {};
|
|
|
669766
670356
|
__export(semaSettingsSeed_exports, {
|
|
669767
670357
|
seedSemaSettings: () => seedSemaSettings
|
|
669768
670358
|
});
|
|
669769
|
-
import { existsSync as
|
|
670359
|
+
import { existsSync as existsSync33, mkdirSync as mkdirSync23, readFileSync as readFileSync50, writeFileSync as writeFileSync20 } from "node:fs";
|
|
669770
670360
|
import { dirname as dirname87, join as join200 } from "node:path";
|
|
669771
670361
|
function seedSemaSettings() {
|
|
669772
670362
|
const file2 = join200(getClaudeConfigHomeDir(), "settings.json");
|
|
669773
670363
|
let current3 = {};
|
|
669774
670364
|
let parsedOk = false;
|
|
669775
670365
|
try {
|
|
669776
|
-
if (
|
|
670366
|
+
if (existsSync33(file2)) {
|
|
669777
670367
|
const parsed = JSON.parse(readFileSync50(file2, "utf8"));
|
|
669778
670368
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
669779
670369
|
current3 = parsed;
|
|
@@ -670100,6 +670690,21 @@ var init_node4 = __esm({
|
|
|
670100
670690
|
}
|
|
670101
670691
|
});
|
|
670102
670692
|
|
|
670693
|
+
// build-src/src/sema/scheduler/firePrompt.ts
|
|
670694
|
+
function effectiveFirePrompt(fire) {
|
|
670695
|
+
const raw2 = fire.prompt;
|
|
670696
|
+
if (typeof raw2 === "string" && raw2.trim().length > 0) return { prompt: raw2, substituted: false };
|
|
670697
|
+
const what = fire.mode === "session-wakeup" ? "wakeup" : "task";
|
|
670698
|
+
return {
|
|
670699
|
+
prompt: `A scheduled ${what} fired (record ${fire.recordId}), but its stored prompt was empty. Tell the user the scheduled prompt was lost, and use recent conversation context to decide whether anything needs doing.`,
|
|
670700
|
+
substituted: true
|
|
670701
|
+
};
|
|
670702
|
+
}
|
|
670703
|
+
var init_firePrompt = __esm({
|
|
670704
|
+
"build-src/src/sema/scheduler/firePrompt.ts"() {
|
|
670705
|
+
}
|
|
670706
|
+
});
|
|
670707
|
+
|
|
670103
670708
|
// build-src/src/sema/scheduler/schedulerDaemonWire.ts
|
|
670104
670709
|
import { join as join201 } from "node:path";
|
|
670105
670710
|
import { homedir as homedir57 } from "node:os";
|
|
@@ -670116,6 +670721,7 @@ var init_schedulerDaemonWire = __esm({
|
|
|
670116
670721
|
"build-src/src/sema/scheduler/schedulerDaemonWire.ts"() {
|
|
670117
670722
|
init_node4();
|
|
670118
670723
|
init_schedulerDaemon();
|
|
670724
|
+
init_firePrompt();
|
|
670119
670725
|
}
|
|
670120
670726
|
});
|
|
670121
670727
|
|
|
@@ -670132,22 +670738,31 @@ function ownsScheduledRecord(r) {
|
|
|
670132
670738
|
const current3 = getLiveSessionId() ?? String(getSessionId());
|
|
670133
670739
|
return r.sessionId === current3;
|
|
670134
670740
|
}
|
|
670135
|
-
function submitViaQueue() {
|
|
670741
|
+
function submitViaQueue(onWarn) {
|
|
670136
670742
|
return async (fire) => {
|
|
670743
|
+
const { prompt, substituted } = effectiveFirePrompt(fire);
|
|
670744
|
+
if (substituted) {
|
|
670745
|
+
onWarn?.(`scheduler: record ${fire.recordId} fired with an EMPTY prompt \u2014 substituted a placeholder (never inject empty user content)`);
|
|
670746
|
+
}
|
|
670137
670747
|
enqueuePendingNotification({
|
|
670138
|
-
value:
|
|
670748
|
+
value: prompt,
|
|
670139
670749
|
mode: "prompt",
|
|
670140
670750
|
priority: "later",
|
|
670141
670751
|
// never starve real user input (CC cron precedent)
|
|
670142
670752
|
isMeta: true,
|
|
670143
670753
|
// hidden injected prompt, visible assistant wake turn (CC useScheduledTasks precedent)
|
|
670754
|
+
skipSlashCommands: true,
|
|
670755
|
+
// CC 207 逐字位:fired prompt 是纯文本,不走本地 slash 命令路由
|
|
670756
|
+
// 件A 标记行驱动(handlePromptSubmit 按 origin.kind 渲 `✳ …` scheduled_task_fire 行;
|
|
670757
|
+
// 'loop' = session-wakeup(ScheduleWakeup 续班),'task' = cron/one-shot 排程。
|
|
670758
|
+
origin: { kind: "scheduled-task", cronKind: fire.mode === "session-wakeup" ? "loop" : "task" },
|
|
670144
670759
|
workload: WORKLOAD_CRON
|
|
670145
670760
|
});
|
|
670146
670761
|
};
|
|
670147
670762
|
}
|
|
670148
670763
|
function createReplSchedulerDaemon(opts = {}) {
|
|
670149
670764
|
const storePath = opts.storePath ?? schedulerStorePath();
|
|
670150
|
-
return new SchedulerDaemon(fileSchedulerStoreIO(storePath), submitViaQueue(), {
|
|
670765
|
+
return new SchedulerDaemon(fileSchedulerStoreIO(storePath), submitViaQueue((m2) => opts.onError?.(new Error(m2))), {
|
|
670151
670766
|
intervalMs: opts.intervalMs ?? REPL_SCHEDULER_TICK_MS,
|
|
670152
670767
|
owns: ownsScheduledRecord,
|
|
670153
670768
|
...opts.now ? { now: opts.now } : {},
|
|
@@ -670163,6 +670778,7 @@ var init_schedulerQueueSubmit = __esm({
|
|
|
670163
670778
|
init_liveSessionStore();
|
|
670164
670779
|
init_schedulerDaemon();
|
|
670165
670780
|
init_schedulerDaemonWire();
|
|
670781
|
+
init_firePrompt();
|
|
670166
670782
|
REPL_SCHEDULER_TICK_MS = 5e3;
|
|
670167
670783
|
}
|
|
670168
670784
|
});
|
|
@@ -670492,11 +671108,11 @@ var init_skillsFill = __esm({
|
|
|
670492
671108
|
});
|
|
670493
671109
|
|
|
670494
671110
|
// build-src/mock/commands/teamOnboarding.ts
|
|
670495
|
-
import { existsSync as
|
|
671111
|
+
import { existsSync as existsSync34, readdirSync as readdirSync14 } from "fs";
|
|
670496
671112
|
function hasWorkspaceData() {
|
|
670497
671113
|
try {
|
|
670498
671114
|
const dir = getProjectsDir2();
|
|
670499
|
-
if (!
|
|
671115
|
+
if (!existsSync34(dir)) return false;
|
|
670500
671116
|
return readdirSync14(dir).length > 0;
|
|
670501
671117
|
} catch {
|
|
670502
671118
|
return false;
|
|
@@ -671243,7 +671859,7 @@ __export(agentsHotReload_exports, {
|
|
|
671243
671859
|
startAgentsHotReload: () => startAgentsHotReload,
|
|
671244
671860
|
stopAgentsHotReload: () => stopAgentsHotReload
|
|
671245
671861
|
});
|
|
671246
|
-
import { watch as watch3, existsSync as
|
|
671862
|
+
import { watch as watch3, existsSync as existsSync35 } from "node:fs";
|
|
671247
671863
|
import { join as join203 } from "node:path";
|
|
671248
671864
|
async function reloadAgentDefinitions(cwd5) {
|
|
671249
671865
|
try {
|
|
@@ -671282,7 +671898,7 @@ async function startAgentsHotReload(cwd5) {
|
|
|
671282
671898
|
try {
|
|
671283
671899
|
const { getClaudeConfigHomeDir: getClaudeConfigHomeDir3 } = await Promise.resolve().then(() => (init_envUtils(), envUtils_exports));
|
|
671284
671900
|
const userDir = join203(getClaudeConfigHomeDir3(), "agents");
|
|
671285
|
-
if (
|
|
671901
|
+
if (existsSync35(userDir)) dirs.add(userDir);
|
|
671286
671902
|
} catch (e) {
|
|
671287
671903
|
if (process.env.SEMA_DEBUG) console.error("[sema] agents hot-reload user-dir scan soft-failed:", e);
|
|
671288
671904
|
}
|
|
@@ -673997,9 +674613,11 @@ async function launchReplProduction() {
|
|
|
673997
674613
|
const { createLiveConversationClient: createLiveConversationClient2 } = await Promise.resolve().then(() => (init_liveClient(), liveClient_exports));
|
|
673998
674614
|
const { setSeamClient: setSeamClient2 } = await Promise.resolve().then(() => (init_seamQuery(), seamQuery_exports));
|
|
673999
674615
|
const { setQueryEngineClient: setQueryEngineClient2 } = await Promise.resolve().then(() => (init_seamQueryEngine(), seamQueryEngine_exports));
|
|
674616
|
+
const { resolveLiveAuthToken: resolveLiveAuthToken2 } = await Promise.resolve().then(() => (init_engineTarget(), engineTarget_exports));
|
|
674000
674617
|
const newClient = createLiveConversationClient2({
|
|
674001
674618
|
baseUrl: rr.baseUrl,
|
|
674002
|
-
authToken:
|
|
674619
|
+
authToken: resolveLiveAuthToken2(rr.baseUrl),
|
|
674620
|
+
// #118:无 token loopback = loopback-unauthed,不伪造 'anon'
|
|
674003
674621
|
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
674004
674622
|
});
|
|
674005
674623
|
setSeamClient2(newClient);
|
|
@@ -674146,9 +674764,11 @@ async function launchReplProduction() {
|
|
|
674146
674764
|
const { createLiveConversationClient: createLiveConversationClient2 } = await Promise.resolve().then(() => (init_liveClient(), liveClient_exports));
|
|
674147
674765
|
const { setSeamClient: setSeamClient2 } = await Promise.resolve().then(() => (init_seamQuery(), seamQuery_exports));
|
|
674148
674766
|
const { setQueryEngineClient: setQueryEngineClient2 } = await Promise.resolve().then(() => (init_seamQueryEngine(), seamQueryEngine_exports));
|
|
674767
|
+
const { resolveLiveAuthToken: resolveLiveAuthToken2 } = await Promise.resolve().then(() => (init_engineTarget(), engineTarget_exports));
|
|
674149
674768
|
const swapClient = createLiveConversationClient2({
|
|
674150
674769
|
baseUrl: rr.baseUrl,
|
|
674151
|
-
authToken:
|
|
674770
|
+
authToken: resolveLiveAuthToken2(rr.baseUrl),
|
|
674771
|
+
// #118:同上,零 'anon' 占位符
|
|
674152
674772
|
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
674153
674773
|
});
|
|
674154
674774
|
setSeamClient2(swapClient);
|
|
@@ -674188,9 +674808,11 @@ async function launchReplProduction() {
|
|
|
674188
674808
|
const { setQueryEngineClient: setQueryEngineClient2 } = await Promise.resolve().then(() => (init_seamQueryEngine(), seamQueryEngine_exports));
|
|
674189
674809
|
const tok2 = tokenAfterRespawn();
|
|
674190
674810
|
if (tok2) process.env.SEMA_LIVE_TOKEN = tok2;
|
|
674811
|
+
const { resolveLiveAuthToken: resolveLiveAuthToken2 } = await Promise.resolve().then(() => (init_engineTarget(), engineTarget_exports));
|
|
674191
674812
|
const nextClient = createLiveConversationClient2({
|
|
674192
674813
|
baseUrl: rr.baseUrl,
|
|
674193
|
-
authToken:
|
|
674814
|
+
authToken: resolveLiveAuthToken2(rr.baseUrl),
|
|
674815
|
+
// #118:同上,零 'anon' 占位符
|
|
674194
674816
|
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
674195
674817
|
});
|
|
674196
674818
|
setSeamClient2(nextClient);
|
|
@@ -674242,9 +674864,10 @@ async function launchReplProduction() {
|
|
|
674242
674864
|
if (process.env.SEMA_DEBUG) console.error("[sema] persist wire soft-failed:", ePw);
|
|
674243
674865
|
}
|
|
674244
674866
|
}
|
|
674867
|
+
const { resolveLiveAuthToken: resolveBootAuth } = await Promise.resolve().then(() => (init_engineTarget(), engineTarget_exports));
|
|
674245
674868
|
const liveClient = createLiveConversationClient2({
|
|
674246
674869
|
baseUrl: process.env.SEMA_LIVE_BASEURL,
|
|
674247
|
-
authToken: process.env.
|
|
674870
|
+
authToken: resolveBootAuth(process.env.SEMA_LIVE_BASEURL),
|
|
674248
674871
|
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
674249
674872
|
});
|
|
674250
674873
|
setSeamClient2(liveClient);
|
|
@@ -674362,7 +674985,8 @@ async function launchReplProduction() {
|
|
|
674362
674985
|
const { setLiveModelCatalog: setLiveModelCatalog2 } = await Promise.resolve().then(() => (init_liveModelCatalog(), liveModelCatalog_exports));
|
|
674363
674986
|
const catalog2 = await fetchLiveModelCatalog2({
|
|
674364
674987
|
baseUrl: process.env.SEMA_LIVE_BASEURL,
|
|
674365
|
-
authToken: process.env.
|
|
674988
|
+
authToken: resolveBootAuth(process.env.SEMA_LIVE_BASEURL),
|
|
674989
|
+
// #118:同 boot client,零 'anon' 占位符
|
|
674366
674990
|
principal: process.env.SEMA_LIVE_PRINCIPAL ?? "anon:shell-live"
|
|
674367
674991
|
});
|
|
674368
674992
|
setLiveModelCatalog2(catalog2);
|