MCPcopy Create free account
hub / github.com/arctic-cli/interface / checkExternalDirectory

Function checkExternalDirectory

packages/arctic/src/tool/bash.ts:94–121  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

92 const agent = await Agent.get(ctx.agent)
93
94 const checkExternalDirectory = async (dir: string) => {
95 if (Filesystem.contains(Instance.directory, dir)) return
96 if (await Permission.isBypassEnabled()) return
97 const title = `This command references paths outside of ${Instance.directory}`
98 if (agent.permission.external_directory === "ask") {
99 await Permission.ask({
100 type: "external_directory",
101 pattern: [dir, path.join(dir, "*")],
102 sessionID: ctx.sessionID,
103 messageID: ctx.messageID,
104 callID: ctx.callID,
105 title,
106 metadata: {
107 command: params.command,
108 },
109 })
110 } else if (agent.permission.external_directory === "deny") {
111 throw new Permission.RejectedError(
112 ctx.sessionID,
113 "external_directory",
114 ctx.callID,
115 {
116 command: params.command,
117 },
118 `${title} so this command is not allowed to be executed.`,
119 )
120 }
121 }
122
123 await checkExternalDirectory(cwd)
124

Callers 1

executeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected