micro-models-agent 0.13.1 → 0.13.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.
- package/dist/cli/commands.js +2 -1
- package/dist/cli/repl.js +42 -20
- package/dist/config/config.js +42 -0
- package/dist/config/defaults.js +1 -1
- package/dist/config/security.js +1 -1
- package/dist/core/agent-moe.js +98 -0
- package/dist/core/agent.js +41 -250
- package/dist/core/bootstrap.js +4 -3
- package/dist/core/session-logger.js +122 -0
- package/dist/i18n/en.json +1 -0
- package/dist/i18n/ru.json +1 -0
- package/dist/llm/openai-compat.js +6 -9
- package/dist/modules/execution/moe-executor.js +13 -0
- package/dist/modules/hallucination/confidence.js +22 -15
- package/dist/modules/hallucination/consistency.js +29 -1
- package/dist/modules/hallucination/factual.js +49 -7
- package/dist/modules/processes/registry.js +6 -0
- package/dist/modules/security/command-validator.js +57 -14
- package/dist/modules/security/encryption.js +8 -6
- package/dist/modules/session/module.js +0 -4
- package/dist/tools/bash.js +27 -0
- package/dist/tools/create-dir.js +3 -4
- package/dist/tools/delete-file.js +3 -4
- package/dist/tools/edit-file.js +3 -4
- package/dist/tools/executor.js +6 -0
- package/dist/tools/file-info.js +3 -4
- package/dist/tools/list-dir.js +4 -4
- package/dist/tools/path-utils.js +51 -0
- package/dist/tools/read-file.js +6 -3
- package/dist/tools/write-file.js +5 -5
- package/dist/ui/renderer.js +1 -1
- package/package.json +1 -1
package/dist/tools/write-file.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { writeFileSync, mkdirSync, existsSync, readFileSync } from "fs";
|
|
2
|
-
import {
|
|
2
|
+
import { dirname } from "path";
|
|
3
3
|
import { t } from "../i18n/index";
|
|
4
4
|
import { isPathWritable } from "../modules/security/path-validator";
|
|
5
5
|
import { scanContent } from "../modules/security/content-scanner";
|
|
6
6
|
import { logFileWrite, logSecurityBlock } from "../modules/security/audit-log";
|
|
7
7
|
import { getSessionSecurityConfig } from "../modules/security/session-isolation";
|
|
8
8
|
import { generateDiff, generateNewFileDiff } from "../ui/diff";
|
|
9
|
+
import { safeResolvePath } from "./path-utils";
|
|
9
10
|
export const writeFileTool = {
|
|
10
11
|
name: "write_file",
|
|
11
12
|
description: "Create or overwrite a file with given content. Creates intermediate directories if needed.",
|
|
@@ -20,10 +21,9 @@ export const writeFileTool = {
|
|
|
20
21
|
},
|
|
21
22
|
handler: async (ctx, args) => {
|
|
22
23
|
const path = String(args.path);
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const scopeCheck = isPathWritable(ctx.baseDir, path, ctx.scope, ctx.config.security?.paths);
|
|
24
|
+
const resolved = safeResolvePath(ctx.baseDir, path);
|
|
25
|
+
// Check path permissions using the resolved path
|
|
26
|
+
const scopeCheck = isPathWritable(ctx.baseDir, resolved, ctx.scope, ctx.config.security?.paths);
|
|
27
27
|
if (!scopeCheck.allowed) {
|
|
28
28
|
logSecurityBlock(ctx.sessionId, "file_write", scopeCheck.reason || "Path not allowed", path);
|
|
29
29
|
return {
|
package/dist/ui/renderer.js
CHANGED