@codelia/runtime 0.1.61 → 0.1.62

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/index.cjs CHANGED
@@ -882,7 +882,9 @@ var normalizeExecutionEnvironmentConfig = (value) => {
882
882
  ...configuredCommands
883
883
  ];
884
884
  const commands = Array.from(
885
- new Map(baseCommands.map((command) => [command.join("\0"), command])).values()
885
+ new Map(
886
+ baseCommands.map((command) => [command.join("\0"), command])
887
+ ).values()
886
888
  );
887
889
  return {
888
890
  startupChecks: {
@@ -2019,7 +2021,7 @@ var describeExecutionEnvironmentHost = () => {
2019
2021
  };
2020
2022
  };
2021
2023
  var probeExecutionEnvironmentCommand = (command, timeoutMs, workingDir, probeOptions = {}) => {
2022
- if (command.length === 0 || command[0].trim().length === 0) {
2024
+ if (command.length === 0 || command[0]?.trim().length === 0) {
2023
2025
  return Promise.resolve("invalid command");
2024
2026
  }
2025
2027
  return new Promise((resolve) => {
@@ -2051,7 +2053,9 @@ var probeExecutionEnvironmentCommand = (command, timeoutMs, workingDir, probeOpt
2051
2053
  workingDir
2052
2054
  );
2053
2055
  } catch (error) {
2054
- finish(`error: ${error instanceof Error ? error.message : String(error)}`);
2056
+ finish(
2057
+ `error: ${error instanceof Error ? error.message : String(error)}`
2058
+ );
2055
2059
  return;
2056
2060
  }
2057
2061
  timeoutHandle = setTimeout(() => {
@@ -2122,9 +2126,7 @@ var formatExecutionEnvironmentContext = (options) => {
2122
2126
  if (options.startupChecks && options.startupChecks.length > 0) {
2123
2127
  lines.push("", "startup checks:");
2124
2128
  for (const check of options.startupChecks) {
2125
- lines.push(
2126
- `- ${formatCommandLabel(check.command)} => ${check.summary}`
2127
- );
2129
+ lines.push(`- ${formatCommandLabel(check.command)} => ${check.summary}`);
2128
2130
  }
2129
2131
  }
2130
2132
  lines.push("</execution_environment>");
@@ -6169,7 +6171,9 @@ var createReadLineTool = (sandboxKey) => (0, import_core9.defineTool)({
6169
6171
  ),
6170
6172
  line_number: import_zod8.z.number().int().positive().describe("1-based line number to read."),
6171
6173
  char_offset: import_zod8.z.number().int().nonnegative().optional().describe("0-based grapheme offset in the target line. Default 0."),
6172
- char_limit: import_zod8.z.number().int().positive().max(MAX_CHAR_LIMIT).optional().describe(`Max graphemes to return. Default 10000, Max ${MAX_CHAR_LIMIT}.`)
6174
+ char_limit: import_zod8.z.number().int().positive().max(MAX_CHAR_LIMIT).optional().describe(
6175
+ `Max graphemes to return. Default 10000, Max ${MAX_CHAR_LIMIT}.`
6176
+ )
6173
6177
  }),
6174
6178
  execute: async (input, ctx) => {
6175
6179
  let resolved;
@@ -7617,7 +7621,9 @@ var createSkillSearchTool = (skillsResolverKey) => (0, import_core13.defineTool)
7617
7621
  description: "Search installed local skills by name, description, or path.",
7618
7622
  input: import_zod12.z.object({
7619
7623
  query: import_zod12.z.string().min(1).describe("Search query text."),
7620
- limit: import_zod12.z.number().int().positive().optional().describe("Optional max result count. Higher values may be clamped by config."),
7624
+ limit: import_zod12.z.number().int().positive().optional().describe(
7625
+ "Optional max result count. Higher values may be clamped by config."
7626
+ ),
7621
7627
  scope: import_zod12.z.enum(["repo", "user"]).optional().describe("Optional scope filter.")
7622
7628
  }),
7623
7629
  execute: async (input, ctx) => {
@@ -8079,7 +8085,9 @@ var createViewImageTool = (sandboxKey) => (0, import_core17.defineTool)({
8079
8085
  file_path: import_zod16.z.string().describe(
8080
8086
  "Single local png/jpeg/webp/gif image path. Sandbox-bounded unless full-access mode is active."
8081
8087
  ),
8082
- detail: import_zod16.z.enum(["auto", "low", "high"]).optional().describe("Model image-detail hint (`auto`/`low`/`high`). Default auto."),
8088
+ detail: import_zod16.z.enum(["auto", "low", "high"]).optional().describe(
8089
+ "Model image-detail hint (`auto`/`low`/`high`). Default auto."
8090
+ ),
8083
8091
  max_bytes: import_zod16.z.number().int().positive().max(MAX_MAX_BYTES).optional().describe("Max file size in bytes. Default 5242880, Max 10485760.")
8084
8092
  }),
8085
8093
  execute: async (input, ctx) => {
@@ -8390,8 +8398,12 @@ var createWebfetchTool = () => (0, import_core18.defineTool)({
8390
8398
  input: import_zod17.z.object({
8391
8399
  url: import_zod17.z.string().min(1).describe("HTTP(S) URL to fetch."),
8392
8400
  output_format: import_zod17.z.enum(["markdown", "text", "html"]).optional().describe("Normalized output format. Default markdown."),
8393
- timeout_ms: import_zod17.z.number().int().positive().max(MAX_TIMEOUT_MS).optional().describe(`Fetch timeout in ms. Default ${DEFAULT_TIMEOUT_MS3}, Max ${MAX_TIMEOUT_MS}.`),
8394
- max_bytes: import_zod17.z.number().int().positive().max(MAX_MAX_BYTES2).optional().describe(`Max response bytes to keep. Default ${DEFAULT_MAX_BYTES3}, Max ${MAX_MAX_BYTES2}.`)
8401
+ timeout_ms: import_zod17.z.number().int().positive().max(MAX_TIMEOUT_MS).optional().describe(
8402
+ `Fetch timeout in ms. Default ${DEFAULT_TIMEOUT_MS3}, Max ${MAX_TIMEOUT_MS}.`
8403
+ ),
8404
+ max_bytes: import_zod17.z.number().int().positive().max(MAX_MAX_BYTES2).optional().describe(
8405
+ `Max response bytes to keep. Default ${DEFAULT_MAX_BYTES3}, Max ${MAX_MAX_BYTES2}.`
8406
+ )
8395
8407
  }),
8396
8408
  execute: async (input) => {
8397
8409
  let url;
@@ -8406,6 +8418,7 @@ var createWebfetchTool = () => (0, import_core18.defineTool)({
8406
8418
  const timeoutMs = input.timeout_ms ?? DEFAULT_TIMEOUT_MS3;
8407
8419
  const maxBytes = input.max_bytes ?? DEFAULT_MAX_BYTES3;
8408
8420
  const outputFormat = input.output_format ?? "markdown";
8421
+ const startedAt = Date.now();
8409
8422
  const controller = new AbortController();
8410
8423
  const timeout = setTimeout(() => controller.abort(), timeoutMs);
8411
8424
  try {
@@ -8435,6 +8448,7 @@ var createWebfetchTool = () => (0, import_core18.defineTool)({
8435
8448
  } else {
8436
8449
  content = normalizeWhitespace(rawText);
8437
8450
  }
8451
+ const durationMs = Math.max(0, Date.now() - startedAt);
8438
8452
  return {
8439
8453
  url: input.url,
8440
8454
  final_url: response.url || input.url,
@@ -8445,7 +8459,8 @@ var createWebfetchTool = () => (0, import_core18.defineTool)({
8445
8459
  title: isHtml ? extractTitle(rawText) ?? null : null,
8446
8460
  content,
8447
8461
  truncated: body.truncated,
8448
- byte_size: body.byteSize
8462
+ byte_size: body.byteSize,
8463
+ duration_ms: durationMs
8449
8464
  };
8450
8465
  } catch (error) {
8451
8466
  const classified = classifyFetchError(error, timeoutMs);
package/dist/index.js CHANGED
@@ -878,7 +878,9 @@ var normalizeExecutionEnvironmentConfig = (value) => {
878
878
  ...configuredCommands
879
879
  ];
880
880
  const commands = Array.from(
881
- new Map(baseCommands.map((command) => [command.join("\0"), command])).values()
881
+ new Map(
882
+ baseCommands.map((command) => [command.join("\0"), command])
883
+ ).values()
882
884
  );
883
885
  return {
884
886
  startupChecks: {
@@ -2015,7 +2017,7 @@ var describeExecutionEnvironmentHost = () => {
2015
2017
  };
2016
2018
  };
2017
2019
  var probeExecutionEnvironmentCommand = (command, timeoutMs, workingDir, probeOptions = {}) => {
2018
- if (command.length === 0 || command[0].trim().length === 0) {
2020
+ if (command.length === 0 || command[0]?.trim().length === 0) {
2019
2021
  return Promise.resolve("invalid command");
2020
2022
  }
2021
2023
  return new Promise((resolve) => {
@@ -2047,7 +2049,9 @@ var probeExecutionEnvironmentCommand = (command, timeoutMs, workingDir, probeOpt
2047
2049
  workingDir
2048
2050
  );
2049
2051
  } catch (error) {
2050
- finish(`error: ${error instanceof Error ? error.message : String(error)}`);
2052
+ finish(
2053
+ `error: ${error instanceof Error ? error.message : String(error)}`
2054
+ );
2051
2055
  return;
2052
2056
  }
2053
2057
  timeoutHandle = setTimeout(() => {
@@ -2118,9 +2122,7 @@ var formatExecutionEnvironmentContext = (options) => {
2118
2122
  if (options.startupChecks && options.startupChecks.length > 0) {
2119
2123
  lines.push("", "startup checks:");
2120
2124
  for (const check of options.startupChecks) {
2121
- lines.push(
2122
- `- ${formatCommandLabel(check.command)} => ${check.summary}`
2123
- );
2125
+ lines.push(`- ${formatCommandLabel(check.command)} => ${check.summary}`);
2124
2126
  }
2125
2127
  }
2126
2128
  lines.push("</execution_environment>");
@@ -6171,7 +6173,9 @@ var createReadLineTool = (sandboxKey) => defineTool7({
6171
6173
  ),
6172
6174
  line_number: z8.number().int().positive().describe("1-based line number to read."),
6173
6175
  char_offset: z8.number().int().nonnegative().optional().describe("0-based grapheme offset in the target line. Default 0."),
6174
- char_limit: z8.number().int().positive().max(MAX_CHAR_LIMIT).optional().describe(`Max graphemes to return. Default 10000, Max ${MAX_CHAR_LIMIT}.`)
6176
+ char_limit: z8.number().int().positive().max(MAX_CHAR_LIMIT).optional().describe(
6177
+ `Max graphemes to return. Default 10000, Max ${MAX_CHAR_LIMIT}.`
6178
+ )
6175
6179
  }),
6176
6180
  execute: async (input, ctx) => {
6177
6181
  let resolved;
@@ -7621,7 +7625,9 @@ var createSkillSearchTool = (skillsResolverKey) => defineTool11({
7621
7625
  description: "Search installed local skills by name, description, or path.",
7622
7626
  input: z12.object({
7623
7627
  query: z12.string().min(1).describe("Search query text."),
7624
- limit: z12.number().int().positive().optional().describe("Optional max result count. Higher values may be clamped by config."),
7628
+ limit: z12.number().int().positive().optional().describe(
7629
+ "Optional max result count. Higher values may be clamped by config."
7630
+ ),
7625
7631
  scope: z12.enum(["repo", "user"]).optional().describe("Optional scope filter.")
7626
7632
  }),
7627
7633
  execute: async (input, ctx) => {
@@ -8083,7 +8089,9 @@ var createViewImageTool = (sandboxKey) => defineTool15({
8083
8089
  file_path: z16.string().describe(
8084
8090
  "Single local png/jpeg/webp/gif image path. Sandbox-bounded unless full-access mode is active."
8085
8091
  ),
8086
- detail: z16.enum(["auto", "low", "high"]).optional().describe("Model image-detail hint (`auto`/`low`/`high`). Default auto."),
8092
+ detail: z16.enum(["auto", "low", "high"]).optional().describe(
8093
+ "Model image-detail hint (`auto`/`low`/`high`). Default auto."
8094
+ ),
8087
8095
  max_bytes: z16.number().int().positive().max(MAX_MAX_BYTES).optional().describe("Max file size in bytes. Default 5242880, Max 10485760.")
8088
8096
  }),
8089
8097
  execute: async (input, ctx) => {
@@ -8394,8 +8402,12 @@ var createWebfetchTool = () => defineTool16({
8394
8402
  input: z17.object({
8395
8403
  url: z17.string().min(1).describe("HTTP(S) URL to fetch."),
8396
8404
  output_format: z17.enum(["markdown", "text", "html"]).optional().describe("Normalized output format. Default markdown."),
8397
- timeout_ms: z17.number().int().positive().max(MAX_TIMEOUT_MS).optional().describe(`Fetch timeout in ms. Default ${DEFAULT_TIMEOUT_MS3}, Max ${MAX_TIMEOUT_MS}.`),
8398
- max_bytes: z17.number().int().positive().max(MAX_MAX_BYTES2).optional().describe(`Max response bytes to keep. Default ${DEFAULT_MAX_BYTES3}, Max ${MAX_MAX_BYTES2}.`)
8405
+ timeout_ms: z17.number().int().positive().max(MAX_TIMEOUT_MS).optional().describe(
8406
+ `Fetch timeout in ms. Default ${DEFAULT_TIMEOUT_MS3}, Max ${MAX_TIMEOUT_MS}.`
8407
+ ),
8408
+ max_bytes: z17.number().int().positive().max(MAX_MAX_BYTES2).optional().describe(
8409
+ `Max response bytes to keep. Default ${DEFAULT_MAX_BYTES3}, Max ${MAX_MAX_BYTES2}.`
8410
+ )
8399
8411
  }),
8400
8412
  execute: async (input) => {
8401
8413
  let url;
@@ -8410,6 +8422,7 @@ var createWebfetchTool = () => defineTool16({
8410
8422
  const timeoutMs = input.timeout_ms ?? DEFAULT_TIMEOUT_MS3;
8411
8423
  const maxBytes = input.max_bytes ?? DEFAULT_MAX_BYTES3;
8412
8424
  const outputFormat = input.output_format ?? "markdown";
8425
+ const startedAt = Date.now();
8413
8426
  const controller = new AbortController();
8414
8427
  const timeout = setTimeout(() => controller.abort(), timeoutMs);
8415
8428
  try {
@@ -8439,6 +8452,7 @@ var createWebfetchTool = () => defineTool16({
8439
8452
  } else {
8440
8453
  content = normalizeWhitespace(rawText);
8441
8454
  }
8455
+ const durationMs = Math.max(0, Date.now() - startedAt);
8442
8456
  return {
8443
8457
  url: input.url,
8444
8458
  final_url: response.url || input.url,
@@ -8449,7 +8463,8 @@ var createWebfetchTool = () => defineTool16({
8449
8463
  title: isHtml ? extractTitle(rawText) ?? null : null,
8450
8464
  content,
8451
8465
  truncated: body.truncated,
8452
- byte_size: body.byteSize
8466
+ byte_size: body.byteSize,
8467
+ duration_ms: durationMs
8453
8468
  };
8454
8469
  } catch (error) {
8455
8470
  const classified = classifyFetchError(error, timeoutMs);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codelia/runtime",
3
- "version": "0.1.61",
3
+ "version": "0.1.62",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=20 <25"
@@ -23,14 +23,14 @@
23
23
  "typecheck": "tsc --noEmit"
24
24
  },
25
25
  "dependencies": {
26
- "@codelia/config": "0.1.61",
27
- "@codelia/config-loader": "0.1.61",
28
- "@codelia/core": "0.1.61",
29
- "@codelia/logger": "0.1.61",
30
- "@codelia/model-metadata": "0.1.61",
31
- "@codelia/protocol": "0.1.61",
32
- "@codelia/shared-types": "0.1.61",
33
- "@codelia/storage": "0.1.61",
26
+ "@codelia/config": "0.1.62",
27
+ "@codelia/config-loader": "0.1.62",
28
+ "@codelia/core": "0.1.62",
29
+ "@codelia/logger": "0.1.62",
30
+ "@codelia/model-metadata": "0.1.62",
31
+ "@codelia/protocol": "0.1.62",
32
+ "@codelia/shared-types": "0.1.62",
33
+ "@codelia/storage": "0.1.62",
34
34
  "eventsource-parser": "^3.0.6",
35
35
  "oauth4webapi": "^3.8.4",
36
36
  "zod": "^4.3.5"