Explorar o código

fix(tools): omit an absent Session during runtime policy resolution

Tianyi Cui hai 3 semanas
pai
achega
f6904f4615
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      packages/core/tools/src/index.ts

+ 1 - 1
packages/core/tools/src/index.ts

@@ -919,7 +919,7 @@ export class ToolRuntime extends Service {
       resolveSandboxPolicy: (exec) => {
         const policy = this.ctx.get('sandboxPolicy')
         if (policy === undefined) throw new Error('dsh-tools: confined code runtime requires sandboxPolicy')
-        return policy.resolve({ session: exec.agent?.session })
+        return policy.resolve(exec.agent === undefined ? {} : { session: exec.agent.session })
       },
       // The language-aware description/parameters getters read the runtime
       // without demanding one, so a native-default process can still project