@clearideas/agent-runtime-sandbox 0.6.1 → 0.6.3

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.
Files changed (2) hide show
  1. package/dist/policy.js +24 -5
  2. package/package.json +5 -5
package/dist/policy.js CHANGED
@@ -154,7 +154,7 @@ const pathSchema = {
154
154
  type: "string",
155
155
  minLength: 1,
156
156
  maxLength: 1024,
157
- description: "Relative POSIX path inside the workspace.",
157
+ description: "Path relative to the workspace root, such as docs/guide.md. Use forward slashes.",
158
158
  };
159
159
  const BUILTIN_SCHEMAS = {
160
160
  list_files: {
@@ -166,7 +166,8 @@ const BUILTIN_SCHEMAS = {
166
166
  properties: {
167
167
  path: {
168
168
  ...pathSchema,
169
- description: "Directory to list; defaults to the root.",
169
+ minLength: 0,
170
+ description: "Directory to list, relative to the workspace root, such as docs. Omit it to list the root.",
170
171
  },
171
172
  glob: { type: "string", minLength: 1, maxLength: MAXIMUM_GLOB_LENGTH },
172
173
  limit: { type: "integer", minimum: 1, maximum: MAXIMUM_LIST_LIMIT },
@@ -349,13 +350,31 @@ const requireBoolean = (value, label) => {
349
350
  throw invalidArguments(`${label} must be a boolean.`);
350
351
  return value;
351
352
  };
353
+ /**
354
+ * Accept the common spellings of a relative workspace path and return its
355
+ * canonical form: Windows separators (`reports\q3.md`), a leading `./` or
356
+ * `/`, repeated or trailing slashes, and `.` segments. `.` alone (or an empty
357
+ * path) means the workspace root and normalizes to "". Nothing here can
358
+ * change which file a path names: `..`, hidden segments, drive letters, and
359
+ * other unsafe segments are left in place and rejected by the caller.
360
+ */
361
+ const normalizeWorkspaceToolPath = (value) => value
362
+ .trim()
363
+ .replaceAll("\\", "/")
364
+ .split("/")
365
+ .filter((segment) => segment !== "" && segment !== ".")
366
+ .join("/");
352
367
  const requirePath = (value, label, required = true) => {
353
368
  const text = requireString(value, label, 1024, required);
354
369
  if (text === undefined)
355
370
  return undefined;
356
- if (!isSafeWorkspacePath(text))
357
- throw invalidPath(`${label} must be a relative POSIX path with safe segments: ${text}`);
358
- return text;
371
+ const normalized = normalizeWorkspaceToolPath(text);
372
+ // An optional directory path may name the root; a file path may not.
373
+ if (normalized === "" && !required)
374
+ return undefined;
375
+ if (!isSafeWorkspacePath(normalized))
376
+ throw invalidPath(`${label} must be a path inside the workspace, such as docs/guide.md (got ${JSON.stringify(text)}). Segments must start with a letter, digit, or underscore and may contain letters, digits, ".", "_", and "-". Dot-prefixed segments and traversal are not allowed.`);
377
+ return normalized;
359
378
  };
360
379
  const rejectUnknownKeys = (input, allowed) => {
361
380
  for (const key of Object.keys(input)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearideas/agent-runtime-sandbox",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Provider-neutral sandbox lifecycle and code execution adapters for Clear Ideas Agent Runtime.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Clear Ideas Incorporated",
@@ -41,13 +41,13 @@
41
41
  "postpack": "node ../../scripts/cleanup-package-license.mjs"
42
42
  },
43
43
  "dependencies": {
44
- "@clearideas/agent-runtime-contracts": "0.6.1",
45
- "@clearideas/agent-runtime-core": "0.6.1"
44
+ "@clearideas/agent-runtime-contracts": "0.6.3",
45
+ "@clearideas/agent-runtime-core": "0.6.3"
46
46
  },
47
47
  "devDependencies": {
48
- "@types/node": "^26.4.0",
48
+ "@types/node": "^26.6.6",
49
49
  "typescript": "^7.0.2",
50
- "vitest": "^5.0.0"
50
+ "vitest": "^5.1.0"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=24"