This commit is contained in:
yiling
2026-05-31 19:11:27 +08:00
parent be7dc45051
commit b53c40cbde
6 changed files with 5 additions and 76 deletions
+2 -3
View File
@@ -4,8 +4,8 @@ import { NodeExecutionEnv } from '@earendil-works/pi-agent-core/node'
import { getModel } from '@earendil-works/pi-ai'
import { Type, type TSchema } from '@sinclair/typebox'
import * as fs from 'fs'
import * as path from 'path'
import * as os from 'os'
import * as path from 'path'
import { DatabaseSessionStorage } from './database-session-storage'
import { analyzeAssetMediaTool } from './tools/analyze-asset-media'
import { createCreateFileTool } from './tools/create-file'
@@ -119,8 +119,7 @@ export async function createAgentSession(params: CreateAgentSessionParams) {
deniedDomains: [],
},
filesystem: {
allowRead: [piDir],
denyRead: [os.homedir(), '.env', '.env.*', '*.pem', '*.key'],
denyRead: ['.env', '.env.*', '*.pem', '*.key'],
allowWrite,
denyWrite: ['.env', '.env.*', '*.pem', '*.key'],
},
+3 -2
View File
@@ -1,8 +1,8 @@
import { logger } from '@/logger'
import { SandboxManager } from '@anthropic-ai/sandbox-runtime'
import { type AgentTool, type AgentToolResult } from '@earendil-works/pi-agent-core'
import { Type } from '@sinclair/typebox'
import { spawn } from 'node:child_process'
import { logger } from '@/logger'
const BashParameters = Type.Object({
command: Type.String({ description: 'The bash command to execute.' }),
@@ -37,7 +37,8 @@ export const createSandboxedBashTool = (
detached: true,
stdio: ['ignore', 'pipe', 'pipe'],
env: {
...process.env,
PATH: process.env.PATH || '',
HOME: process.env.HOME || '',
...skillEnvs,
},
})