( ctx context.Context, scope toolspkg.Scope, )
| 4784 | } |
| 4785 | |
| 4786 | func (n *daemonNativeTools) nativeBoundSession( |
| 4787 | ctx context.Context, |
| 4788 | scope toolspkg.Scope, |
| 4789 | ) (*nativeBoundSessionScope, error) { |
| 4790 | sessionID := strings.TrimSpace(scope.SessionID) |
| 4791 | if sessionID == "" { |
| 4792 | return nil, nil |
| 4793 | } |
| 4794 | if n == nil || n.deps == nil || n.deps.Sessions == nil { |
| 4795 | return nil, errors.New("daemon: sessions are required") |
| 4796 | } |
| 4797 | info, err := n.deps.Sessions.Status(ctx, sessionID) |
| 4798 | if err != nil { |
| 4799 | return nil, err |
| 4800 | } |
| 4801 | bound := &nativeBoundSessionScope{ |
| 4802 | sessionID: strings.TrimSpace(info.ID), |
| 4803 | workspaceID: strings.TrimSpace(info.WorkspaceID), |
| 4804 | networkChannels: make(map[string]struct{}), |
| 4805 | } |
| 4806 | lineage := store.NormalizeSessionLineage(info.ID, info.Lineage) |
| 4807 | if lineage != nil { |
| 4808 | for _, channel := range lineage.PermissionPolicy.NetworkChannels { |
| 4809 | bound.networkChannels[channel] = struct{}{} |
| 4810 | } |
| 4811 | } |
| 4812 | return bound, nil |
| 4813 | } |
| 4814 | |
| 4815 | func nativeBoundWorkspaceRef(bound *nativeBoundSessionScope, workspaceRef string) string { |
| 4816 | if bound == nil { |
no test coverage detected