MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / ExecuteStream

Method ExecuteStream

internal/pluginhost/adapters.go:1619–1643  ·  view source on GitHub ↗
(ctx context.Context, auth *coreauth.Auth, req coreexecutor.Request, opts coreexecutor.Options)

Source from the content-addressed store, hash-verified

1617}
1618
1619func (a *executorAdapter) ExecuteStream(ctx context.Context, auth *coreauth.Auth, req coreexecutor.Request, opts coreexecutor.Options) (result *coreexecutor.StreamResult, err error) {
1620 if a == nil || a.executor == nil || a.host.isPluginFused(a.pluginID) || !a.host.pluginIdentityCurrent(a.pluginID, a.path, a.version) {
1621 return nil, fmt.Errorf("plugin executor %s is unavailable", a.Identifier())
1622 }
1623 defer func() {
1624 if recovered := recover(); recovered != nil {
1625 a.host.fusePlugin(a.pluginID, "Executor.ExecuteStream", recovered)
1626 result = nil
1627 err = fmt.Errorf("plugin executor %s stream panic: %v", a.Identifier(), recovered)
1628 }
1629 }()
1630
1631 prepared, errPrepare := a.prepareExecutorCall(req, opts)
1632 if errPrepare != nil {
1633 return nil, errPrepare
1634 }
1635 pluginResp, errExecuteStream := a.executor.ExecuteStream(ctx, buildExecutorRequest(a.host, a.provider, auth, prepared.req, prepared.opts))
1636 if errExecuteStream != nil {
1637 return nil, errExecuteStream
1638 }
1639 return &coreexecutor.StreamResult{
1640 Headers: cloneHeader(pluginResp.Headers),
1641 Chunks: mapExecutorStreamChunks(ctx, a.translateExecutorStreamChunks(ctx, prepared, pluginResp.Chunks)),
1642 }, nil
1643}
1644
1645func (a *executorAdapter) Refresh(ctx context.Context, auth *coreauth.Auth) (refreshed *coreauth.Auth, err error) {
1646 if a == nil || a.executor == nil || a.host.isPluginFused(a.pluginID) || !a.host.pluginIdentityCurrent(a.pluginID, a.path, a.version) {

Callers

nothing calls this directly

Calls 10

IdentifierMethod · 0.95
prepareExecutorCallMethod · 0.95
buildExecutorRequestFunction · 0.85
mapExecutorStreamChunksFunction · 0.85
isPluginFusedMethod · 0.80
pluginIdentityCurrentMethod · 0.80
fusePluginMethod · 0.80
cloneHeaderFunction · 0.70
ExecuteStreamMethod · 0.65

Tested by

no test coverage detected