@chosengeneration/light-code 0.162.0 → 0.163.0
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/dist/cli.cjs +1753 -980
- package/dist/server.cjs +1643 -975
- package/package.json +1 -1
package/dist/server.cjs
CHANGED
|
@@ -104,54 +104,54 @@ var require_errors = __commonJS({
|
|
|
104
104
|
"../../node_modules/.pnpm/undici@5.29.0/node_modules/undici/lib/core/errors.js"(exports2, module2) {
|
|
105
105
|
"use strict";
|
|
106
106
|
var UndiciError = class extends Error {
|
|
107
|
-
constructor(
|
|
108
|
-
super(
|
|
107
|
+
constructor(message5) {
|
|
108
|
+
super(message5);
|
|
109
109
|
this.name = "UndiciError";
|
|
110
110
|
this.code = "UND_ERR";
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
113
|
var ConnectTimeoutError = class _ConnectTimeoutError extends UndiciError {
|
|
114
|
-
constructor(
|
|
115
|
-
super(
|
|
114
|
+
constructor(message5) {
|
|
115
|
+
super(message5);
|
|
116
116
|
Error.captureStackTrace(this, _ConnectTimeoutError);
|
|
117
117
|
this.name = "ConnectTimeoutError";
|
|
118
|
-
this.message =
|
|
118
|
+
this.message = message5 || "Connect Timeout Error";
|
|
119
119
|
this.code = "UND_ERR_CONNECT_TIMEOUT";
|
|
120
120
|
}
|
|
121
121
|
};
|
|
122
122
|
var HeadersTimeoutError = class _HeadersTimeoutError extends UndiciError {
|
|
123
|
-
constructor(
|
|
124
|
-
super(
|
|
123
|
+
constructor(message5) {
|
|
124
|
+
super(message5);
|
|
125
125
|
Error.captureStackTrace(this, _HeadersTimeoutError);
|
|
126
126
|
this.name = "HeadersTimeoutError";
|
|
127
|
-
this.message =
|
|
127
|
+
this.message = message5 || "Headers Timeout Error";
|
|
128
128
|
this.code = "UND_ERR_HEADERS_TIMEOUT";
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
131
|
var HeadersOverflowError = class _HeadersOverflowError extends UndiciError {
|
|
132
|
-
constructor(
|
|
133
|
-
super(
|
|
132
|
+
constructor(message5) {
|
|
133
|
+
super(message5);
|
|
134
134
|
Error.captureStackTrace(this, _HeadersOverflowError);
|
|
135
135
|
this.name = "HeadersOverflowError";
|
|
136
|
-
this.message =
|
|
136
|
+
this.message = message5 || "Headers Overflow Error";
|
|
137
137
|
this.code = "UND_ERR_HEADERS_OVERFLOW";
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
var BodyTimeoutError = class _BodyTimeoutError extends UndiciError {
|
|
141
|
-
constructor(
|
|
142
|
-
super(
|
|
141
|
+
constructor(message5) {
|
|
142
|
+
super(message5);
|
|
143
143
|
Error.captureStackTrace(this, _BodyTimeoutError);
|
|
144
144
|
this.name = "BodyTimeoutError";
|
|
145
|
-
this.message =
|
|
145
|
+
this.message = message5 || "Body Timeout Error";
|
|
146
146
|
this.code = "UND_ERR_BODY_TIMEOUT";
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
var ResponseStatusCodeError = class _ResponseStatusCodeError extends UndiciError {
|
|
150
|
-
constructor(
|
|
151
|
-
super(
|
|
150
|
+
constructor(message5, statusCode, headers, body) {
|
|
151
|
+
super(message5);
|
|
152
152
|
Error.captureStackTrace(this, _ResponseStatusCodeError);
|
|
153
153
|
this.name = "ResponseStatusCodeError";
|
|
154
|
-
this.message =
|
|
154
|
+
this.message = message5 || "Response Status Code Error";
|
|
155
155
|
this.code = "UND_ERR_RESPONSE_STATUS_CODE";
|
|
156
156
|
this.body = body;
|
|
157
157
|
this.status = statusCode;
|
|
@@ -160,108 +160,108 @@ var require_errors = __commonJS({
|
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
var InvalidArgumentError = class _InvalidArgumentError extends UndiciError {
|
|
163
|
-
constructor(
|
|
164
|
-
super(
|
|
163
|
+
constructor(message5) {
|
|
164
|
+
super(message5);
|
|
165
165
|
Error.captureStackTrace(this, _InvalidArgumentError);
|
|
166
166
|
this.name = "InvalidArgumentError";
|
|
167
|
-
this.message =
|
|
167
|
+
this.message = message5 || "Invalid Argument Error";
|
|
168
168
|
this.code = "UND_ERR_INVALID_ARG";
|
|
169
169
|
}
|
|
170
170
|
};
|
|
171
171
|
var InvalidReturnValueError = class _InvalidReturnValueError extends UndiciError {
|
|
172
|
-
constructor(
|
|
173
|
-
super(
|
|
172
|
+
constructor(message5) {
|
|
173
|
+
super(message5);
|
|
174
174
|
Error.captureStackTrace(this, _InvalidReturnValueError);
|
|
175
175
|
this.name = "InvalidReturnValueError";
|
|
176
|
-
this.message =
|
|
176
|
+
this.message = message5 || "Invalid Return Value Error";
|
|
177
177
|
this.code = "UND_ERR_INVALID_RETURN_VALUE";
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
180
|
var RequestAbortedError = class _RequestAbortedError extends UndiciError {
|
|
181
|
-
constructor(
|
|
182
|
-
super(
|
|
181
|
+
constructor(message5) {
|
|
182
|
+
super(message5);
|
|
183
183
|
Error.captureStackTrace(this, _RequestAbortedError);
|
|
184
184
|
this.name = "AbortError";
|
|
185
|
-
this.message =
|
|
185
|
+
this.message = message5 || "Request aborted";
|
|
186
186
|
this.code = "UND_ERR_ABORTED";
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
var InformationalError = class _InformationalError extends UndiciError {
|
|
190
|
-
constructor(
|
|
191
|
-
super(
|
|
190
|
+
constructor(message5) {
|
|
191
|
+
super(message5);
|
|
192
192
|
Error.captureStackTrace(this, _InformationalError);
|
|
193
193
|
this.name = "InformationalError";
|
|
194
|
-
this.message =
|
|
194
|
+
this.message = message5 || "Request information";
|
|
195
195
|
this.code = "UND_ERR_INFO";
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
var RequestContentLengthMismatchError = class _RequestContentLengthMismatchError extends UndiciError {
|
|
199
|
-
constructor(
|
|
200
|
-
super(
|
|
199
|
+
constructor(message5) {
|
|
200
|
+
super(message5);
|
|
201
201
|
Error.captureStackTrace(this, _RequestContentLengthMismatchError);
|
|
202
202
|
this.name = "RequestContentLengthMismatchError";
|
|
203
|
-
this.message =
|
|
203
|
+
this.message = message5 || "Request body length does not match content-length header";
|
|
204
204
|
this.code = "UND_ERR_REQ_CONTENT_LENGTH_MISMATCH";
|
|
205
205
|
}
|
|
206
206
|
};
|
|
207
207
|
var ResponseContentLengthMismatchError = class _ResponseContentLengthMismatchError extends UndiciError {
|
|
208
|
-
constructor(
|
|
209
|
-
super(
|
|
208
|
+
constructor(message5) {
|
|
209
|
+
super(message5);
|
|
210
210
|
Error.captureStackTrace(this, _ResponseContentLengthMismatchError);
|
|
211
211
|
this.name = "ResponseContentLengthMismatchError";
|
|
212
|
-
this.message =
|
|
212
|
+
this.message = message5 || "Response body length does not match content-length header";
|
|
213
213
|
this.code = "UND_ERR_RES_CONTENT_LENGTH_MISMATCH";
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
var ClientDestroyedError = class _ClientDestroyedError extends UndiciError {
|
|
217
|
-
constructor(
|
|
218
|
-
super(
|
|
217
|
+
constructor(message5) {
|
|
218
|
+
super(message5);
|
|
219
219
|
Error.captureStackTrace(this, _ClientDestroyedError);
|
|
220
220
|
this.name = "ClientDestroyedError";
|
|
221
|
-
this.message =
|
|
221
|
+
this.message = message5 || "The client is destroyed";
|
|
222
222
|
this.code = "UND_ERR_DESTROYED";
|
|
223
223
|
}
|
|
224
224
|
};
|
|
225
225
|
var ClientClosedError = class _ClientClosedError extends UndiciError {
|
|
226
|
-
constructor(
|
|
227
|
-
super(
|
|
226
|
+
constructor(message5) {
|
|
227
|
+
super(message5);
|
|
228
228
|
Error.captureStackTrace(this, _ClientClosedError);
|
|
229
229
|
this.name = "ClientClosedError";
|
|
230
|
-
this.message =
|
|
230
|
+
this.message = message5 || "The client is closed";
|
|
231
231
|
this.code = "UND_ERR_CLOSED";
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
var SocketError = class _SocketError extends UndiciError {
|
|
235
|
-
constructor(
|
|
236
|
-
super(
|
|
235
|
+
constructor(message5, socket) {
|
|
236
|
+
super(message5);
|
|
237
237
|
Error.captureStackTrace(this, _SocketError);
|
|
238
238
|
this.name = "SocketError";
|
|
239
|
-
this.message =
|
|
239
|
+
this.message = message5 || "Socket error";
|
|
240
240
|
this.code = "UND_ERR_SOCKET";
|
|
241
241
|
this.socket = socket;
|
|
242
242
|
}
|
|
243
243
|
};
|
|
244
244
|
var NotSupportedError = class _NotSupportedError extends UndiciError {
|
|
245
|
-
constructor(
|
|
246
|
-
super(
|
|
245
|
+
constructor(message5) {
|
|
246
|
+
super(message5);
|
|
247
247
|
Error.captureStackTrace(this, _NotSupportedError);
|
|
248
248
|
this.name = "NotSupportedError";
|
|
249
|
-
this.message =
|
|
249
|
+
this.message = message5 || "Not supported error";
|
|
250
250
|
this.code = "UND_ERR_NOT_SUPPORTED";
|
|
251
251
|
}
|
|
252
252
|
};
|
|
253
253
|
var BalancedPoolMissingUpstreamError = class extends UndiciError {
|
|
254
|
-
constructor(
|
|
255
|
-
super(
|
|
254
|
+
constructor(message5) {
|
|
255
|
+
super(message5);
|
|
256
256
|
Error.captureStackTrace(this, NotSupportedError);
|
|
257
257
|
this.name = "MissingUpstreamError";
|
|
258
|
-
this.message =
|
|
258
|
+
this.message = message5 || "No upstream has been added to the BalancedPool";
|
|
259
259
|
this.code = "UND_ERR_BPL_MISSING_UPSTREAM";
|
|
260
260
|
}
|
|
261
261
|
};
|
|
262
262
|
var HTTPParserError = class _HTTPParserError extends Error {
|
|
263
|
-
constructor(
|
|
264
|
-
super(
|
|
263
|
+
constructor(message5, code, data) {
|
|
264
|
+
super(message5);
|
|
265
265
|
Error.captureStackTrace(this, _HTTPParserError);
|
|
266
266
|
this.name = "HTTPParserError";
|
|
267
267
|
this.code = code ? `HPE_${code}` : void 0;
|
|
@@ -269,20 +269,20 @@ var require_errors = __commonJS({
|
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
271
|
var ResponseExceededMaxSizeError = class _ResponseExceededMaxSizeError extends UndiciError {
|
|
272
|
-
constructor(
|
|
273
|
-
super(
|
|
272
|
+
constructor(message5) {
|
|
273
|
+
super(message5);
|
|
274
274
|
Error.captureStackTrace(this, _ResponseExceededMaxSizeError);
|
|
275
275
|
this.name = "ResponseExceededMaxSizeError";
|
|
276
|
-
this.message =
|
|
276
|
+
this.message = message5 || "Response content exceeded max size";
|
|
277
277
|
this.code = "UND_ERR_RES_EXCEEDED_MAX_SIZE";
|
|
278
278
|
}
|
|
279
279
|
};
|
|
280
280
|
var RequestRetryError = class _RequestRetryError extends UndiciError {
|
|
281
|
-
constructor(
|
|
282
|
-
super(
|
|
281
|
+
constructor(message5, code, { headers, data }) {
|
|
282
|
+
super(message5);
|
|
283
283
|
Error.captureStackTrace(this, _RequestRetryError);
|
|
284
284
|
this.name = "RequestRetryError";
|
|
285
|
-
this.message =
|
|
285
|
+
this.message = message5 || "Request retry error";
|
|
286
286
|
this.code = "UND_ERR_REQ_RETRY";
|
|
287
287
|
this.statusCode = code;
|
|
288
288
|
this.data = data;
|
|
@@ -3761,15 +3761,15 @@ var require_webidl = __commonJS({
|
|
|
3761
3761
|
webidl.converters = {};
|
|
3762
3762
|
webidl.util = {};
|
|
3763
3763
|
webidl.errors = {};
|
|
3764
|
-
webidl.errors.exception = function(
|
|
3765
|
-
return new TypeError(`${
|
|
3764
|
+
webidl.errors.exception = function(message5) {
|
|
3765
|
+
return new TypeError(`${message5.header}: ${message5.message}`);
|
|
3766
3766
|
};
|
|
3767
3767
|
webidl.errors.conversionFailed = function(context) {
|
|
3768
3768
|
const plural = context.types.length === 1 ? "" : " one of";
|
|
3769
|
-
const
|
|
3769
|
+
const message5 = `${context.argument} could not be converted to${plural}: ${context.types.join(", ")}.`;
|
|
3770
3770
|
return webidl.errors.exception({
|
|
3771
3771
|
header: context.prefix,
|
|
3772
|
-
message:
|
|
3772
|
+
message: message5
|
|
3773
3773
|
});
|
|
3774
3774
|
};
|
|
3775
3775
|
webidl.errors.invalidArgument = function(context) {
|
|
@@ -4175,9 +4175,9 @@ var require_dataURL = __commonJS({
|
|
|
4175
4175
|
const hashLength = url2.hash.length;
|
|
4176
4176
|
return hashLength === 0 ? href : href.substring(0, href.length - hashLength);
|
|
4177
4177
|
}
|
|
4178
|
-
function collectASequenceOfCodePoints(
|
|
4178
|
+
function collectASequenceOfCodePoints(condition2, input, position) {
|
|
4179
4179
|
let result = "";
|
|
4180
|
-
while (position.position < input.length &&
|
|
4180
|
+
while (position.position < input.length && condition2(input[position.position])) {
|
|
4181
4181
|
result += input[position.position];
|
|
4182
4182
|
position.position++;
|
|
4183
4183
|
}
|
|
@@ -6911,12 +6911,12 @@ var require_client = __commonJS({
|
|
|
6911
6911
|
socket.unshift(data.slice(offset));
|
|
6912
6912
|
} else if (ret !== constants2.ERROR.OK) {
|
|
6913
6913
|
const ptr = llhttp.llhttp_get_error_reason(this.ptr);
|
|
6914
|
-
let
|
|
6914
|
+
let message5 = "";
|
|
6915
6915
|
if (ptr) {
|
|
6916
6916
|
const len = new Uint8Array(llhttp.memory.buffer, ptr).indexOf(0);
|
|
6917
|
-
|
|
6917
|
+
message5 = "Response does not match the HTTP/1.1 protocol (" + Buffer.from(llhttp.memory.buffer, ptr, len).toString() + ")";
|
|
6918
6918
|
}
|
|
6919
|
-
throw new HTTPParserError(
|
|
6919
|
+
throw new HTTPParserError(message5, constants2.ERROR[ret], data.slice(offset));
|
|
6920
6920
|
}
|
|
6921
6921
|
} catch (err) {
|
|
6922
6922
|
util.destroy(socket, err);
|
|
@@ -9762,11 +9762,11 @@ var require_mock_errors = __commonJS({
|
|
|
9762
9762
|
"use strict";
|
|
9763
9763
|
var { UndiciError } = require_errors();
|
|
9764
9764
|
var MockNotMatchedError = class _MockNotMatchedError extends UndiciError {
|
|
9765
|
-
constructor(
|
|
9766
|
-
super(
|
|
9765
|
+
constructor(message5) {
|
|
9766
|
+
super(message5);
|
|
9767
9767
|
Error.captureStackTrace(this, _MockNotMatchedError);
|
|
9768
9768
|
this.name = "MockNotMatchedError";
|
|
9769
|
-
this.message =
|
|
9769
|
+
this.message = message5 || "The request does not match any registered mock dispatches";
|
|
9770
9770
|
this.code = "UND_MOCK_ERR_MOCK_NOT_MATCHED";
|
|
9771
9771
|
}
|
|
9772
9772
|
};
|
|
@@ -17306,9 +17306,9 @@ var require_codegen = __commonJS({
|
|
|
17306
17306
|
};
|
|
17307
17307
|
Else.kind = "else";
|
|
17308
17308
|
var If = class _If extends BlockNode {
|
|
17309
|
-
constructor(
|
|
17309
|
+
constructor(condition2, nodes) {
|
|
17310
17310
|
super(nodes);
|
|
17311
|
-
this.condition =
|
|
17311
|
+
this.condition = condition2;
|
|
17312
17312
|
}
|
|
17313
17313
|
render(opts) {
|
|
17314
17314
|
let code = `if(${this.condition})` + super.render(opts);
|
|
@@ -17571,8 +17571,8 @@ var require_codegen = __commonJS({
|
|
|
17571
17571
|
return new code_1._Code(code);
|
|
17572
17572
|
}
|
|
17573
17573
|
// `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed)
|
|
17574
|
-
if(
|
|
17575
|
-
this._blockNode(new If(
|
|
17574
|
+
if(condition2, thenBody, elseBody) {
|
|
17575
|
+
this._blockNode(new If(condition2));
|
|
17576
17576
|
if (thenBody && elseBody) {
|
|
17577
17577
|
this.code(thenBody).else().code(elseBody).endIf();
|
|
17578
17578
|
} else if (thenBody) {
|
|
@@ -17583,8 +17583,8 @@ var require_codegen = __commonJS({
|
|
|
17583
17583
|
return this;
|
|
17584
17584
|
}
|
|
17585
17585
|
// `else if` clause - invalid without `if` or after `else` clauses
|
|
17586
|
-
elseIf(
|
|
17587
|
-
return this._elseNode(new If(
|
|
17586
|
+
elseIf(condition2) {
|
|
17587
|
+
return this._elseNode(new If(condition2));
|
|
17588
17588
|
}
|
|
17589
17589
|
// `else` clause - only valid after `if` or `else if` clauses
|
|
17590
17590
|
else() {
|
|
@@ -18118,12 +18118,12 @@ var require_errors2 = __commonJS({
|
|
|
18118
18118
|
}
|
|
18119
18119
|
return [E.schemaPath, schPath];
|
|
18120
18120
|
}
|
|
18121
|
-
function extraErrorProps(cxt, { params: params3, message:
|
|
18121
|
+
function extraErrorProps(cxt, { params: params3, message: message5 }, keyValues) {
|
|
18122
18122
|
const { keyword, data, schemaValue, it } = cxt;
|
|
18123
18123
|
const { opts, propertyName, topSchemaRef, schemaPath } = it;
|
|
18124
18124
|
keyValues.push([E.keyword, keyword], [E.params, typeof params3 == "function" ? params3(cxt) : params3 || (0, codegen_1._)`{}`]);
|
|
18125
18125
|
if (opts.messages) {
|
|
18126
|
-
keyValues.push([E.message, typeof
|
|
18126
|
+
keyValues.push([E.message, typeof message5 == "function" ? message5(cxt) : message5]);
|
|
18127
18127
|
}
|
|
18128
18128
|
if (opts.verbose) {
|
|
18129
18129
|
keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._)`${topSchemaRef}${schemaPath}`], [names_1.default.data, data]);
|
|
@@ -18451,11 +18451,11 @@ var require_defaults = __commonJS({
|
|
|
18451
18451
|
(0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`);
|
|
18452
18452
|
return;
|
|
18453
18453
|
}
|
|
18454
|
-
let
|
|
18454
|
+
let condition2 = (0, codegen_1._)`${childData} === undefined`;
|
|
18455
18455
|
if (opts.useDefaults === "empty") {
|
|
18456
|
-
|
|
18456
|
+
condition2 = (0, codegen_1._)`${condition2} || ${childData} === null || ${childData} === ""`;
|
|
18457
18457
|
}
|
|
18458
|
-
gen.if(
|
|
18458
|
+
gen.if(condition2, (0, codegen_1._)`${childData} = ${(0, codegen_1.stringify)(defaultValue)}`);
|
|
18459
18459
|
}
|
|
18460
18460
|
}
|
|
18461
18461
|
});
|
|
@@ -19379,11 +19379,11 @@ var require_validate = __commonJS({
|
|
|
19379
19379
|
this.errsCount = it.gen.const("_errs", names_1.default.errors);
|
|
19380
19380
|
}
|
|
19381
19381
|
}
|
|
19382
|
-
result(
|
|
19383
|
-
this.failResult((0, codegen_1.not)(
|
|
19382
|
+
result(condition2, successAction, failAction) {
|
|
19383
|
+
this.failResult((0, codegen_1.not)(condition2), successAction, failAction);
|
|
19384
19384
|
}
|
|
19385
|
-
failResult(
|
|
19386
|
-
this.gen.if(
|
|
19385
|
+
failResult(condition2, successAction, failAction) {
|
|
19386
|
+
this.gen.if(condition2);
|
|
19387
19387
|
if (failAction)
|
|
19388
19388
|
failAction();
|
|
19389
19389
|
else
|
|
@@ -19400,28 +19400,28 @@ var require_validate = __commonJS({
|
|
|
19400
19400
|
this.gen.else();
|
|
19401
19401
|
}
|
|
19402
19402
|
}
|
|
19403
|
-
pass(
|
|
19404
|
-
this.failResult((0, codegen_1.not)(
|
|
19403
|
+
pass(condition2, failAction) {
|
|
19404
|
+
this.failResult((0, codegen_1.not)(condition2), void 0, failAction);
|
|
19405
19405
|
}
|
|
19406
|
-
fail(
|
|
19407
|
-
if (
|
|
19406
|
+
fail(condition2) {
|
|
19407
|
+
if (condition2 === void 0) {
|
|
19408
19408
|
this.error();
|
|
19409
19409
|
if (!this.allErrors)
|
|
19410
19410
|
this.gen.if(false);
|
|
19411
19411
|
return;
|
|
19412
19412
|
}
|
|
19413
|
-
this.gen.if(
|
|
19413
|
+
this.gen.if(condition2);
|
|
19414
19414
|
this.error();
|
|
19415
19415
|
if (this.allErrors)
|
|
19416
19416
|
this.gen.endIf();
|
|
19417
19417
|
else
|
|
19418
19418
|
this.gen.else();
|
|
19419
19419
|
}
|
|
19420
|
-
fail$data(
|
|
19420
|
+
fail$data(condition2) {
|
|
19421
19421
|
if (!this.$data)
|
|
19422
|
-
return this.fail(
|
|
19422
|
+
return this.fail(condition2);
|
|
19423
19423
|
const { schemaCode } = this;
|
|
19424
|
-
this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(),
|
|
19424
|
+
this.fail((0, codegen_1._)`${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition2)})`);
|
|
19425
19425
|
}
|
|
19426
19426
|
error(append, errorParams, errorPaths) {
|
|
19427
19427
|
if (errorParams) {
|
|
@@ -20949,11 +20949,11 @@ var require_core = __commonJS({
|
|
|
20949
20949
|
}
|
|
20950
20950
|
const valid = this.validate($schema, schema8);
|
|
20951
20951
|
if (!valid && throwOrLogError) {
|
|
20952
|
-
const
|
|
20952
|
+
const message5 = "schema is invalid: " + this.errorsText();
|
|
20953
20953
|
if (this.opts.validateSchema === "log")
|
|
20954
|
-
this.logger.error(
|
|
20954
|
+
this.logger.error(message5);
|
|
20955
20955
|
else
|
|
20956
|
-
throw new Error(
|
|
20956
|
+
throw new Error(message5);
|
|
20957
20957
|
}
|
|
20958
20958
|
return valid;
|
|
20959
20959
|
}
|
|
@@ -24580,21 +24580,21 @@ var FetchHttpClient = class {
|
|
|
24580
24580
|
};
|
|
24581
24581
|
function describeCause(error51) {
|
|
24582
24582
|
let current = error51;
|
|
24583
|
-
let
|
|
24583
|
+
let message5 = error51.message;
|
|
24584
24584
|
for (let depth = 0; depth < 4 && current instanceof Error; depth++) {
|
|
24585
24585
|
if (current.message.length > 0)
|
|
24586
|
-
|
|
24586
|
+
message5 = current.message;
|
|
24587
24587
|
current = current.cause;
|
|
24588
24588
|
}
|
|
24589
|
-
return
|
|
24589
|
+
return message5;
|
|
24590
24590
|
}
|
|
24591
24591
|
|
|
24592
24592
|
// ../../packages/core/dist/platform/connectionTls.js
|
|
24593
24593
|
var import_promises = __toESM(require("node:fs/promises"), 1);
|
|
24594
24594
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
24595
24595
|
var TlsConfigError = class extends Error {
|
|
24596
|
-
constructor(
|
|
24597
|
-
super(
|
|
24596
|
+
constructor(message5) {
|
|
24597
|
+
super(message5);
|
|
24598
24598
|
this.name = "TlsConfigError";
|
|
24599
24599
|
}
|
|
24600
24600
|
};
|
|
@@ -25841,14 +25841,14 @@ function prefixIssues(path63, issues) {
|
|
|
25841
25841
|
return iss;
|
|
25842
25842
|
});
|
|
25843
25843
|
}
|
|
25844
|
-
function unwrapMessage(
|
|
25845
|
-
return typeof
|
|
25844
|
+
function unwrapMessage(message5) {
|
|
25845
|
+
return typeof message5 === "string" ? message5 : message5?.message;
|
|
25846
25846
|
}
|
|
25847
25847
|
function finalizeIssue(iss, ctx, config2) {
|
|
25848
|
-
const
|
|
25848
|
+
const message5 = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
|
|
25849
25849
|
const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
|
|
25850
25850
|
rest.path ?? (rest.path = []);
|
|
25851
|
-
rest.message =
|
|
25851
|
+
rest.message = message5;
|
|
25852
25852
|
if (ctx?.reportInput) {
|
|
25853
25853
|
rest.input = _input;
|
|
25854
25854
|
}
|
|
@@ -40900,8 +40900,8 @@ var configSchema = external_exports.object({
|
|
|
40900
40900
|
}).partial();
|
|
40901
40901
|
var ConfigValidationError = class extends Error {
|
|
40902
40902
|
issues;
|
|
40903
|
-
constructor(
|
|
40904
|
-
super(
|
|
40903
|
+
constructor(message5, issues) {
|
|
40904
|
+
super(message5);
|
|
40905
40905
|
this.issues = issues;
|
|
40906
40906
|
this.name = "ConfigValidationError";
|
|
40907
40907
|
}
|
|
@@ -41852,23 +41852,23 @@ var Logger = class {
|
|
|
41852
41852
|
this.knownSecrets = options.knownSecrets ?? (() => []);
|
|
41853
41853
|
this.sink = options.sink ?? ((line) => console.log(line));
|
|
41854
41854
|
}
|
|
41855
|
-
debug(
|
|
41856
|
-
this.write("debug",
|
|
41855
|
+
debug(message5, ...args) {
|
|
41856
|
+
this.write("debug", message5, args);
|
|
41857
41857
|
}
|
|
41858
|
-
info(
|
|
41859
|
-
this.write("info",
|
|
41858
|
+
info(message5, ...args) {
|
|
41859
|
+
this.write("info", message5, args);
|
|
41860
41860
|
}
|
|
41861
|
-
warn(
|
|
41862
|
-
this.write("warn",
|
|
41861
|
+
warn(message5, ...args) {
|
|
41862
|
+
this.write("warn", message5, args);
|
|
41863
41863
|
}
|
|
41864
|
-
error(
|
|
41865
|
-
this.write("error",
|
|
41864
|
+
error(message5, ...args) {
|
|
41865
|
+
this.write("error", message5, args);
|
|
41866
41866
|
}
|
|
41867
|
-
write(
|
|
41868
|
-
if (LEVEL_ORDER[
|
|
41867
|
+
write(level2, message5, args) {
|
|
41868
|
+
if (LEVEL_ORDER[level2] < LEVEL_ORDER[this.level])
|
|
41869
41869
|
return;
|
|
41870
|
-
const rendered = [
|
|
41871
|
-
this.sink(`[${
|
|
41870
|
+
const rendered = [message5, ...args.map(formatArg)].join(" ");
|
|
41871
|
+
this.sink(`[${level2}] ${redact(rendered, this.knownSecrets())}`);
|
|
41872
41872
|
}
|
|
41873
41873
|
};
|
|
41874
41874
|
|
|
@@ -42281,8 +42281,8 @@ function readPath2(source, dottedPath) {
|
|
|
42281
42281
|
}, source);
|
|
42282
42282
|
}
|
|
42283
42283
|
var ApigeeAuthError = class extends Error {
|
|
42284
|
-
constructor(
|
|
42285
|
-
super(
|
|
42284
|
+
constructor(message5) {
|
|
42285
|
+
super(message5);
|
|
42286
42286
|
this.name = "ApigeeAuthError";
|
|
42287
42287
|
}
|
|
42288
42288
|
};
|
|
@@ -42421,7 +42421,7 @@ function describeTlsError(error51) {
|
|
|
42421
42421
|
chain.push(current);
|
|
42422
42422
|
current = current.cause;
|
|
42423
42423
|
}
|
|
42424
|
-
const
|
|
42424
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
42425
42425
|
const combined = chain.map((link) => `${link.code ?? ""} ${link instanceof Error ? link.message : String(link)}`).join(" ");
|
|
42426
42426
|
if (/UNABLE_TO_VERIFY_LEAF_SIGNATURE|SELF_SIGNED_CERT|UNABLE_TO_GET_ISSUER_CERT|unable to get local issuer|unable to verify the first certificate/i.test(combined)) {
|
|
42427
42427
|
return "the server certificate could not be verified. If your network intercepts TLS, add the corporate root CA (caFile, or NODE_EXTRA_CA_CERTS).";
|
|
@@ -42443,7 +42443,7 @@ function describeTlsError(error51) {
|
|
|
42443
42443
|
}
|
|
42444
42444
|
const deepest = chain[chain.length - 1];
|
|
42445
42445
|
const deepestMessage = deepest instanceof Error ? deepest.message : String(deepest);
|
|
42446
|
-
return
|
|
42446
|
+
return message5 === "fetch failed" && deepestMessage !== message5 ? deepestMessage : message5;
|
|
42447
42447
|
}
|
|
42448
42448
|
|
|
42449
42449
|
// ../../packages/core/dist/providers/auth/certs.js
|
|
@@ -42451,8 +42451,8 @@ var import_node_crypto2 = __toESM(require("node:crypto"), 1);
|
|
|
42451
42451
|
var import_promises3 = __toESM(require("node:fs/promises"), 1);
|
|
42452
42452
|
var import_node_path7 = __toESM(require("node:path"), 1);
|
|
42453
42453
|
var CertError = class extends Error {
|
|
42454
|
-
constructor(
|
|
42455
|
-
super(
|
|
42454
|
+
constructor(message5) {
|
|
42455
|
+
super(message5);
|
|
42456
42456
|
this.name = "CertError";
|
|
42457
42457
|
}
|
|
42458
42458
|
};
|
|
@@ -42491,11 +42491,11 @@ function assertKeyMatchesCert(cert, key2, passphrase) {
|
|
|
42491
42491
|
try {
|
|
42492
42492
|
privateKey = import_node_crypto2.default.createPrivateKey(passphrase !== void 0 ? { key: key2, passphrase } : { key: key2 });
|
|
42493
42493
|
} catch (error51) {
|
|
42494
|
-
const
|
|
42495
|
-
if (/bad decrypt|bad password|passphrase/i.test(
|
|
42494
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
42495
|
+
if (/bad decrypt|bad password|passphrase/i.test(message5)) {
|
|
42496
42496
|
throw new CertError("The private key is encrypted and the passphrase is missing or wrong.");
|
|
42497
42497
|
}
|
|
42498
|
-
throw new CertError(`The private key could not be parsed: ${
|
|
42498
|
+
throw new CertError(`The private key could not be parsed: ${message5}`);
|
|
42499
42499
|
}
|
|
42500
42500
|
const probe2 = Buffer.from("light-code-key-match-probe");
|
|
42501
42501
|
try {
|
|
@@ -42562,8 +42562,8 @@ function checkExpiry(notAfter, now = /* @__PURE__ */ new Date()) {
|
|
|
42562
42562
|
|
|
42563
42563
|
// ../../packages/core/dist/providers/auth/factory.js
|
|
42564
42564
|
var AuthConfigError = class extends Error {
|
|
42565
|
-
constructor(
|
|
42566
|
-
super(
|
|
42565
|
+
constructor(message5) {
|
|
42566
|
+
super(message5);
|
|
42567
42567
|
this.name = "AuthConfigError";
|
|
42568
42568
|
}
|
|
42569
42569
|
};
|
|
@@ -43153,21 +43153,21 @@ function partialMarkerLength(buffer, marker) {
|
|
|
43153
43153
|
function describeRequestError(error51, url2) {
|
|
43154
43154
|
return `Could not reach ${url2}: ${describeTlsError(error51)}`;
|
|
43155
43155
|
}
|
|
43156
|
-
function toWireMessage(
|
|
43157
|
-
if (
|
|
43158
|
-
const parts =
|
|
43156
|
+
function toWireMessage(message5) {
|
|
43157
|
+
if (message5.role === "user" && message5.images !== void 0 && message5.images.length > 0) {
|
|
43158
|
+
const parts = message5.images.map((image) => ({
|
|
43159
43159
|
type: "image_url",
|
|
43160
43160
|
image_url: { url: `data:${image.mediaType};base64,${image.data}` }
|
|
43161
43161
|
}));
|
|
43162
|
-
if (
|
|
43163
|
-
parts.push({ type: "text", text:
|
|
43162
|
+
if (message5.content.length > 0)
|
|
43163
|
+
parts.push({ type: "text", text: message5.content });
|
|
43164
43164
|
return { role: "user", content: parts };
|
|
43165
43165
|
}
|
|
43166
|
-
if (
|
|
43167
|
-
const wire = { role: "assistant", content:
|
|
43168
|
-
if (
|
|
43169
|
-
wire.content =
|
|
43170
|
-
wire.tool_calls =
|
|
43166
|
+
if (message5.role === "assistant") {
|
|
43167
|
+
const wire = { role: "assistant", content: message5.content };
|
|
43168
|
+
if (message5.toolCalls !== void 0 && message5.toolCalls.length > 0) {
|
|
43169
|
+
wire.content = message5.content.length > 0 ? message5.content : null;
|
|
43170
|
+
wire.tool_calls = message5.toolCalls.map((call) => ({
|
|
43171
43171
|
id: call.id,
|
|
43172
43172
|
type: "function",
|
|
43173
43173
|
function: { name: call.name, arguments: call.arguments }
|
|
@@ -43175,10 +43175,10 @@ function toWireMessage(message4) {
|
|
|
43175
43175
|
}
|
|
43176
43176
|
return wire;
|
|
43177
43177
|
}
|
|
43178
|
-
if (
|
|
43179
|
-
return { role: "tool", tool_call_id:
|
|
43178
|
+
if (message5.role === "tool") {
|
|
43179
|
+
return { role: "tool", tool_call_id: message5.toolCallId, content: message5.content };
|
|
43180
43180
|
}
|
|
43181
|
-
return { role:
|
|
43181
|
+
return { role: message5.role, content: message5.content };
|
|
43182
43182
|
}
|
|
43183
43183
|
var OpenAIProvider = class {
|
|
43184
43184
|
http;
|
|
@@ -43434,13 +43434,13 @@ var AnthropicProvider = class {
|
|
|
43434
43434
|
}
|
|
43435
43435
|
};
|
|
43436
43436
|
function toAnthropicMessages(messages) {
|
|
43437
|
-
const system = messages.find((
|
|
43437
|
+
const system = messages.find((message5) => message5.role === "system")?.content;
|
|
43438
43438
|
const wireMessages = [];
|
|
43439
|
-
for (const
|
|
43440
|
-
if (
|
|
43439
|
+
for (const message5 of messages) {
|
|
43440
|
+
if (message5.role === "system")
|
|
43441
43441
|
continue;
|
|
43442
|
-
if (
|
|
43443
|
-
const block2 = { type: "tool_result", tool_use_id:
|
|
43442
|
+
if (message5.role === "tool") {
|
|
43443
|
+
const block2 = { type: "tool_result", tool_use_id: message5.toolCallId, content: message5.content };
|
|
43444
43444
|
const previous = wireMessages[wireMessages.length - 1];
|
|
43445
43445
|
if (previous?.role === "user" && Array.isArray(previous.content) && isToolResultBlocks(previous.content)) {
|
|
43446
43446
|
;
|
|
@@ -43450,16 +43450,16 @@ function toAnthropicMessages(messages) {
|
|
|
43450
43450
|
}
|
|
43451
43451
|
continue;
|
|
43452
43452
|
}
|
|
43453
|
-
if (
|
|
43453
|
+
if (message5.role === "user") {
|
|
43454
43454
|
const blocks2 = [];
|
|
43455
|
-
for (const image of
|
|
43455
|
+
for (const image of message5.images ?? []) {
|
|
43456
43456
|
blocks2.push({
|
|
43457
43457
|
type: "image",
|
|
43458
43458
|
source: { type: "base64", media_type: image.mediaType, data: image.data }
|
|
43459
43459
|
});
|
|
43460
43460
|
}
|
|
43461
|
-
if (
|
|
43462
|
-
blocks2.push({ type: "text", text:
|
|
43461
|
+
if (message5.content.length > 0)
|
|
43462
|
+
blocks2.push({ type: "text", text: message5.content });
|
|
43463
43463
|
const previous = wireMessages[wireMessages.length - 1];
|
|
43464
43464
|
if (previous?.role === "user" && Array.isArray(previous.content)) {
|
|
43465
43465
|
;
|
|
@@ -43470,9 +43470,9 @@ function toAnthropicMessages(messages) {
|
|
|
43470
43470
|
continue;
|
|
43471
43471
|
}
|
|
43472
43472
|
const blocks = [];
|
|
43473
|
-
if (
|
|
43474
|
-
blocks.push({ type: "text", text:
|
|
43475
|
-
for (const toolCall of
|
|
43473
|
+
if (message5.content.length > 0)
|
|
43474
|
+
blocks.push({ type: "text", text: message5.content });
|
|
43475
|
+
for (const toolCall of message5.toolCalls ?? []) {
|
|
43476
43476
|
blocks.push({
|
|
43477
43477
|
type: "tool_use",
|
|
43478
43478
|
id: toolCall.id,
|
|
@@ -43560,9 +43560,9 @@ async function* parseAnthropicStream(body, url2, signal, logger) {
|
|
|
43560
43560
|
return;
|
|
43561
43561
|
} else if (eventType === "error") {
|
|
43562
43562
|
const error51 = parsed.error;
|
|
43563
|
-
const
|
|
43564
|
-
logger?.debug("anthropic stream error",
|
|
43565
|
-
yield { type: "error", error:
|
|
43563
|
+
const message5 = typeof error51?.message === "string" ? error51.message : "The provider reported an error.";
|
|
43564
|
+
logger?.debug("anthropic stream error", message5);
|
|
43565
|
+
yield { type: "error", error: message5 };
|
|
43566
43566
|
return;
|
|
43567
43567
|
}
|
|
43568
43568
|
}
|
|
@@ -43667,26 +43667,26 @@ var GeminiProvider = class {
|
|
|
43667
43667
|
};
|
|
43668
43668
|
function buildIdToName(messages) {
|
|
43669
43669
|
const map2 = /* @__PURE__ */ new Map();
|
|
43670
|
-
for (const
|
|
43671
|
-
if (
|
|
43670
|
+
for (const message5 of messages) {
|
|
43671
|
+
if (message5.role !== "assistant")
|
|
43672
43672
|
continue;
|
|
43673
|
-
for (const toolCall of
|
|
43673
|
+
for (const toolCall of message5.toolCalls ?? [])
|
|
43674
43674
|
map2.set(toolCall.id, toolCall.name);
|
|
43675
43675
|
}
|
|
43676
43676
|
return map2;
|
|
43677
43677
|
}
|
|
43678
43678
|
function toGeminiContents(messages) {
|
|
43679
|
-
const systemInstruction = messages.find((
|
|
43679
|
+
const systemInstruction = messages.find((message5) => message5.role === "system")?.content;
|
|
43680
43680
|
const idToName = buildIdToName(messages);
|
|
43681
43681
|
const contents = [];
|
|
43682
|
-
for (const
|
|
43683
|
-
if (
|
|
43682
|
+
for (const message5 of messages) {
|
|
43683
|
+
if (message5.role === "system")
|
|
43684
43684
|
continue;
|
|
43685
|
-
if (
|
|
43685
|
+
if (message5.role === "tool") {
|
|
43686
43686
|
const part = {
|
|
43687
43687
|
functionResponse: {
|
|
43688
|
-
name: idToName.get(
|
|
43689
|
-
response: { result:
|
|
43688
|
+
name: idToName.get(message5.toolCallId) ?? message5.toolCallId,
|
|
43689
|
+
response: { result: message5.content }
|
|
43690
43690
|
}
|
|
43691
43691
|
};
|
|
43692
43692
|
const previous = contents[contents.length - 1];
|
|
@@ -43698,13 +43698,13 @@ function toGeminiContents(messages) {
|
|
|
43698
43698
|
}
|
|
43699
43699
|
continue;
|
|
43700
43700
|
}
|
|
43701
|
-
if (
|
|
43701
|
+
if (message5.role === "user") {
|
|
43702
43702
|
const parts2 = [];
|
|
43703
|
-
for (const image of
|
|
43703
|
+
for (const image of message5.images ?? []) {
|
|
43704
43704
|
parts2.push({ inlineData: { mimeType: image.mediaType, data: image.data } });
|
|
43705
43705
|
}
|
|
43706
|
-
if (
|
|
43707
|
-
parts2.push({ text:
|
|
43706
|
+
if (message5.content.length > 0)
|
|
43707
|
+
parts2.push({ text: message5.content });
|
|
43708
43708
|
const previous = contents[contents.length - 1];
|
|
43709
43709
|
if (previous?.role === "user" && Array.isArray(previous.parts)) {
|
|
43710
43710
|
;
|
|
@@ -43715,9 +43715,9 @@ function toGeminiContents(messages) {
|
|
|
43715
43715
|
continue;
|
|
43716
43716
|
}
|
|
43717
43717
|
const parts = [];
|
|
43718
|
-
if (
|
|
43719
|
-
parts.push({ text:
|
|
43720
|
-
for (const toolCall of
|
|
43718
|
+
if (message5.content.length > 0)
|
|
43719
|
+
parts.push({ text: message5.content });
|
|
43720
|
+
for (const toolCall of message5.toolCalls ?? []) {
|
|
43721
43721
|
parts.push({ functionCall: { name: toolCall.name, args: safeParseArguments2(toolCall.arguments) } });
|
|
43722
43722
|
}
|
|
43723
43723
|
if (parts.length > 0)
|
|
@@ -44064,23 +44064,23 @@ function computeBreakdown(messages, tools, contextWindow) {
|
|
|
44064
44064
|
let system = 0;
|
|
44065
44065
|
let history = 0;
|
|
44066
44066
|
let results = 0;
|
|
44067
|
-
for (const
|
|
44068
|
-
if (
|
|
44069
|
-
system += estimateTokens(
|
|
44067
|
+
for (const message5 of messages) {
|
|
44068
|
+
if (message5.role === "system") {
|
|
44069
|
+
system += estimateTokens(message5.content);
|
|
44070
44070
|
continue;
|
|
44071
44071
|
}
|
|
44072
|
-
if (
|
|
44073
|
-
results += estimateTokens(
|
|
44072
|
+
if (message5.role === "tool") {
|
|
44073
|
+
results += estimateTokens(message5.content);
|
|
44074
44074
|
continue;
|
|
44075
44075
|
}
|
|
44076
|
-
history += estimateTokens(
|
|
44077
|
-
if (
|
|
44078
|
-
for (const toolCall of
|
|
44076
|
+
history += estimateTokens(message5.content);
|
|
44077
|
+
if (message5.role === "assistant") {
|
|
44078
|
+
for (const toolCall of message5.toolCalls ?? []) {
|
|
44079
44079
|
history += estimateTokens(toolCall.name) + estimateTokens(toolCall.arguments);
|
|
44080
44080
|
}
|
|
44081
44081
|
}
|
|
44082
|
-
if (
|
|
44083
|
-
history += (
|
|
44082
|
+
if (message5.role === "user") {
|
|
44083
|
+
history += (message5.images?.length ?? 0) * 1e3;
|
|
44084
44084
|
}
|
|
44085
44085
|
}
|
|
44086
44086
|
const toolDefinitions = tools.reduce((total, tool) => total + estimateTokens(tool.name) + estimateTokens(tool.description) + estimateTokens(JSON.stringify(tool.parameters ?? {})), 0);
|
|
@@ -44108,10 +44108,10 @@ function readFilePath(argumentsJson) {
|
|
|
44108
44108
|
}
|
|
44109
44109
|
function dropSupersededReads(messages) {
|
|
44110
44110
|
const keyByCallId = /* @__PURE__ */ new Map();
|
|
44111
|
-
for (const
|
|
44112
|
-
if (
|
|
44111
|
+
for (const message5 of messages) {
|
|
44112
|
+
if (message5.role !== "assistant")
|
|
44113
44113
|
continue;
|
|
44114
|
-
for (const toolCall of
|
|
44114
|
+
for (const toolCall of message5.toolCalls ?? []) {
|
|
44115
44115
|
if (toolCall.name !== "read_file")
|
|
44116
44116
|
continue;
|
|
44117
44117
|
const path63 = readFilePath(toolCall.arguments);
|
|
@@ -44121,27 +44121,27 @@ function dropSupersededReads(messages) {
|
|
|
44121
44121
|
}
|
|
44122
44122
|
}
|
|
44123
44123
|
const lastCallIdForKey = /* @__PURE__ */ new Map();
|
|
44124
|
-
for (const
|
|
44125
|
-
if (
|
|
44124
|
+
for (const message5 of messages) {
|
|
44125
|
+
if (message5.role !== "tool")
|
|
44126
44126
|
continue;
|
|
44127
|
-
const key2 = keyByCallId.get(
|
|
44127
|
+
const key2 = keyByCallId.get(message5.toolCallId);
|
|
44128
44128
|
if (key2 !== void 0)
|
|
44129
|
-
lastCallIdForKey.set(key2,
|
|
44129
|
+
lastCallIdForKey.set(key2, message5.toolCallId);
|
|
44130
44130
|
}
|
|
44131
44131
|
const survivors = new Set(lastCallIdForKey.values());
|
|
44132
44132
|
let supersededCount = 0;
|
|
44133
44133
|
let charactersSaved = 0;
|
|
44134
|
-
const result = messages.map((
|
|
44135
|
-
if (
|
|
44136
|
-
return
|
|
44137
|
-
const key2 = keyByCallId.get(
|
|
44138
|
-
if (key2 === void 0 || survivors.has(
|
|
44139
|
-
return
|
|
44140
|
-
if (
|
|
44141
|
-
return
|
|
44134
|
+
const result = messages.map((message5) => {
|
|
44135
|
+
if (message5.role !== "tool")
|
|
44136
|
+
return message5;
|
|
44137
|
+
const key2 = keyByCallId.get(message5.toolCallId);
|
|
44138
|
+
if (key2 === void 0 || survivors.has(message5.toolCallId))
|
|
44139
|
+
return message5;
|
|
44140
|
+
if (message5.content.length <= SUPERSEDED_MARKER.length)
|
|
44141
|
+
return message5;
|
|
44142
44142
|
supersededCount += 1;
|
|
44143
|
-
charactersSaved +=
|
|
44144
|
-
return { role: "tool", toolCallId:
|
|
44143
|
+
charactersSaved += message5.content.length - SUPERSEDED_MARKER.length;
|
|
44144
|
+
return { role: "tool", toolCallId: message5.toolCallId, content: SUPERSEDED_MARKER };
|
|
44145
44145
|
});
|
|
44146
44146
|
return { messages: result, supersededCount, charactersSaved };
|
|
44147
44147
|
}
|
|
@@ -44153,10 +44153,10 @@ var FORGET_DOCS_TOOL = "forget_docs";
|
|
|
44153
44153
|
function dropEvictedDocs(messages) {
|
|
44154
44154
|
let cutoff = -1;
|
|
44155
44155
|
const evictableCallIds = /* @__PURE__ */ new Set();
|
|
44156
|
-
messages.forEach((
|
|
44157
|
-
if (
|
|
44156
|
+
messages.forEach((message5, index) => {
|
|
44157
|
+
if (message5.role !== "assistant")
|
|
44158
44158
|
return;
|
|
44159
|
-
for (const toolCall of
|
|
44159
|
+
for (const toolCall of message5.toolCalls ?? []) {
|
|
44160
44160
|
if (toolCall.name === FORGET_DOCS_TOOL)
|
|
44161
44161
|
cutoff = index;
|
|
44162
44162
|
else if (EVICTABLE_TOOLS.has(toolCall.name))
|
|
@@ -44168,16 +44168,16 @@ function dropEvictedDocs(messages) {
|
|
|
44168
44168
|
}
|
|
44169
44169
|
let evictedCount = 0;
|
|
44170
44170
|
let charactersSaved = 0;
|
|
44171
|
-
const result = messages.map((
|
|
44172
|
-
if (
|
|
44173
|
-
return
|
|
44174
|
-
if (!evictableCallIds.has(
|
|
44175
|
-
return
|
|
44176
|
-
if (
|
|
44177
|
-
return
|
|
44171
|
+
const result = messages.map((message5, index) => {
|
|
44172
|
+
if (message5.role !== "tool" || index > cutoff)
|
|
44173
|
+
return message5;
|
|
44174
|
+
if (!evictableCallIds.has(message5.toolCallId))
|
|
44175
|
+
return message5;
|
|
44176
|
+
if (message5.content.length <= EVICTED_MARKER.length)
|
|
44177
|
+
return message5;
|
|
44178
44178
|
evictedCount += 1;
|
|
44179
|
-
charactersSaved +=
|
|
44180
|
-
return { role: "tool", toolCallId:
|
|
44179
|
+
charactersSaved += message5.content.length - EVICTED_MARKER.length;
|
|
44180
|
+
return { role: "tool", toolCallId: message5.toolCallId, content: EVICTED_MARKER };
|
|
44181
44181
|
});
|
|
44182
44182
|
return { messages: result, evictedCount, charactersSaved };
|
|
44183
44183
|
}
|
|
@@ -44351,27 +44351,27 @@ function isSafeBoundary(messages, index) {
|
|
|
44351
44351
|
return false;
|
|
44352
44352
|
const callIdsBefore = /* @__PURE__ */ new Set();
|
|
44353
44353
|
for (let i = 0; i < index; i += 1) {
|
|
44354
|
-
const
|
|
44355
|
-
if (
|
|
44356
|
-
for (const toolCall of
|
|
44354
|
+
const message5 = messages[i];
|
|
44355
|
+
if (message5?.role === "assistant") {
|
|
44356
|
+
for (const toolCall of message5.toolCalls ?? [])
|
|
44357
44357
|
callIdsBefore.add(toolCall.id);
|
|
44358
44358
|
}
|
|
44359
|
-
if (
|
|
44360
|
-
callIdsBefore.delete(
|
|
44359
|
+
if (message5?.role === "tool")
|
|
44360
|
+
callIdsBefore.delete(message5.toolCallId);
|
|
44361
44361
|
}
|
|
44362
44362
|
return callIdsBefore.size === 0;
|
|
44363
44363
|
}
|
|
44364
44364
|
function buildSummaryPrompt(messages) {
|
|
44365
|
-
const transcript = messages.map((
|
|
44366
|
-
if (
|
|
44367
|
-
return `[tool result] ${
|
|
44368
|
-
if (isSummaryMessage(
|
|
44369
|
-
return `[earlier summary] ${splitSummary(
|
|
44370
|
-
if (
|
|
44371
|
-
const calls = (
|
|
44372
|
-
return `[assistant] ${
|
|
44373
|
-
}
|
|
44374
|
-
return `[${
|
|
44365
|
+
const transcript = messages.map((message5) => {
|
|
44366
|
+
if (message5.role === "tool")
|
|
44367
|
+
return `[tool result] ${message5.content}`;
|
|
44368
|
+
if (isSummaryMessage(message5))
|
|
44369
|
+
return `[earlier summary] ${splitSummary(message5.content).notes}`;
|
|
44370
|
+
if (message5.role === "assistant") {
|
|
44371
|
+
const calls = (message5.toolCalls ?? []).map((call) => `${call.name}(${call.arguments})`).join(", ");
|
|
44372
|
+
return `[assistant] ${message5.content}${calls.length > 0 ? ` -> ${calls}` : ""}`;
|
|
44373
|
+
}
|
|
44374
|
+
return `[${message5.role}] ${message5.content}`;
|
|
44375
44375
|
}).join("\n");
|
|
44376
44376
|
return [
|
|
44377
44377
|
"Summarise the earlier part of this coding session so it can replace the original",
|
|
@@ -44410,14 +44410,14 @@ function splitSummary(content) {
|
|
|
44410
44410
|
}
|
|
44411
44411
|
function userMessagesOf(messages) {
|
|
44412
44412
|
const out = [];
|
|
44413
|
-
for (const
|
|
44414
|
-
if (
|
|
44413
|
+
for (const message5 of messages) {
|
|
44414
|
+
if (message5.role !== "user")
|
|
44415
44415
|
continue;
|
|
44416
|
-
if (isSummaryMessage(
|
|
44417
|
-
out.push(...splitSummary(
|
|
44416
|
+
if (isSummaryMessage(message5)) {
|
|
44417
|
+
out.push(...splitSummary(message5.content).userMessages);
|
|
44418
44418
|
continue;
|
|
44419
44419
|
}
|
|
44420
|
-
const text2 =
|
|
44420
|
+
const text2 = message5.content.trim();
|
|
44421
44421
|
if (text2.length === 0 || text2 === CONTINUE_PROMPT)
|
|
44422
44422
|
continue;
|
|
44423
44423
|
out.push(text2.length > USER_MESSAGE_LIMIT ? `${text2.slice(0, USER_MESSAGE_LIMIT)} \u2026[clipped]` : text2);
|
|
@@ -44452,8 +44452,8 @@ function tailStartWithin(messages, budget) {
|
|
|
44452
44452
|
function isContextOverflow(error51) {
|
|
44453
44453
|
return /context.{0,20}(length|window|limit)|maximum context|too many tokens|prompt is too long|input is too long|request too large|reduce the length|exceeds? (the )?(maximum|max|token)|token limit|tokens? exceed|context_length_exceeded|string_above_max_length/i.test(error51);
|
|
44454
44454
|
}
|
|
44455
|
-
function isSummaryMessage(
|
|
44456
|
-
return
|
|
44455
|
+
function isSummaryMessage(message5) {
|
|
44456
|
+
return message5.role === "user" && message5.content.startsWith(SUMMARY_PREFIX);
|
|
44457
44457
|
}
|
|
44458
44458
|
function shouldCompact(messages, estimatedTokens, contextWindow, options = {}) {
|
|
44459
44459
|
const trigger = options.triggerFraction ?? DEFAULTS2.triggerFraction;
|
|
@@ -44467,8 +44467,8 @@ function shouldCompact(messages, estimatedTokens, contextWindow, options = {}) {
|
|
|
44467
44467
|
async function compactHistory(messages, provider, options = {}) {
|
|
44468
44468
|
const keepRecent = options.keepRecent ?? DEFAULTS2.keepRecent;
|
|
44469
44469
|
const unchanged = { messages: [...messages], compacted: false, summarisedCount: 0 };
|
|
44470
|
-
const systemMessages = messages.filter((
|
|
44471
|
-
const rest = messages.filter((
|
|
44470
|
+
const systemMessages = messages.filter((message5) => message5.role === "system");
|
|
44471
|
+
const rest = messages.filter((message5) => message5.role !== "system");
|
|
44472
44472
|
if (rest.length <= keepRecent)
|
|
44473
44473
|
return unchanged;
|
|
44474
44474
|
let preferred = rest.length - keepRecent;
|
|
@@ -44495,7 +44495,7 @@ async function compactHistory(messages, provider, options = {}) {
|
|
|
44495
44495
|
return unchanged;
|
|
44496
44496
|
const verbatim = renderUserMessages(userMessagesOf(toSummarise));
|
|
44497
44497
|
const summaryMessage = { role: "user", content: `${SUMMARY_PREFIX}${summary.trim()}${verbatim}` };
|
|
44498
|
-
const before = toSummarise.reduce((total,
|
|
44498
|
+
const before = toSummarise.reduce((total, message5) => total + estimateTokens(message5.content), 0);
|
|
44499
44499
|
if (estimateTokens(summaryMessage.content) >= before)
|
|
44500
44500
|
return unchanged;
|
|
44501
44501
|
return {
|
|
@@ -44526,8 +44526,8 @@ var Conversation = class {
|
|
|
44526
44526
|
* was written, and a stale prompt would describe a world that no longer exists.
|
|
44527
44527
|
*/
|
|
44528
44528
|
restore(messages) {
|
|
44529
|
-
const systemPrompt = this.messages.find((
|
|
44530
|
-
const restored = messages.filter((
|
|
44529
|
+
const systemPrompt = this.messages.find((message5) => message5.role === "system");
|
|
44530
|
+
const restored = messages.filter((message5) => message5.role !== "system");
|
|
44531
44531
|
this.messages = systemPrompt !== void 0 ? [systemPrompt, ...restored] : [...restored];
|
|
44532
44532
|
this.compaction = void 0;
|
|
44533
44533
|
}
|
|
@@ -44536,7 +44536,7 @@ var Conversation = class {
|
|
|
44536
44536
|
this.restore([]);
|
|
44537
44537
|
}
|
|
44538
44538
|
isEmpty() {
|
|
44539
|
-
return this.messages.every((
|
|
44539
|
+
return this.messages.every((message5) => message5.role === "system");
|
|
44540
44540
|
}
|
|
44541
44541
|
/**
|
|
44542
44542
|
* Replaces the system prompt, keeping the rest of the history.
|
|
@@ -44547,7 +44547,7 @@ var Conversation = class {
|
|
|
44547
44547
|
* doing it per turn would be expensive and invisible.
|
|
44548
44548
|
*/
|
|
44549
44549
|
setSystemPrompt(prompt) {
|
|
44550
|
-
const existing = this.messages.findIndex((
|
|
44550
|
+
const existing = this.messages.findIndex((message5) => message5.role === "system");
|
|
44551
44551
|
if (existing === -1)
|
|
44552
44552
|
this.messages.unshift({ role: "system", content: prompt });
|
|
44553
44553
|
else
|
|
@@ -44555,7 +44555,7 @@ var Conversation = class {
|
|
|
44555
44555
|
}
|
|
44556
44556
|
/** The current system prompt, so a caller can tell whether it needs replacing. */
|
|
44557
44557
|
systemPrompt() {
|
|
44558
|
-
return this.messages.find((
|
|
44558
|
+
return this.messages.find((message5) => message5.role === "system")?.content;
|
|
44559
44559
|
}
|
|
44560
44560
|
addUserMessage(content, images) {
|
|
44561
44561
|
this.messages.push(images !== void 0 && images.length > 0 ? { role: "user", content, images } : { role: "user", content });
|
|
@@ -44585,8 +44585,8 @@ var Conversation = class {
|
|
|
44585
44585
|
const compaction = this.compaction;
|
|
44586
44586
|
if (compaction === void 0)
|
|
44587
44587
|
return [...this.messages];
|
|
44588
|
-
const system = this.messages.filter((
|
|
44589
|
-
const rest = this.messages.filter((
|
|
44588
|
+
const system = this.messages.filter((message5) => message5.role === "system");
|
|
44589
|
+
const rest = this.messages.filter((message5) => message5.role !== "system");
|
|
44590
44590
|
return [...system, compaction.summary, ...rest.slice(compaction.replacedCount)];
|
|
44591
44591
|
}
|
|
44592
44592
|
/**
|
|
@@ -46424,6 +46424,10 @@ var ALWAYS_ASK_TOOLS = /* @__PURE__ */ new Set([
|
|
|
46424
46424
|
"autosys_apply_jil",
|
|
46425
46425
|
// Where every AutoSys request goes from now on - often learned from a wiki page; the prompt shows each one tried live.
|
|
46426
46426
|
"autosys_set_addresses",
|
|
46427
|
+
// A monitor runs a tool unattended on a schedule; approving the file approves it on this machine.
|
|
46428
|
+
"monitor_create",
|
|
46429
|
+
// Silencing, pausing or muting an alert: an agent doing that unseen would defeat the dashboard.
|
|
46430
|
+
"monitor_control",
|
|
46427
46431
|
"bitbucket_write_pull_request",
|
|
46428
46432
|
// Merges into a shared branch (and may tag it) under the user's name; only after a reviewer approved.
|
|
46429
46433
|
"bitbucket_merge_pull_request",
|
|
@@ -46920,8 +46924,8 @@ function describeExpertBudget(spend, limits, pricing) {
|
|
|
46920
46924
|
// ../../packages/core/dist/rag/vectorStore.js
|
|
46921
46925
|
var VectorStoreError = class extends Error {
|
|
46922
46926
|
status;
|
|
46923
|
-
constructor(
|
|
46924
|
-
super(
|
|
46927
|
+
constructor(message5, status2) {
|
|
46928
|
+
super(message5);
|
|
46925
46929
|
this.status = status2;
|
|
46926
46930
|
this.name = "VectorStoreError";
|
|
46927
46931
|
}
|
|
@@ -46929,8 +46933,8 @@ var VectorStoreError = class extends Error {
|
|
|
46929
46933
|
|
|
46930
46934
|
// ../../packages/core/dist/rag/opensearch/client.js
|
|
46931
46935
|
var OpenSearchError = class extends VectorStoreError {
|
|
46932
|
-
constructor(
|
|
46933
|
-
super(
|
|
46936
|
+
constructor(message5, status2) {
|
|
46937
|
+
super(message5, status2);
|
|
46934
46938
|
this.name = "OpenSearchError";
|
|
46935
46939
|
}
|
|
46936
46940
|
};
|
|
@@ -48256,8 +48260,8 @@ async function syncVectorStores(options) {
|
|
|
48256
48260
|
|
|
48257
48261
|
// ../../packages/core/dist/rag/embedder.js
|
|
48258
48262
|
var EmbedderError = class extends Error {
|
|
48259
|
-
constructor(
|
|
48260
|
-
super(
|
|
48263
|
+
constructor(message5) {
|
|
48264
|
+
super(message5);
|
|
48261
48265
|
this.name = "EmbedderError";
|
|
48262
48266
|
}
|
|
48263
48267
|
};
|
|
@@ -48614,7 +48618,7 @@ ${hit.text}`;
|
|
|
48614
48618
|
].join("\n")
|
|
48615
48619
|
};
|
|
48616
48620
|
} catch (error51) {
|
|
48617
|
-
const
|
|
48621
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
48618
48622
|
options.observer?.record({
|
|
48619
48623
|
at: startedAt,
|
|
48620
48624
|
source: "search_codebase",
|
|
@@ -48622,9 +48626,9 @@ ${hit.text}`;
|
|
|
48622
48626
|
collection: options.index,
|
|
48623
48627
|
hits: 0,
|
|
48624
48628
|
elapsedMs: Date.now() - startedAt,
|
|
48625
|
-
error:
|
|
48629
|
+
error: message5
|
|
48626
48630
|
});
|
|
48627
|
-
return { content:
|
|
48631
|
+
return { content: message5, isError: true };
|
|
48628
48632
|
}
|
|
48629
48633
|
}
|
|
48630
48634
|
};
|
|
@@ -48860,7 +48864,7 @@ function createSearchTeamSkillsTool(options) {
|
|
|
48860
48864
|
});
|
|
48861
48865
|
return { content: renderTeamSkillHits(found2, params3.query, scope) };
|
|
48862
48866
|
} catch (error51) {
|
|
48863
|
-
const
|
|
48867
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
48864
48868
|
options.observer?.record({
|
|
48865
48869
|
at: startedAt,
|
|
48866
48870
|
source: "search_team_skills",
|
|
@@ -48869,9 +48873,9 @@ function createSearchTeamSkillsTool(options) {
|
|
|
48869
48873
|
collection: options.collections.join(" \u2192 "),
|
|
48870
48874
|
hits: 0,
|
|
48871
48875
|
elapsedMs: Date.now() - startedAt,
|
|
48872
|
-
error:
|
|
48876
|
+
error: message5
|
|
48873
48877
|
});
|
|
48874
|
-
return { content:
|
|
48878
|
+
return { content: message5, isError: true };
|
|
48875
48879
|
}
|
|
48876
48880
|
}
|
|
48877
48881
|
};
|
|
@@ -49266,8 +49270,8 @@ var FAT_SECTOR = 4294967293;
|
|
|
49266
49270
|
var DIFAT_SECTOR = 4294967292;
|
|
49267
49271
|
var DIRECTORY_ENTRY_SIZE = 128;
|
|
49268
49272
|
var CompoundFileError = class extends Error {
|
|
49269
|
-
constructor(
|
|
49270
|
-
super(
|
|
49273
|
+
constructor(message5) {
|
|
49274
|
+
super(message5);
|
|
49271
49275
|
this.name = "CompoundFileError";
|
|
49272
49276
|
}
|
|
49273
49277
|
};
|
|
@@ -49641,8 +49645,8 @@ var STORED = 0;
|
|
|
49641
49645
|
var DEFLATED = 8;
|
|
49642
49646
|
var MAX_ENTRY_BYTES = 128 * 1024 * 1024;
|
|
49643
49647
|
var ZipError = class extends Error {
|
|
49644
|
-
constructor(
|
|
49645
|
-
super(
|
|
49648
|
+
constructor(message5) {
|
|
49649
|
+
super(message5);
|
|
49646
49650
|
this.name = "ZipError";
|
|
49647
49651
|
}
|
|
49648
49652
|
};
|
|
@@ -49726,8 +49730,8 @@ var ZipArchive = class _ZipArchive {
|
|
|
49726
49730
|
|
|
49727
49731
|
// ../../packages/core/dist/documents/extract.js
|
|
49728
49732
|
var DocumentError = class extends Error {
|
|
49729
|
-
constructor(
|
|
49730
|
-
super(
|
|
49733
|
+
constructor(message5) {
|
|
49734
|
+
super(message5);
|
|
49731
49735
|
this.name = "DocumentError";
|
|
49732
49736
|
}
|
|
49733
49737
|
};
|
|
@@ -51338,8 +51342,8 @@ function normaliseSubject(subject) {
|
|
|
51338
51342
|
return subject.replace(/^\s*(re|fw|fwd)\s*:\s*/gi, "").replace(/\[\s*(alert|ok)\s*\]/gi, "").replace(/\d{1,2}:\d{2}(:\d{2})?/g, "").replace(/\d{4}-\d{2}-\d{2}/g, "").replace(/\d{1,2}\/\d{1,2}\/\d{2,4}/g, "").replace(/\b[0-9a-f]{8,}\b/gi, "").replace(/\d+/g, "").replace(/\s+/g, " ").trim().toLowerCase();
|
|
51339
51343
|
}
|
|
51340
51344
|
function minutesIntoDay(at) {
|
|
51341
|
-
const
|
|
51342
|
-
return
|
|
51345
|
+
const when4 = new Date(at);
|
|
51346
|
+
return when4.getHours() * 60 + when4.getMinutes();
|
|
51343
51347
|
}
|
|
51344
51348
|
function median(values) {
|
|
51345
51349
|
const sorted = [...values].sort((a, b) => a - b);
|
|
@@ -51454,11 +51458,11 @@ var searchSchema2 = external_exports.object({
|
|
|
51454
51458
|
limit: external_exports.number().int().min(1).max(50).optional().describe("How many to return. Default 20.")
|
|
51455
51459
|
});
|
|
51456
51460
|
function describe3(record2) {
|
|
51457
|
-
const
|
|
51461
|
+
const when4 = new Date(record2.receivedAt).toLocaleString();
|
|
51458
51462
|
const tag = record2.status === void 0 ? "" : `[${record2.status.toUpperCase()}] `;
|
|
51459
51463
|
const preview = record2.preview.trim().length === 0 ? "" : `
|
|
51460
51464
|
${record2.preview.trim().slice(0, 220)}`;
|
|
51461
|
-
return `${
|
|
51465
|
+
return `${when4} ${tag}${record2.subject}
|
|
51462
51466
|
from ${record2.sender} in ${record2.folder}
|
|
51463
51467
|
id: ${record2.id}${preview}`;
|
|
51464
51468
|
}
|
|
@@ -51920,8 +51924,8 @@ var TRANSIENT = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
|
51920
51924
|
var DELAYS_MS = [20, 40, 80, 120, 200, 300, 400, 600, 800, 1e3];
|
|
51921
51925
|
var FileReplaceError = class extends Error {
|
|
51922
51926
|
code;
|
|
51923
|
-
constructor(
|
|
51924
|
-
super(
|
|
51927
|
+
constructor(message5, code) {
|
|
51928
|
+
super(message5);
|
|
51925
51929
|
this.code = code;
|
|
51926
51930
|
this.name = "FileReplaceError";
|
|
51927
51931
|
}
|
|
@@ -52269,8 +52273,8 @@ ${chosen.map((name) => ` - ${name}`).join("\n")}`,
|
|
|
52269
52273
|
}
|
|
52270
52274
|
try {
|
|
52271
52275
|
const created = await options.create(pending);
|
|
52272
|
-
const
|
|
52273
|
-
const summary = describeTrigger(
|
|
52276
|
+
const when4 = pending.trigger;
|
|
52277
|
+
const summary = describeTrigger(when4);
|
|
52274
52278
|
pending = void 0;
|
|
52275
52279
|
return {
|
|
52276
52280
|
content: `Scheduled "${params3.name}" to run ${summary}.${created.nextRunAt === void 0 ? "" : ` Next run ${new Date(created.nextRunAt).toLocaleString()}.`}
|
|
@@ -52309,15 +52313,15 @@ async function refreshMail(options) {
|
|
|
52309
52313
|
complete: []
|
|
52310
52314
|
};
|
|
52311
52315
|
}
|
|
52312
|
-
function toRecord(
|
|
52313
|
-
const status2 = parseStatusTag(
|
|
52316
|
+
function toRecord(message5) {
|
|
52317
|
+
const status2 = parseStatusTag(message5.subject);
|
|
52314
52318
|
return {
|
|
52315
|
-
id:
|
|
52316
|
-
subject:
|
|
52317
|
-
sender:
|
|
52318
|
-
receivedAt:
|
|
52319
|
-
folder:
|
|
52320
|
-
preview:
|
|
52319
|
+
id: message5.id,
|
|
52320
|
+
subject: message5.subject,
|
|
52321
|
+
sender: message5.sender,
|
|
52322
|
+
receivedAt: message5.receivedAt,
|
|
52323
|
+
folder: message5.folder,
|
|
52324
|
+
preview: message5.preview,
|
|
52321
52325
|
...status2 !== void 0 ? { status: status2 } : {}
|
|
52322
52326
|
};
|
|
52323
52327
|
}
|
|
@@ -52356,7 +52360,7 @@ async function syncMail(options) {
|
|
|
52356
52360
|
const backward = await options.harvest(backRequests, { limit: remaining, previewChars });
|
|
52357
52361
|
backfilled = backward.messages.length;
|
|
52358
52362
|
candidates = [...candidates, ...backward.messages.map(toRecord)];
|
|
52359
|
-
const returnedFor = new Set(backward.messages.map((
|
|
52363
|
+
const returnedFor = new Set(backward.messages.map((message5) => message5.folder));
|
|
52360
52364
|
for (const path63 of behind) {
|
|
52361
52365
|
if (!returnedFor.has(path63))
|
|
52362
52366
|
completed.push(path63);
|
|
@@ -52528,6 +52532,9 @@ var NEVER_AVAILABLE_TO_SCHEDULES = [
|
|
|
52528
52532
|
"autosys_apply_jil",
|
|
52529
52533
|
// Repointing every later AutoSys request, with nobody to see where.
|
|
52530
52534
|
"autosys_set_addresses",
|
|
52535
|
+
// A new unattended check, or an alert silenced, with nobody to see it.
|
|
52536
|
+
"monitor_create",
|
|
52537
|
+
"monitor_control",
|
|
52531
52538
|
// A merge into a shared branch, and a release tag, with nobody watching.
|
|
52532
52539
|
"bitbucket_merge_pull_request",
|
|
52533
52540
|
// A chat window opened with nobody there to press Send, or to notice it.
|
|
@@ -54870,8 +54877,8 @@ var ServerResultSchema = union([
|
|
|
54870
54877
|
CreateTaskResultSchema
|
|
54871
54878
|
]);
|
|
54872
54879
|
var McpError = class _McpError extends Error {
|
|
54873
|
-
constructor(code,
|
|
54874
|
-
super(`MCP error ${code}: ${
|
|
54880
|
+
constructor(code, message5, data) {
|
|
54881
|
+
super(`MCP error ${code}: ${message5}`);
|
|
54875
54882
|
this.code = code;
|
|
54876
54883
|
this.data = data;
|
|
54877
54884
|
this.name = "McpError";
|
|
@@ -54879,19 +54886,19 @@ var McpError = class _McpError extends Error {
|
|
|
54879
54886
|
/**
|
|
54880
54887
|
* Factory method to create the appropriate error type based on the error code and data
|
|
54881
54888
|
*/
|
|
54882
|
-
static fromError(code,
|
|
54889
|
+
static fromError(code, message5, data) {
|
|
54883
54890
|
if (code === ErrorCode.UrlElicitationRequired && data) {
|
|
54884
54891
|
const errorData = data;
|
|
54885
54892
|
if (errorData.elicitations) {
|
|
54886
|
-
return new UrlElicitationRequiredError(errorData.elicitations,
|
|
54893
|
+
return new UrlElicitationRequiredError(errorData.elicitations, message5);
|
|
54887
54894
|
}
|
|
54888
54895
|
}
|
|
54889
|
-
return new _McpError(code,
|
|
54896
|
+
return new _McpError(code, message5, data);
|
|
54890
54897
|
}
|
|
54891
54898
|
};
|
|
54892
54899
|
var UrlElicitationRequiredError = class extends McpError {
|
|
54893
|
-
constructor(elicitations,
|
|
54894
|
-
super(ErrorCode.UrlElicitationRequired,
|
|
54900
|
+
constructor(elicitations, message5 = `URL elicitation${elicitations.length > 1 ? "s" : ""} required`) {
|
|
54901
|
+
super(ErrorCode.UrlElicitationRequired, message5, {
|
|
54895
54902
|
elicitations
|
|
54896
54903
|
});
|
|
54897
54904
|
}
|
|
@@ -54974,15 +54981,15 @@ var Protocol = class {
|
|
|
54974
54981
|
let queuedMessage;
|
|
54975
54982
|
while (queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId)) {
|
|
54976
54983
|
if (queuedMessage.type === "response" || queuedMessage.type === "error") {
|
|
54977
|
-
const
|
|
54978
|
-
const requestId =
|
|
54984
|
+
const message5 = queuedMessage.message;
|
|
54985
|
+
const requestId = message5.id;
|
|
54979
54986
|
const resolver = this._requestResolvers.get(requestId);
|
|
54980
54987
|
if (resolver) {
|
|
54981
54988
|
this._requestResolvers.delete(requestId);
|
|
54982
54989
|
if (queuedMessage.type === "response") {
|
|
54983
|
-
resolver(
|
|
54990
|
+
resolver(message5);
|
|
54984
54991
|
} else {
|
|
54985
|
-
const errorMessage =
|
|
54992
|
+
const errorMessage = message5;
|
|
54986
54993
|
const error51 = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data);
|
|
54987
54994
|
resolver(error51);
|
|
54988
54995
|
}
|
|
@@ -55121,16 +55128,16 @@ var Protocol = class {
|
|
|
55121
55128
|
this._onerror(error51);
|
|
55122
55129
|
};
|
|
55123
55130
|
const _onmessage = this._transport?.onmessage;
|
|
55124
|
-
this._transport.onmessage = (
|
|
55125
|
-
_onmessage?.(
|
|
55126
|
-
if (isJSONRPCResultResponse(
|
|
55127
|
-
this._onresponse(
|
|
55128
|
-
} else if (isJSONRPCRequest(
|
|
55129
|
-
this._onrequest(
|
|
55130
|
-
} else if (isJSONRPCNotification(
|
|
55131
|
-
this._onnotification(
|
|
55131
|
+
this._transport.onmessage = (message5, extra) => {
|
|
55132
|
+
_onmessage?.(message5, extra);
|
|
55133
|
+
if (isJSONRPCResultResponse(message5) || isJSONRPCErrorResponse(message5)) {
|
|
55134
|
+
this._onresponse(message5);
|
|
55135
|
+
} else if (isJSONRPCRequest(message5)) {
|
|
55136
|
+
this._onrequest(message5, extra);
|
|
55137
|
+
} else if (isJSONRPCNotification(message5)) {
|
|
55138
|
+
this._onnotification(message5);
|
|
55132
55139
|
} else {
|
|
55133
|
-
this._onerror(new Error(`Unknown message type: ${JSON.stringify(
|
|
55140
|
+
this._onerror(new Error(`Unknown message type: ${JSON.stringify(message5)}`));
|
|
55134
55141
|
}
|
|
55135
55142
|
};
|
|
55136
55143
|
await this._transport.start();
|
|
@@ -55740,12 +55747,12 @@ var Protocol = class {
|
|
|
55740
55747
|
* the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer
|
|
55741
55748
|
* simply propagates the error.
|
|
55742
55749
|
*/
|
|
55743
|
-
async _enqueueTaskMessage(taskId,
|
|
55750
|
+
async _enqueueTaskMessage(taskId, message5, sessionId) {
|
|
55744
55751
|
if (!this._taskStore || !this._taskMessageQueue) {
|
|
55745
55752
|
throw new Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");
|
|
55746
55753
|
}
|
|
55747
55754
|
const maxQueueSize = this._options?.maxTaskQueueSize;
|
|
55748
|
-
await this._taskMessageQueue.enqueue(taskId,
|
|
55755
|
+
await this._taskMessageQueue.enqueue(taskId, message5, sessionId, maxQueueSize);
|
|
55749
55756
|
}
|
|
55750
55757
|
/**
|
|
55751
55758
|
* Clears the message queue for a task and rejects any pending request resolvers.
|
|
@@ -55755,9 +55762,9 @@ var Protocol = class {
|
|
|
55755
55762
|
async _clearTaskQueue(taskId, sessionId) {
|
|
55756
55763
|
if (this._taskMessageQueue) {
|
|
55757
55764
|
const messages = await this._taskMessageQueue.dequeueAll(taskId, sessionId);
|
|
55758
|
-
for (const
|
|
55759
|
-
if (
|
|
55760
|
-
const requestId =
|
|
55765
|
+
for (const message5 of messages) {
|
|
55766
|
+
if (message5.type === "request" && isJSONRPCRequest(message5.message)) {
|
|
55767
|
+
const requestId = message5.message.id;
|
|
55761
55768
|
const resolver = this._requestResolvers.get(requestId);
|
|
55762
55769
|
if (resolver) {
|
|
55763
55770
|
resolver(new McpError(ErrorCode.InternalError, "Task cancelled or completed"));
|
|
@@ -56002,9 +56009,9 @@ var ExperimentalClientTasks = class {
|
|
|
56002
56009
|
};
|
|
56003
56010
|
const stream = clientInternal.requestStream({ method: "tools/call", params: params3 }, resultSchema, optionsWithTask);
|
|
56004
56011
|
const validator = clientInternal.getToolOutputValidator(params3.name);
|
|
56005
|
-
for await (const
|
|
56006
|
-
if (
|
|
56007
|
-
const result =
|
|
56012
|
+
for await (const message5 of stream) {
|
|
56013
|
+
if (message5.type === "result" && validator) {
|
|
56014
|
+
const result = message5.result;
|
|
56008
56015
|
if (!result.structuredContent && !result.isError) {
|
|
56009
56016
|
yield {
|
|
56010
56017
|
type: "error",
|
|
@@ -56035,7 +56042,7 @@ var ExperimentalClientTasks = class {
|
|
|
56035
56042
|
}
|
|
56036
56043
|
}
|
|
56037
56044
|
}
|
|
56038
|
-
yield
|
|
56045
|
+
yield message5;
|
|
56039
56046
|
}
|
|
56040
56047
|
}
|
|
56041
56048
|
/**
|
|
@@ -56504,8 +56511,8 @@ var Client = class extends Protocol {
|
|
|
56504
56511
|
async complete(params3, options) {
|
|
56505
56512
|
return this.request({ method: "completion/complete", params: params3 }, CompleteResultSchema, options);
|
|
56506
56513
|
}
|
|
56507
|
-
async setLoggingLevel(
|
|
56508
|
-
return this.request({ method: "logging/setLevel", params: { level } }, EmptyResultSchema, options);
|
|
56514
|
+
async setLoggingLevel(level2, options) {
|
|
56515
|
+
return this.request({ method: "logging/setLevel", params: { level: level2 } }, EmptyResultSchema, options);
|
|
56509
56516
|
}
|
|
56510
56517
|
async getPrompt(params3, options) {
|
|
56511
56518
|
return this.request({ method: "prompts/get", params: params3 }, GetPromptResultSchema, options);
|
|
@@ -56689,8 +56696,8 @@ var ReadBuffer = class {
|
|
|
56689
56696
|
function deserializeMessage(line) {
|
|
56690
56697
|
return JSONRPCMessageSchema.parse(JSON.parse(line));
|
|
56691
56698
|
}
|
|
56692
|
-
function serializeMessage(
|
|
56693
|
-
return JSON.stringify(
|
|
56699
|
+
function serializeMessage(message5) {
|
|
56700
|
+
return JSON.stringify(message5) + "\n";
|
|
56694
56701
|
}
|
|
56695
56702
|
|
|
56696
56703
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
|
|
@@ -56809,11 +56816,11 @@ var StdioClientTransport = class {
|
|
|
56809
56816
|
processReadBuffer() {
|
|
56810
56817
|
while (true) {
|
|
56811
56818
|
try {
|
|
56812
|
-
const
|
|
56813
|
-
if (
|
|
56819
|
+
const message5 = this._readBuffer.readMessage();
|
|
56820
|
+
if (message5 === null) {
|
|
56814
56821
|
break;
|
|
56815
56822
|
}
|
|
56816
|
-
this.onmessage?.(
|
|
56823
|
+
this.onmessage?.(message5);
|
|
56817
56824
|
} catch (error51) {
|
|
56818
56825
|
this.onerror?.(error51);
|
|
56819
56826
|
}
|
|
@@ -56849,12 +56856,12 @@ var StdioClientTransport = class {
|
|
|
56849
56856
|
}
|
|
56850
56857
|
this._readBuffer.clear();
|
|
56851
56858
|
}
|
|
56852
|
-
send(
|
|
56859
|
+
send(message5) {
|
|
56853
56860
|
return new Promise((resolve) => {
|
|
56854
56861
|
if (!this._process?.stdin) {
|
|
56855
56862
|
throw new Error("Not connected");
|
|
56856
56863
|
}
|
|
56857
|
-
const json2 = serializeMessage(
|
|
56864
|
+
const json2 = serializeMessage(message5);
|
|
56858
56865
|
if (this._process.stdin.write(json2)) {
|
|
56859
56866
|
resolve();
|
|
56860
56867
|
} else {
|
|
@@ -56866,8 +56873,8 @@ var StdioClientTransport = class {
|
|
|
56866
56873
|
|
|
56867
56874
|
// ../../node_modules/.pnpm/eventsource-parser@3.1.0/node_modules/eventsource-parser/dist/index.js
|
|
56868
56875
|
var ParseError = class extends Error {
|
|
56869
|
-
constructor(
|
|
56870
|
-
super(
|
|
56876
|
+
constructor(message5, options) {
|
|
56877
|
+
super(message5), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
56871
56878
|
}
|
|
56872
56879
|
};
|
|
56873
56880
|
var LF = 10;
|
|
@@ -57083,9 +57090,9 @@ var ErrorEvent = class extends Event {
|
|
|
57083
57090
|
return inspect(inspectableError(this), options);
|
|
57084
57091
|
}
|
|
57085
57092
|
};
|
|
57086
|
-
function syntaxError(
|
|
57093
|
+
function syntaxError(message5) {
|
|
57087
57094
|
const DomException = globalThis.DOMException;
|
|
57088
|
-
return typeof DomException == "function" ? new DomException(
|
|
57095
|
+
return typeof DomException == "function" ? new DomException(message5, "SyntaxError") : new SyntaxError(message5);
|
|
57089
57096
|
}
|
|
57090
57097
|
function flattenError2(err) {
|
|
57091
57098
|
return err instanceof Error ? "errors" in err && Array.isArray(err.errors) ? err.errors.map(flattenError2).join(", ") : "cause" in err && err.cause instanceof Error ? `${err}: ${flattenError2(err.cause)}` : err.message : `${err}`;
|
|
@@ -57297,10 +57304,10 @@ getRequestOptions_fn = function() {
|
|
|
57297
57304
|
* @param code - The HTTP status code, if available
|
|
57298
57305
|
* @internal
|
|
57299
57306
|
*/
|
|
57300
|
-
failConnection_fn = function(
|
|
57307
|
+
failConnection_fn = function(message5, code) {
|
|
57301
57308
|
var _a3;
|
|
57302
57309
|
__privateGet(this, _readyState) !== this.CLOSED && __privateSet(this, _readyState, this.CLOSED);
|
|
57303
|
-
const errorEvent = new ErrorEvent("error", { code, message:
|
|
57310
|
+
const errorEvent = new ErrorEvent("error", { code, message: message5 });
|
|
57304
57311
|
(_a3 = __privateGet(this, _onError)) == null || _a3.call(this, errorEvent), this.dispatchEvent(errorEvent);
|
|
57305
57312
|
}, /**
|
|
57306
57313
|
* Schedules a reconnection attempt against the EventSource endpoint.
|
|
@@ -57309,12 +57316,12 @@ failConnection_fn = function(message4, code) {
|
|
|
57309
57316
|
* @param code - The HTTP status code, if available
|
|
57310
57317
|
* @internal
|
|
57311
57318
|
*/
|
|
57312
|
-
scheduleReconnect_fn = function(
|
|
57319
|
+
scheduleReconnect_fn = function(message5, code) {
|
|
57313
57320
|
var _a3;
|
|
57314
57321
|
if (__privateGet(this, _readyState) === this.CLOSED)
|
|
57315
57322
|
return;
|
|
57316
57323
|
__privateSet(this, _readyState, this.CONNECTING);
|
|
57317
|
-
const errorEvent = new ErrorEvent("error", { code, message:
|
|
57324
|
+
const errorEvent = new ErrorEvent("error", { code, message: message5 });
|
|
57318
57325
|
(_a3 = __privateGet(this, _onError)) == null || _a3.call(this, errorEvent), this.dispatchEvent(errorEvent), __privateSet(this, _reconnectTimer, setTimeout(__privateGet(this, _reconnect), __privateGet(this, _reconnectInterval)));
|
|
57319
57326
|
}, _reconnect = /* @__PURE__ */ new WeakMap(), /**
|
|
57320
57327
|
* ReadyState representing an EventSource currently trying to connect
|
|
@@ -57573,8 +57580,8 @@ function checkResourceAllowed({ requestedResource, configuredResource }) {
|
|
|
57573
57580
|
|
|
57574
57581
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js
|
|
57575
57582
|
var OAuthError = class extends Error {
|
|
57576
|
-
constructor(
|
|
57577
|
-
super(
|
|
57583
|
+
constructor(message5, errorUri) {
|
|
57584
|
+
super(message5);
|
|
57578
57585
|
this.errorUri = errorUri;
|
|
57579
57586
|
this.name = this.constructor.name;
|
|
57580
57587
|
}
|
|
@@ -57668,8 +57675,8 @@ var OAUTH_ERRORS = {
|
|
|
57668
57675
|
|
|
57669
57676
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/client/auth.js
|
|
57670
57677
|
var UnauthorizedError = class extends Error {
|
|
57671
|
-
constructor(
|
|
57672
|
-
super(
|
|
57678
|
+
constructor(message5) {
|
|
57679
|
+
super(message5 ?? "Unauthorized");
|
|
57673
57680
|
}
|
|
57674
57681
|
};
|
|
57675
57682
|
function isClientAuthMethod(method) {
|
|
@@ -58209,8 +58216,8 @@ async function registerClient(authorizationServerUrl, { metadata, clientMetadata
|
|
|
58209
58216
|
|
|
58210
58217
|
// ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1_ed45788dfbfe808cc09dd7daea6bd385/node_modules/@modelcontextprotocol/sdk/dist/esm/client/sse.js
|
|
58211
58218
|
var SseError = class extends Error {
|
|
58212
|
-
constructor(code,
|
|
58213
|
-
super(`SSE error: ${
|
|
58219
|
+
constructor(code, message5, event) {
|
|
58220
|
+
super(`SSE error: ${message5}`);
|
|
58214
58221
|
this.code = code;
|
|
58215
58222
|
this.event = event;
|
|
58216
58223
|
}
|
|
@@ -58313,14 +58320,14 @@ var SSEClientTransport = class {
|
|
|
58313
58320
|
});
|
|
58314
58321
|
this._eventSource.onmessage = (event) => {
|
|
58315
58322
|
const messageEvent = event;
|
|
58316
|
-
let
|
|
58323
|
+
let message5;
|
|
58317
58324
|
try {
|
|
58318
|
-
|
|
58325
|
+
message5 = JSONRPCMessageSchema.parse(JSON.parse(messageEvent.data));
|
|
58319
58326
|
} catch (error51) {
|
|
58320
58327
|
this.onerror?.(error51);
|
|
58321
58328
|
return;
|
|
58322
58329
|
}
|
|
58323
|
-
this.onmessage?.(
|
|
58330
|
+
this.onmessage?.(message5);
|
|
58324
58331
|
};
|
|
58325
58332
|
});
|
|
58326
58333
|
}
|
|
@@ -58353,7 +58360,7 @@ var SSEClientTransport = class {
|
|
|
58353
58360
|
this._eventSource?.close();
|
|
58354
58361
|
this.onclose?.();
|
|
58355
58362
|
}
|
|
58356
|
-
async send(
|
|
58363
|
+
async send(message5) {
|
|
58357
58364
|
if (!this._endpoint) {
|
|
58358
58365
|
throw new Error("Not connected");
|
|
58359
58366
|
}
|
|
@@ -58364,7 +58371,7 @@ var SSEClientTransport = class {
|
|
|
58364
58371
|
...this._requestInit,
|
|
58365
58372
|
method: "POST",
|
|
58366
58373
|
headers,
|
|
58367
|
-
body: JSON.stringify(
|
|
58374
|
+
body: JSON.stringify(message5),
|
|
58368
58375
|
signal: this._abortController?.signal
|
|
58369
58376
|
};
|
|
58370
58377
|
const response = await (this._fetch ?? fetch)(this._endpoint, init);
|
|
@@ -58383,7 +58390,7 @@ var SSEClientTransport = class {
|
|
|
58383
58390
|
if (result !== "AUTHORIZED") {
|
|
58384
58391
|
throw new UnauthorizedError();
|
|
58385
58392
|
}
|
|
58386
|
-
return this.send(
|
|
58393
|
+
return this.send(message5);
|
|
58387
58394
|
}
|
|
58388
58395
|
throw new Error(`Error POSTing to endpoint (HTTP ${response.status}): ${text2}`);
|
|
58389
58396
|
}
|
|
@@ -58448,8 +58455,8 @@ var DEFAULT_STREAMABLE_HTTP_RECONNECTION_OPTIONS = {
|
|
|
58448
58455
|
maxRetries: 2
|
|
58449
58456
|
};
|
|
58450
58457
|
var StreamableHTTPError = class extends Error {
|
|
58451
|
-
constructor(code,
|
|
58452
|
-
super(`Streamable HTTP error: ${
|
|
58458
|
+
constructor(code, message5) {
|
|
58459
|
+
super(`Streamable HTTP error: ${message5}`);
|
|
58453
58460
|
this.code = code;
|
|
58454
58461
|
}
|
|
58455
58462
|
};
|
|
@@ -58601,14 +58608,14 @@ var StreamableHTTPClientTransport = class {
|
|
|
58601
58608
|
}
|
|
58602
58609
|
if (!event.event || event.event === "message") {
|
|
58603
58610
|
try {
|
|
58604
|
-
const
|
|
58605
|
-
if (isJSONRPCResultResponse(
|
|
58611
|
+
const message5 = JSONRPCMessageSchema.parse(JSON.parse(event.data));
|
|
58612
|
+
if (isJSONRPCResultResponse(message5)) {
|
|
58606
58613
|
receivedResponse = true;
|
|
58607
58614
|
if (replayMessageId !== void 0) {
|
|
58608
|
-
|
|
58615
|
+
message5.id = replayMessageId;
|
|
58609
58616
|
}
|
|
58610
58617
|
}
|
|
58611
|
-
this.onmessage?.(
|
|
58618
|
+
this.onmessage?.(message5);
|
|
58612
58619
|
} catch (error51) {
|
|
58613
58620
|
this.onerror?.(error51);
|
|
58614
58621
|
}
|
|
@@ -58674,11 +58681,11 @@ var StreamableHTTPClientTransport = class {
|
|
|
58674
58681
|
this._abortController?.abort();
|
|
58675
58682
|
this.onclose?.();
|
|
58676
58683
|
}
|
|
58677
|
-
async send(
|
|
58684
|
+
async send(message5, options) {
|
|
58678
58685
|
try {
|
|
58679
58686
|
const { resumptionToken, onresumptiontoken } = options || {};
|
|
58680
58687
|
if (resumptionToken) {
|
|
58681
|
-
this._startOrAuthSse({ resumptionToken, replayMessageId: isJSONRPCRequest(
|
|
58688
|
+
this._startOrAuthSse({ resumptionToken, replayMessageId: isJSONRPCRequest(message5) ? message5.id : void 0 }).catch((err) => this.onerror?.(err));
|
|
58682
58689
|
return;
|
|
58683
58690
|
}
|
|
58684
58691
|
const headers = await this._commonHeaders();
|
|
@@ -58688,7 +58695,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
58688
58695
|
...this._requestInit,
|
|
58689
58696
|
method: "POST",
|
|
58690
58697
|
headers,
|
|
58691
|
-
body: JSON.stringify(
|
|
58698
|
+
body: JSON.stringify(message5),
|
|
58692
58699
|
signal: this._abortController?.signal
|
|
58693
58700
|
};
|
|
58694
58701
|
const response = await (this._fetch ?? fetch)(this._url, init);
|
|
@@ -58715,7 +58722,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
58715
58722
|
throw new UnauthorizedError();
|
|
58716
58723
|
}
|
|
58717
58724
|
this._hasCompletedAuthFlow = true;
|
|
58718
|
-
return this.send(
|
|
58725
|
+
return this.send(message5);
|
|
58719
58726
|
}
|
|
58720
58727
|
if (response.status === 403 && this._authProvider) {
|
|
58721
58728
|
const { resourceMetadataUrl, scope, error: error51 } = extractWWWAuthenticateParams(response);
|
|
@@ -58740,7 +58747,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
58740
58747
|
if (result !== "AUTHORIZED") {
|
|
58741
58748
|
throw new UnauthorizedError();
|
|
58742
58749
|
}
|
|
58743
|
-
return this.send(
|
|
58750
|
+
return this.send(message5);
|
|
58744
58751
|
}
|
|
58745
58752
|
}
|
|
58746
58753
|
throw new StreamableHTTPError(response.status, `Error POSTing to endpoint: ${text2}`);
|
|
@@ -58749,12 +58756,12 @@ var StreamableHTTPClientTransport = class {
|
|
|
58749
58756
|
this._lastUpscopingHeader = void 0;
|
|
58750
58757
|
if (response.status === 202) {
|
|
58751
58758
|
await response.body?.cancel();
|
|
58752
|
-
if (isInitializedNotification(
|
|
58759
|
+
if (isInitializedNotification(message5)) {
|
|
58753
58760
|
this._startOrAuthSse({ resumptionToken: void 0 }).catch((err) => this.onerror?.(err));
|
|
58754
58761
|
}
|
|
58755
58762
|
return;
|
|
58756
58763
|
}
|
|
58757
|
-
const messages = Array.isArray(
|
|
58764
|
+
const messages = Array.isArray(message5) ? message5 : [message5];
|
|
58758
58765
|
const hasRequests = messages.filter((msg) => "method" in msg && "id" in msg && msg.id !== void 0).length > 0;
|
|
58759
58766
|
const contentType2 = response.headers.get("content-type");
|
|
58760
58767
|
const responseMediaType = mediaTypeEssence(contentType2);
|
|
@@ -59258,11 +59265,11 @@ var McpRegistry = class {
|
|
|
59258
59265
|
this.appendLog(name, "Connected.");
|
|
59259
59266
|
await this.refreshTools(name);
|
|
59260
59267
|
} catch (error51) {
|
|
59261
|
-
const
|
|
59262
|
-
this.logger?.warn(`MCP server "${name}" failed to connect: ${
|
|
59268
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
59269
|
+
this.logger?.warn(`MCP server "${name}" failed to connect: ${message5}`);
|
|
59263
59270
|
this.statuses.set(name, "failed");
|
|
59264
|
-
this.errors.set(name,
|
|
59265
|
-
this.appendLog(name, `Failed: ${
|
|
59271
|
+
this.errors.set(name, message5);
|
|
59272
|
+
this.appendLog(name, `Failed: ${message5}`);
|
|
59266
59273
|
this.events.onStateChanged();
|
|
59267
59274
|
}
|
|
59268
59275
|
}
|
|
@@ -59394,8 +59401,8 @@ var import_node_child_process4 = require("node:child_process");
|
|
|
59394
59401
|
var import_promises9 = __toESM(require("node:fs/promises"), 1);
|
|
59395
59402
|
var import_node_path20 = __toESM(require("node:path"), 1);
|
|
59396
59403
|
var UvError = class extends Error {
|
|
59397
|
-
constructor(
|
|
59398
|
-
super(
|
|
59404
|
+
constructor(message5) {
|
|
59405
|
+
super(message5);
|
|
59399
59406
|
this.name = "UvError";
|
|
59400
59407
|
}
|
|
59401
59408
|
};
|
|
@@ -59544,8 +59551,8 @@ var import_node_child_process5 = require("node:child_process");
|
|
|
59544
59551
|
var import_node_readline = require("node:readline");
|
|
59545
59552
|
var PythonWorkerError = class extends Error {
|
|
59546
59553
|
traceback;
|
|
59547
|
-
constructor(
|
|
59548
|
-
super(
|
|
59554
|
+
constructor(message5, traceback) {
|
|
59555
|
+
super(message5);
|
|
59549
59556
|
this.traceback = traceback;
|
|
59550
59557
|
this.name = "PythonWorkerError";
|
|
59551
59558
|
}
|
|
@@ -61562,12 +61569,12 @@ function makeWriteTool(context, options) {
|
|
|
61562
61569
|
described = await context.worker.validate(params3.name, filePath);
|
|
61563
61570
|
} catch (error51) {
|
|
61564
61571
|
await restore();
|
|
61565
|
-
const
|
|
61572
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
61566
61573
|
const traceback = error51.traceback;
|
|
61567
61574
|
return {
|
|
61568
61575
|
content: `The tool was not saved.
|
|
61569
61576
|
|
|
61570
|
-
${
|
|
61577
|
+
${message5}
|
|
61571
61578
|
|
|
61572
61579
|
${traceback ?? ""}`.trim(),
|
|
61573
61580
|
isError: true
|
|
@@ -61751,11 +61758,11 @@ run(${JSON.stringify(params3, null, 2)})`
|
|
|
61751
61758
|
--- stdout ---
|
|
61752
61759
|
${printed}` : value) };
|
|
61753
61760
|
} catch (error51) {
|
|
61754
|
-
const
|
|
61761
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
61755
61762
|
const traceback = error51.traceback;
|
|
61756
|
-
const text2 = traceback !== void 0 ? `${
|
|
61763
|
+
const text2 = traceback !== void 0 ? `${message5}
|
|
61757
61764
|
|
|
61758
|
-
${traceback}` :
|
|
61765
|
+
${traceback}` : message5;
|
|
61759
61766
|
const module2 = /No module named ['"]([\w.]+)['"]/.exec(text2)?.[1];
|
|
61760
61767
|
const advice = module2 === void 0 ? "" : context.canInstall === true ? `
|
|
61761
61768
|
|
|
@@ -62577,7 +62584,7 @@ function createSearchDocsTool(options) {
|
|
|
62577
62584
|
].filter((line) => line.length > 0).join("\n")
|
|
62578
62585
|
};
|
|
62579
62586
|
} catch (error51) {
|
|
62580
|
-
const
|
|
62587
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
62581
62588
|
options.observer?.record({
|
|
62582
62589
|
at: startedAt,
|
|
62583
62590
|
source: "search_docs",
|
|
@@ -62585,9 +62592,9 @@ function createSearchDocsTool(options) {
|
|
|
62585
62592
|
...options.retrieval !== void 0 ? { collection: options.retrieval.index } : {},
|
|
62586
62593
|
hits: 0,
|
|
62587
62594
|
elapsedMs: Date.now() - startedAt,
|
|
62588
|
-
error:
|
|
62595
|
+
error: message5
|
|
62589
62596
|
});
|
|
62590
|
-
return { content:
|
|
62597
|
+
return { content: message5, isError: true };
|
|
62591
62598
|
}
|
|
62592
62599
|
}
|
|
62593
62600
|
};
|
|
@@ -62685,16 +62692,16 @@ function renderDocsMatches(options, matches) {
|
|
|
62685
62692
|
var UNANSWERED = "This tool call never reported a result \u2014 the turn ended before it did. Nothing can be assumed about whether it ran or what it changed. If it still matters, call it again; otherwise carry on.";
|
|
62686
62693
|
function repairUnansweredToolCalls(messages) {
|
|
62687
62694
|
const answered = /* @__PURE__ */ new Set();
|
|
62688
|
-
for (const
|
|
62689
|
-
if (
|
|
62690
|
-
answered.add(
|
|
62695
|
+
for (const message5 of messages) {
|
|
62696
|
+
if (message5.role === "tool" && message5.toolCallId !== void 0)
|
|
62697
|
+
answered.add(message5.toolCallId);
|
|
62691
62698
|
}
|
|
62692
62699
|
const repaired = [];
|
|
62693
|
-
for (const
|
|
62694
|
-
repaired.push(
|
|
62695
|
-
if (
|
|
62700
|
+
for (const message5 of messages) {
|
|
62701
|
+
repaired.push(message5);
|
|
62702
|
+
if (message5.role !== "assistant" || message5.toolCalls === void 0)
|
|
62696
62703
|
continue;
|
|
62697
|
-
for (const call of
|
|
62704
|
+
for (const call of message5.toolCalls) {
|
|
62698
62705
|
if (answered.has(call.id))
|
|
62699
62706
|
continue;
|
|
62700
62707
|
repaired.push({ role: "tool", toolCallId: call.id, content: UNANSWERED });
|
|
@@ -62830,10 +62837,10 @@ var TRANSIENT_STATUS = /HTTP (408|409|425|429|500|502|503|504|520|521|522|523|52
|
|
|
62830
62837
|
var TRANSIENT_TRANSPORT = /ECONNRESET|ECONNREFUSED|ETIMEDOUT|ECONNABORTED|EPIPE|EAI_AGAIN|ENETUNREACH|EHOSTUNREACH|socket hang up|other side closed|terminated|fetch failed|network error|UND_ERR_(SOCKET|CONNECT_TIMEOUT|HEADERS_TIMEOUT|BODY_TIMEOUT|CLOSED)|No reply from .* within/i;
|
|
62831
62838
|
var TRANSIENT_PROVIDER = /overloaded|rate.?limit|too many requests|temporarily unavailable|service unavailable|RESOURCE_EXHAUSTED|UNAVAILABLE|try again later|server_error|internal server error/i;
|
|
62832
62839
|
var PERMANENT = /HTTP (400|401|403|404|405|413|422)\b|certificate|self[- ]signed|unable to verify|CERT_|key (does not|doesn't) match|passphrase|credential missing|context.{0,20}(length|window|limit)|too many tokens|prompt is too long/i;
|
|
62833
|
-
function isTransientError(
|
|
62834
|
-
if (PERMANENT.test(
|
|
62840
|
+
function isTransientError(message5) {
|
|
62841
|
+
if (PERMANENT.test(message5))
|
|
62835
62842
|
return false;
|
|
62836
|
-
return TRANSIENT_STATUS.test(
|
|
62843
|
+
return TRANSIENT_STATUS.test(message5) || TRANSIENT_TRANSPORT.test(message5) || TRANSIENT_PROVIDER.test(message5);
|
|
62837
62844
|
}
|
|
62838
62845
|
function retryDelayMs(retryNumber, random2 = Math.random) {
|
|
62839
62846
|
const base = [2e3, 5e3, 12e3, 25e3][Math.min(retryNumber - 1, 3)];
|
|
@@ -63221,9 +63228,9 @@ The conversation is longer than this model accepts, and it could not be shortene
|
|
|
63221
63228
|
}
|
|
63222
63229
|
events.onToolResult(toolCall, result);
|
|
63223
63230
|
const queued = options.drainQueuedMessages?.() ?? [];
|
|
63224
|
-
for (const
|
|
63225
|
-
conversation.addUserMessage(
|
|
63226
|
-
events.onQueuedMessageConsumed?.(
|
|
63231
|
+
for (const message5 of queued) {
|
|
63232
|
+
conversation.addUserMessage(message5.text, message5.images);
|
|
63233
|
+
events.onQueuedMessageConsumed?.(message5.text);
|
|
63227
63234
|
}
|
|
63228
63235
|
if (queued.length > 0) {
|
|
63229
63236
|
iteration = -1;
|
|
@@ -63429,8 +63436,8 @@ function localFolderNames(folders) {
|
|
|
63429
63436
|
// ../../packages/core/dist/jupyter/client.js
|
|
63430
63437
|
var JupyterError = class extends Error {
|
|
63431
63438
|
status;
|
|
63432
|
-
constructor(
|
|
63433
|
-
super(
|
|
63439
|
+
constructor(message5, status2) {
|
|
63440
|
+
super(message5);
|
|
63434
63441
|
this.status = status2;
|
|
63435
63442
|
}
|
|
63436
63443
|
};
|
|
@@ -63494,8 +63501,8 @@ var JupyterClient = class {
|
|
|
63494
63501
|
if (error51 instanceof JupyterError)
|
|
63495
63502
|
return error51;
|
|
63496
63503
|
const cause = error51?.cause?.message;
|
|
63497
|
-
const
|
|
63498
|
-
return new JupyterError(`Could not reach JupyterHub at ${this.spec.url}: ${cause ??
|
|
63504
|
+
const message5 = error51 instanceof Error ? error51.message : String(error51);
|
|
63505
|
+
return new JupyterError(`Could not reach JupyterHub at ${this.spec.url}: ${cause ?? message5}`);
|
|
63499
63506
|
}
|
|
63500
63507
|
async failure(response, what) {
|
|
63501
63508
|
let detail = "";
|
|
@@ -63659,15 +63666,15 @@ var KernelSession = class {
|
|
|
63659
63666
|
throw new JupyterError(`Could not connect to the kernel on the hub: ${error51 instanceof Error ? error51.message : String(error51)}`);
|
|
63660
63667
|
}
|
|
63661
63668
|
channels.onMessage((text2) => {
|
|
63662
|
-
let
|
|
63669
|
+
let message5;
|
|
63663
63670
|
try {
|
|
63664
|
-
|
|
63671
|
+
message5 = JSON.parse(text2);
|
|
63665
63672
|
} catch {
|
|
63666
63673
|
return;
|
|
63667
63674
|
}
|
|
63668
|
-
const parent =
|
|
63675
|
+
const parent = message5.parent_header?.msg_id;
|
|
63669
63676
|
if (parent !== void 0)
|
|
63670
|
-
this.listeners.get(parent)?.(
|
|
63677
|
+
this.listeners.get(parent)?.(message5);
|
|
63671
63678
|
});
|
|
63672
63679
|
channels.onClose(() => {
|
|
63673
63680
|
if (this.channels === channels)
|
|
@@ -63734,9 +63741,9 @@ var KernelSession = class {
|
|
|
63734
63741
|
const timer = setTimeout(() => interrupt("timedOut"), options.timeoutMs);
|
|
63735
63742
|
const onAbort = () => interrupt("stopped");
|
|
63736
63743
|
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
63737
|
-
this.listeners.set(msgId, (
|
|
63738
|
-
const content =
|
|
63739
|
-
switch (
|
|
63744
|
+
this.listeners.set(msgId, (message5) => {
|
|
63745
|
+
const content = message5.content ?? {};
|
|
63746
|
+
switch (message5.msg_type ?? message5.header?.msg_type) {
|
|
63740
63747
|
case "stream":
|
|
63741
63748
|
append(String(content.text ?? ""));
|
|
63742
63749
|
break;
|
|
@@ -64245,10 +64252,10 @@ var HubMirror = class {
|
|
|
64245
64252
|
*/
|
|
64246
64253
|
async walk(folder, signal) {
|
|
64247
64254
|
const files = [];
|
|
64248
|
-
let
|
|
64249
|
-
while (
|
|
64255
|
+
let level2 = [{ remote: folder.remote, inside: "", ignore: new HubIgnore() }];
|
|
64256
|
+
while (level2.length > 0) {
|
|
64250
64257
|
const next = [];
|
|
64251
|
-
await inBatches(
|
|
64258
|
+
await inBatches(level2, CONCURRENCY, async (dir) => {
|
|
64252
64259
|
const entries = await this.client.list(dir.remote, signal);
|
|
64253
64260
|
if (entries === void 0) {
|
|
64254
64261
|
if (dir.remote === folder.remote)
|
|
@@ -64272,7 +64279,7 @@ var HubMirror = class {
|
|
|
64272
64279
|
files.push(entry);
|
|
64273
64280
|
}
|
|
64274
64281
|
});
|
|
64275
|
-
|
|
64282
|
+
level2 = next;
|
|
64276
64283
|
}
|
|
64277
64284
|
return files;
|
|
64278
64285
|
}
|
|
@@ -65618,7 +65625,7 @@ var import_node_path37 = __toESM(require("node:path"), 1);
|
|
|
65618
65625
|
var MARKER = "__LC_HUBGIT__";
|
|
65619
65626
|
var LISTED = 40;
|
|
65620
65627
|
var py2 = (value) => JSON.stringify(value);
|
|
65621
|
-
function hubGitCode(op, folders,
|
|
65628
|
+
function hubGitCode(op, folders, message5) {
|
|
65622
65629
|
return [
|
|
65623
65630
|
"import json as _lc_json, os as _lc_os, subprocess as _lc_sp",
|
|
65624
65631
|
`_lc_home = globals().setdefault('_lc_home', _lc_os.getcwd())`,
|
|
@@ -65639,7 +65646,7 @@ function hubGitCode(op, folders, message4) {
|
|
|
65639
65646
|
" _lc_x = {'repo': _lc_r}",
|
|
65640
65647
|
...op === "status" ? [" _lc_x['status'] = _lc_git(_lc_r, ['status', '--porcelain=v1', '-z', '--branch', '-unormal'], 30)"] : op === "pull" ? [" _lc_x['pull'] = _lc_git(_lc_r, ['pull', '--ff-only'], 180)"] : [
|
|
65641
65648
|
" _lc_x['add'] = _lc_git(_lc_r, ['add', '-A'])",
|
|
65642
|
-
` _lc_x['commit'] = _lc_git(_lc_r, ['commit', '-m', ${py2(
|
|
65649
|
+
` _lc_x['commit'] = _lc_git(_lc_r, ['commit', '-m', ${py2(message5 ?? "")}])`,
|
|
65643
65650
|
" _lc_x['tracks'] = _lc_git(_lc_r, ['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'], 20)['ok']",
|
|
65644
65651
|
" if _lc_x['tracks']:",
|
|
65645
65652
|
" _lc_x['push'] = _lc_git(_lc_r, ['push'], 180)",
|
|
@@ -65736,8 +65743,8 @@ async function hubGitStatus(runtime, signal) {
|
|
|
65736
65743
|
}
|
|
65737
65744
|
return { ok: true, text: "", counts: total };
|
|
65738
65745
|
}
|
|
65739
|
-
async function hubGitCommitPush(runtime,
|
|
65740
|
-
const trimmed =
|
|
65746
|
+
async function hubGitCommitPush(runtime, message5, signal) {
|
|
65747
|
+
const trimmed = message5.trim();
|
|
65741
65748
|
if (trimmed.length === 0)
|
|
65742
65749
|
return { ok: false, text: "Write a commit message first." };
|
|
65743
65750
|
const pending = await runtime.mirror.pending();
|
|
@@ -67255,6 +67262,7 @@ var OFFLOAD_FAMILIES = [
|
|
|
67255
67262
|
{ label: "Bitbucket", about: "pull requests, files at a branch, comments, merge and tag", matches: (n) => n.startsWith("bitbucket_") },
|
|
67256
67263
|
{ label: "Jenkins", about: "jobs, builds, logs, queue, start, stop and replay a Jenkinsfile", matches: (n) => n.startsWith("jenkins_") },
|
|
67257
67264
|
{ label: "AutoSys", about: "job status, definitions, logs, dependencies, events and JIL", matches: (n) => n.startsWith("autosys_") },
|
|
67265
|
+
{ label: "Monitoring (Fire Code)", about: "create monitors; their status, rows and alerts; run, show, pause, snooze, acknowledge", matches: (n) => n.startsWith("monitor_") },
|
|
67258
67266
|
{ label: "JupyterHub", about: "run code and inspect libraries on the hub, sync files, browse it", matches: (n) => n.startsWith("hub_") },
|
|
67259
67267
|
{ label: "S3 buckets", about: "list, read, download and upload files", matches: (n) => n.startsWith("s3_") },
|
|
67260
67268
|
{ label: "APIs and messaging", about: "call a REST API; open or send a Teams message", matches: named("http_request", "teams_open_chat") },
|
|
@@ -67723,15 +67731,15 @@ function handoffFacts(messages) {
|
|
|
67723
67731
|
if (typeof value === "string" && value.trim().length > 0 && !list2.includes(value.trim()))
|
|
67724
67732
|
list2.push(value.trim());
|
|
67725
67733
|
};
|
|
67726
|
-
for (const
|
|
67727
|
-
if (
|
|
67728
|
-
if (
|
|
67729
|
-
facts.userMessages.push(
|
|
67734
|
+
for (const message5 of messages) {
|
|
67735
|
+
if (message5.role === "user") {
|
|
67736
|
+
if (message5.content.trim() !== CONTINUE_PROMPT.trim() && message5.content.trim().length > 0)
|
|
67737
|
+
facts.userMessages.push(message5.content.trim());
|
|
67730
67738
|
continue;
|
|
67731
67739
|
}
|
|
67732
|
-
if (
|
|
67740
|
+
if (message5.role !== "assistant")
|
|
67733
67741
|
continue;
|
|
67734
|
-
for (const call of
|
|
67742
|
+
for (const call of message5.toolCalls ?? []) {
|
|
67735
67743
|
const { name, args } = unwrap(call.name, argumentsOf(call.arguments));
|
|
67736
67744
|
if (READ_TOOLS.has(name)) {
|
|
67737
67745
|
add(facts.filesRead, args["path"]);
|
|
@@ -67750,19 +67758,19 @@ function handoffFacts(messages) {
|
|
|
67750
67758
|
var RESULT_CHARS = 1500;
|
|
67751
67759
|
function handoffTranscript(messages, maxChars) {
|
|
67752
67760
|
const parts = [];
|
|
67753
|
-
for (const
|
|
67754
|
-
if (
|
|
67761
|
+
for (const message5 of messages) {
|
|
67762
|
+
if (message5.role === "system")
|
|
67755
67763
|
continue;
|
|
67756
|
-
if (
|
|
67764
|
+
if (message5.role === "user")
|
|
67757
67765
|
parts.push(`USER:
|
|
67758
|
-
${
|
|
67759
|
-
else if (
|
|
67760
|
-
const calls = (
|
|
67766
|
+
${message5.content}`);
|
|
67767
|
+
else if (message5.role === "assistant") {
|
|
67768
|
+
const calls = (message5.toolCalls ?? []).map((call) => `[tool ${call.name} ${call.arguments.length > 400 ? `${call.arguments.slice(0, 400)}\u2026` : call.arguments}]`);
|
|
67761
67769
|
parts.push(`ASSISTANT:
|
|
67762
|
-
${[
|
|
67770
|
+
${[message5.content, ...calls].filter((part) => part.trim().length > 0).join("\n")}`);
|
|
67763
67771
|
} else {
|
|
67764
|
-
const content =
|
|
67765
|
-
\u2026 (${String(
|
|
67772
|
+
const content = message5.content.length > RESULT_CHARS ? `${message5.content.slice(0, RESULT_CHARS)}
|
|
67773
|
+
\u2026 (${String(message5.content.length - RESULT_CHARS)} more characters)` : message5.content;
|
|
67766
67774
|
parts.push(`TOOL RESULT:
|
|
67767
67775
|
${content}`);
|
|
67768
67776
|
}
|
|
@@ -70654,21 +70662,21 @@ var OfficeBridge = class {
|
|
|
70654
70662
|
index = this.buffer.indexOf("\n");
|
|
70655
70663
|
if (line.length === 0)
|
|
70656
70664
|
continue;
|
|
70657
|
-
let
|
|
70665
|
+
let message5;
|
|
70658
70666
|
try {
|
|
70659
|
-
|
|
70667
|
+
message5 = JSON.parse(line);
|
|
70660
70668
|
} catch {
|
|
70661
70669
|
this.options.logger.warn(`office worker: unparsed output ${line.slice(0, 200)}`);
|
|
70662
70670
|
continue;
|
|
70663
70671
|
}
|
|
70664
|
-
const pending =
|
|
70672
|
+
const pending = message5.id === void 0 ? void 0 : this.waiting.get(message5.id);
|
|
70665
70673
|
if (pending === void 0)
|
|
70666
70674
|
continue;
|
|
70667
|
-
this.waiting.delete(
|
|
70668
|
-
if (
|
|
70669
|
-
pending.resolve(
|
|
70675
|
+
this.waiting.delete(message5.id);
|
|
70676
|
+
if (message5.ok === true)
|
|
70677
|
+
pending.resolve(message5.result);
|
|
70670
70678
|
else
|
|
70671
|
-
pending.reject(new Error(
|
|
70679
|
+
pending.reject(new Error(message5.error ?? "The Excel/Outlook helper reported an unknown failure."));
|
|
70672
70680
|
}
|
|
70673
70681
|
}
|
|
70674
70682
|
async dispose() {
|
|
@@ -71218,8 +71226,8 @@ var PRODUCT_LABELS = {
|
|
|
71218
71226
|
};
|
|
71219
71227
|
var AtlassianError = class extends Error {
|
|
71220
71228
|
status;
|
|
71221
|
-
constructor(
|
|
71222
|
-
super(
|
|
71229
|
+
constructor(message5, status2) {
|
|
71230
|
+
super(message5);
|
|
71223
71231
|
this.status = status2;
|
|
71224
71232
|
this.name = "AtlassianError";
|
|
71225
71233
|
}
|
|
@@ -71318,14 +71326,14 @@ function messageFrom(body) {
|
|
|
71318
71326
|
parts.push(...parsed.errorMessages.filter((m) => typeof m === "string"));
|
|
71319
71327
|
if (Array.isArray(parsed.errors)) {
|
|
71320
71328
|
for (const entry of parsed.errors) {
|
|
71321
|
-
const
|
|
71322
|
-
if (typeof
|
|
71323
|
-
parts.push(
|
|
71329
|
+
const message5 = entry.message;
|
|
71330
|
+
if (typeof message5 === "string")
|
|
71331
|
+
parts.push(message5);
|
|
71324
71332
|
}
|
|
71325
71333
|
} else if (parsed.errors !== null && typeof parsed.errors === "object") {
|
|
71326
|
-
for (const [field2,
|
|
71327
|
-
if (typeof
|
|
71328
|
-
parts.push(`${field2}: ${
|
|
71334
|
+
for (const [field2, message5] of Object.entries(parsed.errors)) {
|
|
71335
|
+
if (typeof message5 === "string")
|
|
71336
|
+
parts.push(`${field2}: ${message5}`);
|
|
71329
71337
|
}
|
|
71330
71338
|
}
|
|
71331
71339
|
return parts.join(" ");
|
|
@@ -71335,11 +71343,11 @@ function messageFrom(body) {
|
|
|
71335
71343
|
}
|
|
71336
71344
|
function describeAtlassianFailure(product, doing, status2, body) {
|
|
71337
71345
|
const label = PRODUCT_LABELS[product];
|
|
71338
|
-
const
|
|
71339
|
-
const said =
|
|
71346
|
+
const message5 = messageFrom(body);
|
|
71347
|
+
const said = message5.length > 0 ? ` ${label} said: ${message5}` : "";
|
|
71340
71348
|
switch (status2) {
|
|
71341
71349
|
case 400:
|
|
71342
|
-
return `${label} refused ${doing}.${said}` + (product === "confluence" && /xhtml/i.test(
|
|
71350
|
+
return `${label} refused ${doing}.${said}` + (product === "confluence" && /xhtml/i.test(message5) ? " The page body is not valid storage format \u2014 every tag must be closed and every macro well formed." : "");
|
|
71343
71351
|
case 401:
|
|
71344
71352
|
return product === "autosys" || product === "jenkins" ? `${label} answered HTTP 401 (not signed in) while ${doing}: it did not accept the credentials sent.${said} Check the user and password or token in Settings \u2192 DevOps \u2192 ${label} - and, through an API gateway, its consumer key and secret. Test connection's Details show exactly what was sent.` : `${label} answered HTTP 401 (not signed in) while ${doing}: it did not accept the personal access token.${said} It may have expired or been revoked: create a new one and save it in Settings \u2192 DevOps \u2192 ${label}.`;
|
|
71345
71353
|
case 403:
|
|
@@ -72226,19 +72234,19 @@ var BitbucketClient = class {
|
|
|
72226
72234
|
};
|
|
72227
72235
|
}
|
|
72228
72236
|
/** Merges at `version`, so a pull request that changed since it was checked is refused (409). */
|
|
72229
|
-
async merge(repo, id, version2,
|
|
72230
|
-
const raw = await this.rest.json(`merging #${String(id)}`, `${this.repoPath(repo)}/pull-requests/${String(id)}/merge?version=${String(version2)}`, { method: "POST", body: JSON.stringify(
|
|
72237
|
+
async merge(repo, id, version2, message5, signal) {
|
|
72238
|
+
const raw = await this.rest.json(`merging #${String(id)}`, `${this.repoPath(repo)}/pull-requests/${String(id)}/merge?version=${String(version2)}`, { method: "POST", body: JSON.stringify(message5 !== void 0 && message5.trim().length > 0 ? { message: message5 } : {}) }, signal);
|
|
72231
72239
|
return { mergeCommit: raw.properties?.mergeCommit?.id };
|
|
72232
72240
|
}
|
|
72233
72241
|
/**
|
|
72234
72242
|
* A tag at `startPoint` (a commit id or a ref). The core REST API has this resource only in later
|
|
72235
72243
|
* versions; older servers keep it under `/rest/git/1.0`, so a 404 or 405 tries there.
|
|
72236
72244
|
*/
|
|
72237
|
-
async createTag(repo, name, startPoint,
|
|
72245
|
+
async createTag(repo, name, startPoint, message5, signal) {
|
|
72238
72246
|
if (!isSafeTagName(name))
|
|
72239
72247
|
throw new AtlassianError(`"${name}" is not a valid tag name.`);
|
|
72240
|
-
const annotated =
|
|
72241
|
-
const body = { name, startPoint, ...annotated ? { message:
|
|
72248
|
+
const annotated = message5 !== void 0 && message5.trim().length > 0;
|
|
72249
|
+
const body = { name, startPoint, ...annotated ? { message: message5 } : {} };
|
|
72242
72250
|
try {
|
|
72243
72251
|
await this.rest.json(`creating tag ${name}`, `${this.repoPath(repo)}/tags`, { method: "POST", body: JSON.stringify(body) }, signal);
|
|
72244
72252
|
} catch (error51) {
|
|
@@ -74856,10 +74864,10 @@ var CONDITION_KIND = {
|
|
|
74856
74864
|
e: "e",
|
|
74857
74865
|
exitcode: "e"
|
|
74858
74866
|
};
|
|
74859
|
-
function parseConditions(
|
|
74867
|
+
function parseConditions(condition2) {
|
|
74860
74868
|
const found2 = [];
|
|
74861
74869
|
const pattern = /\b(success|failure|done|notrunning|terminated|exitcode|s|f|d|n|t|e)\s*\(\s*([A-Za-z0-9._#-]+)(\^[A-Za-z0-9]+)?(?:\s*,\s*[\d.:]+)?\s*\)(\s*(?:=|!=|<=|>=|<|>)\s*-?\d+)?/gi;
|
|
74862
|
-
for (const match of
|
|
74870
|
+
for (const match of condition2.matchAll(pattern)) {
|
|
74863
74871
|
const kind = CONDITION_KIND[(match[1] ?? "").toLowerCase()];
|
|
74864
74872
|
if (kind === void 0 || match[2] === void 0)
|
|
74865
74873
|
continue;
|
|
@@ -74927,7 +74935,7 @@ function createAutosysDependenciesTool(options) {
|
|
|
74927
74935
|
return status2;
|
|
74928
74936
|
};
|
|
74929
74937
|
const visited = /* @__PURE__ */ new Set();
|
|
74930
|
-
const walk = async (name,
|
|
74938
|
+
const walk = async (name, level2, indent2) => {
|
|
74931
74939
|
if (visited.has(name)) {
|
|
74932
74940
|
lines2.push(`${indent2}(${name} already shown above)`);
|
|
74933
74941
|
return;
|
|
@@ -74938,17 +74946,17 @@ function createAutosysDependenciesTool(options) {
|
|
|
74938
74946
|
lines2.push(`${indent2}(${name}: definition not readable)`);
|
|
74939
74947
|
return;
|
|
74940
74948
|
}
|
|
74941
|
-
const
|
|
74949
|
+
const condition2 = field(definition, "condition");
|
|
74942
74950
|
const box = field(definition, "boxName", "box_name");
|
|
74943
74951
|
if (box !== void 0)
|
|
74944
74952
|
lines2.push(`${indent2}- in box ${box} [${await statusOf(box)}] \u2014 runs only while its box is running`);
|
|
74945
|
-
if (
|
|
74953
|
+
if (condition2 === void 0) {
|
|
74946
74954
|
if (box === void 0)
|
|
74947
74955
|
lines2.push(`${indent2}- no starting condition: it runs on its own schedule${field(definition, "startTimes", "start_times") !== void 0 ? ` (${field(definition, "startTimes", "start_times") ?? ""})` : ""}`);
|
|
74948
74956
|
return;
|
|
74949
74957
|
}
|
|
74950
|
-
lines2.push(`${indent2}condition: ${
|
|
74951
|
-
for (const reference of parseConditions(
|
|
74958
|
+
lines2.push(`${indent2}condition: ${condition2}`);
|
|
74959
|
+
for (const reference of parseConditions(condition2)) {
|
|
74952
74960
|
if (reference.instance !== void 0) {
|
|
74953
74961
|
lines2.push(`${indent2}- ${KIND_WORDS[reference.kind]} ${reference.job} on instance ${reference.instance} (another instance: status not checked)`);
|
|
74954
74962
|
continue;
|
|
@@ -74956,8 +74964,8 @@ function createAutosysDependenciesTool(options) {
|
|
|
74956
74964
|
const status2 = await statusOf(reference.job);
|
|
74957
74965
|
const met = conditionMet(reference.kind, status2);
|
|
74958
74966
|
lines2.push(`${indent2}- ${KIND_WORDS[reference.kind]} ${reference.job}${reference.comparison !== void 0 ? ` ${reference.comparison}` : ""}: ${status2} \u2014 ${met === void 0 ? "check the exit code" : met ? "met" : "NOT met"}`);
|
|
74959
|
-
if (met === false &&
|
|
74960
|
-
await walk(reference.job,
|
|
74967
|
+
if (met === false && level2 < (params3.depth ?? 3))
|
|
74968
|
+
await walk(reference.job, level2 + 1, `${indent2} `);
|
|
74961
74969
|
}
|
|
74962
74970
|
};
|
|
74963
74971
|
await walk(params3.job, 1, " ");
|
|
@@ -75551,6 +75559,520 @@ function createAutosysAddressTools(options) {
|
|
|
75551
75559
|
];
|
|
75552
75560
|
}
|
|
75553
75561
|
|
|
75562
|
+
// ../../packages/core/dist/monitoring/channel.js
|
|
75563
|
+
function monitorToolRefusal(tool, name) {
|
|
75564
|
+
if (tool === void 0) {
|
|
75565
|
+
return `There is no tool called "${name}" here. A monitor uses a Python tool (py__name), an MCP tool, or a read tool that exists in the settings monitoring runs with (Fire Code \u2192 Settings \u2192 Monitoring \u2192 'Run tools with the settings of').`;
|
|
75566
|
+
}
|
|
75567
|
+
if (ALWAYS_ASK_TOOLS.has(tool.name) || NEVER_AVAILABLE_TO_SCHEDULES.includes(tool.name)) {
|
|
75568
|
+
return `"${tool.name}" changes something or always asks, so a monitor - which runs unattended - may not use it.`;
|
|
75569
|
+
}
|
|
75570
|
+
if (tool.group === "edit" || tool.group === "always") {
|
|
75571
|
+
return `"${tool.name}" is not a reading tool (${tool.group}), so a monitor may not use it.`;
|
|
75572
|
+
}
|
|
75573
|
+
if (tool.group === "command" && !tool.name.startsWith("py__")) {
|
|
75574
|
+
return `"${tool.name}" runs commands, so a monitor may not use it. Write a Python tool that reads what is needed and returns rows.`;
|
|
75575
|
+
}
|
|
75576
|
+
return void 0;
|
|
75577
|
+
}
|
|
75578
|
+
|
|
75579
|
+
// ../../packages/core/dist/monitoring/rowsCheck.js
|
|
75580
|
+
var NUMERIC_TEXT = /^\s*[-+(]?[\d,]+(\.\d+)?\)?\s*(%|ms|s|sec|min|mins|h|hrs|kb|mb|gb|tb)?\s*$/i;
|
|
75581
|
+
var ISO = /^\d{4}-\d{2}-\d{2}([T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
|
|
75582
|
+
var OTHER_DATE = /^\d{1,2}[/.-]\d{1,2}[/.-]\d{2,4}(\s+\d{1,2}:\d{2}(:\d{2})?)?$|^\d{1,2}\s+[A-Za-z]{3}\s+\d{4}/;
|
|
75583
|
+
var ERRORISH = /^(error|errors|message|exception|failure|reason)$/i;
|
|
75584
|
+
function typeOf(value) {
|
|
75585
|
+
if (value === null || value === void 0 || value === "")
|
|
75586
|
+
return "empty";
|
|
75587
|
+
if (typeof value === "number")
|
|
75588
|
+
return "number";
|
|
75589
|
+
if (typeof value === "boolean")
|
|
75590
|
+
return "boolean";
|
|
75591
|
+
if (typeof value === "object")
|
|
75592
|
+
return "nested";
|
|
75593
|
+
const text2 = String(value);
|
|
75594
|
+
if (ISO.test(text2.trim()))
|
|
75595
|
+
return "timestamp";
|
|
75596
|
+
return "text";
|
|
75597
|
+
}
|
|
75598
|
+
function checkMonitorRows(text2) {
|
|
75599
|
+
const problems = [];
|
|
75600
|
+
const warnings = [];
|
|
75601
|
+
const body = text2.split("\n\n--- stdout ---\n")[0]?.trim() ?? "";
|
|
75602
|
+
let value;
|
|
75603
|
+
try {
|
|
75604
|
+
value = JSON.parse(body);
|
|
75605
|
+
} catch {
|
|
75606
|
+
return {
|
|
75607
|
+
verdict: "fail",
|
|
75608
|
+
rows: 0,
|
|
75609
|
+
problems: ["It returned text, not data. run() must RETURN a list of dicts (not print, not a formatted string) - Fire Code serialises it as JSON."],
|
|
75610
|
+
warnings: [],
|
|
75611
|
+
columns: []
|
|
75612
|
+
};
|
|
75613
|
+
}
|
|
75614
|
+
let list2 = value;
|
|
75615
|
+
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
75616
|
+
const object3 = value;
|
|
75617
|
+
const keys2 = Object.keys(object3);
|
|
75618
|
+
if (keys2.some((k) => ERRORISH.test(k)) && !keys2.some((k) => Array.isArray(object3[k]))) {
|
|
75619
|
+
return {
|
|
75620
|
+
verdict: "fail",
|
|
75621
|
+
rows: 0,
|
|
75622
|
+
problems: [`It returned ${JSON.stringify(object3).slice(0, 200)} - a failure reported as data reads as a row, and the tile would not turn purple. RAISE an exception when the data cannot be read.`],
|
|
75623
|
+
warnings: [],
|
|
75624
|
+
columns: []
|
|
75625
|
+
};
|
|
75626
|
+
}
|
|
75627
|
+
const inner = ["rows", "items", "data", "results", "records"].find((k) => Array.isArray(object3[k]));
|
|
75628
|
+
if (inner !== void 0) {
|
|
75629
|
+
warnings.push(`The rows are inside "${inner}". That is read, but returning the list itself is simpler and needs no "rows" setting.`);
|
|
75630
|
+
list2 = object3[inner];
|
|
75631
|
+
} else {
|
|
75632
|
+
problems.push("It returned one object. Return a LIST of dicts - one per thing watched - even when there is only one.");
|
|
75633
|
+
list2 = [value];
|
|
75634
|
+
}
|
|
75635
|
+
}
|
|
75636
|
+
if (!Array.isArray(list2)) {
|
|
75637
|
+
return { verdict: "fail", rows: 0, problems: [`It returned a ${typeof value}. run() must return a list of dicts.`], warnings: [], columns: [] };
|
|
75638
|
+
}
|
|
75639
|
+
const rows = list2;
|
|
75640
|
+
if (rows.length === 0) {
|
|
75641
|
+
warnings.push("It returned no rows, so the shape cannot be checked. That is right when there is nothing to report - check again with arguments that return data.");
|
|
75642
|
+
}
|
|
75643
|
+
const notObjects = rows.filter((r) => r === null || typeof r !== "object" || Array.isArray(r)).length;
|
|
75644
|
+
if (notObjects > 0) {
|
|
75645
|
+
problems.push(`${String(notObjects)} of ${String(rows.length)} items are not dicts. Every item must be a dict of field -> value, e.g. {"job": "PAY_LOAD", "status": "FAILURE"}.`);
|
|
75646
|
+
}
|
|
75647
|
+
const records = rows.filter((r) => r !== null && typeof r === "object" && !Array.isArray(r));
|
|
75648
|
+
if (records.length > 0 && records.every((r) => Object.keys(r).some((k) => ERRORISH.test(k)) && Object.keys(r).length <= 2)) {
|
|
75649
|
+
problems.push("Every row is an error message. RAISE an exception when the data cannot be read, so the tile turns purple instead of showing it as data.");
|
|
75650
|
+
}
|
|
75651
|
+
if (rows.length > 5e3)
|
|
75652
|
+
problems.push(`${String(rows.length)} rows - a monitor keeps 5000. Filter at the source and return what is worth watching.`);
|
|
75653
|
+
const keys = [];
|
|
75654
|
+
for (const r of records.slice(0, 200))
|
|
75655
|
+
for (const k of Object.keys(r))
|
|
75656
|
+
if (!keys.includes(k))
|
|
75657
|
+
keys.push(k);
|
|
75658
|
+
const columns = keys.map((key2) => {
|
|
75659
|
+
const values = records.map((r) => r[key2]);
|
|
75660
|
+
const types = new Set(values.map(typeOf).filter((t) => t !== "empty"));
|
|
75661
|
+
const type = types.size === 0 ? "empty" : types.size === 1 ? [...types][0] ?? "empty" : "mixed";
|
|
75662
|
+
const sample = values.find((v) => typeOf(v) !== "empty");
|
|
75663
|
+
return {
|
|
75664
|
+
key: key2,
|
|
75665
|
+
type,
|
|
75666
|
+
...sample !== void 0 ? { example: typeof sample === "object" ? JSON.stringify(sample).slice(0, 60) : String(sample).slice(0, 60) } : {},
|
|
75667
|
+
present: values.filter((v) => typeOf(v) !== "empty").length
|
|
75668
|
+
};
|
|
75669
|
+
});
|
|
75670
|
+
for (const c2 of columns) {
|
|
75671
|
+
const values = records.map((r) => r[c2.key]).filter((v) => typeOf(v) === "text");
|
|
75672
|
+
const numeric = values.filter((v) => NUMERIC_TEXT.test(v));
|
|
75673
|
+
if (numeric.length > 0 && numeric.length === values.length) {
|
|
75674
|
+
warnings.push(`"${c2.key}" holds numbers as text (${JSON.stringify(numeric[0])}). Return a number (int or float, no units or commas) so > and < rules compare numbers.`);
|
|
75675
|
+
}
|
|
75676
|
+
const dates = values.filter((v) => OTHER_DATE.test(v.trim()));
|
|
75677
|
+
if (dates.length > 0) {
|
|
75678
|
+
warnings.push(`"${c2.key}" has dates like ${JSON.stringify(dates[0])}. Return ISO 8601 ("2026-10-25T14:05:00Z", with a zone) so olderThan/newerThan rules read them the same everywhere.`);
|
|
75679
|
+
}
|
|
75680
|
+
if (c2.type === "nested")
|
|
75681
|
+
warnings.push(`"${c2.key}" holds nested data. It is read with a dotted key ("${c2.key}.field"); flat fields are easier to show and filter.`);
|
|
75682
|
+
if (c2.type === "mixed")
|
|
75683
|
+
warnings.push(`"${c2.key}" mixes types (${[...new Set(records.map((r) => typeOf(r[c2.key])).filter((t) => t !== "empty"))].join(", ")}). Give each field one type.`);
|
|
75684
|
+
if (c2.present < records.length && records.length > 1)
|
|
75685
|
+
warnings.push(`"${c2.key}" is missing from ${String(records.length - c2.present)} of ${String(records.length)} rows. Give every row the same fields (None for no value).`);
|
|
75686
|
+
}
|
|
75687
|
+
const suggestedKey = columns.find((c2) => c2.type === "text" && c2.present === records.length && new Set(records.map((r) => String(r[c2.key]))).size === records.length && records.length > 0)?.key;
|
|
75688
|
+
if (records.length > 1 && suggestedKey === void 0) {
|
|
75689
|
+
warnings.push("No field names each row uniquely. Add one (a job name, a host) - acknowledgements stay with a row by it across checks.");
|
|
75690
|
+
}
|
|
75691
|
+
return { verdict: problems.length > 0 ? "fail" : warnings.length > 0 ? "warn" : "pass", rows: rows.length, problems, warnings, columns, ...suggestedKey !== void 0 ? { suggestedKey } : {} };
|
|
75692
|
+
}
|
|
75693
|
+
function describeRowsCheck(check2) {
|
|
75694
|
+
const verdict = check2.verdict === "pass" ? "PASS - ready for a monitor." : check2.verdict === "warn" ? "PASS with warnings - it will work; fixing these makes rules more reliable." : "FAIL - fix the tool and check again before creating a monitor.";
|
|
75695
|
+
const columns = check2.columns.map((c2) => ({ key: c2.key, ...c2.type === "number" ? { format: "number" } : c2.type === "timestamp" ? { format: "datetime" } : {} }));
|
|
75696
|
+
return [
|
|
75697
|
+
verdict,
|
|
75698
|
+
`${String(check2.rows)} row(s).`,
|
|
75699
|
+
...check2.problems.length > 0 ? ["", "Problems:", ...check2.problems.map((p) => `- ${p}`)] : [],
|
|
75700
|
+
...check2.warnings.length > 0 ? ["", "Warnings:", ...check2.warnings.map((w) => `- ${w}`)] : [],
|
|
75701
|
+
...check2.columns.length > 0 ? ["", "Fields:", ...check2.columns.map((c2) => `- ${c2.key}: ${c2.type}${c2.example !== void 0 ? ` (e.g. ${c2.example})` : ""}${c2.present < check2.rows ? `, in ${String(c2.present)} rows` : ""}`)] : [],
|
|
75702
|
+
...check2.verdict !== "fail" && check2.columns.length > 0 ? ["", `For monitor_create: "columns": ${JSON.stringify(columns)}${check2.suggestedKey !== void 0 ? `, "key": "${check2.suggestedKey}"` : ""}`] : []
|
|
75703
|
+
].join("\n");
|
|
75704
|
+
}
|
|
75705
|
+
var MONITOR_TOOL_TEMPLATE = `
|
|
75706
|
+
"""<What it reads>, for monitoring: one record per <job | host | feed>."""
|
|
75707
|
+
from datetime import datetime, timezone
|
|
75708
|
+
|
|
75709
|
+
|
|
75710
|
+
def run(pattern: str = "PAY_*") -> list[dict]:
|
|
75711
|
+
"""<One line>.
|
|
75712
|
+
|
|
75713
|
+
Args:
|
|
75714
|
+
pattern: <what narrows it>.
|
|
75715
|
+
"""
|
|
75716
|
+
items = read_source(pattern) # let it RAISE when the source cannot be read - the tile turns purple
|
|
75717
|
+
rows = []
|
|
75718
|
+
for item in items:
|
|
75719
|
+
rows.append({
|
|
75720
|
+
"job": item.name, # names the row: the monitor's "key"
|
|
75721
|
+
"status": item.status.upper(), # a short fixed word rules can match
|
|
75722
|
+
"minutes": int(item.minutes), # numbers as numbers - no units, no commas
|
|
75723
|
+
"lastStart": item.start.astimezone(timezone.utc).isoformat(), # ISO 8601, with a zone
|
|
75724
|
+
"machine": item.machine or None, # None, not "", when there is no value
|
|
75725
|
+
})
|
|
75726
|
+
return rows # [] when there is nothing to report - never a message
|
|
75727
|
+
`.trim();
|
|
75728
|
+
|
|
75729
|
+
// ../../packages/core/dist/monitoring/tools.js
|
|
75730
|
+
var MONITOR_TOOL_FORMAT = `FORMAT a monitor reads: make the Python tool's run() return a LIST OF DICTS - one dict per thing watched (a job, a host, a feed), the same keys in each; flat values (str, int, float, bool or None - a nested dict is read with a dotted key such as "owner.name"); numbers as numbers, never "1,250" or "84 min" strings; timestamps as ISO 8601 ("2026-10-25T14:05:00Z") or epoch seconds, so olderThan/newerThan rules work; one key that names the row (job, host) for the monitor's "key"; a status as a short fixed word (FAILURE, OK) rules can match. Return [] when there is nothing to report - never a message saying so. RAISE an exception when the data cannot be read, so the tile turns purple (cannot tell) instead of green. Keep it fast (seconds) and read-only. {"rows": [...]} and {"columns": [...], "rows": [[...]]} are read too. Try it with monitor_create tryOnly: true before saving.`;
|
|
75731
|
+
var condition = external_exports.lazy(() => external_exports.union([
|
|
75732
|
+
external_exports.object({ all: external_exports.array(condition) }),
|
|
75733
|
+
external_exports.object({ any: external_exports.array(condition) }),
|
|
75734
|
+
external_exports.object({ not: condition }),
|
|
75735
|
+
external_exports.object({ column: external_exports.string(), op: external_exports.string().optional(), value: external_exports.unknown().optional() })
|
|
75736
|
+
]));
|
|
75737
|
+
var level = external_exports.enum(["red", "amber", "purple", "blue", "green", "grey"]);
|
|
75738
|
+
var sourceSchema = external_exports.union([
|
|
75739
|
+
external_exports.object({ tool: external_exports.string(), args: external_exports.record(external_exports.string(), external_exports.unknown()).optional() }),
|
|
75740
|
+
external_exports.object({ sqlite: external_exports.string(), sql: external_exports.string() }),
|
|
75741
|
+
external_exports.object({ files: external_exports.union([external_exports.string(), external_exports.array(external_exports.union([external_exports.string(), external_exports.object({ name: external_exports.string().optional(), path: external_exports.string() })]))]), sql: external_exports.string() })
|
|
75742
|
+
]).describe('Where the rows come from. {"tool": "py__name", "args": {...}}: a Python tool (returning a list of records), an MCP tool or a read tool - runs in the background with the settings Fire Code monitoring uses. {"sqlite": "C:\\\\full\\\\path.db", "sql": "select ..."}: read by Fire Code itself, never locked. {"files": ["C:\\\\full\\\\path.csv"], "sql": "select ... from data"}: CSV, TSV, Excel or JSON, queried with SQL (the first file is the table "data", the second "data2").');
|
|
75743
|
+
var createSchema2 = external_exports.object({
|
|
75744
|
+
name: external_exports.string().describe('kebab-case, e.g. "overnight-batch" - the monitor and its skill file.'),
|
|
75745
|
+
title: external_exports.string().describe('What the tile says, a few words: "Overnight batch".'),
|
|
75746
|
+
summary: external_exports.string().describe("One sentence shown on hover: what it watches and what an alert means."),
|
|
75747
|
+
audience: external_exports.enum(["me", "team"]).optional().describe('"team" (the default): shown under Team alerts and shared where the team shares skills. "me": a Personal monitor only on this computer. Use "me" when the user says it is just for them.'),
|
|
75748
|
+
every: external_exports.union([external_exports.string(), external_exports.number()]).describe('How often to check: "5m", "15m", "1h", "1d" (one minute at least).'),
|
|
75749
|
+
activeHours: external_exports.string().optional().describe('Only check between these times, e.g. "07:00-19:00" (a window past midnight is allowed).'),
|
|
75750
|
+
days: external_exports.array(external_exports.string()).optional().describe('Only on these days, e.g. ["mon","tue","wed","thu","fri"].'),
|
|
75751
|
+
source: sourceSchema,
|
|
75752
|
+
rows: external_exports.string().optional().describe('Where the list of rows is in the answer, as a dotted path ("data.jobs"), when it is not found by itself.'),
|
|
75753
|
+
columns: external_exports.array(external_exports.object({ key: external_exports.string(), label: external_exports.string().optional(), format: external_exports.enum(["text", "number", "percent", "datetime", "duration", "bytes"]).optional(), width: external_exports.number().optional() })).optional().describe("The grid columns, in order. Omit to show every field. A dotted key reads inside a nested object."),
|
|
75754
|
+
key: external_exports.string().optional().describe("The column that identifies a row (a job name, a host) - acknowledgements stay with that row across checks."),
|
|
75755
|
+
rules: external_exports.array(external_exports.object({
|
|
75756
|
+
level,
|
|
75757
|
+
when: condition.describe('{"column", "op", "value"} with op ==, !=, >, >=, <, <=, contains, notContains, startsWith, endsWith, matches (regex), in, notIn (value a list), empty, notEmpty, olderThan / newerThan (value "30m", "2h", for a timestamp column); or {"all": [...]}, {"any": [...]}, {"not": {...}}.'),
|
|
75758
|
+
highlight: external_exports.enum(["row", "cell"]).optional().describe("Colour the whole row, or just the cell (the default when the rule is about one column)."),
|
|
75759
|
+
column: external_exports.string().optional().describe("Which cell to colour, when not the rule's own column."),
|
|
75760
|
+
message: external_exports.string().optional().describe('The alert text, filled from the row: "{name} failed at {lastEnd}".')
|
|
75761
|
+
})).describe("Alert rules, tried on every row. red = failure / needs attention, amber = warning, blue = information, purple = no data or cannot tell."),
|
|
75762
|
+
whenEmpty: level.optional().describe("The level when there are no rows. Default green."),
|
|
75763
|
+
whenClear: level.optional().describe("The level when there are rows and no rule fires. Default green."),
|
|
75764
|
+
notify: level.optional().describe("The least severe level that sends a Windows notification for this monitor. Default amber. How each level notifies is the user's setting."),
|
|
75765
|
+
details: sourceSchema.optional().describe(`The breakdown shown when the user double-clicks a row: a source whose args or SQL take {column} values from that row, e.g. {"tool": "py__job_runs", "args": {"job": "{name}"}}. Omit to show the row's own fields.`),
|
|
75766
|
+
timeoutSeconds: external_exports.number().int().min(5).max(900).optional().describe("How long one check may take. Default 120."),
|
|
75767
|
+
notes: external_exports.string().optional().describe("Markdown for the skill body: what this watches, why, and what to do about each alert."),
|
|
75768
|
+
tryOnly: external_exports.boolean().optional().describe("Run the source once and show what Fire Code makes of it - columns, rows, alerts - without saving anything. Use it while writing or fixing the tool.")
|
|
75769
|
+
});
|
|
75770
|
+
function monitorBlock(params3) {
|
|
75771
|
+
const spec = { title: params3.title, summary: params3.summary, every: params3.every };
|
|
75772
|
+
for (const key2 of ["activeHours", "days", "source", "rows", "columns", "key", "rules", "whenEmpty", "whenClear", "notify", "details", "timeoutSeconds"]) {
|
|
75773
|
+
if (params3[key2] !== void 0)
|
|
75774
|
+
spec[key2] = params3[key2];
|
|
75775
|
+
}
|
|
75776
|
+
return JSON.stringify(spec, null, 2);
|
|
75777
|
+
}
|
|
75778
|
+
function monitorSkillBody(params3, block2) {
|
|
75779
|
+
return [
|
|
75780
|
+
`# ${params3.title}`,
|
|
75781
|
+
"",
|
|
75782
|
+
params3.summary,
|
|
75783
|
+
"",
|
|
75784
|
+
...params3.notes !== void 0 && params3.notes.trim().length > 0 ? [params3.notes.trim(), ""] : [],
|
|
75785
|
+
`This skill is a **Fire Code monitor**: Fire Code checks it every ${String(params3.every)} and shows it on the Monitoring dashboard. The block below is its definition. Change it with monitor_create under the same name, so the change is approved again; an edit by hand is reviewed on the dashboard before it runs.`,
|
|
75786
|
+
"",
|
|
75787
|
+
"```monitor",
|
|
75788
|
+
block2,
|
|
75789
|
+
"```",
|
|
75790
|
+
""
|
|
75791
|
+
].join("\n");
|
|
75792
|
+
}
|
|
75793
|
+
function describeEvaluation(e) {
|
|
75794
|
+
const keys = e.columns.map((c2) => c2.key);
|
|
75795
|
+
const shapeless = keys.length === 1 && (keys[0] === "line" || keys[0] === "value");
|
|
75796
|
+
return [
|
|
75797
|
+
`${e.level.toUpperCase()} (${e.meaning}) - ${e.headline}`,
|
|
75798
|
+
`${String(e.rows)} row(s); columns: ${keys.join(", ") || "none"}`,
|
|
75799
|
+
...e.alerts.slice(0, 10).map((a) => `- ${a.level}: ${a.message}`),
|
|
75800
|
+
...e.alerts.length > 10 ? [`- \u2026 ${String(e.alerts.length - 10)} more`] : [],
|
|
75801
|
+
...shapeless ? ["", `The answer is not records: it was read as one "${keys[0] ?? ""}" per row, so rules cannot compare fields. Change the tool. ${MONITOR_TOOL_FORMAT}`] : []
|
|
75802
|
+
].join("\n");
|
|
75803
|
+
}
|
|
75804
|
+
var message2 = (error51) => error51 instanceof Error ? error51.message : String(error51);
|
|
75805
|
+
function createMonitorCreateTool(options) {
|
|
75806
|
+
const skillParams = (params3, block2) => ({
|
|
75807
|
+
name: params3.name,
|
|
75808
|
+
description: `Monitor: ${params3.summary.replace(/\s+/g, " ").trim()}`,
|
|
75809
|
+
body: monitorSkillBody(params3, block2),
|
|
75810
|
+
...params3.audience !== void 0 ? { audience: params3.audience } : {}
|
|
75811
|
+
});
|
|
75812
|
+
const tryIt = async (block2) => {
|
|
75813
|
+
try {
|
|
75814
|
+
const checked = await options.channel.request("evaluate", { block: block2 });
|
|
75815
|
+
if (checked.sourceKind === "tool") {
|
|
75816
|
+
return { ok: true, native: false, note: "After it is saved, its tool is run once here to show what the first check finds." };
|
|
75817
|
+
}
|
|
75818
|
+
const answer = await options.channel.request("fetchPreview", { block: block2 });
|
|
75819
|
+
const tried = await options.channel.request("evaluate", { block: block2, rows: answer });
|
|
75820
|
+
return { ok: true, native: true, note: `Tried now:
|
|
75821
|
+
${describeEvaluation(tried)}` };
|
|
75822
|
+
} catch (error51) {
|
|
75823
|
+
return { ok: false, error: message2(error51) };
|
|
75824
|
+
}
|
|
75825
|
+
};
|
|
75826
|
+
return {
|
|
75827
|
+
name: "monitor_create",
|
|
75828
|
+
group: "edit",
|
|
75829
|
+
description: "Create or replace a Fire Code monitor: a check that runs on a schedule and shows on the Monitoring dashboard as a coloured tile, with a data grid whose cells or rows are coloured by alert rules, and Windows notifications at the levels the user chose. Before creating one: find an existing tool that returns the data (search_docs, or the tools you have) and reuse it; if none does, write a Python tool with create_python_tool from the template in monitor_check_tool, and run monitor_check_tool until it says PASS - then use the columns and key it gives. A SQLite database or CSV/Excel file needs no tool. Rules are judged by Fire Code itself on every check - no model is involved - so make them exact. The user approves the skill file; the result shows what the first check found. " + MONITOR_TOOL_FORMAT,
|
|
75830
|
+
parametersSchema: createSchema2,
|
|
75831
|
+
async preview(params3, context) {
|
|
75832
|
+
const block2 = monitorBlock(params3);
|
|
75833
|
+
if (params3.tryOnly === true) {
|
|
75834
|
+
return {
|
|
75835
|
+
kind: "text",
|
|
75836
|
+
text: `Try the monitor "${params3.name}" once - nothing is saved:
|
|
75837
|
+
|
|
75838
|
+
${"tool" in params3.source ? `Run ${params3.source.tool}(${JSON.stringify(params3.source.args ?? {})})` : `Read ${JSON.stringify(params3.source)}`}`
|
|
75839
|
+
};
|
|
75840
|
+
}
|
|
75841
|
+
const tried = await tryIt(block2);
|
|
75842
|
+
if (!tried.ok) {
|
|
75843
|
+
return { kind: "text", text: `This monitor cannot be created as written - nothing will be saved:
|
|
75844
|
+
|
|
75845
|
+
${tried.error}` };
|
|
75846
|
+
}
|
|
75847
|
+
const written = options.writeSkill.preview !== void 0 ? await options.writeSkill.preview(skillParams(params3, block2), context) : void 0;
|
|
75848
|
+
if (written?.kind === "diff") {
|
|
75849
|
+
return { ...written, note: [written.note, tried.note, "Approving this also lets it run on this computer."].filter((n) => n !== void 0 && n.length > 0).join("\n\n") };
|
|
75850
|
+
}
|
|
75851
|
+
return { kind: "text", text: `${monitorSkillBody(params3, block2)}
|
|
75852
|
+
|
|
75853
|
+
${tried.note}` };
|
|
75854
|
+
},
|
|
75855
|
+
async execute(params3, context) {
|
|
75856
|
+
const block2 = monitorBlock(params3);
|
|
75857
|
+
const tried = await tryIt(block2);
|
|
75858
|
+
if (!tried.ok)
|
|
75859
|
+
return { content: `Not created: ${tried.error}`, isError: true };
|
|
75860
|
+
if (params3.tryOnly === true) {
|
|
75861
|
+
if (tried.native || !("tool" in params3.source))
|
|
75862
|
+
return { content: `Nothing saved.
|
|
75863
|
+
|
|
75864
|
+
${tried.note}` };
|
|
75865
|
+
const result = await options.runTool(params3.source.tool, params3.source.args ?? {}, context);
|
|
75866
|
+
if (result.isError === true)
|
|
75867
|
+
return { content: `Nothing saved. The tool failed:
|
|
75868
|
+
${result.content.slice(0, 3e3)}`, isError: true };
|
|
75869
|
+
try {
|
|
75870
|
+
const e = await options.channel.request("evaluate", { block: block2, text: result.content });
|
|
75871
|
+
return { content: `Nothing saved. Fire Code reads this answer as:
|
|
75872
|
+
${describeEvaluation(e)}
|
|
75873
|
+
|
|
75874
|
+
The tool's answer, checked:
|
|
75875
|
+
${describeRowsCheck(checkMonitorRows(result.content))}` };
|
|
75876
|
+
} catch (error51) {
|
|
75877
|
+
return { content: `Nothing saved. The answer could not be read as rows: ${message2(error51)}
|
|
75878
|
+
|
|
75879
|
+
${MONITOR_TOOL_FORMAT}`, isError: true };
|
|
75880
|
+
}
|
|
75881
|
+
}
|
|
75882
|
+
const written = await options.writeSkill.execute(skillParams(params3, block2), context);
|
|
75883
|
+
if (written.isError === true)
|
|
75884
|
+
return written;
|
|
75885
|
+
const lines2 = [written.content];
|
|
75886
|
+
try {
|
|
75887
|
+
await options.channel.request("approve", { name: params3.name, block: block2 });
|
|
75888
|
+
} catch (error51) {
|
|
75889
|
+
lines2.push(`It is saved, but monitoring could not approve it here: ${message2(error51)} Approve it on the dashboard.`);
|
|
75890
|
+
return { content: lines2.join("\n\n") };
|
|
75891
|
+
}
|
|
75892
|
+
if (!tried.native && "tool" in params3.source) {
|
|
75893
|
+
const result = await options.runTool(params3.source.tool, params3.source.args ?? {}, context);
|
|
75894
|
+
if (result.isError === true) {
|
|
75895
|
+
lines2.push(`The first try of ${params3.source.tool} failed, so the tile will show purple until it works:
|
|
75896
|
+
${result.content.slice(0, 2e3)}`);
|
|
75897
|
+
} else {
|
|
75898
|
+
try {
|
|
75899
|
+
const e = await options.channel.request("evaluate", { block: block2, text: result.content });
|
|
75900
|
+
lines2.push(`First check:
|
|
75901
|
+
${describeEvaluation(e)}`);
|
|
75902
|
+
} catch (error51) {
|
|
75903
|
+
lines2.push(`The tool answered, but its answer could not be read as rows: ${message2(error51)}`);
|
|
75904
|
+
}
|
|
75905
|
+
}
|
|
75906
|
+
} else {
|
|
75907
|
+
lines2.push(tried.note);
|
|
75908
|
+
}
|
|
75909
|
+
await options.channel.request("run", { name: params3.name }).catch(() => void 0);
|
|
75910
|
+
lines2.push("It is approved on this computer and its first check has started; it shows on the Monitoring dashboard. If the rows or rules are not right, call monitor_create again with the same name.");
|
|
75911
|
+
return { content: lines2.join("\n\n") };
|
|
75912
|
+
}
|
|
75913
|
+
};
|
|
75914
|
+
}
|
|
75915
|
+
var checkToolSchema = external_exports.object({
|
|
75916
|
+
tool: external_exports.string().describe('The tool to check, e.g. "py__pay_job_status".'),
|
|
75917
|
+
args: external_exports.record(external_exports.string(), external_exports.unknown()).optional().describe("The arguments the monitor will call it with.")
|
|
75918
|
+
});
|
|
75919
|
+
function createMonitorCheckToolTool(options) {
|
|
75920
|
+
return {
|
|
75921
|
+
name: "monitor_check_tool",
|
|
75922
|
+
group: "command",
|
|
75923
|
+
description: 'Run a tool once and check its answer is what a Fire Code monitor needs: a list of records with one type per field, numbers as numbers, ISO timestamps, a field naming each row, failures raised rather than returned. Says PASS or FAIL with what to change, the fields it found, and the "columns" and "key" to give monitor_create. HOW TO MAKE A MONITORING TOOL: (1) reuse a tool that already returns the data if one passes this check; (2) otherwise write a Python tool with create_python_tool (audience "team" for a team monitor, "me" for a personal one) starting from this template, reading the real source - use light_code.credential("name") for a saved credential, never a password in the code:\n' + MONITOR_TOOL_TEMPLATE + '\n(3) call monitor_check_tool and fix the tool until it says PASS; (4) only then call monitor_create with the "columns" and "key" it suggests.',
|
|
75924
|
+
parametersSchema: checkToolSchema,
|
|
75925
|
+
async preview(params3) {
|
|
75926
|
+
return { kind: "text", text: `Run ${params3.tool}(${JSON.stringify(params3.args ?? {}, null, 2)}) once and check what it returns.` };
|
|
75927
|
+
},
|
|
75928
|
+
async execute(params3, context) {
|
|
75929
|
+
const result = await options.runTool(params3.tool, params3.args ?? {}, context);
|
|
75930
|
+
if (result.isError === true) {
|
|
75931
|
+
return {
|
|
75932
|
+
content: `FAIL - the tool raised:
|
|
75933
|
+
${result.content.slice(0, 3e3)}
|
|
75934
|
+
|
|
75935
|
+
That is what a monitor shows as purple (cannot tell). Fix the tool and check again.`,
|
|
75936
|
+
isError: true
|
|
75937
|
+
};
|
|
75938
|
+
}
|
|
75939
|
+
return { content: describeRowsCheck(checkMonitorRows(result.content)) };
|
|
75940
|
+
}
|
|
75941
|
+
};
|
|
75942
|
+
}
|
|
75943
|
+
var statusSchema2 = external_exports.object({
|
|
75944
|
+
name: external_exports.string().optional().describe("One monitor, for its alerts and rows. Omit for every monitor."),
|
|
75945
|
+
rows: external_exports.number().int().min(0).max(1e3).optional().describe("How many rows of one monitor to include. Default 50."),
|
|
75946
|
+
onlyAlerts: external_exports.boolean().optional().describe("Only the rows with an alert.")
|
|
75947
|
+
});
|
|
75948
|
+
function when3(seconds) {
|
|
75949
|
+
if (seconds === void 0 || seconds === null)
|
|
75950
|
+
return "never";
|
|
75951
|
+
return new Date(seconds * 1e3).toLocaleString();
|
|
75952
|
+
}
|
|
75953
|
+
function createMonitorStatusTool(options) {
|
|
75954
|
+
return {
|
|
75955
|
+
name: "monitor_status",
|
|
75956
|
+
group: "read",
|
|
75957
|
+
description: "What Fire Code's monitors show now: every monitor's colour, headline and state, or - with name - one monitor's alerts and rows (as JSON records, which dataframe can take further) and its recent history. Use it before answering a question about an alert.",
|
|
75958
|
+
parametersSchema: statusSchema2,
|
|
75959
|
+
async execute(params3) {
|
|
75960
|
+
try {
|
|
75961
|
+
if (params3.name === void 0) {
|
|
75962
|
+
const list2 = await options.channel.request("list");
|
|
75963
|
+
if (list2.monitors.length === 0)
|
|
75964
|
+
return { content: "No monitors yet. monitor_create makes one." };
|
|
75965
|
+
return {
|
|
75966
|
+
content: list2.monitors.map((m2) => `- ${m2.name} (${m2.team ? "Team" : "Personal"}, ${m2.origin}): ${m2.level.toUpperCase()} - ${m2.headline} \xB7 last check ${when3(m2.lastRun)}` + (m2.paused ? " \xB7 PAUSED" : "") + (m2.snoozeUntil ? ` \xB7 snoozed until ${when3(m2.snoozeUntil)}` : "") + (!m2.approved ? " \xB7 NOT APPROVED on this computer" : "")).join("\n")
|
|
75967
|
+
};
|
|
75968
|
+
}
|
|
75969
|
+
const got = await options.channel.request("get", { name: params3.name, rows: params3.rows ?? 50, ...params3.onlyAlerts === true ? { onlyAlerts: true } : {} });
|
|
75970
|
+
const m = got.monitor;
|
|
75971
|
+
const e = got.record?.evaluation;
|
|
75972
|
+
const changes = (got.history ?? []).filter((p, i, all) => i === 0 || all[i - 1]?.level !== p.level).slice(-10);
|
|
75973
|
+
return {
|
|
75974
|
+
content: [
|
|
75975
|
+
`${m.title} (${m.name}): ${m.level.toUpperCase()} - ${m.headline}`,
|
|
75976
|
+
m.summary,
|
|
75977
|
+
`Last check ${when3(m.lastRun)}${m.error ? ` - failed: ${m.error}` : ""}`,
|
|
75978
|
+
"",
|
|
75979
|
+
"Alerts:",
|
|
75980
|
+
...e?.alerts.length ? e.alerts.map((a) => `- [${a.id}] ${a.level}${a.acknowledged ? " (acknowledged)" : ""}: ${a.message}`) : ["- none"],
|
|
75981
|
+
"",
|
|
75982
|
+
`Rows (${String(e?.rows.length ?? 0)} of ${String(e?.rowsTotal ?? e?.rows.length ?? 0)}):`,
|
|
75983
|
+
JSON.stringify(e?.rows ?? []),
|
|
75984
|
+
"",
|
|
75985
|
+
`Level changes: ${changes.map((p) => `${when3(p.at)} ${p.level}`).join(" \u2192 ") || "none recorded"}`
|
|
75986
|
+
].join("\n")
|
|
75987
|
+
};
|
|
75988
|
+
} catch (error51) {
|
|
75989
|
+
return { content: message2(error51), isError: true };
|
|
75990
|
+
}
|
|
75991
|
+
}
|
|
75992
|
+
};
|
|
75993
|
+
}
|
|
75994
|
+
var showSchema = external_exports.object({
|
|
75995
|
+
action: external_exports.enum(["run", "open", "dashboard"]).describe("run: check now. open: the monitor's grid window. dashboard: the Monitoring dashboard."),
|
|
75996
|
+
name: external_exports.string().optional().describe("The monitor, for run and open.")
|
|
75997
|
+
});
|
|
75998
|
+
function createMonitorShowTool(options) {
|
|
75999
|
+
return {
|
|
76000
|
+
name: "monitor_show",
|
|
76001
|
+
group: "read",
|
|
76002
|
+
description: "Check a monitor now, or put its grid window or the Monitoring dashboard on the user's screen.",
|
|
76003
|
+
parametersSchema: showSchema,
|
|
76004
|
+
async execute(params3) {
|
|
76005
|
+
try {
|
|
76006
|
+
if (params3.action !== "dashboard" && params3.name === void 0)
|
|
76007
|
+
return { content: `Name the monitor to ${params3.action}.`, isError: true };
|
|
76008
|
+
await options.channel.request(params3.action, params3.name !== void 0 ? { name: params3.name } : {});
|
|
76009
|
+
return {
|
|
76010
|
+
content: params3.action === "run" ? `Checking ${params3.name ?? ""} now; monitor_status shows the result in a moment.` : params3.action === "open" ? `${params3.name ?? ""}'s grid is on screen.` : "The Monitoring dashboard is on screen."
|
|
76011
|
+
};
|
|
76012
|
+
} catch (error51) {
|
|
76013
|
+
return { content: message2(error51), isError: true };
|
|
76014
|
+
}
|
|
76015
|
+
}
|
|
76016
|
+
};
|
|
76017
|
+
}
|
|
76018
|
+
var controlSchema = external_exports.object({
|
|
76019
|
+
action: external_exports.enum(["pause", "resume", "snooze", "ack", "unack", "notify"]),
|
|
76020
|
+
name: external_exports.string(),
|
|
76021
|
+
minutes: external_exports.number().int().min(0).max(10080).optional().describe("snooze: how long (0 ends a snooze). ack: how long the acknowledgement lasts; omit for as long as the alert lasts."),
|
|
76022
|
+
ids: external_exports.array(external_exports.string()).optional().describe("ack / unack: which alerts, by the ids monitor_status shows. Omit for every alert."),
|
|
76023
|
+
note: external_exports.string().optional().describe("ack: why, kept with it."),
|
|
76024
|
+
mode: external_exports.enum(["default", "off", "dashboard", "silent", "toast", "urgent", "alarm"]).optional().describe('notify: how this monitor tells the user, replacing the per-level setting; "default" goes back to it.'),
|
|
76025
|
+
notifyFrom: external_exports.enum(["default", "red", "amber", "purple", "blue", "green"]).optional().describe("notify: the least severe level that notifies.")
|
|
76026
|
+
});
|
|
76027
|
+
function createMonitorControlTool(options) {
|
|
76028
|
+
return {
|
|
76029
|
+
name: "monitor_control",
|
|
76030
|
+
group: "edit",
|
|
76031
|
+
description: "Change what a monitor tells the user: pause or resume its checks, snooze its notifications, acknowledge (or un-acknowledge) alerts so they stop counting until they get worse, or change how it notifies. Always asks the user - use it when they asked.",
|
|
76032
|
+
parametersSchema: controlSchema,
|
|
76033
|
+
async preview(params3) {
|
|
76034
|
+
const lines2 = [];
|
|
76035
|
+
switch (params3.action) {
|
|
76036
|
+
case "pause":
|
|
76037
|
+
lines2.push(`Pause "${params3.name}": no checks and no notifications until it is resumed.`);
|
|
76038
|
+
break;
|
|
76039
|
+
case "resume":
|
|
76040
|
+
lines2.push(`Resume "${params3.name}".`);
|
|
76041
|
+
break;
|
|
76042
|
+
case "snooze":
|
|
76043
|
+
lines2.push(params3.minutes === 0 ? `End the snooze on "${params3.name}".` : `Snooze "${params3.name}" for ${String(params3.minutes ?? 60)} minutes: it keeps checking, and tells nobody.`);
|
|
76044
|
+
break;
|
|
76045
|
+
case "notify":
|
|
76046
|
+
lines2.push(`"${params3.name}" notifies: ${params3.mode ?? "unchanged"}; from level: ${params3.notifyFrom ?? "unchanged"}.`);
|
|
76047
|
+
break;
|
|
76048
|
+
default: {
|
|
76049
|
+
lines2.push(`${params3.action === "ack" ? "Acknowledge" : "Un-acknowledge"} on "${params3.name}"${params3.minutes !== void 0 ? ` for ${String(params3.minutes)} minutes` : ""}:`);
|
|
76050
|
+
try {
|
|
76051
|
+
const got = await options.channel.request("get", { name: params3.name, rows: 0 });
|
|
76052
|
+
const alerts = (got.record?.evaluation?.alerts ?? []).filter((a) => params3.ids === void 0 || params3.ids.includes(a.id));
|
|
76053
|
+
lines2.push(...alerts.length > 0 ? alerts.map((a) => `- ${a.level}: ${a.message}`) : ["- no matching alerts"]);
|
|
76054
|
+
} catch (error51) {
|
|
76055
|
+
lines2.push(`(could not read its alerts: ${message2(error51)})`);
|
|
76056
|
+
}
|
|
76057
|
+
if (params3.note !== void 0)
|
|
76058
|
+
lines2.push("", `Note: ${params3.note}`);
|
|
76059
|
+
}
|
|
76060
|
+
}
|
|
76061
|
+
return { kind: "text", text: lines2.join("\n") };
|
|
76062
|
+
},
|
|
76063
|
+
async execute(params3) {
|
|
76064
|
+
try {
|
|
76065
|
+
const { action, ...rest } = params3;
|
|
76066
|
+
const args = Object.fromEntries(Object.entries(rest).filter(([, v]) => v !== void 0));
|
|
76067
|
+
const answer = await options.channel.request(action === "resume" ? "pause" : action, action === "resume" ? { ...args, on: false } : args);
|
|
76068
|
+
return { content: `Done: ${JSON.stringify(answer)}` };
|
|
76069
|
+
} catch (error51) {
|
|
76070
|
+
return { content: message2(error51), isError: true };
|
|
76071
|
+
}
|
|
76072
|
+
}
|
|
76073
|
+
};
|
|
76074
|
+
}
|
|
76075
|
+
|
|
75554
76076
|
// ../../packages/core/dist/atlassian/readOnly.js
|
|
75555
76077
|
function readOnlyNote(label) {
|
|
75556
76078
|
return ` Access to ${label} here is read-only: nothing in ${label} can be changed from this chat. If asked to change something, say so and give the exact change for someone with access to make; do not try another way.`;
|
|
@@ -75682,8 +76204,8 @@ var import_node_crypto15 = require("node:crypto");
|
|
|
75682
76204
|
var import_promises26 = __toESM(require("node:fs/promises"), 1);
|
|
75683
76205
|
var import_node_path46 = __toESM(require("node:path"), 1);
|
|
75684
76206
|
var TOMBSTONE_PREFIX = "LIGHT-CODE-DELETED:";
|
|
75685
|
-
function tombstoneText(who,
|
|
75686
|
-
return `${TOMBSTONE_PREFIX} removed for the team by ${who} on ${
|
|
76207
|
+
function tombstoneText(who, when4) {
|
|
76208
|
+
return `${TOMBSTONE_PREFIX} removed for the team by ${who} on ${when4.toISOString().slice(0, 10)}. Light Code no longer loads this file; writing a new one of the same name brings it back.
|
|
75687
76209
|
`;
|
|
75688
76210
|
}
|
|
75689
76211
|
function isTombstone(bytes) {
|
|
@@ -76145,9 +76667,9 @@ function errorChain(error51) {
|
|
|
76145
76667
|
const parts = [];
|
|
76146
76668
|
let current = error51;
|
|
76147
76669
|
for (let depth = 0; depth < 5 && current !== void 0 && current !== null; depth++) {
|
|
76148
|
-
const
|
|
76670
|
+
const message5 = current instanceof Error ? `${current.name === "Error" ? "" : `${current.name}: `}${current.message}` : String(current);
|
|
76149
76671
|
const code = current.code;
|
|
76150
|
-
parts.push(typeof code === "string" ? `${
|
|
76672
|
+
parts.push(typeof code === "string" ? `${message5} [${code}]` : message5);
|
|
76151
76673
|
current = current.cause;
|
|
76152
76674
|
}
|
|
76153
76675
|
return parts.join(" <- ");
|
|
@@ -77329,8 +77851,8 @@ function cdata(text2) {
|
|
|
77329
77851
|
function block(node) {
|
|
77330
77852
|
switch (node.kind) {
|
|
77331
77853
|
case "heading": {
|
|
77332
|
-
const
|
|
77333
|
-
return `<h${String(
|
|
77854
|
+
const level2 = Math.min(Math.max(node.level, 1), 6);
|
|
77855
|
+
return `<h${String(level2)}>${inline(node.content)}</h${String(level2)}>`;
|
|
77334
77856
|
}
|
|
77335
77857
|
case "paragraph":
|
|
77336
77858
|
return `<p>${inline(node.content)}</p>`;
|
|
@@ -77633,7 +78155,7 @@ var paramsSchema12 = external_exports.object({
|
|
|
77633
78155
|
cid: external_exports.string().min(1).max(80).regex(/^[A-Za-z0-9._-]+$/, "A cid may only contain letters, digits, dot, underscore and hyphen.").describe("The id your HTML refers to as cid:THIS.")
|
|
77634
78156
|
})).max(20).optional().describe('Images shown inside the message rather than as attachments. Needs html: true and an <img src="cid:..."> in the body for each one.')
|
|
77635
78157
|
});
|
|
77636
|
-
function
|
|
78158
|
+
function message3(error51) {
|
|
77637
78159
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
77638
78160
|
}
|
|
77639
78161
|
function filesIn(params3) {
|
|
@@ -77735,7 +78257,7 @@ function createOutlookDraftTool(options) {
|
|
|
77735
78257
|
}
|
|
77736
78258
|
return { content: lines2.join("\n") };
|
|
77737
78259
|
} catch (error51) {
|
|
77738
|
-
return { content:
|
|
78260
|
+
return { content: message3(error51), isError: true };
|
|
77739
78261
|
}
|
|
77740
78262
|
}
|
|
77741
78263
|
};
|
|
@@ -77890,7 +78412,7 @@ function createExcelRunMacroTool(options) {
|
|
|
77890
78412
|
const found2 = await findMacroSource(options, params3.workbook, params3.macro);
|
|
77891
78413
|
source = found2 ?? `(the source of "${params3.macro}" could not be found \u2014 it may live in a module this cannot read)`;
|
|
77892
78414
|
} catch (error51) {
|
|
77893
|
-
source = `(the source could not be read: ${
|
|
78415
|
+
source = `(the source could not be read: ${message4(error51)})`;
|
|
77894
78416
|
}
|
|
77895
78417
|
return {
|
|
77896
78418
|
kind: "text",
|
|
@@ -77924,7 +78446,7 @@ function createExcelRunMacroTool(options) {
|
|
|
77924
78446
|
}
|
|
77925
78447
|
return { content: lines2.join("\n"), ...result.failed ? { isError: true } : {} };
|
|
77926
78448
|
} catch (error51) {
|
|
77927
|
-
return { content:
|
|
78449
|
+
return { content: message4(error51), isError: true };
|
|
77928
78450
|
}
|
|
77929
78451
|
}
|
|
77930
78452
|
};
|
|
@@ -77948,7 +78470,7 @@ function createExcelEvaluateTool(options) {
|
|
|
77948
78470
|
}
|
|
77949
78471
|
return { content: `${result.expression} on ${result.sheet} gives: ${result.value ?? "(empty)"}` };
|
|
77950
78472
|
} catch (error51) {
|
|
77951
|
-
return { content:
|
|
78473
|
+
return { content: message4(error51), isError: true };
|
|
77952
78474
|
}
|
|
77953
78475
|
}
|
|
77954
78476
|
};
|
|
@@ -77991,7 +78513,7 @@ function createExcelCalculateTool(options) {
|
|
|
77991
78513
|
}
|
|
77992
78514
|
return { content: lines2.join("\n") };
|
|
77993
78515
|
} catch (error51) {
|
|
77994
|
-
return { content:
|
|
78516
|
+
return { content: message4(error51), isError: true };
|
|
77995
78517
|
}
|
|
77996
78518
|
}
|
|
77997
78519
|
};
|
|
@@ -78051,7 +78573,7 @@ function createExcelCheckMacroTool(options) {
|
|
|
78051
78573
|
].join("\n")
|
|
78052
78574
|
};
|
|
78053
78575
|
} catch (error51) {
|
|
78054
|
-
return { content:
|
|
78576
|
+
return { content: message4(error51), isError: true };
|
|
78055
78577
|
}
|
|
78056
78578
|
}
|
|
78057
78579
|
};
|
|
@@ -78094,7 +78616,7 @@ function describeChanges(before, after) {
|
|
|
78094
78616
|
}
|
|
78095
78617
|
return changes;
|
|
78096
78618
|
}
|
|
78097
|
-
function
|
|
78619
|
+
function message4(error51) {
|
|
78098
78620
|
return error51 instanceof Error ? error51.message : String(error51);
|
|
78099
78621
|
}
|
|
78100
78622
|
|
|
@@ -78563,7 +79085,7 @@ function taskSummary(task) {
|
|
|
78563
79085
|
createdAt: task.createdAt,
|
|
78564
79086
|
updatedAt: task.updatedAt,
|
|
78565
79087
|
// The system prompt is not part of what the user said or saw.
|
|
78566
|
-
messageCount: task.messages.filter((
|
|
79088
|
+
messageCount: task.messages.filter((message5) => message5.role !== "system").length
|
|
78567
79089
|
};
|
|
78568
79090
|
}
|
|
78569
79091
|
|
|
@@ -79409,8 +79931,8 @@ function computeDashboard(input) {
|
|
|
79409
79931
|
(item.kind === "skill" ? entry.skills : entry.tools).add(item.name);
|
|
79410
79932
|
if (item.updated !== void 0 && (entry.lastUpdated === void 0 || item.updated > entry.lastUpdated))
|
|
79411
79933
|
entry.lastUpdated = item.updated;
|
|
79412
|
-
const
|
|
79413
|
-
if (Number.isFinite(
|
|
79934
|
+
const when4 = item.updated !== void 0 ? Date.parse(item.updated) : NaN;
|
|
79935
|
+
if (Number.isFinite(when4) && when4 >= from && when4 <= to) {
|
|
79414
79936
|
if (item.version === void 0 || item.version <= 1)
|
|
79415
79937
|
entry.added++;
|
|
79416
79938
|
else
|
|
@@ -79683,8 +80205,8 @@ function eventsFromTask(task, context) {
|
|
|
79683
80205
|
const skillsByPath = new Map(context.skills.map((skill) => [comparablePath(skill.filePath), skill]));
|
|
79684
80206
|
const skip = new Set(context.skip);
|
|
79685
80207
|
const calls = [];
|
|
79686
|
-
for (const
|
|
79687
|
-
const entry =
|
|
80208
|
+
for (const message5 of task.messages) {
|
|
80209
|
+
const entry = message5;
|
|
79688
80210
|
if (entry.role !== "assistant" || !Array.isArray(entry.toolCalls))
|
|
79689
80211
|
continue;
|
|
79690
80212
|
for (const call of entry.toolCalls) {
|
|
@@ -80641,13 +81163,14 @@ ${preview.text}` } : {}
|
|
|
80641
81163
|
const chosen = configured !== void 0 && configured.length > 0;
|
|
80642
81164
|
const team = chosen ? void 0 : teamRepoPlan(config2);
|
|
80643
81165
|
const publish = chosen ? void 0 : publishFolder("tools", config2.s3?.tools ?? []) ?? (team !== void 0 && "own" in team ? team.own.tools : void 0);
|
|
80644
|
-
const personal = personalToolsDir !== void 0 ? [personalToolsDir] : [];
|
|
81166
|
+
const personal = [...personalToolsDir !== void 0 ? [personalToolsDir] : []];
|
|
81167
|
+
const added = services.extraToolDirs ?? [];
|
|
80645
81168
|
if (publish === void 0)
|
|
80646
|
-
return { extraToolDirs: [...personal, ...mirroredToolsDirs] };
|
|
81169
|
+
return { extraToolDirs: [...personal, ...mirroredToolsDirs, ...added] };
|
|
80647
81170
|
const local = localToolsDir(config2);
|
|
80648
81171
|
return {
|
|
80649
81172
|
toolsDir: publish,
|
|
80650
|
-
extraToolDirs: [...personal, ...local !== void 0 ? [local] : [], ...mirroredToolsDirs.filter((dir) => !samePath(dir, publish))]
|
|
81173
|
+
extraToolDirs: [...personal, ...local !== void 0 ? [local] : [], ...mirroredToolsDirs.filter((dir) => !samePath(dir, publish)), ...added]
|
|
80651
81174
|
};
|
|
80652
81175
|
}
|
|
80653
81176
|
function noFolderMessage(kind) {
|
|
@@ -81158,13 +81681,13 @@ ${preview.text}` } : {}
|
|
|
81158
81681
|
activeTaskId = id;
|
|
81159
81682
|
await services.workspaceState.set(ACTIVE_TASK_KEY, id);
|
|
81160
81683
|
}
|
|
81161
|
-
function post(
|
|
81162
|
-
if (backgroundRun && isTranscriptMessage(
|
|
81163
|
-
if (
|
|
81164
|
-
backgroundRunErrors.push(
|
|
81684
|
+
function post(message5) {
|
|
81685
|
+
if (backgroundRun && isTranscriptMessage(message5.type)) {
|
|
81686
|
+
if (message5.type === "error")
|
|
81687
|
+
backgroundRunErrors.push(message5.message);
|
|
81165
81688
|
return;
|
|
81166
81689
|
}
|
|
81167
|
-
transport.post(
|
|
81690
|
+
transport.post(message5);
|
|
81168
81691
|
}
|
|
81169
81692
|
let backgroundRun = false;
|
|
81170
81693
|
let backgroundRunErrors = [];
|
|
@@ -81639,9 +82162,9 @@ ${preview.text}` } : {}
|
|
|
81639
82162
|
if (recovery === void 0)
|
|
81640
82163
|
return;
|
|
81641
82164
|
const where = recovery.quarantinedTo === void 0 ? "" : ` The damaged file was kept as ${recovery.quarantinedTo}.`;
|
|
81642
|
-
const
|
|
81643
|
-
logger.warn(
|
|
81644
|
-
post({ type: "error", message:
|
|
82165
|
+
const message5 = `Your ${recovery.scope} settings file could not be read and was restored from the last good copy.${where} Anything changed immediately before this may need setting again.`;
|
|
82166
|
+
logger.warn(message5);
|
|
82167
|
+
post({ type: "error", message: message5 });
|
|
81645
82168
|
}
|
|
81646
82169
|
function settingsMessageFrom(approvals = cachedApprovals) {
|
|
81647
82170
|
return {
|
|
@@ -81900,12 +82423,12 @@ ${preview.text}` } : {}
|
|
|
81900
82423
|
if (hubBrowse !== void 0)
|
|
81901
82424
|
combined.register(hubBrowse);
|
|
81902
82425
|
combined.register(createNotifyTool({
|
|
81903
|
-
notify: (
|
|
82426
|
+
notify: (message5, level2, details, reportFile) => {
|
|
81904
82427
|
if (reportFile !== void 0) {
|
|
81905
82428
|
lastReportPath = reportFile;
|
|
81906
|
-
services.desktopNotify?.({ message:
|
|
82429
|
+
services.desktopNotify?.({ message: message5, level: level2, reportPath: reportFile });
|
|
81907
82430
|
void (async () => {
|
|
81908
|
-
const open = await ui.showActionMessage(
|
|
82431
|
+
const open = await ui.showActionMessage(message5, "Open report", level2);
|
|
81909
82432
|
if (open && ui.openFile !== void 0)
|
|
81910
82433
|
await ui.openFile(reportFile);
|
|
81911
82434
|
})();
|
|
@@ -81913,34 +82436,34 @@ ${preview.text}` } : {}
|
|
|
81913
82436
|
}
|
|
81914
82437
|
if (details !== void 0) {
|
|
81915
82438
|
void (async () => {
|
|
81916
|
-
const saved = await saveReport(
|
|
82439
|
+
const saved = await saveReport(message5, details);
|
|
81917
82440
|
if (saved !== void 0)
|
|
81918
82441
|
lastReportPath = saved;
|
|
81919
82442
|
services.desktopNotify?.({
|
|
81920
|
-
message:
|
|
81921
|
-
level,
|
|
82443
|
+
message: message5,
|
|
82444
|
+
level: level2,
|
|
81922
82445
|
...saved !== void 0 ? { reportPath: saved } : {}
|
|
81923
82446
|
});
|
|
81924
|
-
const open = await ui.showActionMessage(
|
|
82447
|
+
const open = await ui.showActionMessage(message5, "Open report", level2);
|
|
81925
82448
|
if (!open)
|
|
81926
82449
|
return;
|
|
81927
82450
|
if (saved !== void 0 && ui.openFile !== void 0)
|
|
81928
82451
|
await ui.openFile(saved);
|
|
81929
82452
|
else
|
|
81930
|
-
await ui.openDocument({ title:
|
|
82453
|
+
await ui.openDocument({ title: message5, content: details });
|
|
81931
82454
|
})();
|
|
81932
82455
|
return;
|
|
81933
82456
|
}
|
|
81934
|
-
services.desktopNotify?.({ message:
|
|
82457
|
+
services.desktopNotify?.({ message: message5, level: level2 });
|
|
81935
82458
|
const taskId = runningScheduleId !== void 0 ? activeTaskId : void 0;
|
|
81936
82459
|
if (taskId === void 0) {
|
|
81937
|
-
if (
|
|
81938
|
-
ui.showWarning(
|
|
82460
|
+
if (level2 === "warning")
|
|
82461
|
+
ui.showWarning(message5);
|
|
81939
82462
|
else
|
|
81940
|
-
ui.showInfo(
|
|
82463
|
+
ui.showInfo(message5);
|
|
81941
82464
|
return;
|
|
81942
82465
|
}
|
|
81943
|
-
void openFromNotification(
|
|
82466
|
+
void openFromNotification(message5, level2, taskId);
|
|
81944
82467
|
}
|
|
81945
82468
|
}));
|
|
81946
82469
|
if (skillsDir !== void 0) {
|
|
@@ -81971,7 +82494,7 @@ ${preview.text}` } : {}
|
|
|
81971
82494
|
const publishTo = cachedSkillMirrors.find((mirror) => mirror.enabled === true && mirror.publish === true);
|
|
81972
82495
|
const skillTarget = publishTo === void 0 ? void 0 : targetById(cachedS3, publishTo.connectionId);
|
|
81973
82496
|
const mirrorPrefix = publishTo?.prefix;
|
|
81974
|
-
|
|
82497
|
+
const writeSkill = createWriteSkillTool({
|
|
81975
82498
|
...context,
|
|
81976
82499
|
...skillTarget !== void 0 && skillTarget.readOnly !== true ? {
|
|
81977
82500
|
onSaved: async (name, content, relativePath) => {
|
|
@@ -81983,7 +82506,20 @@ ${preview.text}` } : {}
|
|
|
81983
82506
|
});
|
|
81984
82507
|
}
|
|
81985
82508
|
} : {}
|
|
81986
|
-
})
|
|
82509
|
+
});
|
|
82510
|
+
combined.register(writeSkill);
|
|
82511
|
+
if (services.monitoring !== void 0) {
|
|
82512
|
+
const monitorOptions = {
|
|
82513
|
+
channel: services.monitoring,
|
|
82514
|
+
writeSkill,
|
|
82515
|
+
runTool: (name, args, toolContext) => executeForMonitor(name, args, toolContext)
|
|
82516
|
+
};
|
|
82517
|
+
combined.register(createMonitorCreateTool(monitorOptions));
|
|
82518
|
+
combined.register(createMonitorStatusTool(monitorOptions));
|
|
82519
|
+
combined.register(createMonitorShowTool(monitorOptions));
|
|
82520
|
+
combined.register(createMonitorCheckToolTool(monitorOptions));
|
|
82521
|
+
combined.register(createMonitorControlTool(monitorOptions));
|
|
82522
|
+
}
|
|
81987
82523
|
combined.register(createDeleteSkillTool(context));
|
|
81988
82524
|
combined.register(createUseSkillFileTool(context));
|
|
81989
82525
|
}
|
|
@@ -82337,36 +82873,36 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
82337
82873
|
await secrets.delete(ref);
|
|
82338
82874
|
}
|
|
82339
82875
|
}
|
|
82340
|
-
async function handleSaveAddonRecord(
|
|
82341
|
-
const addon = installedAddons.find((candidate) => candidate.package ===
|
|
82876
|
+
async function handleSaveAddonRecord(message5) {
|
|
82877
|
+
const addon = installedAddons.find((candidate) => candidate.package === message5.package);
|
|
82342
82878
|
const spec = addon?.page?.records;
|
|
82343
82879
|
if (addon === void 0 || spec === void 0)
|
|
82344
|
-
return postAddonPage(
|
|
82345
|
-
const cleaned = cleanAddonValues(spec.fields,
|
|
82880
|
+
return postAddonPage(message5.package, { error: "This add-on keeps no list." });
|
|
82881
|
+
const cleaned = cleanAddonValues(spec.fields, message5.values);
|
|
82346
82882
|
if (!cleaned.ok)
|
|
82347
|
-
return postAddonPage(
|
|
82883
|
+
return postAddonPage(message5.package, { error: cleaned.message });
|
|
82348
82884
|
const { config: config2 } = await configManager.load();
|
|
82349
82885
|
const current = config2.addons?.settings?.[addon.package] ?? {};
|
|
82350
82886
|
const records = [...current.records ?? []];
|
|
82351
82887
|
const name = String(cleaned.values[spec.keyField] ?? "");
|
|
82352
|
-
const clash = records.find((record2) => record2.id !==
|
|
82888
|
+
const clash = records.find((record2) => record2.id !== message5.id && String(record2.values[spec.keyField] ?? "").toLowerCase() === name.toLowerCase());
|
|
82353
82889
|
if (clash !== void 0)
|
|
82354
|
-
return postAddonPage(
|
|
82355
|
-
let id =
|
|
82890
|
+
return postAddonPage(message5.package, { error: `There is already a ${spec.noun} called "${name}".` });
|
|
82891
|
+
let id = message5.id;
|
|
82356
82892
|
if (id === void 0) {
|
|
82357
82893
|
if (records.length >= (spec.max ?? 500))
|
|
82358
|
-
return postAddonPage(
|
|
82894
|
+
return postAddonPage(message5.package, { error: `No more than ${String(spec.max ?? 500)} ${spec.noun}s.` });
|
|
82359
82895
|
id = (0, import_node_crypto16.randomBytes)(6).toString("hex");
|
|
82360
82896
|
records.push({ id, values: cleaned.values });
|
|
82361
82897
|
} else {
|
|
82362
82898
|
const at = records.findIndex((record2) => record2.id === id);
|
|
82363
82899
|
if (at < 0)
|
|
82364
|
-
return postAddonPage(
|
|
82900
|
+
return postAddonPage(message5.package, { error: `That ${spec.noun} no longer exists.` });
|
|
82365
82901
|
records[at] = { id, values: cleaned.values };
|
|
82366
82902
|
}
|
|
82367
|
-
await writeAddonSecrets(addon.package, id, spec.fields,
|
|
82903
|
+
await writeAddonSecrets(addon.package, id, spec.fields, message5.secrets, message5.clearSecrets);
|
|
82368
82904
|
await storeAddonSettings(addon, { ...current, records });
|
|
82369
|
-
await postAddonPage(
|
|
82905
|
+
await postAddonPage(message5.package, { saved: true });
|
|
82370
82906
|
}
|
|
82371
82907
|
async function handleDeleteAddonRecord(pkg, id) {
|
|
82372
82908
|
const addon = installedAddons.find((candidate) => candidate.package === pkg);
|
|
@@ -82379,18 +82915,18 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
82379
82915
|
await storeAddonSettings(addon, { ...current, records: (current.records ?? []).filter((record2) => record2.id !== id) });
|
|
82380
82916
|
await postAddonPage(pkg, { saved: true });
|
|
82381
82917
|
}
|
|
82382
|
-
async function handleSaveAddonValues(
|
|
82383
|
-
const addon = installedAddons.find((candidate) => candidate.package ===
|
|
82918
|
+
async function handleSaveAddonValues(message5) {
|
|
82919
|
+
const addon = installedAddons.find((candidate) => candidate.package === message5.package);
|
|
82384
82920
|
const fields = addon?.page?.fields;
|
|
82385
82921
|
if (addon === void 0 || fields === void 0)
|
|
82386
|
-
return postAddonPage(
|
|
82387
|
-
const cleaned = cleanAddonValues(fields,
|
|
82922
|
+
return postAddonPage(message5.package);
|
|
82923
|
+
const cleaned = cleanAddonValues(fields, message5.values);
|
|
82388
82924
|
if (!cleaned.ok)
|
|
82389
|
-
return postAddonPage(
|
|
82925
|
+
return postAddonPage(message5.package, { error: cleaned.message });
|
|
82390
82926
|
const { config: config2 } = await configManager.load();
|
|
82391
|
-
await writeAddonSecrets(addon.package, void 0, fields,
|
|
82927
|
+
await writeAddonSecrets(addon.package, void 0, fields, message5.secrets, message5.clearSecrets);
|
|
82392
82928
|
await storeAddonSettings(addon, { ...config2.addons?.settings?.[addon.package] ?? {}, values: cleaned.values });
|
|
82393
|
-
await postAddonPage(
|
|
82929
|
+
await postAddonPage(message5.package, { saved: true });
|
|
82394
82930
|
}
|
|
82395
82931
|
async function handleRunAddonAction(pkg, id, tool) {
|
|
82396
82932
|
const reply = (ok, text2) => post({ type: "addonActionResult", package: pkg, id, tool, ok, text: text2 });
|
|
@@ -82679,7 +83215,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
82679
83215
|
return;
|
|
82680
83216
|
}
|
|
82681
83217
|
const messages = conversation.toArray();
|
|
82682
|
-
if (!messages.some((
|
|
83218
|
+
if (!messages.some((message5) => message5.role === "user")) {
|
|
82683
83219
|
progress("failed", { message: "There is nothing in this chat to hand over yet." });
|
|
82684
83220
|
return;
|
|
82685
83221
|
}
|
|
@@ -82981,7 +83517,7 @@ ${error51.stack.split("\n").slice(1, 6).join("\n")}`;
|
|
|
82981
83517
|
hasNewUserInput: () => queuedMessages.length > 0 || pendingReactions.size > 0,
|
|
82982
83518
|
// What the user has said, for `http_request`'s host rule. Not the images a tool returned (labelled
|
|
82983
83519
|
// user messages nobody typed) and not the loop's own nudge to continue.
|
|
82984
|
-
userText: () => conversation.toArray().filter((
|
|
83520
|
+
userText: () => conversation.toArray().filter((message5) => message5.role === "user" && !message5.content.startsWith("[Images returned by ") && message5.content !== CONTINUE_PROMPT).map((message5) => message5.content).join("\n"),
|
|
82985
83521
|
signal: activeAbortController.signal,
|
|
82986
83522
|
/*
|
|
82987
83523
|
* Supplied by the host, not imported by core: the binary is platform-specific and
|
|
@@ -83259,7 +83795,7 @@ ${direction}` : attachMentions(text2, mentions);
|
|
|
83259
83795
|
userTurnWindingDown = true;
|
|
83260
83796
|
post({ type: "done", ...ending === "question" ? { awaitingAnswer: true } : {} });
|
|
83261
83797
|
},
|
|
83262
|
-
onError: (
|
|
83798
|
+
onError: (message5) => post({ type: "error", message: message5 })
|
|
83263
83799
|
}, turnOptions);
|
|
83264
83800
|
} catch (error51) {
|
|
83265
83801
|
post({ type: "error", message: error51 instanceof Error ? error51.message : String(error51) });
|
|
@@ -83572,7 +84108,7 @@ ${direction}` : attachMentions(text2, mentions);
|
|
|
83572
84108
|
post({ type: "compacted", summarisedCount: result.summarisedCount });
|
|
83573
84109
|
await persistActiveTask();
|
|
83574
84110
|
}
|
|
83575
|
-
async function handleHubGit(op,
|
|
84111
|
+
async function handleHubGit(op, message5) {
|
|
83576
84112
|
if (hub === void 0) {
|
|
83577
84113
|
post({ type: "hubGitResult", op, ok: false, text: "This codebase is not on a JupyterHub." });
|
|
83578
84114
|
return;
|
|
@@ -83583,7 +84119,7 @@ ${direction}` : attachMentions(text2, mentions);
|
|
|
83583
84119
|
return;
|
|
83584
84120
|
}
|
|
83585
84121
|
try {
|
|
83586
|
-
const result = op === "status" ? await hubGitStatus(hub) : op === "pull" ? await hubGitPull(hub) : await hubGitCommitPush(hub,
|
|
84122
|
+
const result = op === "status" ? await hubGitStatus(hub) : op === "pull" ? await hubGitPull(hub) : await hubGitCommitPush(hub, message5 ?? "");
|
|
83587
84123
|
post({ type: "hubGitResult", op, ok: result.ok, text: redact(result.text, cachedSecretValues), ..."counts" in result && result.counts !== void 0 ? { counts: result.counts } : {} });
|
|
83588
84124
|
} catch (error51) {
|
|
83589
84125
|
post({ type: "hubGitResult", op, ok: false, text: redact(error51 instanceof Error ? error51.message : String(error51), cachedSecretValues) });
|
|
@@ -83650,10 +84186,10 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83650
84186
|
if (chunk.type === "error")
|
|
83651
84187
|
throw new Error(chunk.error);
|
|
83652
84188
|
}
|
|
83653
|
-
const
|
|
83654
|
-
if (
|
|
84189
|
+
const message5 = text2.trim().replace(/^```[a-z]*\n?/i, "").replace(/\n?```$/, "").trim();
|
|
84190
|
+
if (message5.length === 0)
|
|
83655
84191
|
throw new Error("The model replied with nothing.");
|
|
83656
|
-
return
|
|
84192
|
+
return message5;
|
|
83657
84193
|
}
|
|
83658
84194
|
function mentionCodebases() {
|
|
83659
84195
|
const self = services.mentionName !== void 0 && workspaceRoot !== void 0 ? [{ name: services.mentionName, path: workspaceRoot }] : [];
|
|
@@ -83750,8 +84286,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
83750
84286
|
canWrite: config2.agents?.roles?.[info.role]?.write ?? info.canWrite,
|
|
83751
84287
|
enabled: config2.agents?.roles?.[info.role]?.enabled !== false,
|
|
83752
84288
|
...(() => {
|
|
83753
|
-
const
|
|
83754
|
-
return
|
|
84289
|
+
const level2 = config2.agents?.roles?.[info.role]?.thinking;
|
|
84290
|
+
return level2 !== void 0 ? { thinking: level2 } : {};
|
|
83755
84291
|
})()
|
|
83756
84292
|
};
|
|
83757
84293
|
});
|
|
@@ -85043,6 +85579,48 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85043
85579
|
const paths = Object.fromEntries(Object.entries(config2.autosys?.paths ?? {}).filter(([, value]) => value !== void 0));
|
|
85044
85580
|
return new AutosysClient(http, await atlassianConnection("autosys", http), paths);
|
|
85045
85581
|
}
|
|
85582
|
+
let monitorSettingsLoaded = false;
|
|
85583
|
+
async function executeForMonitor(name, args, given, signal) {
|
|
85584
|
+
const { config: config2 } = await configManager.load();
|
|
85585
|
+
if (!monitorSettingsLoaded) {
|
|
85586
|
+
monitorSettingsLoaded = true;
|
|
85587
|
+
await loadSettings();
|
|
85588
|
+
}
|
|
85589
|
+
await syncMcpFromConfig(config2);
|
|
85590
|
+
await mcp.ensureConnected();
|
|
85591
|
+
await python.configure({ ...config2.python ?? {}, ...pythonFolders(config2) });
|
|
85592
|
+
const registry2 = currentToolRegistry();
|
|
85593
|
+
const tool = registry2.get(name) ?? registry2.get(`py__${name}`);
|
|
85594
|
+
const refusal = monitorToolRefusal(tool, name);
|
|
85595
|
+
if (refusal !== void 0 || tool === void 0)
|
|
85596
|
+
return { content: refusal ?? `No tool called "${name}".`, isError: true };
|
|
85597
|
+
const parsed = tool.parametersSchema.safeParse(args);
|
|
85598
|
+
if (!parsed.success)
|
|
85599
|
+
return { content: `The arguments do not fit ${tool.name}: ${parsed.error.message}`, isError: true };
|
|
85600
|
+
const context = given ?? {
|
|
85601
|
+
fs: new NodeFileSystem(),
|
|
85602
|
+
terminal: new NodeTerminal(cachedCommandRules.shell),
|
|
85603
|
+
workspaceRoot: workspaceRoot ?? services.storageDir,
|
|
85604
|
+
denylist,
|
|
85605
|
+
readFiles: /* @__PURE__ */ new Set(),
|
|
85606
|
+
readRoots: [...cachedReadRoots, ...skillSearchPath(), ...python.toolDirectories()],
|
|
85607
|
+
...services.fileReach === "anywhere" ? { reach: "anywhere" } : {},
|
|
85608
|
+
...signal !== void 0 ? { signal } : {},
|
|
85609
|
+
...(() => {
|
|
85610
|
+
const resolved = services.ripgrepPath();
|
|
85611
|
+
return resolved !== void 0 ? { ripgrepPath: resolved } : {};
|
|
85612
|
+
})()
|
|
85613
|
+
};
|
|
85614
|
+
return tool.execute(parsed.data, context);
|
|
85615
|
+
}
|
|
85616
|
+
services.monitorExecutor?.serve(async (fetch2) => {
|
|
85617
|
+
try {
|
|
85618
|
+
const result = await executeForMonitor(fetch2.tool, fetch2.args, void 0, AbortSignal.timeout(Math.max(5e3, fetch2.timeoutMs)));
|
|
85619
|
+
return result.isError === true ? { ok: false, error: result.content.slice(0, 4e3) } : { ok: true, text: result.content };
|
|
85620
|
+
} catch (error51) {
|
|
85621
|
+
return { ok: false, error: error51 instanceof Error ? error51.message : String(error51) };
|
|
85622
|
+
}
|
|
85623
|
+
});
|
|
85046
85624
|
async function saveAutosysPaths(paths) {
|
|
85047
85625
|
const { config: config2 } = await configManager.load();
|
|
85048
85626
|
const { paths: _old, ...rest } = config2.autosys ?? {};
|
|
@@ -85080,8 +85658,8 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85080
85658
|
post({ type: "atlassian", products });
|
|
85081
85659
|
}
|
|
85082
85660
|
async function handleSaveAtlassian(product, input, token, gateway) {
|
|
85083
|
-
const refuse = (
|
|
85084
|
-
post({ type: "atlassianTest", product, ok: false, detail: `Not saved: ${
|
|
85661
|
+
const refuse = (message5) => {
|
|
85662
|
+
post({ type: "atlassianTest", product, ok: false, detail: `Not saved: ${message5}` });
|
|
85085
85663
|
};
|
|
85086
85664
|
try {
|
|
85087
85665
|
const info = atlassianProduct(product);
|
|
@@ -85514,7 +86092,7 @@ ${redact(shown2, cachedSecretValues)}` }
|
|
|
85514
86092
|
}
|
|
85515
86093
|
async function handleDeleteEverywhere(requested2) {
|
|
85516
86094
|
const { kind, name } = requested2;
|
|
85517
|
-
const done = (ok,
|
|
86095
|
+
const done = (ok, message5) => post({ type: "deleteEverywhereDone", kind, name, ok, message: message5 });
|
|
85518
86096
|
try {
|
|
85519
86097
|
const config2 = await loadSettings();
|
|
85520
86098
|
const team = teamRepoPlan(config2);
|
|
@@ -87785,7 +88363,7 @@ ${last}` : ""}`);
|
|
|
87785
88363
|
inventory: usageInventory,
|
|
87786
88364
|
me: () => cachedAttribution.author ?? "unknown"
|
|
87787
88365
|
});
|
|
87788
|
-
async function handleRequestUsage(
|
|
88366
|
+
async function handleRequestUsage(message5) {
|
|
87789
88367
|
const config2 = await loadSettings();
|
|
87790
88368
|
const settings = await usageSettings(config2);
|
|
87791
88369
|
const options = usageOptions(config2);
|
|
@@ -87793,7 +88371,7 @@ ${last}` : ""}`);
|
|
|
87793
88371
|
post({ type: "usage", settings, options });
|
|
87794
88372
|
return;
|
|
87795
88373
|
}
|
|
87796
|
-
const data = await gatherUsage(
|
|
88374
|
+
const data = await gatherUsage(message5.from, message5.to);
|
|
87797
88375
|
if ("problem" in data) {
|
|
87798
88376
|
post({ type: "usage", settings, options, storeProblem: data.problem });
|
|
87799
88377
|
return;
|
|
@@ -87803,12 +88381,12 @@ ${last}` : ""}`);
|
|
|
87803
88381
|
const dashboard = computeDashboard({
|
|
87804
88382
|
events,
|
|
87805
88383
|
inventory: await usageInventory(),
|
|
87806
|
-
scope:
|
|
88384
|
+
scope: message5.scope,
|
|
87807
88385
|
me,
|
|
87808
|
-
from:
|
|
87809
|
-
to:
|
|
88386
|
+
from: message5.from,
|
|
88387
|
+
to: message5.to,
|
|
87810
88388
|
profiles,
|
|
87811
|
-
...
|
|
88389
|
+
...message5.timezoneOffsetMinutes !== void 0 ? { timezoneOffsetMinutes: message5.timezoneOffsetMinutes } : {}
|
|
87812
88390
|
});
|
|
87813
88391
|
const withBackground = { ...dashboard, problems: [...backgroundProblems.values(), ...pythonProblems(), ...dashboard.problems] };
|
|
87814
88392
|
post({
|
|
@@ -87820,11 +88398,11 @@ ${last}` : ""}`);
|
|
|
87820
88398
|
dashboard: withBackground
|
|
87821
88399
|
});
|
|
87822
88400
|
}
|
|
87823
|
-
async function handleSaveUsageSettings(
|
|
88401
|
+
async function handleSaveUsageSettings(message5) {
|
|
87824
88402
|
const config2 = await loadSettings();
|
|
87825
88403
|
const refuse = async (saveError) => post({ type: "usage", settings: await usageSettings(config2), options: usageOptions(config2), saveError });
|
|
87826
|
-
const store =
|
|
87827
|
-
if (store !== void 0 && !
|
|
88404
|
+
const store = message5.store;
|
|
88405
|
+
if (store !== void 0 && !message5.stopped) {
|
|
87828
88406
|
const trial = await openUsageStore(config2, store);
|
|
87829
88407
|
if ("problem" in trial) {
|
|
87830
88408
|
await refuse(trial.problem);
|
|
@@ -87837,10 +88415,10 @@ ${last}` : ""}`);
|
|
|
87837
88415
|
return;
|
|
87838
88416
|
}
|
|
87839
88417
|
}
|
|
87840
|
-
const userInfoTool =
|
|
88418
|
+
const userInfoTool = message5.userInfoTool?.trim();
|
|
87841
88419
|
await configManager.save("user", {
|
|
87842
88420
|
usage: {
|
|
87843
|
-
...
|
|
88421
|
+
...message5.stopped ? { enabled: false } : {},
|
|
87844
88422
|
...store !== void 0 ? { store } : {},
|
|
87845
88423
|
...userInfoTool !== void 0 && userInfoTool.length > 0 ? { userInfoTool } : {}
|
|
87846
88424
|
}
|
|
@@ -88395,8 +88973,8 @@ ${last}` : ""}`);
|
|
|
88395
88973
|
}
|
|
88396
88974
|
}
|
|
88397
88975
|
async function handlePreviewImport() {
|
|
88398
|
-
const fail = (
|
|
88399
|
-
post({ type: "shareSections", direction: "import", sections: [], selected: [], error:
|
|
88976
|
+
const fail = (message5) => {
|
|
88977
|
+
post({ type: "shareSections", direction: "import", sections: [], selected: [], error: message5 });
|
|
88400
88978
|
};
|
|
88401
88979
|
try {
|
|
88402
88980
|
const source = await ui.showOpenDialog({ kind: "file", extensions: ["json"] });
|
|
@@ -89094,8 +89672,8 @@ ${last}` : ""}`);
|
|
|
89094
89672
|
});
|
|
89095
89673
|
}
|
|
89096
89674
|
const unsubscribe = transport.onMessage((raw) => {
|
|
89097
|
-
const
|
|
89098
|
-
if (
|
|
89675
|
+
const message5 = raw;
|
|
89676
|
+
if (message5.type === "sendMessage") {
|
|
89099
89677
|
if (activeAbortController !== void 0) {
|
|
89100
89678
|
logger.warn("Ignoring sendMessage: a turn is already in progress.");
|
|
89101
89679
|
return;
|
|
@@ -89107,7 +89685,7 @@ ${last}` : ""}`);
|
|
|
89107
89685
|
}
|
|
89108
89686
|
userTurnRunning = true;
|
|
89109
89687
|
userTurnWindingDown = false;
|
|
89110
|
-
const turn = handleSendMessage(composeUserText(
|
|
89688
|
+
const turn = handleSendMessage(composeUserText(message5.text, { replyTo: boundedQuote(message5.replyTo), reactions: takeReactions() }), message5.images);
|
|
89111
89689
|
userTurnSettled = turn.then(() => void 0, () => void 0);
|
|
89112
89690
|
try {
|
|
89113
89691
|
await turn;
|
|
@@ -89116,17 +89694,17 @@ ${last}` : ""}`);
|
|
|
89116
89694
|
userTurnWindingDown = false;
|
|
89117
89695
|
}
|
|
89118
89696
|
})();
|
|
89119
|
-
} else if (
|
|
89697
|
+
} else if (message5.type === "compactConversation") {
|
|
89120
89698
|
reportFailure("handleCompactConversation", handleCompactConversation());
|
|
89121
|
-
} else if (
|
|
89699
|
+
} else if (message5.type === "pickContextFiles") {
|
|
89122
89700
|
void (async () => {
|
|
89123
89701
|
const picked = await ui.pickContextFiles?.();
|
|
89124
89702
|
if (picked === void 0 || picked.length === 0)
|
|
89125
89703
|
return;
|
|
89126
89704
|
post({ type: "addContextFiles", paths: picked.map((file2) => contextMentionPath(file2)) });
|
|
89127
89705
|
})();
|
|
89128
|
-
} else if (
|
|
89129
|
-
const { id, name, data } =
|
|
89706
|
+
} else if (message5.type === "stageAttachment") {
|
|
89707
|
+
const { id, name, data } = message5;
|
|
89130
89708
|
void (async () => {
|
|
89131
89709
|
try {
|
|
89132
89710
|
const staged = await stageDroppedFile(droppedFilesDir, name, Buffer.from(data, "base64"));
|
|
@@ -89135,383 +89713,383 @@ ${last}` : ""}`);
|
|
|
89135
89713
|
post({ type: "attachmentStaged", id, name, error: error51 instanceof Error ? error51.message : String(error51) });
|
|
89136
89714
|
}
|
|
89137
89715
|
})();
|
|
89138
|
-
} else if (
|
|
89139
|
-
reportFailure("handleHubGit", handleHubGit(
|
|
89140
|
-
} else if (
|
|
89716
|
+
} else if (message5.type === "hubGit") {
|
|
89717
|
+
reportFailure("handleHubGit", handleHubGit(message5.op, message5.message));
|
|
89718
|
+
} else if (message5.type === "suggestCommitMessage") {
|
|
89141
89719
|
reportFailure("handleSuggestCommitMessage", handleSuggestCommitMessage());
|
|
89142
|
-
} else if (
|
|
89143
|
-
reportFailure("handleMentionCandidates", handleMentionCandidates(
|
|
89144
|
-
} else if (
|
|
89145
|
-
const quote = boundedQuote(
|
|
89146
|
-
if (
|
|
89147
|
-
pendingReactions.delete(
|
|
89720
|
+
} else if (message5.type === "requestMentionCandidates") {
|
|
89721
|
+
reportFailure("handleMentionCandidates", handleMentionCandidates(message5.query));
|
|
89722
|
+
} else if (message5.type === "reactToMessage") {
|
|
89723
|
+
const quote = boundedQuote(message5.quote);
|
|
89724
|
+
if (message5.reaction === void 0 || quote === void 0)
|
|
89725
|
+
pendingReactions.delete(message5.key);
|
|
89148
89726
|
else
|
|
89149
|
-
pendingReactions.set(
|
|
89727
|
+
pendingReactions.set(message5.key, { reaction: message5.reaction, quote });
|
|
89150
89728
|
postPendingFeedback();
|
|
89151
|
-
} else if (
|
|
89152
|
-
const replyTo = boundedQuote(
|
|
89729
|
+
} else if (message5.type === "queueMessage") {
|
|
89730
|
+
const replyTo = boundedQuote(message5.replyTo);
|
|
89153
89731
|
queuedMessages.push({
|
|
89154
|
-
text: composeUserText(
|
|
89155
|
-
...
|
|
89732
|
+
text: composeUserText(message5.text, { replyTo }),
|
|
89733
|
+
...message5.images !== void 0 && message5.images.length > 0 ? { images: message5.images } : {}
|
|
89156
89734
|
});
|
|
89157
89735
|
postQueued();
|
|
89158
|
-
} else if (
|
|
89159
|
-
queuedMessages.splice(
|
|
89736
|
+
} else if (message5.type === "unqueueMessage") {
|
|
89737
|
+
queuedMessages.splice(message5.index, 1);
|
|
89160
89738
|
postQueued();
|
|
89161
|
-
} else if (
|
|
89739
|
+
} else if (message5.type === "cancel") {
|
|
89162
89740
|
queuedMessages = [];
|
|
89163
89741
|
postQueued();
|
|
89164
89742
|
activeAbortController?.abort();
|
|
89165
89743
|
userGate.denyAll();
|
|
89166
89744
|
settleAllForms();
|
|
89167
|
-
} else if (
|
|
89168
|
-
userGate.resolve(
|
|
89169
|
-
} else if (
|
|
89170
|
-
const resolve = pendingForms.get(
|
|
89745
|
+
} else if (message5.type === "approvalResponse") {
|
|
89746
|
+
userGate.resolve(message5.id, message5.decision);
|
|
89747
|
+
} else if (message5.type === "formResponse") {
|
|
89748
|
+
const resolve = pendingForms.get(message5.id);
|
|
89171
89749
|
if (resolve !== void 0) {
|
|
89172
|
-
pendingForms.delete(
|
|
89173
|
-
resolve(
|
|
89174
|
-
pendingFormFields.delete(
|
|
89750
|
+
pendingForms.delete(message5.id);
|
|
89751
|
+
resolve(message5.submitted ? answerFromResponse(pendingFormFields.get(message5.id) ?? [], message5.values) : { submitted: false, values: {} });
|
|
89752
|
+
pendingFormFields.delete(message5.id);
|
|
89175
89753
|
}
|
|
89176
|
-
} else if (
|
|
89177
|
-
reportFailure("handleAlwaysAllow", handleAlwaysAllow(
|
|
89178
|
-
} else if (
|
|
89754
|
+
} else if (message5.type === "approvalResponseAlways") {
|
|
89755
|
+
reportFailure("handleAlwaysAllow", handleAlwaysAllow(message5.id, message5.scope));
|
|
89756
|
+
} else if (message5.type === "rollback") {
|
|
89179
89757
|
reportFailure("handleRollback", handleRollback());
|
|
89180
|
-
} else if (
|
|
89758
|
+
} else if (message5.type === "requestSettings") {
|
|
89181
89759
|
reportFailure("postSettings", postSettings());
|
|
89182
|
-
} else if (
|
|
89760
|
+
} else if (message5.type === "requestTasks") {
|
|
89183
89761
|
reportFailure("postTasks", postTasks());
|
|
89184
|
-
} else if (
|
|
89185
|
-
reportFailure("openTask", openTask(
|
|
89186
|
-
} else if (
|
|
89187
|
-
reportFailure("deleteTask", deleteTask(
|
|
89188
|
-
} else if (
|
|
89762
|
+
} else if (message5.type === "openTask") {
|
|
89763
|
+
reportFailure("openTask", openTask(message5.id));
|
|
89764
|
+
} else if (message5.type === "deleteTask") {
|
|
89765
|
+
reportFailure("deleteTask", deleteTask(message5.id));
|
|
89766
|
+
} else if (message5.type === "newTask") {
|
|
89189
89767
|
reportFailure("startNewTask", startNewTask());
|
|
89190
|
-
} else if (
|
|
89768
|
+
} else if (message5.type === "startHandoff") {
|
|
89191
89769
|
reportFailure("handleHandoff", handleHandoff());
|
|
89192
|
-
} else if (
|
|
89770
|
+
} else if (message5.type === "cancelHandoff") {
|
|
89193
89771
|
handoffAbort?.abort();
|
|
89194
|
-
} else if (
|
|
89195
|
-
reportFailure("handleSetMode", handleSetMode(
|
|
89196
|
-
} else if (
|
|
89197
|
-
void configManager.save("user", { connection: { stallSeconds:
|
|
89198
|
-
} else if (
|
|
89199
|
-
void configManager.save("user", { autoCompact:
|
|
89200
|
-
} else if (
|
|
89201
|
-
void configManager.save("user", { maxIterations:
|
|
89202
|
-
} else if (
|
|
89772
|
+
} else if (message5.type === "setMode") {
|
|
89773
|
+
reportFailure("handleSetMode", handleSetMode(message5.modeId));
|
|
89774
|
+
} else if (message5.type === "setConnectionRetry") {
|
|
89775
|
+
void configManager.save("user", { connection: { stallSeconds: message5.stallSeconds, retries: message5.retries } }).then(() => postSettings()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89776
|
+
} else if (message5.type === "setAutoCompact") {
|
|
89777
|
+
void configManager.save("user", { autoCompact: message5.value }).then(() => postSettings()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89778
|
+
} else if (message5.type === "setMaxIterations") {
|
|
89779
|
+
void configManager.save("user", { maxIterations: message5.value }).then(() => postSettings()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89780
|
+
} else if (message5.type === "setProgrammingProfile") {
|
|
89203
89781
|
void configManager.load().then(async ({ config: config2 }) => {
|
|
89204
89782
|
const next = { ...config2 };
|
|
89205
|
-
if (
|
|
89783
|
+
if (message5.id.length === 0)
|
|
89206
89784
|
delete next.programmingProfileId;
|
|
89207
89785
|
else
|
|
89208
|
-
next.programmingProfileId =
|
|
89786
|
+
next.programmingProfileId = message5.id;
|
|
89209
89787
|
await configManager.save("user", next);
|
|
89210
89788
|
await postSettings();
|
|
89211
89789
|
}).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89212
|
-
} else if (
|
|
89790
|
+
} else if (message5.type === "setReadRoots") {
|
|
89213
89791
|
void configManager.save("user", {
|
|
89214
89792
|
filesystem: {
|
|
89215
|
-
readRoots:
|
|
89793
|
+
readRoots: message5.roots.map((root) => root.trim()).filter((root) => root.length > 0)
|
|
89216
89794
|
}
|
|
89217
89795
|
}).then(() => postSettings()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89218
|
-
} else if (
|
|
89219
|
-
reportFailure("handleMigrateFolder", handleMigrateFolder(
|
|
89220
|
-
} else if (
|
|
89221
|
-
reportFailure("handlePublishAllToBucket", handlePublishAllToBucket(
|
|
89222
|
-
} else if (
|
|
89223
|
-
reportFailure("handleSetCommandRules", handleSetCommandRules(
|
|
89224
|
-
} else if (
|
|
89796
|
+
} else if (message5.type === "migrateFolder") {
|
|
89797
|
+
reportFailure("handleMigrateFolder", handleMigrateFolder(message5.kind, message5.from));
|
|
89798
|
+
} else if (message5.type === "publishAllToBucket") {
|
|
89799
|
+
reportFailure("handlePublishAllToBucket", handlePublishAllToBucket(message5.kind));
|
|
89800
|
+
} else if (message5.type === "setCommandRules") {
|
|
89801
|
+
reportFailure("handleSetCommandRules", handleSetCommandRules(message5.rules));
|
|
89802
|
+
} else if (message5.type === "setAccentColor") {
|
|
89225
89803
|
void configManager.save("user", {
|
|
89226
89804
|
ui: {
|
|
89227
|
-
accentColor:
|
|
89805
|
+
accentColor: message5.value,
|
|
89228
89806
|
expertColor: cachedExpertColor,
|
|
89229
89807
|
...cachedTheme === void 0 ? {} : { theme: cachedTheme }
|
|
89230
89808
|
}
|
|
89231
89809
|
}).then(() => postSettings()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89232
|
-
} else if (
|
|
89233
|
-
reportFailure("handleSetToolTimeoutFor", handleSetToolTimeoutFor(
|
|
89234
|
-
} else if (
|
|
89810
|
+
} else if (message5.type === "setToolTimeoutFor") {
|
|
89811
|
+
reportFailure("handleSetToolTimeoutFor", handleSetToolTimeoutFor(message5.name, message5.seconds));
|
|
89812
|
+
} else if (message5.type === "setToolTimeout") {
|
|
89235
89813
|
void configManager.save("user", {
|
|
89236
|
-
tools:
|
|
89814
|
+
tools: message5.seconds === void 0 ? {} : { timeoutSeconds: message5.seconds }
|
|
89237
89815
|
}).then(() => postSettings()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89238
|
-
} else if (
|
|
89816
|
+
} else if (message5.type === "setTheme") {
|
|
89239
89817
|
void configManager.save("user", {
|
|
89240
89818
|
ui: {
|
|
89241
89819
|
accentColor: cachedAccentColor,
|
|
89242
89820
|
expertColor: cachedExpertColor,
|
|
89243
|
-
theme:
|
|
89821
|
+
theme: message5.theme
|
|
89244
89822
|
}
|
|
89245
89823
|
}).then(() => postSettings()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89246
|
-
} else if (
|
|
89824
|
+
} else if (message5.type === "setExpertColor") {
|
|
89247
89825
|
void configManager.save("user", {
|
|
89248
89826
|
ui: {
|
|
89249
89827
|
accentColor: cachedAccentColor,
|
|
89250
|
-
expertColor:
|
|
89828
|
+
expertColor: message5.value,
|
|
89251
89829
|
...cachedTheme === void 0 ? {} : { theme: cachedTheme }
|
|
89252
89830
|
}
|
|
89253
89831
|
}).then(() => postSettings()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89254
|
-
} else if (
|
|
89255
|
-
reportFailure("handleSetAutoApprove", handleSetAutoApprove(
|
|
89256
|
-
} else if (
|
|
89832
|
+
} else if (message5.type === "setAutoApprove") {
|
|
89833
|
+
reportFailure("handleSetAutoApprove", handleSetAutoApprove(message5.group, message5.enabled));
|
|
89834
|
+
} else if (message5.type === "revokeAllowedTool") {
|
|
89257
89835
|
reportFailure("saveApprovals", saveApprovals({
|
|
89258
89836
|
...cachedApprovals,
|
|
89259
|
-
allowedTools: removeFromAllowlist(
|
|
89837
|
+
allowedTools: removeFromAllowlist(message5.toolName, cachedApprovals.allowedTools ?? [])
|
|
89260
89838
|
}));
|
|
89261
|
-
} else if (
|
|
89839
|
+
} else if (message5.type === "revokeAllowedCommand") {
|
|
89262
89840
|
reportFailure("saveApprovals", saveApprovals({
|
|
89263
89841
|
...cachedApprovals,
|
|
89264
|
-
allowedCommands: removeFromAllowlist(
|
|
89842
|
+
allowedCommands: removeFromAllowlist(message5.command, cachedApprovals.allowedCommands ?? [])
|
|
89265
89843
|
}));
|
|
89266
|
-
} else if (
|
|
89844
|
+
} else if (message5.type === "requestMcp") {
|
|
89267
89845
|
reportFailure("handleRequestMcp", handleRequestMcp());
|
|
89268
|
-
} else if (
|
|
89269
|
-
reportFailure("handleSaveMcpServers", handleSaveMcpServers(
|
|
89270
|
-
} else if (
|
|
89271
|
-
reportFailure("handleSaveMcpServer", handleSaveMcpServer(
|
|
89272
|
-
} else if (
|
|
89273
|
-
reportFailure("handleDuplicateMcpServer", handleDuplicateMcpServer(
|
|
89274
|
-
} else if (
|
|
89275
|
-
reportFailure("handleDeleteMcpServer", handleDeleteMcpServer(
|
|
89276
|
-
} else if (
|
|
89277
|
-
reportFailure("handleSaveFile", handleSaveFile(
|
|
89278
|
-
} else if (
|
|
89279
|
-
reportFailure("handleBrowseForPath", handleBrowseForPath(
|
|
89280
|
-
} else if (
|
|
89281
|
-
reportFailure("handleProbePythonEnv", handleProbePythonEnv(
|
|
89282
|
-
} else if (
|
|
89283
|
-
void mcp.connectServer(
|
|
89284
|
-
} else if (
|
|
89285
|
-
void mcp.restart(
|
|
89286
|
-
} else if (
|
|
89287
|
-
reportFailure("updateMcpServer", updateMcpServer(
|
|
89846
|
+
} else if (message5.type === "saveMcpServers") {
|
|
89847
|
+
reportFailure("handleSaveMcpServers", handleSaveMcpServers(message5.json));
|
|
89848
|
+
} else if (message5.type === "saveMcpServer") {
|
|
89849
|
+
reportFailure("handleSaveMcpServer", handleSaveMcpServer(message5.name, message5.previousName, message5.config));
|
|
89850
|
+
} else if (message5.type === "duplicateMcpServer") {
|
|
89851
|
+
reportFailure("handleDuplicateMcpServer", handleDuplicateMcpServer(message5.name));
|
|
89852
|
+
} else if (message5.type === "deleteMcpServer") {
|
|
89853
|
+
reportFailure("handleDeleteMcpServer", handleDeleteMcpServer(message5.name));
|
|
89854
|
+
} else if (message5.type === "saveFile") {
|
|
89855
|
+
reportFailure("handleSaveFile", handleSaveFile(message5.requestId, message5.name, message5.base64));
|
|
89856
|
+
} else if (message5.type === "browseForPath") {
|
|
89857
|
+
reportFailure("handleBrowseForPath", handleBrowseForPath(message5.purpose, message5.kind, message5.extensions));
|
|
89858
|
+
} else if (message5.type === "probePythonEnv") {
|
|
89859
|
+
reportFailure("handleProbePythonEnv", handleProbePythonEnv(message5.venvDir, message5.script));
|
|
89860
|
+
} else if (message5.type === "connectMcpServer") {
|
|
89861
|
+
void mcp.connectServer(message5.name);
|
|
89862
|
+
} else if (message5.type === "restartMcpServer") {
|
|
89863
|
+
void mcp.restart(message5.name);
|
|
89864
|
+
} else if (message5.type === "setMcpServerEnabled") {
|
|
89865
|
+
reportFailure("updateMcpServer", updateMcpServer(message5.name, (entry) => ({
|
|
89288
89866
|
...entry,
|
|
89289
|
-
disabled: !
|
|
89867
|
+
disabled: !message5.enabled
|
|
89290
89868
|
})).then(() => postMcp()));
|
|
89291
|
-
} else if (
|
|
89292
|
-
reportFailure("handleSetToolTimeout", handleSetToolTimeout(
|
|
89293
|
-
} else if (
|
|
89294
|
-
reportFailure("handleSetToolPermission", handleSetToolPermission(
|
|
89295
|
-
} else if (
|
|
89869
|
+
} else if (message5.type === "setMcpToolTimeout") {
|
|
89870
|
+
reportFailure("handleSetToolTimeout", handleSetToolTimeout(message5.server, message5.tool, message5.seconds));
|
|
89871
|
+
} else if (message5.type === "setMcpToolPermission") {
|
|
89872
|
+
reportFailure("handleSetToolPermission", handleSetToolPermission(message5.server, message5.tool, message5.permission));
|
|
89873
|
+
} else if (message5.type === "requestSearch") {
|
|
89296
89874
|
reportFailure("postSearch", postSearch());
|
|
89297
89875
|
reportFailure("postDispatcher", postDispatcher());
|
|
89298
89876
|
post({ type: "searchLog", entries: [...searchLog.list()] });
|
|
89299
|
-
} else if (
|
|
89300
|
-
reportFailure("handleSaveSearchConnection", handleSaveSearchConnection(
|
|
89301
|
-
} else if (
|
|
89302
|
-
reportFailure("handleDeleteSearchConnection", handleDeleteSearchConnection(
|
|
89303
|
-
} else if (
|
|
89304
|
-
void (
|
|
89877
|
+
} else if (message5.type === "saveSearchConnection") {
|
|
89878
|
+
reportFailure("handleSaveSearchConnection", handleSaveSearchConnection(message5.connection));
|
|
89879
|
+
} else if (message5.type === "deleteSearchConnection") {
|
|
89880
|
+
reportFailure("handleDeleteSearchConnection", handleDeleteSearchConnection(message5.id));
|
|
89881
|
+
} else if (message5.type === "setActiveSearchConnection") {
|
|
89882
|
+
void (message5.forProject === true ? configManager.saveForWorkspace({ activeVectorStoreId: message5.id }) : configManager.save("user", { activeVectorStoreId: message5.id })).then(async () => {
|
|
89305
89883
|
await postSearch();
|
|
89306
89884
|
await postProjectSettings();
|
|
89307
89885
|
}).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89308
|
-
} else if (
|
|
89886
|
+
} else if (message5.type === "requestProjectSettings") {
|
|
89309
89887
|
reportFailure("postProjectSettings", postProjectSettings());
|
|
89310
|
-
} else if (
|
|
89888
|
+
} else if (message5.type === "clearProjectSettings") {
|
|
89311
89889
|
reportFailure("handleClearProjectSettings", handleClearProjectSettings());
|
|
89312
|
-
} else if (
|
|
89313
|
-
reportFailure("handleRequestSearchIndexes", handleRequestSearchIndexes(
|
|
89314
|
-
} else if (
|
|
89315
|
-
reportFailure("handleTestSearchConnection", handleTestSearchConnection(
|
|
89316
|
-
} else if (
|
|
89890
|
+
} else if (message5.type === "requestSearchIndexes") {
|
|
89891
|
+
reportFailure("handleRequestSearchIndexes", handleRequestSearchIndexes(message5.connection));
|
|
89892
|
+
} else if (message5.type === "testSearchConnection") {
|
|
89893
|
+
reportFailure("handleTestSearchConnection", handleTestSearchConnection(message5.connection));
|
|
89894
|
+
} else if (message5.type === "requestProject") {
|
|
89317
89895
|
reportFailure("postProject", postProject());
|
|
89318
|
-
} else if (
|
|
89896
|
+
} else if (message5.type === "saveProjectNaming") {
|
|
89319
89897
|
reportFailure("handleSaveProjectNaming", handleSaveProjectNaming({
|
|
89320
|
-
owner:
|
|
89321
|
-
indexPrefix:
|
|
89322
|
-
indexName:
|
|
89323
|
-
indexAliases:
|
|
89898
|
+
owner: message5.owner,
|
|
89899
|
+
indexPrefix: message5.indexPrefix,
|
|
89900
|
+
indexName: message5.indexName,
|
|
89901
|
+
indexAliases: message5.indexAliases
|
|
89324
89902
|
}));
|
|
89325
|
-
} else if (
|
|
89326
|
-
reportFailure("handleSaveProjectSearchScope", handleSaveProjectSearchScope(
|
|
89327
|
-
} else if (
|
|
89328
|
-
reportFailure("handleSaveProjectName", handleSaveProjectName(
|
|
89329
|
-
} else if (
|
|
89330
|
-
reportFailure("handleIndexRenames", handleIndexRenames(
|
|
89331
|
-
} else if (
|
|
89332
|
-
reportFailure("handleProjectStamp", handleProjectStamp(
|
|
89333
|
-
} else if (
|
|
89334
|
-
reportFailure("handleInstallPythonPackages", handleInstallPythonPackages(
|
|
89335
|
-
} else if (
|
|
89336
|
-
reportFailure("handleSyncVectorStore", handleSyncVectorStore(
|
|
89337
|
-
} else if (
|
|
89338
|
-
reportFailure("handleClearDocsIndex", handleClearDocsIndex(
|
|
89339
|
-
} else if (
|
|
89903
|
+
} else if (message5.type === "saveProjectSearchScope") {
|
|
89904
|
+
reportFailure("handleSaveProjectSearchScope", handleSaveProjectSearchScope(message5.scope));
|
|
89905
|
+
} else if (message5.type === "saveProjectName") {
|
|
89906
|
+
reportFailure("handleSaveProjectName", handleSaveProjectName(message5.name));
|
|
89907
|
+
} else if (message5.type === "runIndexRenames") {
|
|
89908
|
+
reportFailure("handleIndexRenames", handleIndexRenames(message5.apply));
|
|
89909
|
+
} else if (message5.type === "runProjectStamp") {
|
|
89910
|
+
reportFailure("handleProjectStamp", handleProjectStamp(message5.apply, message5.labels ?? []));
|
|
89911
|
+
} else if (message5.type === "installPythonPackages") {
|
|
89912
|
+
reportFailure("handleInstallPythonPackages", handleInstallPythonPackages(message5.packages));
|
|
89913
|
+
} else if (message5.type === "syncVectorStore") {
|
|
89914
|
+
reportFailure("handleSyncVectorStore", handleSyncVectorStore(message5.fromId));
|
|
89915
|
+
} else if (message5.type === "clearDocsIndex") {
|
|
89916
|
+
reportFailure("handleClearDocsIndex", handleClearDocsIndex(message5.kind));
|
|
89917
|
+
} else if (message5.type === "clearCodebaseIndex") {
|
|
89340
89918
|
reportFailure("handleClearCodebaseIndex", handleClearCodebaseIndex());
|
|
89341
|
-
} else if (
|
|
89919
|
+
} else if (message5.type === "openStandingSkill") {
|
|
89342
89920
|
reportFailure("handleOpenStandingSkill", handleOpenStandingSkill());
|
|
89343
|
-
} else if (
|
|
89344
|
-
reportFailure("postAddonPage", postAddonPage(
|
|
89345
|
-
} else if (
|
|
89346
|
-
reportAddonFailure("Saving", handleSaveAddonRecord(
|
|
89347
|
-
} else if (
|
|
89348
|
-
reportAddonFailure("Removing", handleDeleteAddonRecord(
|
|
89349
|
-
} else if (
|
|
89350
|
-
reportAddonFailure("Saving", handleSaveAddonValues(
|
|
89351
|
-
} else if (
|
|
89352
|
-
reportAddonFailure(
|
|
89353
|
-
} else if (
|
|
89921
|
+
} else if (message5.type === "requestAddonPage") {
|
|
89922
|
+
reportFailure("postAddonPage", postAddonPage(message5.package));
|
|
89923
|
+
} else if (message5.type === "saveAddonRecord") {
|
|
89924
|
+
reportAddonFailure("Saving", handleSaveAddonRecord(message5), message5.package);
|
|
89925
|
+
} else if (message5.type === "deleteAddonRecord") {
|
|
89926
|
+
reportAddonFailure("Removing", handleDeleteAddonRecord(message5.package, message5.id), message5.package);
|
|
89927
|
+
} else if (message5.type === "saveAddonValues") {
|
|
89928
|
+
reportAddonFailure("Saving", handleSaveAddonValues(message5), message5.package);
|
|
89929
|
+
} else if (message5.type === "runAddonAction") {
|
|
89930
|
+
reportAddonFailure(message5.tool, handleRunAddonAction(message5.package, message5.id, message5.tool), message5.package);
|
|
89931
|
+
} else if (message5.type === "requestAddons") {
|
|
89354
89932
|
reportFailure("postAddons", postAddons());
|
|
89355
|
-
} else if (
|
|
89356
|
-
reportAddonFailure("Enabling", handleEnableAddon(
|
|
89357
|
-
} else if (
|
|
89358
|
-
reportAddonFailure("Disabling", handleRemoveAddon(
|
|
89359
|
-
} else if (
|
|
89360
|
-
reportAddonFailure("Saving the folders", handleSaveAddonFolders(
|
|
89361
|
-
} else if (
|
|
89933
|
+
} else if (message5.type === "enableAddon") {
|
|
89934
|
+
reportAddonFailure("Enabling", handleEnableAddon(message5.package));
|
|
89935
|
+
} else if (message5.type === "removeAddon") {
|
|
89936
|
+
reportAddonFailure("Disabling", handleRemoveAddon(message5.server));
|
|
89937
|
+
} else if (message5.type === "saveAddonFolders") {
|
|
89938
|
+
reportAddonFailure("Saving the folders", handleSaveAddonFolders(message5.folders));
|
|
89939
|
+
} else if (message5.type === "openCodebaseInstructions") {
|
|
89362
89940
|
reportFailure("handleOpenCodebaseInstructions", handleOpenCodebaseInstructions());
|
|
89363
|
-
} else if (
|
|
89941
|
+
} else if (message5.type === "requestAtlassian") {
|
|
89364
89942
|
reportFailure("postAtlassian", postAtlassian());
|
|
89365
|
-
} else if (
|
|
89366
|
-
reportFailure("handleSaveAtlassian", handleSaveAtlassian(
|
|
89367
|
-
} else if (
|
|
89368
|
-
reportFailure("handleSaveAutosysGateway", handleSaveAutosysGateway(
|
|
89369
|
-
} else if (
|
|
89370
|
-
reportFailure("handleClearAutosysGatewaySecret", handleClearAutosysGatewaySecret(
|
|
89371
|
-
} else if (
|
|
89372
|
-
reportFailure("handleClearAtlassianToken", handleClearAtlassianToken(
|
|
89373
|
-
} else if (
|
|
89374
|
-
reportFailure("handleTestAtlassian", handleTestAtlassian(
|
|
89375
|
-
} else if (
|
|
89943
|
+
} else if (message5.type === "saveAtlassian") {
|
|
89944
|
+
reportFailure("handleSaveAtlassian", handleSaveAtlassian(message5.product, message5.settings, message5.token, message5.gateway));
|
|
89945
|
+
} else if (message5.type === "saveAutosysGateway") {
|
|
89946
|
+
reportFailure("handleSaveAutosysGateway", handleSaveAutosysGateway(message5.gateway, message5.clientSecret, message5.passphrase, message5.basicValue));
|
|
89947
|
+
} else if (message5.type === "clearAutosysGatewaySecret") {
|
|
89948
|
+
reportFailure("handleClearAutosysGatewaySecret", handleClearAutosysGatewaySecret(message5.which));
|
|
89949
|
+
} else if (message5.type === "clearAtlassianToken") {
|
|
89950
|
+
reportFailure("handleClearAtlassianToken", handleClearAtlassianToken(message5.product));
|
|
89951
|
+
} else if (message5.type === "testAtlassian") {
|
|
89952
|
+
reportFailure("handleTestAtlassian", handleTestAtlassian(message5.product));
|
|
89953
|
+
} else if (message5.type === "setOffice") {
|
|
89376
89954
|
void configManager.load().then(async () => {
|
|
89377
89955
|
await configManager.save("user", {
|
|
89378
89956
|
// A window that predates the Teams switch sends no `teams`; that must not switch it off.
|
|
89379
|
-
office: { excel:
|
|
89957
|
+
office: { excel: message5.excel, outlook: message5.outlook, teams: message5.teams ?? cachedOffice.teams === true }
|
|
89380
89958
|
});
|
|
89381
89959
|
await loadSettings();
|
|
89382
89960
|
await postTools();
|
|
89383
|
-
if (!
|
|
89961
|
+
if (!message5.excel && !message5.outlook) {
|
|
89384
89962
|
await officeBridge?.dispose();
|
|
89385
89963
|
officeBridge = void 0;
|
|
89386
89964
|
}
|
|
89387
89965
|
}).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89388
|
-
} else if (
|
|
89389
|
-
reportFailure("handleIndexDocs", handleIndexDocs(
|
|
89390
|
-
} else if (
|
|
89391
|
-
reportFailure("handleSearchProbe", handleSearchProbe(
|
|
89392
|
-
} else if (
|
|
89966
|
+
} else if (message5.type === "indexDocs") {
|
|
89967
|
+
reportFailure("handleIndexDocs", handleIndexDocs(message5.kind));
|
|
89968
|
+
} else if (message5.type === "runSearchProbe") {
|
|
89969
|
+
reportFailure("handleSearchProbe", handleSearchProbe(message5.query, message5.target));
|
|
89970
|
+
} else if (message5.type === "clearSearchLog") {
|
|
89393
89971
|
searchLog.clear();
|
|
89394
|
-
} else if (
|
|
89395
|
-
reportFailure("saveRetrieval", saveRetrieval({ dispatcher:
|
|
89972
|
+
} else if (message5.type === "setDispatcher") {
|
|
89973
|
+
reportFailure("saveRetrieval", saveRetrieval({ dispatcher: message5.enabled }).then(() => {
|
|
89396
89974
|
reportFailure("postDispatcher", postDispatcher());
|
|
89397
|
-
if (
|
|
89975
|
+
if (message5.enabled)
|
|
89398
89976
|
scheduleDocsReindex("dispatcher enabled");
|
|
89399
89977
|
}));
|
|
89400
|
-
} else if (
|
|
89401
|
-
reportFailure("saveRetrieval", saveRetrieval({ skills:
|
|
89978
|
+
} else if (message5.type === "setSkillRetrieval") {
|
|
89979
|
+
reportFailure("saveRetrieval", saveRetrieval({ skills: message5.enabled }).then(() => {
|
|
89402
89980
|
reportFailure("postDispatcher", postDispatcher());
|
|
89403
|
-
if (
|
|
89981
|
+
if (message5.enabled)
|
|
89404
89982
|
scheduleDocsReindex("skill retrieval enabled");
|
|
89405
89983
|
}));
|
|
89406
|
-
} else if (
|
|
89984
|
+
} else if (message5.type === "startIndexing") {
|
|
89407
89985
|
reportFailure("handleStartIndexing", handleStartIndexing());
|
|
89408
|
-
} else if (
|
|
89986
|
+
} else if (message5.type === "attachTeamAlias") {
|
|
89409
89987
|
reportFailure("handleAttachTeamAlias", handleAttachTeamAlias());
|
|
89410
|
-
} else if (
|
|
89411
|
-
reportFailure("handlePublishTeamSkills", handlePublishTeamSkills(
|
|
89412
|
-
} else if (
|
|
89988
|
+
} else if (message5.type === "publishTeamSkills") {
|
|
89989
|
+
reportFailure("handlePublishTeamSkills", handlePublishTeamSkills(message5.keepPrivate));
|
|
89990
|
+
} else if (message5.type === "requestTeamRepo") {
|
|
89413
89991
|
reportFailure("postTeamRepo", postTeamRepo());
|
|
89414
|
-
} else if (
|
|
89415
|
-
reportFailure("handleSaveTeamRepo", handleSaveTeamRepo(
|
|
89416
|
-
} else if (
|
|
89992
|
+
} else if (message5.type === "saveTeamRepo") {
|
|
89993
|
+
reportFailure("handleSaveTeamRepo", handleSaveTeamRepo(message5.settings));
|
|
89994
|
+
} else if (message5.type === "syncTeamRepo") {
|
|
89417
89995
|
reportFailure("handleTeamRepoSync", handleTeamRepoSync("asked"));
|
|
89418
|
-
} else if (
|
|
89419
|
-
reportFailure("handlePreviewDeleteEverywhere", handlePreviewDeleteEverywhere(
|
|
89420
|
-
} else if (
|
|
89421
|
-
reportFailure("handleDeleteEverywhere", handleDeleteEverywhere(
|
|
89422
|
-
} else if (
|
|
89423
|
-
reportFailure("handleRetireS3Buckets", handleRetireS3Buckets(
|
|
89424
|
-
} else if (
|
|
89425
|
-
reportFailure("saveTeamSkillSelection", saveKeepPrivate(
|
|
89426
|
-
} else if (
|
|
89427
|
-
reportFailure("handleSaveSkillDefaults", handleSaveSkillDefaults(
|
|
89428
|
-
} else if (
|
|
89996
|
+
} else if (message5.type === "previewDeleteEverywhere") {
|
|
89997
|
+
reportFailure("handlePreviewDeleteEverywhere", handlePreviewDeleteEverywhere(message5.kind, message5.name));
|
|
89998
|
+
} else if (message5.type === "deleteEverywhere") {
|
|
89999
|
+
reportFailure("handleDeleteEverywhere", handleDeleteEverywhere(message5.plan));
|
|
90000
|
+
} else if (message5.type === "retireS3Buckets") {
|
|
90001
|
+
reportFailure("handleRetireS3Buckets", handleRetireS3Buckets(message5.confirm));
|
|
90002
|
+
} else if (message5.type === "saveTeamSkillSelection") {
|
|
90003
|
+
reportFailure("saveTeamSkillSelection", saveKeepPrivate(message5.keepPrivate).then(postSkills));
|
|
90004
|
+
} else if (message5.type === "saveSkillDefaults") {
|
|
90005
|
+
reportFailure("handleSaveSkillDefaults", handleSaveSkillDefaults(message5.skill, message5.values));
|
|
90006
|
+
} else if (message5.type === "syncMail") {
|
|
89429
90007
|
reportFailure("runMailSync", runMailSync("requested"));
|
|
89430
|
-
} else if (
|
|
90008
|
+
} else if (message5.type === "pruneMail") {
|
|
89431
90009
|
reportFailure("handlePruneMail", handlePruneMail());
|
|
89432
|
-
} else if (
|
|
89433
|
-
reportFailure("handleRequestOutlookFolders", handleRequestOutlookFolders(
|
|
89434
|
-
} else if (
|
|
89435
|
-
reportFailure("handleValidateMailFolder", handleValidateMailFolder(
|
|
89436
|
-
} else if (
|
|
90010
|
+
} else if (message5.type === "requestOutlookFolders") {
|
|
90011
|
+
reportFailure("handleRequestOutlookFolders", handleRequestOutlookFolders(message5.depth, message5.force === true));
|
|
90012
|
+
} else if (message5.type === "validateMailFolder") {
|
|
90013
|
+
reportFailure("handleValidateMailFolder", handleValidateMailFolder(message5.path));
|
|
90014
|
+
} else if (message5.type === "requestMailStatus") {
|
|
89437
90015
|
reportFailure("loadSettings", loadSettings().then((config2) => {
|
|
89438
90016
|
reconcileMailTimer(config2);
|
|
89439
90017
|
reconcileDatasetTimers(config2);
|
|
89440
90018
|
return postMailStatus();
|
|
89441
90019
|
}));
|
|
89442
|
-
} else if (
|
|
90020
|
+
} else if (message5.type === "saveMailSettings") {
|
|
89443
90021
|
reportFailure("handleSaveMailSettings", handleSaveMailSettings({
|
|
89444
|
-
enabled:
|
|
89445
|
-
folders:
|
|
89446
|
-
includeSubfolders:
|
|
89447
|
-
syncMinutes:
|
|
89448
|
-
retentionMonths:
|
|
89449
|
-
...
|
|
90022
|
+
enabled: message5.enabled,
|
|
90023
|
+
folders: message5.folders,
|
|
90024
|
+
includeSubfolders: message5.includeSubfolders,
|
|
90025
|
+
syncMinutes: message5.syncMinutes,
|
|
90026
|
+
retentionMonths: message5.retentionMonths,
|
|
90027
|
+
...message5.storeId !== void 0 ? { storeId: message5.storeId } : {}
|
|
89450
90028
|
}));
|
|
89451
|
-
} else if (
|
|
90029
|
+
} else if (message5.type === "clearTeamSkills") {
|
|
89452
90030
|
reportFailure("handleClearTeamSkills", handleClearTeamSkills());
|
|
89453
|
-
} else if (
|
|
90031
|
+
} else if (message5.type === "requestTeamSkillsIndexStatus") {
|
|
89454
90032
|
reportFailure("handleTeamSkillsIndexStatus", handleTeamSkillsIndexStatus());
|
|
89455
|
-
} else if (
|
|
89456
|
-
reportFailure("handleRefreshMail", handleRefreshMail(
|
|
89457
|
-
} else if (
|
|
90033
|
+
} else if (message5.type === "refreshMail") {
|
|
90034
|
+
reportFailure("handleRefreshMail", handleRefreshMail(message5.days));
|
|
90035
|
+
} else if (message5.type === "requestDatasetStatus") {
|
|
89458
90036
|
reportFailure("postDatasetStatus", postDatasetStatus());
|
|
89459
|
-
} else if (
|
|
89460
|
-
reportFailure("handleSaveDataset", handleSaveDataset(
|
|
89461
|
-
} else if (
|
|
89462
|
-
reportFailure("handleDeleteDataset", handleDeleteDataset(
|
|
89463
|
-
} else if (
|
|
89464
|
-
reportFailure("runDatasetSync", runDatasetSync(
|
|
89465
|
-
} else if (
|
|
89466
|
-
reportFailure("handleClearDataset", handleClearDataset(
|
|
89467
|
-
} else if (
|
|
89468
|
-
reportFailure("handleClearMailIndex", handleClearMailIndex(
|
|
89469
|
-
} else if (
|
|
89470
|
-
reportFailure("handleSkillImage", handleSkillImage(
|
|
89471
|
-
} else if (
|
|
90037
|
+
} else if (message5.type === "saveDataset") {
|
|
90038
|
+
reportFailure("handleSaveDataset", handleSaveDataset(message5.dataset));
|
|
90039
|
+
} else if (message5.type === "deleteDataset") {
|
|
90040
|
+
reportFailure("handleDeleteDataset", handleDeleteDataset(message5.id));
|
|
90041
|
+
} else if (message5.type === "syncDataset") {
|
|
90042
|
+
reportFailure("runDatasetSync", runDatasetSync(message5.id, "manual"));
|
|
90043
|
+
} else if (message5.type === "clearDataset") {
|
|
90044
|
+
reportFailure("handleClearDataset", handleClearDataset(message5.id, message5.resync === true));
|
|
90045
|
+
} else if (message5.type === "clearMailIndex") {
|
|
90046
|
+
reportFailure("handleClearMailIndex", handleClearMailIndex(message5.resync === true));
|
|
90047
|
+
} else if (message5.type === "requestSkillImage") {
|
|
90048
|
+
reportFailure("handleSkillImage", handleSkillImage(message5.skill, message5.image));
|
|
90049
|
+
} else if (message5.type === "requestS3") {
|
|
89472
90050
|
reportFailure("postS3", postS3());
|
|
89473
|
-
} else if (
|
|
89474
|
-
reportFailure("handleSaveS3Connection", handleSaveS3Connection(
|
|
89475
|
-
} else if (
|
|
89476
|
-
reportFailure("handleDeleteS3Connection", handleDeleteS3Connection(
|
|
89477
|
-
} else if (
|
|
89478
|
-
reportFailure("handleSaveS3Mirrors", handleSaveS3Mirrors(
|
|
89479
|
-
} else if (
|
|
89480
|
-
reportFailure("handleSyncS3", handleSyncS3(
|
|
89481
|
-
} else if (
|
|
89482
|
-
reportFailure("handleSaveSkillsAlias", handleSaveSkillsAlias(
|
|
89483
|
-
} else if (
|
|
89484
|
-
if (
|
|
90051
|
+
} else if (message5.type === "saveS3Connection") {
|
|
90052
|
+
reportFailure("handleSaveS3Connection", handleSaveS3Connection(message5.connection, message5.secret, message5.sessionToken));
|
|
90053
|
+
} else if (message5.type === "deleteS3Connection") {
|
|
90054
|
+
reportFailure("handleDeleteS3Connection", handleDeleteS3Connection(message5.id));
|
|
90055
|
+
} else if (message5.type === "saveS3Mirrors") {
|
|
90056
|
+
reportFailure("handleSaveS3Mirrors", handleSaveS3Mirrors(message5.kind, message5.mirrors));
|
|
90057
|
+
} else if (message5.type === "syncS3") {
|
|
90058
|
+
reportFailure("handleSyncS3", handleSyncS3(message5.kind));
|
|
90059
|
+
} else if (message5.type === "saveSkillsAlias") {
|
|
90060
|
+
reportFailure("handleSaveSkillsAlias", handleSaveSkillsAlias(message5.aliases));
|
|
90061
|
+
} else if (message5.type === "cancelIndexing") {
|
|
90062
|
+
if (message5.kind === void 0) {
|
|
89485
90063
|
indexingAbort?.abort();
|
|
89486
90064
|
for (const controller of indexingAborts.values())
|
|
89487
90065
|
controller.abort();
|
|
89488
|
-
} else if (
|
|
90066
|
+
} else if (message5.kind === "codebase") {
|
|
89489
90067
|
indexingAbort?.abort();
|
|
89490
90068
|
} else {
|
|
89491
|
-
indexingAborts.get(
|
|
90069
|
+
indexingAborts.get(message5.kind)?.abort();
|
|
89492
90070
|
}
|
|
89493
|
-
} else if (
|
|
89494
|
-
reportFailure("handleSaveEmbedder", handleSaveEmbedder(
|
|
89495
|
-
} else if (
|
|
89496
|
-
reportFailure("handleRequestEmbedderModels", handleRequestEmbedderModels(
|
|
89497
|
-
} else if (
|
|
90071
|
+
} else if (message5.type === "saveEmbedder") {
|
|
90072
|
+
reportFailure("handleSaveEmbedder", handleSaveEmbedder(message5.profileId, message5.model, message5.dimensions, message5.indexName, message5.indexPrefix, message5.indexAliases));
|
|
90073
|
+
} else if (message5.type === "requestEmbedderModels") {
|
|
90074
|
+
reportFailure("handleRequestEmbedderModels", handleRequestEmbedderModels(message5.profileId));
|
|
90075
|
+
} else if (message5.type === "openWalkthrough") {
|
|
89498
90076
|
void ui.openWalkthrough?.();
|
|
89499
|
-
} else if (
|
|
90077
|
+
} else if (message5.type === "requestTools") {
|
|
89500
90078
|
reportFailure("postTools", postTools());
|
|
89501
|
-
} else if (
|
|
90079
|
+
} else if (message5.type === "requestSchedules") {
|
|
89502
90080
|
reportFailure("postSchedules", postSchedules());
|
|
89503
|
-
} else if (
|
|
89504
|
-
reportFailure("handleSaveSchedule", handleSaveSchedule(
|
|
89505
|
-
} else if (
|
|
89506
|
-
reportFailure("handleDuplicateSchedule", handleDuplicateSchedule(
|
|
89507
|
-
} else if (
|
|
89508
|
-
reportFailure("handleDeleteSchedule", handleDeleteSchedule(
|
|
89509
|
-
} else if (
|
|
89510
|
-
reportFailure("handleSetScheduleEnabled", handleSetScheduleEnabled(
|
|
89511
|
-
} else if (
|
|
89512
|
-
const next =
|
|
89513
|
-
...
|
|
89514
|
-
...
|
|
90081
|
+
} else if (message5.type === "saveSchedule") {
|
|
90082
|
+
reportFailure("handleSaveSchedule", handleSaveSchedule(message5.schedule));
|
|
90083
|
+
} else if (message5.type === "duplicateSchedule") {
|
|
90084
|
+
reportFailure("handleDuplicateSchedule", handleDuplicateSchedule(message5.id));
|
|
90085
|
+
} else if (message5.type === "deleteSchedule") {
|
|
90086
|
+
reportFailure("handleDeleteSchedule", handleDeleteSchedule(message5.id));
|
|
90087
|
+
} else if (message5.type === "setScheduleEnabled") {
|
|
90088
|
+
reportFailure("handleSetScheduleEnabled", handleSetScheduleEnabled(message5.id, message5.enabled));
|
|
90089
|
+
} else if (message5.type === "setTaskExpertLimits") {
|
|
90090
|
+
const next = message5.maxSpendUsd === void 0 && message5.maxConsultations === void 0 ? void 0 : {
|
|
90091
|
+
...message5.maxSpendUsd !== void 0 ? { maxSpendUsd: message5.maxSpendUsd } : {},
|
|
90092
|
+
...message5.maxConsultations !== void 0 ? { maxConsultations: message5.maxConsultations } : {}
|
|
89515
90093
|
};
|
|
89516
90094
|
taskExpertLimits = next;
|
|
89517
90095
|
postExpertSpend();
|
|
@@ -89528,17 +90106,17 @@ ${last}` : ""}`);
|
|
|
89528
90106
|
await postExpert({ redetect: false });
|
|
89529
90107
|
}).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89530
90108
|
}
|
|
89531
|
-
} else if (
|
|
90109
|
+
} else if (message5.type === "setExpertKeepAlive") {
|
|
89532
90110
|
void configManager.load().then(async ({ config: config2 }) => {
|
|
89533
90111
|
await configManager.save("user", {
|
|
89534
90112
|
...config2,
|
|
89535
|
-
expert: { ...config2.expert, keepAlive:
|
|
90113
|
+
expert: { ...config2.expert, keepAlive: message5.enabled }
|
|
89536
90114
|
});
|
|
89537
90115
|
await postExpert({ redetect: false });
|
|
89538
90116
|
}).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89539
|
-
} else if (
|
|
90117
|
+
} else if (message5.type === "measureExpertCost") {
|
|
89540
90118
|
reportFailure("handleMeasureExpertCost", handleMeasureExpertCost());
|
|
89541
|
-
} else if (
|
|
90119
|
+
} else if (message5.type === "clearExpertPricing") {
|
|
89542
90120
|
void configManager.load().then(async ({ config: config2 }) => {
|
|
89543
90121
|
const expert = { ...config2.expert };
|
|
89544
90122
|
delete expert.pricing;
|
|
@@ -89546,78 +90124,78 @@ ${last}` : ""}`);
|
|
|
89546
90124
|
await configManager.save("user", { ...config2, expert });
|
|
89547
90125
|
await postExpert({ redetect: false });
|
|
89548
90126
|
}).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89549
|
-
} else if (
|
|
89550
|
-
reportFailure("handleAssessJunior", handleAssessJunior(
|
|
89551
|
-
} else if (
|
|
89552
|
-
reportFailure("handleClearAssessment", handleClearAssessment(
|
|
89553
|
-
} else if (
|
|
90127
|
+
} else if (message5.type === "assessJunior") {
|
|
90128
|
+
reportFailure("handleAssessJunior", handleAssessJunior(message5.profileId));
|
|
90129
|
+
} else if (message5.type === "clearAssessment") {
|
|
90130
|
+
reportFailure("handleClearAssessment", handleClearAssessment(message5.model, message5.profileLabel));
|
|
90131
|
+
} else if (message5.type === "restartScheduler") {
|
|
89554
90132
|
restartScheduleTimer();
|
|
89555
90133
|
if (services.runsSchedules !== false)
|
|
89556
90134
|
logger.info("schedule timer restarted by the user");
|
|
89557
90135
|
reportFailure("postSchedules", postSchedules());
|
|
89558
|
-
} else if (
|
|
89559
|
-
reportFailure("handleDeleteScheduleRun", handleDeleteScheduleRun(
|
|
89560
|
-
} else if (
|
|
89561
|
-
reportFailure("handleClearScheduleRuns", handleClearScheduleRuns(
|
|
89562
|
-
} else if (
|
|
89563
|
-
reportFailure("openRunTranscript", openRunTranscript(
|
|
89564
|
-
} else if (
|
|
89565
|
-
reportFailure("runSchedule", runSchedule(
|
|
89566
|
-
} else if (
|
|
90136
|
+
} else if (message5.type === "deleteScheduleRun") {
|
|
90137
|
+
reportFailure("handleDeleteScheduleRun", handleDeleteScheduleRun(message5.id, message5.at));
|
|
90138
|
+
} else if (message5.type === "clearScheduleRuns") {
|
|
90139
|
+
reportFailure("handleClearScheduleRuns", handleClearScheduleRuns(message5.id));
|
|
90140
|
+
} else if (message5.type === "openScheduleRun") {
|
|
90141
|
+
reportFailure("openRunTranscript", openRunTranscript(message5.taskId, message5.title));
|
|
90142
|
+
} else if (message5.type === "runScheduleNow") {
|
|
90143
|
+
reportFailure("runSchedule", runSchedule(message5.id, "manual"));
|
|
90144
|
+
} else if (message5.type === "requestSkills") {
|
|
89567
90145
|
reportFailure("postSkills", postSkills());
|
|
89568
|
-
} else if (
|
|
90146
|
+
} else if (message5.type === "saveSkillDirs") {
|
|
89569
90147
|
void configManager.save("user", {
|
|
89570
90148
|
skills: {
|
|
89571
|
-
...
|
|
89572
|
-
paths:
|
|
90149
|
+
...message5.dir.trim().length > 0 ? { dir: message5.dir.trim() } : {},
|
|
90150
|
+
paths: message5.paths.map((entry) => entry.trim()).filter((entry) => entry.length > 0)
|
|
89573
90151
|
}
|
|
89574
90152
|
}).then(() => postSkills()).catch((error51) => post({ type: "error", message: String(error51) }));
|
|
89575
|
-
} else if (
|
|
89576
|
-
reportFailure("handleOpenManagedFile", handleOpenManagedFile(
|
|
89577
|
-
} else if (
|
|
89578
|
-
reportFailure("handleSaveEditorFile", handleSaveEditorFile(
|
|
89579
|
-
} else if (
|
|
89580
|
-
reportFailure("handleDeletePythonTool", handleDeletePythonTool(
|
|
89581
|
-
} else if (
|
|
89582
|
-
reportFailure("handleApprovePythonTool", handleApprovePythonTool(
|
|
89583
|
-
} else if (
|
|
89584
|
-
reportFailure("handleDeleteSkillFile", handleDeleteSkillFile(
|
|
89585
|
-
} else if (
|
|
90153
|
+
} else if (message5.type === "openManagedFile") {
|
|
90154
|
+
reportFailure("handleOpenManagedFile", handleOpenManagedFile(message5.path));
|
|
90155
|
+
} else if (message5.type === "saveEditorFile") {
|
|
90156
|
+
reportFailure("handleSaveEditorFile", handleSaveEditorFile(message5.path, message5.content, message5.mtimeMs));
|
|
90157
|
+
} else if (message5.type === "deletePythonTool") {
|
|
90158
|
+
reportFailure("handleDeletePythonTool", handleDeletePythonTool(message5.name, message5.filePath));
|
|
90159
|
+
} else if (message5.type === "approvePythonTool") {
|
|
90160
|
+
reportFailure("handleApprovePythonTool", handleApprovePythonTool(message5.name));
|
|
90161
|
+
} else if (message5.type === "deleteSkillFile") {
|
|
90162
|
+
reportFailure("handleDeleteSkillFile", handleDeleteSkillFile(message5.name));
|
|
90163
|
+
} else if (message5.type === "requestPython") {
|
|
89586
90164
|
reportFailure("postPython", configurePythonFromSettings().then(postPython));
|
|
89587
|
-
} else if (
|
|
89588
|
-
reportFailure("handleSetPython", handleSetPython(
|
|
89589
|
-
} else if (
|
|
89590
|
-
reportFailure("handleRequestUsage", handleRequestUsage(
|
|
89591
|
-
} else if (
|
|
89592
|
-
reportFailure("handleSaveUsageSettings", handleSaveUsageSettings(
|
|
89593
|
-
} else if (
|
|
90165
|
+
} else if (message5.type === "setPython") {
|
|
90166
|
+
reportFailure("handleSetPython", handleSetPython(message5));
|
|
90167
|
+
} else if (message5.type === "requestUsage") {
|
|
90168
|
+
reportFailure("handleRequestUsage", handleRequestUsage(message5));
|
|
90169
|
+
} else if (message5.type === "saveUsageSettings") {
|
|
90170
|
+
reportFailure("handleSaveUsageSettings", handleSaveUsageSettings(message5));
|
|
90171
|
+
} else if (message5.type === "requestNetwork") {
|
|
89594
90172
|
reportFailure("postNetwork", postNetwork());
|
|
89595
|
-
} else if (
|
|
90173
|
+
} else if (message5.type === "requestLsp") {
|
|
89596
90174
|
postLsp();
|
|
89597
|
-
} else if (
|
|
90175
|
+
} else if (message5.type === "saveLsp") {
|
|
89598
90176
|
reportFailure("saveLsp", (async () => {
|
|
89599
|
-
await configManager.save("user", { lsp:
|
|
89600
|
-
cachedLsp =
|
|
90177
|
+
await configManager.save("user", { lsp: message5.settings });
|
|
90178
|
+
cachedLsp = message5.settings;
|
|
89601
90179
|
postLsp();
|
|
89602
90180
|
})());
|
|
89603
|
-
} else if (
|
|
89604
|
-
reportFailure("handleSaveNetwork", handleSaveNetwork(
|
|
89605
|
-
} else if (
|
|
89606
|
-
reportFailure("handleSaveProxy", handleSaveProxy(
|
|
89607
|
-
} else if (
|
|
90181
|
+
} else if (message5.type === "saveNetwork") {
|
|
90182
|
+
reportFailure("handleSaveNetwork", handleSaveNetwork(message5.settings));
|
|
90183
|
+
} else if (message5.type === "saveProxy") {
|
|
90184
|
+
reportFailure("handleSaveProxy", handleSaveProxy(message5));
|
|
90185
|
+
} else if (message5.type === "requestExpert") {
|
|
89608
90186
|
reportFailure("postExpert", postExpert());
|
|
89609
|
-
} else if (
|
|
89610
|
-
reportFailure("applyPlan", applyPlan(
|
|
89611
|
-
} else if (
|
|
90187
|
+
} else if (message5.type === "setPlan") {
|
|
90188
|
+
reportFailure("applyPlan", applyPlan(message5.plan));
|
|
90189
|
+
} else if (message5.type === "requestPlan") {
|
|
89612
90190
|
post({ type: "plan", plan: activePlan ?? "" });
|
|
89613
90191
|
postPlanProgress();
|
|
89614
|
-
} else if (
|
|
90192
|
+
} else if (message5.type === "requestPlanProgress") {
|
|
89615
90193
|
postPlanProgress();
|
|
89616
|
-
} else if (
|
|
90194
|
+
} else if (message5.type === "requestAgents") {
|
|
89617
90195
|
reportFailure("postAgents", postAgents());
|
|
89618
|
-
} else if (
|
|
89619
|
-
const assignment =
|
|
89620
|
-
const role =
|
|
90196
|
+
} else if (message5.type === "setAgentRole") {
|
|
90197
|
+
const assignment = message5.assignment;
|
|
90198
|
+
const role = message5.role;
|
|
89621
90199
|
if (!isAgentRole(role, cachedAgentDefinitions)) {
|
|
89622
90200
|
post({ type: "error", message: `There is no "${role}" role.` });
|
|
89623
90201
|
return;
|
|
@@ -89635,9 +90213,9 @@ ${last}` : ""}`);
|
|
|
89635
90213
|
}
|
|
89636
90214
|
return { ...current, roles };
|
|
89637
90215
|
}));
|
|
89638
|
-
} else if (
|
|
89639
|
-
const role =
|
|
89640
|
-
const prompt =
|
|
90216
|
+
} else if (message5.type === "setAgentPrompt") {
|
|
90217
|
+
const role = message5.role;
|
|
90218
|
+
const prompt = message5.prompt;
|
|
89641
90219
|
if (!isAgentRole(role, cachedAgentDefinitions)) {
|
|
89642
90220
|
post({ type: "error", message: `There is no "${role}" role.` });
|
|
89643
90221
|
return;
|
|
@@ -89656,11 +90234,11 @@ ${last}` : ""}`);
|
|
|
89656
90234
|
}
|
|
89657
90235
|
return { ...current, roles };
|
|
89658
90236
|
}));
|
|
89659
|
-
} else if (
|
|
89660
|
-
const matters =
|
|
90237
|
+
} else if (message5.type === "setAgentBudget") {
|
|
90238
|
+
const matters = message5.matters;
|
|
89661
90239
|
reportFailure("saveAgents", saveAgents((current) => ({ ...current, budgetMatters: matters })));
|
|
89662
|
-
} else if (
|
|
89663
|
-
const guidance =
|
|
90240
|
+
} else if (message5.type === "setTeamGuidance") {
|
|
90241
|
+
const guidance = message5.guidance;
|
|
89664
90242
|
reportFailure("saveAgents", saveAgents((current) => {
|
|
89665
90243
|
if (guidance === void 0 || guidance.trim().length === 0 || guidance === DEFAULT_TEAM_GUIDANCE) {
|
|
89666
90244
|
const rest = { ...current };
|
|
@@ -89669,12 +90247,12 @@ ${last}` : ""}`);
|
|
|
89669
90247
|
}
|
|
89670
90248
|
return { ...current, teamGuidance: guidance };
|
|
89671
90249
|
}));
|
|
89672
|
-
} else if (
|
|
89673
|
-
reportFailure("handleSaveCustomRole", handleSaveCustomRole(
|
|
89674
|
-
} else if (
|
|
89675
|
-
reportFailure("handleDeleteCustomRole", handleDeleteCustomRole(
|
|
89676
|
-
} else if (
|
|
89677
|
-
const role =
|
|
90250
|
+
} else if (message5.type === "saveCustomRole") {
|
|
90251
|
+
reportFailure("handleSaveCustomRole", handleSaveCustomRole(message5));
|
|
90252
|
+
} else if (message5.type === "deleteCustomRole") {
|
|
90253
|
+
reportFailure("handleDeleteCustomRole", handleDeleteCustomRole(message5.id));
|
|
90254
|
+
} else if (message5.type === "setRoleThinking") {
|
|
90255
|
+
const role = message5.role;
|
|
89678
90256
|
if (!isAgentRole(role, cachedAgentDefinitions)) {
|
|
89679
90257
|
post({ type: "error", message: `There is no "${role}" role.` });
|
|
89680
90258
|
return;
|
|
@@ -89682,17 +90260,17 @@ ${last}` : ""}`);
|
|
|
89682
90260
|
reportFailure("saveAgents", saveAgents((current) => {
|
|
89683
90261
|
const roles = { ...current.roles ?? {} };
|
|
89684
90262
|
const existing = roles[role] ?? { kind: "profile" };
|
|
89685
|
-
if (
|
|
90263
|
+
if (message5.level === void 0) {
|
|
89686
90264
|
const rest = { ...existing };
|
|
89687
90265
|
delete rest.thinking;
|
|
89688
90266
|
roles[role] = rest;
|
|
89689
90267
|
} else {
|
|
89690
|
-
roles[role] = { ...existing, thinking:
|
|
90268
|
+
roles[role] = { ...existing, thinking: message5.level };
|
|
89691
90269
|
}
|
|
89692
90270
|
return { ...current, roles };
|
|
89693
90271
|
}));
|
|
89694
|
-
} else if (
|
|
89695
|
-
const role =
|
|
90272
|
+
} else if (message5.type === "setRoleEnabled") {
|
|
90273
|
+
const role = message5.role;
|
|
89696
90274
|
if (!isAgentRole(role, cachedAgentDefinitions)) {
|
|
89697
90275
|
post({ type: "error", message: `There is no "${role}" role.` });
|
|
89698
90276
|
return;
|
|
@@ -89701,35 +90279,35 @@ ${last}` : ""}`);
|
|
|
89701
90279
|
const roles = { ...current.roles ?? {} };
|
|
89702
90280
|
roles[role] = {
|
|
89703
90281
|
...roles[role] ?? { kind: "profile" },
|
|
89704
|
-
enabled:
|
|
90282
|
+
enabled: message5.enabled
|
|
89705
90283
|
};
|
|
89706
90284
|
return { ...current, roles };
|
|
89707
90285
|
}));
|
|
89708
|
-
} else if (
|
|
89709
|
-
const role =
|
|
90286
|
+
} else if (message5.type === "setRoleWrite") {
|
|
90287
|
+
const role = message5.role;
|
|
89710
90288
|
if (!isAgentRole(role, cachedAgentDefinitions)) {
|
|
89711
90289
|
post({ type: "error", message: `There is no "${role}" role.` });
|
|
89712
90290
|
return;
|
|
89713
90291
|
}
|
|
89714
90292
|
reportFailure("saveAgents", saveAgents((current) => {
|
|
89715
90293
|
const roles = { ...current.roles ?? {} };
|
|
89716
|
-
roles[role] = { ...roles[role] ?? { kind: "profile" }, write:
|
|
90294
|
+
roles[role] = { ...roles[role] ?? { kind: "profile" }, write: message5.canWrite };
|
|
89717
90295
|
return { ...current, roles };
|
|
89718
90296
|
}));
|
|
89719
|
-
} else if (
|
|
89720
|
-
const role =
|
|
90297
|
+
} else if (message5.type === "setRoleTools") {
|
|
90298
|
+
const role = message5.role;
|
|
89721
90299
|
if (!isAgentRole(role, cachedAgentDefinitions)) {
|
|
89722
90300
|
post({ type: "error", message: `There is no "${role}" role.` });
|
|
89723
90301
|
return;
|
|
89724
90302
|
}
|
|
89725
90303
|
reportFailure("saveAgents", saveAgents((current) => {
|
|
89726
90304
|
const roles = { ...current.roles ?? {} };
|
|
89727
|
-
roles[role] = { ...roles[role] ?? { kind: "profile" }, tools:
|
|
90305
|
+
roles[role] = { ...roles[role] ?? { kind: "profile" }, tools: message5.usesTools };
|
|
89728
90306
|
return { ...current, roles };
|
|
89729
90307
|
}));
|
|
89730
|
-
} else if (
|
|
89731
|
-
const role =
|
|
89732
|
-
const color =
|
|
90308
|
+
} else if (message5.type === "setAgentColor") {
|
|
90309
|
+
const role = message5.role;
|
|
90310
|
+
const color = message5.color;
|
|
89733
90311
|
if (!isColourableAgent(role, cachedAgentDefinitions)) {
|
|
89734
90312
|
post({ type: "error", message: `There is no "${role}" role.` });
|
|
89735
90313
|
return;
|
|
@@ -89738,49 +90316,49 @@ ${last}` : ""}`);
|
|
|
89738
90316
|
...current,
|
|
89739
90317
|
colors: { ...current.colors ?? {}, [role]: color }
|
|
89740
90318
|
})));
|
|
89741
|
-
} else if (
|
|
89742
|
-
reportFailure("handleSetExpert", handleSetExpert(
|
|
89743
|
-
...
|
|
89744
|
-
...
|
|
89745
|
-
...
|
|
90319
|
+
} else if (message5.type === "setExpert") {
|
|
90320
|
+
reportFailure("handleSetExpert", handleSetExpert(message5.enabled, message5.path, message5.model, {
|
|
90321
|
+
...message5.maxSpendUsd !== void 0 ? { maxSpendUsd: message5.maxSpendUsd } : {},
|
|
90322
|
+
...message5.maxConsultations !== void 0 ? { maxConsultations: message5.maxConsultations } : {},
|
|
90323
|
+
...message5.profileId !== void 0 ? { profileId: message5.profileId } : {}
|
|
89746
90324
|
}));
|
|
89747
|
-
} else if (
|
|
90325
|
+
} else if (message5.type === "requestProfiles") {
|
|
89748
90326
|
reportFailure("postProfiles", postProfiles());
|
|
89749
90327
|
reportFailure("postCapabilities", postCapabilities());
|
|
89750
|
-
} else if (
|
|
89751
|
-
reportFailure("handleSaveProfile", handleSaveProfile(
|
|
89752
|
-
} else if (
|
|
89753
|
-
reportFailure("handleRequestModels", handleRequestModels(
|
|
89754
|
-
} else if (
|
|
89755
|
-
reportFailure("handleTestConnection", handleTestConnection(
|
|
89756
|
-
} else if (
|
|
89757
|
-
reportFailure("handleDuplicateProfile", handleDuplicateProfile(
|
|
89758
|
-
} else if (
|
|
89759
|
-
reportFailure("handleDeleteProfile", handleDeleteProfile(
|
|
89760
|
-
} else if (
|
|
89761
|
-
reportFailure("handleSetActiveProfile", handleSetActiveProfile(
|
|
89762
|
-
} else if (
|
|
89763
|
-
reportFailure("handleDeclinePythonTools", handleDeclinePythonTools(
|
|
89764
|
-
} else if (
|
|
89765
|
-
reportFailure("handleRestorePythonTool", handleRestorePythonTool(
|
|
89766
|
-
} else if (
|
|
89767
|
-
reportFailure("handleApprovePythonTools", handleApprovePythonTools(
|
|
89768
|
-
} else if (
|
|
89769
|
-
reportFailure("handleRequestPythonToolSource", handleRequestPythonToolSource(
|
|
89770
|
-
} else if (
|
|
89771
|
-
reportFailure("handlePreviewBucketSkillDelete", handlePreviewBucketSkillDelete(
|
|
89772
|
-
} else if (
|
|
89773
|
-
reportFailure("handleDeleteSkillFromBucket", handleDeleteSkillFromBucket(
|
|
89774
|
-
} else if (
|
|
90328
|
+
} else if (message5.type === "saveProfile") {
|
|
90329
|
+
reportFailure("handleSaveProfile", handleSaveProfile(message5.profile));
|
|
90330
|
+
} else if (message5.type === "requestModels") {
|
|
90331
|
+
reportFailure("handleRequestModels", handleRequestModels(message5.profile));
|
|
90332
|
+
} else if (message5.type === "testConnection") {
|
|
90333
|
+
reportFailure("handleTestConnection", handleTestConnection(message5.profile));
|
|
90334
|
+
} else if (message5.type === "duplicateProfile") {
|
|
90335
|
+
reportFailure("handleDuplicateProfile", handleDuplicateProfile(message5.id));
|
|
90336
|
+
} else if (message5.type === "deleteProfile") {
|
|
90337
|
+
reportFailure("handleDeleteProfile", handleDeleteProfile(message5.id));
|
|
90338
|
+
} else if (message5.type === "setActiveProfile") {
|
|
90339
|
+
reportFailure("handleSetActiveProfile", handleSetActiveProfile(message5.id, message5.forProject));
|
|
90340
|
+
} else if (message5.type === "declinePythonTools") {
|
|
90341
|
+
reportFailure("handleDeclinePythonTools", handleDeclinePythonTools(message5.names));
|
|
90342
|
+
} else if (message5.type === "restorePythonTool") {
|
|
90343
|
+
reportFailure("handleRestorePythonTool", handleRestorePythonTool(message5.name));
|
|
90344
|
+
} else if (message5.type === "approvePythonTools") {
|
|
90345
|
+
reportFailure("handleApprovePythonTools", handleApprovePythonTools(message5.names));
|
|
90346
|
+
} else if (message5.type === "requestPythonToolSource") {
|
|
90347
|
+
reportFailure("handleRequestPythonToolSource", handleRequestPythonToolSource(message5.name));
|
|
90348
|
+
} else if (message5.type === "previewBucketSkillDelete") {
|
|
90349
|
+
reportFailure("handlePreviewBucketSkillDelete", handlePreviewBucketSkillDelete(message5.name, message5.sourceDir));
|
|
90350
|
+
} else if (message5.type === "deleteSkillFromBucket") {
|
|
90351
|
+
reportFailure("handleDeleteSkillFromBucket", handleDeleteSkillFromBucket(message5.name, message5.sourceDir, message5.keys));
|
|
90352
|
+
} else if (message5.type === "requestShareSections") {
|
|
89775
90353
|
reportFailure("handleRequestShareSections", handleRequestShareSections());
|
|
89776
|
-
} else if (
|
|
90354
|
+
} else if (message5.type === "previewImport") {
|
|
89777
90355
|
reportFailure("handlePreviewImport", handlePreviewImport());
|
|
89778
|
-
} else if (
|
|
90356
|
+
} else if (message5.type === "exportSource") {
|
|
89779
90357
|
reportFailure("handleExportSource", handleExportSource());
|
|
89780
|
-
} else if (
|
|
89781
|
-
reportFailure("handleExportConfig", handleExportConfig(
|
|
89782
|
-
} else if (
|
|
89783
|
-
reportFailure("handleImportConfig", handleImportConfig(
|
|
90358
|
+
} else if (message5.type === "exportConfig") {
|
|
90359
|
+
reportFailure("handleExportConfig", handleExportConfig(message5.sections));
|
|
90360
|
+
} else if (message5.type === "importConfig") {
|
|
90361
|
+
reportFailure("handleImportConfig", handleImportConfig(message5));
|
|
89784
90362
|
}
|
|
89785
90363
|
});
|
|
89786
90364
|
void (async () => {
|
|
@@ -89804,8 +90382,8 @@ ${last}` : ""}`);
|
|
|
89804
90382
|
post({ type: "taskRestored", taskId: void 0, entries: [] });
|
|
89805
90383
|
}
|
|
89806
90384
|
})();
|
|
89807
|
-
async function openFromNotification(
|
|
89808
|
-
const open = await ui.showActionMessage(
|
|
90385
|
+
async function openFromNotification(message5, level2, taskId) {
|
|
90386
|
+
const open = await ui.showActionMessage(message5, "Open", level2);
|
|
89809
90387
|
if (!open)
|
|
89810
90388
|
return;
|
|
89811
90389
|
await ui.revealPanel();
|
|
@@ -90236,9 +90814,9 @@ ${contents}
|
|
|
90236
90814
|
function lastAssistantSummary() {
|
|
90237
90815
|
const messages = conversation.toArray();
|
|
90238
90816
|
for (let index = messages.length - 1; index >= 0; index--) {
|
|
90239
|
-
const
|
|
90240
|
-
if (
|
|
90241
|
-
return
|
|
90817
|
+
const message5 = messages[index];
|
|
90818
|
+
if (message5?.role === "assistant" && typeof message5.content === "string" && message5.content.trim().length > 0) {
|
|
90819
|
+
return message5.content.trim();
|
|
90242
90820
|
}
|
|
90243
90821
|
}
|
|
90244
90822
|
return "";
|
|
@@ -90392,7 +90970,7 @@ this becomes an ordinary skill: listed by name, read only when it looks relevant
|
|
|
90392
90970
|
var MAX_TITLE_LENGTH = 60;
|
|
90393
90971
|
var FALLBACK_TITLE = "Untitled task";
|
|
90394
90972
|
function deriveTitle(messages) {
|
|
90395
|
-
const firstUserMessage = messages.find((
|
|
90973
|
+
const firstUserMessage = messages.find((message5) => message5.role === "user");
|
|
90396
90974
|
if (firstUserMessage === void 0)
|
|
90397
90975
|
return FALLBACK_TITLE;
|
|
90398
90976
|
const collapsed = firstUserMessage.content.replace(/\s+/g, " ").trim();
|
|
@@ -90525,28 +91103,28 @@ function toolCallReason(raw) {
|
|
|
90525
91103
|
}
|
|
90526
91104
|
function toTranscript(messages) {
|
|
90527
91105
|
const resultsByCallId = /* @__PURE__ */ new Map();
|
|
90528
|
-
for (const
|
|
90529
|
-
if (
|
|
90530
|
-
resultsByCallId.set(
|
|
91106
|
+
for (const message5 of messages) {
|
|
91107
|
+
if (message5.role === "tool")
|
|
91108
|
+
resultsByCallId.set(message5.toolCallId, message5.content);
|
|
90531
91109
|
}
|
|
90532
91110
|
const entries = [];
|
|
90533
91111
|
let informedBy;
|
|
90534
|
-
for (const
|
|
90535
|
-
if (
|
|
91112
|
+
for (const message5 of messages) {
|
|
91113
|
+
if (message5.role === "system" || message5.role === "tool")
|
|
90536
91114
|
continue;
|
|
90537
|
-
if (
|
|
90538
|
-
entries.push({ kind: "text", role: "user", content:
|
|
91115
|
+
if (message5.role === "user") {
|
|
91116
|
+
entries.push({ kind: "text", role: "user", content: message5.content });
|
|
90539
91117
|
continue;
|
|
90540
91118
|
}
|
|
90541
|
-
if (
|
|
91119
|
+
if (message5.content.length > 0) {
|
|
90542
91120
|
entries.push({
|
|
90543
91121
|
kind: "text",
|
|
90544
91122
|
role: "assistant",
|
|
90545
|
-
content:
|
|
91123
|
+
content: message5.content,
|
|
90546
91124
|
...informedBy !== void 0 ? { expertInformed: true, informedBy } : {}
|
|
90547
91125
|
});
|
|
90548
91126
|
}
|
|
90549
|
-
for (const toolCall of
|
|
91127
|
+
for (const toolCall of message5.toolCalls ?? []) {
|
|
90550
91128
|
const result = resultsByCallId.get(toolCall.id);
|
|
90551
91129
|
const asChart = chartFromToolCall(toolCall.name, toolCall.arguments);
|
|
90552
91130
|
if (asChart !== void 0) {
|
|
@@ -90558,7 +91136,7 @@ function toTranscript(messages) {
|
|
|
90558
91136
|
continue;
|
|
90559
91137
|
}
|
|
90560
91138
|
if (CONTROL_TOOLS.has(toolCall.name)) {
|
|
90561
|
-
if (result !== void 0 && !repeatsStreamedText(
|
|
91139
|
+
if (result !== void 0 && !repeatsStreamedText(message5.content, result)) {
|
|
90562
91140
|
entries.push({ kind: "text", role: "assistant", content: result });
|
|
90563
91141
|
}
|
|
90564
91142
|
continue;
|
|
@@ -90640,11 +91218,11 @@ function decodeArguments(raw) {
|
|
|
90640
91218
|
}
|
|
90641
91219
|
|
|
90642
91220
|
// ../../packages/core/dist/history/redactTask.js
|
|
90643
|
-
function redactMessage(
|
|
90644
|
-
if (
|
|
90645
|
-
const redacted = { role: "assistant", content: redact(
|
|
90646
|
-
if (
|
|
90647
|
-
redacted.toolCalls =
|
|
91221
|
+
function redactMessage(message5, knownSecrets) {
|
|
91222
|
+
if (message5.role === "assistant") {
|
|
91223
|
+
const redacted = { role: "assistant", content: redact(message5.content, knownSecrets) };
|
|
91224
|
+
if (message5.toolCalls !== void 0 && message5.toolCalls.length > 0) {
|
|
91225
|
+
redacted.toolCalls = message5.toolCalls.map((call) => ({
|
|
90648
91226
|
...call,
|
|
90649
91227
|
// Arguments are model-authored, but a model can echo a secret it was shown.
|
|
90650
91228
|
arguments: redact(call.arguments, knownSecrets)
|
|
@@ -90652,16 +91230,16 @@ function redactMessage(message4, knownSecrets) {
|
|
|
90652
91230
|
}
|
|
90653
91231
|
return redacted;
|
|
90654
91232
|
}
|
|
90655
|
-
if (
|
|
90656
|
-
return { role: "tool", toolCallId:
|
|
91233
|
+
if (message5.role === "tool") {
|
|
91234
|
+
return { role: "tool", toolCallId: message5.toolCallId, content: redact(message5.content, knownSecrets) };
|
|
90657
91235
|
}
|
|
90658
|
-
return { role:
|
|
91236
|
+
return { role: message5.role, content: redact(message5.content, knownSecrets) };
|
|
90659
91237
|
}
|
|
90660
91238
|
function redactTask(task, knownSecrets) {
|
|
90661
91239
|
return {
|
|
90662
91240
|
...task,
|
|
90663
91241
|
title: redact(task.title, knownSecrets),
|
|
90664
|
-
messages: task.messages.map((
|
|
91242
|
+
messages: task.messages.map((message5) => redactMessage(message5, knownSecrets))
|
|
90665
91243
|
};
|
|
90666
91244
|
}
|
|
90667
91245
|
|
|
@@ -90872,8 +91450,8 @@ var LspClient = class {
|
|
|
90872
91450
|
});
|
|
90873
91451
|
this.notify("initialized", {});
|
|
90874
91452
|
}
|
|
90875
|
-
send(
|
|
90876
|
-
const body = Buffer.from(JSON.stringify({ jsonrpc: "2.0", ...
|
|
91453
|
+
send(message5) {
|
|
91454
|
+
const body = Buffer.from(JSON.stringify({ jsonrpc: "2.0", ...message5 }), "utf8");
|
|
90877
91455
|
this.child.stdin?.write(Buffer.concat([Buffer.from(`Content-Length: ${String(body.length)}\r
|
|
90878
91456
|
\r
|
|
90879
91457
|
`, "ascii"), body]));
|
|
@@ -90910,28 +91488,28 @@ var LspClient = class {
|
|
|
90910
91488
|
}
|
|
90911
91489
|
}
|
|
90912
91490
|
}
|
|
90913
|
-
onMessage(
|
|
90914
|
-
if (typeof
|
|
90915
|
-
const waiting = this.pending.get(
|
|
90916
|
-
this.pending.delete(
|
|
90917
|
-
const error51 =
|
|
91491
|
+
onMessage(message5) {
|
|
91492
|
+
if (typeof message5.id === "number" && ("result" in message5 || "error" in message5) && message5.method === void 0) {
|
|
91493
|
+
const waiting = this.pending.get(message5.id);
|
|
91494
|
+
this.pending.delete(message5.id);
|
|
91495
|
+
const error51 = message5.error;
|
|
90918
91496
|
if (error51 !== void 0)
|
|
90919
91497
|
waiting?.reject(new Error(error51.message ?? "Language server error"));
|
|
90920
91498
|
else
|
|
90921
|
-
waiting?.resolve(
|
|
91499
|
+
waiting?.resolve(message5.result);
|
|
90922
91500
|
return;
|
|
90923
91501
|
}
|
|
90924
|
-
const method =
|
|
91502
|
+
const method = message5.method;
|
|
90925
91503
|
if (method === void 0)
|
|
90926
91504
|
return;
|
|
90927
|
-
if (
|
|
90928
|
-
const params3 =
|
|
91505
|
+
if (message5.id !== void 0) {
|
|
91506
|
+
const params3 = message5.params;
|
|
90929
91507
|
const result = method === "workspace/configuration" ? (params3?.items ?? []).map(() => null) : method === "workspace/workspaceFolders" ? [{ uri: (0, import_node_url.pathToFileURL)(this.root).href, name: "workspace" }] : null;
|
|
90930
|
-
this.send({ id:
|
|
91508
|
+
this.send({ id: message5.id, result });
|
|
90931
91509
|
return;
|
|
90932
91510
|
}
|
|
90933
91511
|
if (method === "textDocument/publishDiagnostics") {
|
|
90934
|
-
const params3 =
|
|
91512
|
+
const params3 = message5.params;
|
|
90935
91513
|
const key2 = keyFor(params3.uri);
|
|
90936
91514
|
this.diagnostics.set(key2, params3.diagnostics.map((d) => ({
|
|
90937
91515
|
line: d.range.start.line + 1,
|
|
@@ -93434,6 +94012,82 @@ folders are copied here and searched with the fast tools; editing stays in the h
|
|
|
93434
94012
|
|
|
93435
94013
|
**Not done for you**: a file deleted here is not deleted on the hub (\`hub_sync\` "status" lists it);
|
|
93436
94014
|
edits made outside the agent (in VS Code, say) are saved with \`hub_sync\` "push".
|
|
94015
|
+
`
|
|
94016
|
+
},
|
|
94017
|
+
{
|
|
94018
|
+
id: "monitoring",
|
|
94019
|
+
title: "Monitoring dashboard (Fire Code)",
|
|
94020
|
+
keywords: [
|
|
94021
|
+
"monitoring",
|
|
94022
|
+
"monitor",
|
|
94023
|
+
"monitors",
|
|
94024
|
+
"dashboard",
|
|
94025
|
+
"alert",
|
|
94026
|
+
"alerts",
|
|
94027
|
+
"alerting",
|
|
94028
|
+
"tile",
|
|
94029
|
+
"tiles",
|
|
94030
|
+
"data grid",
|
|
94031
|
+
"highlight",
|
|
94032
|
+
"highlighted",
|
|
94033
|
+
"traffic light",
|
|
94034
|
+
"red amber green",
|
|
94035
|
+
"watch",
|
|
94036
|
+
"check every",
|
|
94037
|
+
"notification level",
|
|
94038
|
+
"alarm",
|
|
94039
|
+
"snooze",
|
|
94040
|
+
"acknowledge",
|
|
94041
|
+
"team alerts",
|
|
94042
|
+
"personal alerts",
|
|
94043
|
+
"monitor_create",
|
|
94044
|
+
"quiet hours"
|
|
94045
|
+
],
|
|
94046
|
+
body: `
|
|
94047
|
+
**Fire Code only.** Settings \u2192 Monitoring switches it on; a Monitoring button then appears at the top of the
|
|
94048
|
+
sidebar (Ctrl+M), showing the worst colour and how many monitors are alerting. Chats that were idle restart
|
|
94049
|
+
so their agents get the monitoring tools.
|
|
94050
|
+
|
|
94051
|
+
**The dashboard** fills the window: one glowing tile per monitor, under **Team alerts** and **Personal**, with
|
|
94052
|
+
a search box and a chip per colour - **red** failure, **amber** warning, **purple** no fresh data (the check
|
|
94053
|
+
failed or is late), **blue** information, **green** all clear, **grey** paused, not run yet, or waiting for
|
|
94054
|
+
your review. Hover a tile for what it watches and when it last checked; right-click it to check now, pause,
|
|
94055
|
+
snooze or change how it notifies. **Click it for its grid**, in a window of its own: rows and cells coloured
|
|
94056
|
+
by its alert rules, a filter on every column (text, or \`>10\`, \`<5\`, \`=x\`), sort by a header, the alerts
|
|
94057
|
+
as chips above. **Double-click a row** for every field and, when the monitor names one, a breakdown fetched
|
|
94058
|
+
for that row. **Acknowledge** an alert and it stops counting until it gets worse.
|
|
94059
|
+
|
|
94060
|
+
**A monitor is a skill** with a \`monitor\` block - what to read, how often (\`every\`, \`activeHours\`,
|
|
94061
|
+
\`days\`), the columns and the alert rules - so it travels like any skill: a **personal** one stays in your
|
|
94062
|
+
personal skills; a **team** one goes where the team shares skills (the codebase, a bucket, the team
|
|
94063
|
+
repository), and each person's Fire Code runs it with their own credentials. Ask an agent: "monitor the
|
|
94064
|
+
PAY_* jobs every 15 minutes, red when one fails". It reuses a tool that returns the data or writes a Python
|
|
94065
|
+
tool, and creates the monitor with \`monitor_create\`; you approve the file, which approves it here. A
|
|
94066
|
+
colleague's monitor shows grey **Review** until you approve exactly what it runs.
|
|
94067
|
+
|
|
94068
|
+
**Tools written for monitoring** return a list of records - one per job, host or feed, the same fields in each,
|
|
94069
|
+
numbers as numbers, times as ISO timestamps, a field naming the row - return an empty list when there is
|
|
94070
|
+
nothing to report, and fail loudly when the data cannot be read (the tile then turns purple rather than
|
|
94071
|
+
falsely green). The agent tries a tool with \`monitor_create\` \`tryOnly\` first: it shows the columns, rows and
|
|
94072
|
+
alerts Fire Code would see, saving nothing. A tool that answers in sentences is read one line per row, and the
|
|
94073
|
+
result says how to change it.
|
|
94074
|
+
|
|
94075
|
+
**Checks need no model.** Fire Code (Rust) runs them on schedule and judges the rows itself. SQLite and
|
|
94076
|
+
CSV/Excel/JSON files are read by Fire Code; a Python, MCP or read tool runs in a background agent with the
|
|
94077
|
+
settings of the codebase chosen under Settings \u2192 Monitoring. A monitor may never run a tool that changes
|
|
94078
|
+
things.
|
|
94079
|
+
|
|
94080
|
+
**Notifications at your level**, per colour (Settings \u2192 Monitoring): Off, Count (only on the button and
|
|
94081
|
+
title bar), Silent, Sound, Stays (on screen until dismissed) or Alarm (loops until dismissed); a reminder
|
|
94082
|
+
while it stays red or amber, a quiet word when it clears, and quiet hours when only failures get through.
|
|
94083
|
+
Each monitor can override it (right-click \u2192 How this one notifies), and its own \`notify\` sets the least
|
|
94084
|
+
severe level that notifies. Notifications have Open, Acknowledge and Snooze buttons.
|
|
94085
|
+
|
|
94086
|
+
**Agents can**: \`monitor_check_tool\` (run a tool once and check its answer strictly: PASS or FAIL with what
|
|
94087
|
+
to change, and the columns and key for the monitor - an agent writing a Python tool for a monitor works until
|
|
94088
|
+
it passes), \`monitor_status\` (every monitor, or one monitor's alerts and rows), \`monitor_show\` (check
|
|
94089
|
+
now, open a grid or the dashboard), \`monitor_control\` (pause, snooze, acknowledge, notification level -
|
|
94090
|
+
always asks you).
|
|
93437
94091
|
`
|
|
93438
94092
|
},
|
|
93439
94093
|
{
|
|
@@ -95368,10 +96022,10 @@ var searchSchema5 = external_exports.object({
|
|
|
95368
96022
|
limit: external_exports.number().int().min(1).max(50).optional().describe("How many to return. Default 15.")
|
|
95369
96023
|
});
|
|
95370
96024
|
function describe4(record2, dataset) {
|
|
95371
|
-
const
|
|
96025
|
+
const when4 = record2.timestamp === void 0 ? "" : `${new Date(record2.timestamp).toLocaleString()} `;
|
|
95372
96026
|
const heading = record2.title ?? record2.text.trim().split("\n")[0]?.slice(0, 100) ?? record2.id;
|
|
95373
96027
|
const body = record2.text.trim().slice(0, 400);
|
|
95374
|
-
return `${
|
|
96028
|
+
return `${when4}[${dataset}] ${heading}
|
|
95375
96029
|
id: ${record2.id}${record2.url === void 0 ? "" : ` ${record2.url}`}
|
|
95376
96030
|
${body}`;
|
|
95377
96031
|
}
|
|
@@ -95795,11 +96449,11 @@ var S3Client = class {
|
|
|
95795
96449
|
};
|
|
95796
96450
|
function describeFailure(status2, body, key2) {
|
|
95797
96451
|
const code = matchTag(body, "Code");
|
|
95798
|
-
const
|
|
96452
|
+
const message5 = matchTag(body, "Message");
|
|
95799
96453
|
const what = key2 === void 0 ? "" : ` for "${key2}"`;
|
|
95800
96454
|
if (code === void 0)
|
|
95801
96455
|
return `S3 request failed${what} with status ${String(status2)}.`;
|
|
95802
|
-
return `S3 ${code}${what}: ${
|
|
96456
|
+
return `S3 ${code}${what}: ${message5 ?? `status ${String(status2)}`}`;
|
|
95803
96457
|
}
|
|
95804
96458
|
function matchTag(xml, tag) {
|
|
95805
96459
|
const match = new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`).exec(xml);
|
|
@@ -96330,6 +96984,10 @@ var SingleUserIdentity = class _SingleUserIdentity {
|
|
|
96330
96984
|
this.principal = principal ?? _SingleUserIdentity.PRINCIPAL;
|
|
96331
96985
|
this.describe = principal === void 0 ? "single user (local)" : `single user \u2014 ${principal.id}`;
|
|
96332
96986
|
}
|
|
96987
|
+
/** The one person this server is for: whose session Fire Code's monitoring executor opens at start. */
|
|
96988
|
+
get localPrincipal() {
|
|
96989
|
+
return this.principal;
|
|
96990
|
+
}
|
|
96333
96991
|
get launchToken() {
|
|
96334
96992
|
if (this.handoffToken === void 0) throw new Error("handoff token already consumed");
|
|
96335
96993
|
return this.handoffToken;
|
|
@@ -97406,8 +98064,8 @@ var FileWorkspaceState = class {
|
|
|
97406
98064
|
};
|
|
97407
98065
|
function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
97408
98066
|
return {
|
|
97409
|
-
showInfo: (
|
|
97410
|
-
showWarning: (
|
|
98067
|
+
showInfo: (message5) => post(`[info] ${message5}`),
|
|
98068
|
+
showWarning: (message5) => post(`[warn] ${message5}`),
|
|
97411
98069
|
showOpenDialog: async () => void 0,
|
|
97412
98070
|
showSaveDialog: async () => void 0,
|
|
97413
98071
|
/*
|
|
@@ -97415,8 +98073,8 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
97415
98073
|
* and `HostUi`'s contract is that no method may be load-bearing (§19) — so resolving false
|
|
97416
98074
|
* is the honest answer rather than a reason to block the feature here.
|
|
97417
98075
|
*/
|
|
97418
|
-
showActionMessage: async (
|
|
97419
|
-
post(`[${
|
|
98076
|
+
showActionMessage: async (message5, _action, level2) => {
|
|
98077
|
+
post(`[${level2}] ${message5}`);
|
|
97420
98078
|
return false;
|
|
97421
98079
|
},
|
|
97422
98080
|
// Nothing to reveal: the browser UI is whatever tab the user already has open.
|
|
@@ -97477,8 +98135,8 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
97477
98135
|
const needle = segment.toLowerCase();
|
|
97478
98136
|
const skip = new Set(excludeFolders);
|
|
97479
98137
|
const found2 = [];
|
|
97480
|
-
const walk = async (dir,
|
|
97481
|
-
if (found2.length >= limit ||
|
|
98138
|
+
const walk = async (dir, level2) => {
|
|
98139
|
+
if (found2.length >= limit || level2 > 12 || depth !== void 0 && level2 > depth) return;
|
|
97482
98140
|
let entries;
|
|
97483
98141
|
try {
|
|
97484
98142
|
entries = await import_promises35.default.readdir(dir, { withFileTypes: true });
|
|
@@ -97490,8 +98148,8 @@ function createBrowserUi(workspaceRoot, post, fastFs) {
|
|
|
97490
98148
|
if (entry.name.startsWith(".") && entry.name !== ".env") continue;
|
|
97491
98149
|
const full = import_node_path62.default.join(dir, entry.name);
|
|
97492
98150
|
if (entry.isDirectory()) {
|
|
97493
|
-
if (!skip.has(entry.name)) await walk(full,
|
|
97494
|
-
} else if (depth !== void 0 &&
|
|
98151
|
+
if (!skip.has(entry.name)) await walk(full, level2 + 1);
|
|
98152
|
+
} else if (depth !== void 0 && level2 !== depth) {
|
|
97495
98153
|
continue;
|
|
97496
98154
|
} else if (needle.length === 0 || (mode === "prefix" ? entry.name.toLowerCase().startsWith(needle) : entry.name.toLowerCase().includes(needle))) {
|
|
97497
98155
|
found2.push(full);
|
|
@@ -97588,6 +98246,10 @@ async function createSession(options) {
|
|
|
97588
98246
|
*/
|
|
97589
98247
|
...options.shared !== true ? { readDebugSession: createRelayDebugReader() } : {},
|
|
97590
98248
|
...options.sharedWorkspace === true ? { sharedWorkspace: true } : {},
|
|
98249
|
+
// Fire Code's monitoring - one person's own machine only, like the rest of what Fire Code passes.
|
|
98250
|
+
...options.monitoring !== void 0 && options.shared !== true ? { monitoring: options.monitoring } : {},
|
|
98251
|
+
...options.monitorExecutor !== void 0 && options.shared !== true ? { monitorExecutor: options.monitorExecutor } : {},
|
|
98252
|
+
...options.extraToolDirs !== void 0 && options.extraToolDirs.length > 0 ? { extraToolDirs: options.extraToolDirs } : {},
|
|
97591
98253
|
...options.noSchedules === true ? { runsSchedules: false } : {},
|
|
97592
98254
|
...options.siblings !== void 0 && options.siblings.length > 0 ? { siblings: options.siblings } : {},
|
|
97593
98255
|
...options.changeLedger !== void 0 ? { changeLedger: options.changeLedger } : {},
|
|
@@ -97785,7 +98447,7 @@ async function startServer(options) {
|
|
|
97785
98447
|
// Server-sent events framing. `\n\n` terminates an event, so a newline inside the
|
|
97786
98448
|
// payload would split it — JSON.stringify already guarantees none, but the data line is
|
|
97787
98449
|
// written explicitly rather than relying on that.
|
|
97788
|
-
post: (
|
|
98450
|
+
post: (message5) => write(`data: ${JSON.stringify(message5)}
|
|
97789
98451
|
|
|
97790
98452
|
`),
|
|
97791
98453
|
onMessage: (listener) => {
|
|
@@ -97801,8 +98463,8 @@ async function startServer(options) {
|
|
|
97801
98463
|
* one handed to anything in between is how a route ends up calling something undefined.
|
|
97802
98464
|
*/
|
|
97803
98465
|
resync: () => void 0,
|
|
97804
|
-
deliver: (
|
|
97805
|
-
for (const listener of listeners) listener(
|
|
98466
|
+
deliver: (message5) => {
|
|
98467
|
+
for (const listener of listeners) listener(message5);
|
|
97806
98468
|
},
|
|
97807
98469
|
attach: (response) => {
|
|
97808
98470
|
sink = response;
|
|
@@ -97849,6 +98511,9 @@ async function startServer(options) {
|
|
|
97849
98511
|
...options.configFile !== void 0 ? { configFile: options.configFile } : {},
|
|
97850
98512
|
...options.secretsFile !== void 0 ? { secretsFile: options.secretsFile } : {},
|
|
97851
98513
|
...options.desktopNotify === true ? { desktopNotify: true } : {},
|
|
98514
|
+
...options.monitoring !== void 0 ? { monitoring: options.monitoring } : {},
|
|
98515
|
+
...options.monitorExecutor !== void 0 ? { monitorExecutor: options.monitorExecutor } : {},
|
|
98516
|
+
...options.extraToolDirs !== void 0 ? { extraToolDirs: options.extraToolDirs } : {},
|
|
97852
98517
|
...options.secretsKey !== void 0 ? { secretsKey: options.secretsKey } : {},
|
|
97853
98518
|
...options.reachAnywhere === true ? { reachAnywhere: true } : {},
|
|
97854
98519
|
...options.sharedWorkspace === true ? { sharedWorkspace: true } : {},
|
|
@@ -98285,6 +98950,9 @@ async function startServer(options) {
|
|
|
98285
98950
|
const address = server.address();
|
|
98286
98951
|
if (address === null || typeof address === "string")
|
|
98287
98952
|
throw new Error("Server did not bind a port.");
|
|
98953
|
+
if (options.eagerSession === true && identity instanceof SingleUserIdentity && !connections.has(identity.localPrincipal.id)) {
|
|
98954
|
+
connections.set(identity.localPrincipal.id, await openConnection(identity.localPrincipal));
|
|
98955
|
+
}
|
|
98288
98956
|
const authority = `${bindAddress}:${address.port}`;
|
|
98289
98957
|
const allowedHosts = reachableHosts(bindAddress, address.port, options.allowHosts ?? []);
|
|
98290
98958
|
policy = {
|