@byteplus-iga-pages/agent 1.0.3 → 1.0.5

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/cjs/419.js CHANGED
@@ -40,7 +40,7 @@ exports.modules = {
40
40
  if (error instanceof src_error.ES) return {
41
41
  tool,
42
42
  ...error.toJSON(),
43
- message: sanitizeMessage(error.message)
43
+ message: redactText(error.message)
44
44
  };
45
45
  if ((0, src_error.zf)(error)) return {
46
46
  tool,
@@ -214,8 +214,8 @@ exports.modules = {
214
214
  file: types.Yj(),
215
215
  line_number: types.ai(),
216
216
  line_content: types.Yj(),
217
- context_before: types.YO(types.Yj()).optional(),
218
- context_after: types.YO(types.Yj()).optional()
217
+ context_before: types.YO(types.Yj()).nullish(),
218
+ context_after: types.YO(types.Yj()).nullish()
219
219
  });
220
220
  const filesSearchSchema = types.Ik({
221
221
  path: types.Yj(),
@@ -335,10 +335,10 @@ exports.modules = {
335
335
  file: match.file,
336
336
  lineNumber: match.line_number,
337
337
  lineContent: match.line_content,
338
- ...void 0 !== match.context_before ? {
338
+ ...null != match.context_before ? {
339
339
  contextBefore: match.context_before
340
340
  } : {},
341
- ...void 0 !== match.context_after ? {
341
+ ...null != match.context_after ? {
342
342
  contextAfter: match.context_after
343
343
  } : {}
344
344
  }))
@@ -505,7 +505,7 @@ exports.modules = {
505
505
  }).strict(),
506
506
  execute: async (input, options)=>mapData(await sandbox.file.readFile({
507
507
  file: input.path,
508
- start_line: input.startLine,
508
+ start_line: void 0 === input.startLine ? void 0 : input.startLine - 1,
509
509
  end_line: input.endLine
510
510
  }, requestOptions(options)), "sandbox.file.readFile", mapFilesReadOutput)
511
511
  },
package/dist/cjs/647.js CHANGED
@@ -211,9 +211,14 @@ exports.modules = {
211
211
  function controlPlaneMessage(body, token) {
212
212
  const record = body && "object" == typeof body ? body : void 0;
213
213
  const value = "string" == typeof record?.message && record.message.trim() ? record.message : "string" == typeof record?.error && record.error.trim() ? record.error : "The sandbox request could not be completed.";
214
- let message = token ? value.split(token).join("[redacted]") : value;
215
- message = message.replace(/\bBearer\s+[A-Za-z0-9._~+\/-]+=*/gi, "Bearer [redacted]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[redacted]").replace(/([?&](?:access[_-]?token|api[_-]?key|key|token|signature|credential|auth|password|secret)\s*=)[^&#\s]*/gi, "$1[redacted]").replace(/([a-z][a-z0-9+.-]*:\/\/)[^@\s/]+@/gi, "$1[redacted]@").replace(/\b(token|authorization|password|secret|api[_-]?key|credential|signature)\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1=[redacted]");
216
- return message;
214
+ const sanitize = (text)=>{
215
+ let message = token ? text.split(token).join("[redacted]") : text;
216
+ message = message.replace(/\bBearer\s+[A-Za-z0-9._~+\/-]+=*/gi, "Bearer [redacted]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[redacted]").replace(/([?&](?:access[_-]?token|api[_-]?key|key|token|signature|credential|auth|password|secret)\s*=)[^&#\s]*/gi, "$1[redacted]").replace(/([a-z][a-z0-9+.-]*:\/\/)[^@\s/]+@/gi, "$1[redacted]@").replace(/\b(token|authorization|password|secret|api[_-]?key|credential|signature)\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1=[redacted]");
217
+ return message;
218
+ };
219
+ const logId = "string" == typeof record?.log_id && record.log_id.trim() ? sanitize(record.log_id).replace(/[\r\n]/g, " ").slice(0, 256) : void 0;
220
+ const suffix = logId ? ` (log_id: ${logId})` : "";
221
+ return sanitize(value).slice(0, 2048 - suffix.length) + suffix;
217
222
  }
218
223
  function sandboxNotFoundError() {
219
224
  return new _error_js__rspack_import_3.YA("The sandbox was not found.");
package/dist/esm/392.js CHANGED
@@ -3640,7 +3640,7 @@ function normalizeError(tool, error) {
3640
3640
  if (error instanceof SandboxError) return {
3641
3641
  tool,
3642
3642
  ...error.toJSON(),
3643
- message: sanitizeMessage(error.message)
3643
+ message: redactText(error.message)
3644
3644
  };
3645
3645
  if (isAbortError(error)) return {
3646
3646
  tool,
@@ -3814,8 +3814,8 @@ const fileSearchMatchSchema = objectType({
3814
3814
  file: stringType(),
3815
3815
  line_number: numberType(),
3816
3816
  line_content: stringType(),
3817
- context_before: arrayType(stringType()).optional(),
3818
- context_after: arrayType(stringType()).optional()
3817
+ context_before: arrayType(stringType()).nullish(),
3818
+ context_after: arrayType(stringType()).nullish()
3819
3819
  });
3820
3820
  const filesSearchSchema = objectType({
3821
3821
  path: stringType(),
@@ -3935,10 +3935,10 @@ function mapFilesSearchOutput(value) {
3935
3935
  file: match.file,
3936
3936
  lineNumber: match.line_number,
3937
3937
  lineContent: match.line_content,
3938
- ...void 0 !== match.context_before ? {
3938
+ ...null != match.context_before ? {
3939
3939
  contextBefore: match.context_before
3940
3940
  } : {},
3941
- ...void 0 !== match.context_after ? {
3941
+ ...null != match.context_after ? {
3942
3942
  contextAfter: match.context_after
3943
3943
  } : {}
3944
3944
  }))
@@ -4105,7 +4105,7 @@ function createSandboxTools(sandbox) {
4105
4105
  }).strict(),
4106
4106
  execute: async (input, options)=>mapData(await sandbox.file.readFile({
4107
4107
  file: input.path,
4108
- start_line: input.startLine,
4108
+ start_line: void 0 === input.startLine ? void 0 : input.startLine - 1,
4109
4109
  end_line: input.endLine
4110
4110
  }, requestOptions(options)), "sandbox.file.readFile", mapFilesReadOutput)
4111
4111
  },
package/dist/esm/613.js CHANGED
@@ -18076,9 +18076,14 @@ function controlPlaneHttpError(input) {
18076
18076
  function controlPlaneMessage(body, token) {
18077
18077
  const record = body && "object" == typeof body ? body : void 0;
18078
18078
  const value = "string" == typeof record?.message && record.message.trim() ? record.message : "string" == typeof record?.error && record.error.trim() ? record.error : "The sandbox request could not be completed.";
18079
- let message = token ? value.split(token).join("[redacted]") : value;
18080
- message = message.replace(/\bBearer\s+[A-Za-z0-9._~+\/-]+=*/gi, "Bearer [redacted]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[redacted]").replace(/([?&](?:access[_-]?token|api[_-]?key|key|token|signature|credential|auth|password|secret)\s*=)[^&#\s]*/gi, "$1[redacted]").replace(/([a-z][a-z0-9+.-]*:\/\/)[^@\s/]+@/gi, "$1[redacted]@").replace(/\b(token|authorization|password|secret|api[_-]?key|credential|signature)\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1=[redacted]");
18081
- return message;
18079
+ const sanitize = (text)=>{
18080
+ let message = token ? text.split(token).join("[redacted]") : text;
18081
+ message = message.replace(/\bBearer\s+[A-Za-z0-9._~+\/-]+=*/gi, "Bearer [redacted]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g, "[redacted]").replace(/([?&](?:access[_-]?token|api[_-]?key|key|token|signature|credential|auth|password|secret)\s*=)[^&#\s]*/gi, "$1[redacted]").replace(/([a-z][a-z0-9+.-]*:\/\/)[^@\s/]+@/gi, "$1[redacted]@").replace(/\b(token|authorization|password|secret|api[_-]?key|credential|signature)\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1=[redacted]");
18082
+ return message;
18083
+ };
18084
+ const logId = "string" == typeof record?.log_id && record.log_id.trim() ? sanitize(record.log_id).replace(/[\r\n]/g, " ").slice(0, 256) : void 0;
18085
+ const suffix = logId ? ` (log_id: ${logId})` : "";
18086
+ return sanitize(value).slice(0, 2048 - suffix.length) + suffix;
18082
18087
  }
18083
18088
  function sandboxNotFoundError() {
18084
18089
  return new SandboxInstanceGoneError("The sandbox was not found.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteplus-iga-pages/agent",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Server-only Agent SDK for BytePlus IGA Pages",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "sideEffects": false,